Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
150 lines (133 sloc) 5.07 KB
//panel.clear();
//var topPanel = panel.add_Panel();
var topPanel = O2Gui.open<Panel>("Exploit Execution", 800,600);
var mainGui = topPanel.add_1x1("Exploits (BlackBox PoCs) - executes in embedded Browser", "Embedded Browser",true, 350);
var wpfHost = mainGui[0].add_WpfHost();
var unitTestExecution = mainGui[0].insert_Below<GroupBox>()
.set_Text("Unit Test Execution - executes in new Browser windows")
.add_Control<ascx_XRules_UnitTests>();
var targetGui = mainGui[1];
//var browser = mainGui[1].add_IE();
// methods
Action<string,string> loadExploitScript =
(exploitFile, startUrl)=>{
try
{
wpfHost.clear();
var grid = wpfHost.add_Control_Wpf<WPF.Grid>();
var sp = grid.add_StackPanel();
if (exploitFile.fileExists().isFalse())
{
exploitFile = exploitFile.local();
if (exploitFile.fileExists().isFalse())
{
"could not find exploit script to load:{0}".error(exploitFile);
return;
}
}
var compiledExploitFile = exploitFile.compile();
if (compiledExploitFile.notNull())
{
unitTestExecution.loadFile(compiledExploitFile.Location);
var classWithExploits = compiledExploitFile.types()[0].ctor(targetGui, startUrl);
//classWithExploits.prop("StartUrl", startUrl);
//classWithExploits.prop("Browser", browser);
foreach(var method in classWithExploits.type().methods_public())
{
if (method.IsStatic.isFalse())
{
var methodToInvoke = method;
var buttonText = method.Name.replace("_"," ");
//sp.add_Xaml_Button(buttonText, ()=> PublicDI.reflection.invokeMethod_Instance(classWithExploits, methodToInvoke.Name, new object[] {}));
sp.add_Xaml_Button(buttonText,
()=> O2Thread.mtaThread(
()=> Reflection_ExtensionMethods_Invoke.invoke(classWithExploits,methodToInvoke.Name)));
}
}
}
}
catch(Exception ex)
{
ex.log("in loadExploitScript");
}
};
//var exploitFile = "HacmeBank_BlackBox_Exploits.cs".local();
var userDataPanel = topPanel.insert_Above<Panel>(25);
userDataPanel.add_Label("Script file with exploits")
.top(5)
.append_TextBox("")
.width(300)
.append_Label("URL of start page")
.top(5)
.leftAdd(15)
.append_TextBox("")
.width(300)
.append_Link("Load exploits",
()=>{
var textBoxes = userDataPanel.controls<TextBox>(true);
loadExploitScript(textBoxes[0].get_Text(),textBoxes[1].get_Text());
})
.top(5)
.append_Link("Edit exploit code",
()=>{
var scriptFile = userDataPanel.controls<TextBox>(true)[0].get_Text();
if (scriptFile.fileExists().isFalse())
scriptFile = scriptFile.local();
mainGui[1].insert_Below<Panel>().add_SourceCodeEditor().open(scriptFile);
});
var scriptToExecute_TextBox = userDataPanel.controls<TextBox>(true)[0];
var startUrl_TextBox = userDataPanel.controls<TextBox>(true)[1];
Action<string> loadExploitScriptFile =
(file)=>{
"in loadExploitScriptFile".info();
scriptToExecute_TextBox.set_Text(file);
loadExploitScript(file, startUrl_TextBox.get_Text());
};
scriptToExecute_TextBox.onDrop(loadExploitScriptFile);
scriptToExecute_TextBox.onEnter(loadExploitScriptFile);
//scriptToExecute.set_Text(@"C:\O2\O2Scripts_Database\_Scripts\_Sample_Vulnerabilities\WebGoat\WebGoat_BlackBox_Exploits.cs");
//userDataPanel.controls<TextBox>(true)[0].set_Text("HacmeBank_BlackBox_Exploits.cs");
//userDataPanel.controls<TextBox>(true)[1].set_Text("http://localhost:54579/HacmeBank_v2_Website");
//userDataPanel.controls<LinkLabel>(true)[0].click();
Func<string, string, System.Windows.Forms.Form> loadData =
(exploitScript, startUrl)=>
{
"in loadData: {0}:{1}".info(exploitScript, startUrl);
scriptToExecute_TextBox.set_Text(exploitScript);
startUrl_TextBox.set_Text(startUrl);
loadExploitScript(exploitScript, startUrl);
return topPanel.parentForm();
};
return loadData;
//browser.open("http://www.google.co.uk");
//sp.add_Xaml_Button("Login as JM", ()=>{});
//using O2.XRules.Database.Utils
//using FluentSharp.CSharpAST
//using FluentSharp.CSharpAST.Utils
//using WatiN.Core
//using O2.XRules.Database.APIs
//using O2.XRules.Database.APIs
//using O2.Core.XRules.Ascx
//using WPF = System.Windows.Controls
//using FluentSharp.Watin
//using FluentSharp.WPF
//O2File:Xaml_ExtensionMethods.cs
//O2File:XamlCode.cs
//O2File:DotNet_ViewState.cs
//O2File:Xaml_ExtensionMethods.cs
//O2Ref:FluentSharp.Watin.dll
//O2Ref:Watin.Core.dll
//O2Ref:FluentSharp.WPF.dll
//O2Ref:Interop.SHDocVw.dll
//O2Ref:PresentationCore.dll
//O2Ref:PresentationFramework.dll
//O2Ref:System.Xaml.dll
//O2Ref:WindowsBase.dll
//O2Ref:System.Core.dll
//O2Ref:WindowsFormsIntegration.dll
//O2Ref:GraphSharp.dll
//O2Ref:QuickGraph.dll
//O2Ref:GraphSharp.Controls.dll
//O2Ref:ICSharpCode.AvalonEdit.dll
//O2Ref:O2_Core_XRules.dll
//O2Ref:O2_External_O2Mono.dll