Permalink
Browse files

Using Patched Jni4Net version

New ZAP API
Better CUrl invocation tool gui
  • Loading branch information...
1 parent 3149719 commit bcd5abb2aa6d038a58f3f79ec9491e25ad8e23a5 @DinisCruz DinisCruz committed Aug 20, 2013
@@ -12,10 +12,9 @@
using java.lang.reflect;
using net.sf.jni4net;
using net.sf.jni4net.jni;
-//Installer:Jni4Net_Installer.cs!Jni4Net/bin/proxygen.exe
-//O2Ref:Jni4Net/lib/jni4net.n-0.8.6.0.dll
+//Installer:Jni4Net_Installer.cs!Jni4Net_Patched/jni4net-0.8.7.0-bin/bin/proxygen.exe
-//O2File:_Extra_methods_To_Add_to_Main_CodeBase.cs
+//O2Ref:Jni4Net_Patched/jni4net-0.8.7.0-bin/lib/jni4net.n-0.8.7.0_Patched.dll
namespace O2.XRules.Database.APIs
{
@@ -17,8 +17,9 @@ public class Jni4Net_Installer : Tool_API
{
public Jni4Net_Installer()
{
- config("Jni4Net",
- "http://switch.dl.sourceforge.net/project/jni4net/0.8.6/jni4net-0.8.6.0-bin.zip".uri(),
+ config("Jni4Net_Patched",
+ "https://dl.dropboxusercontent.com/u/81532342/O2%20Files/jni4net-0.8.7.0-bin_Patched.zip".uri(),
+ //"http://switch.dl.sourceforge.net/project/jni4net/0.8.6/jni4net-0.8.6.0-bin.zip".uri(),
@"bin/proxygen.exe");
installFromZip_Web();
}
@@ -1,8 +1,11 @@
-//Environment.setEnvironmentVariable("JAVA_HOME", @"C:\Program Files\Java\jre7");
+Environment.SetEnvironmentVariable("JAVA_HOME", @"C:\Program Files (x86)\Java\jre7");
O2Setup.extractEmbededConfigZips();
var topPanel = "PoC - Jni4Net - List JavaProperties: {0}".format(clr.details()).popupWindow().insert_LogViewer();
var tableList = topPanel.clear().add_TableList("Java Properties").add_Columns("Key", "Value");
tableList.insert_Below().add_ConsoleOut();
+
+BridgeSetup.Patch_IgnoreArgsInAttach=true;
+
var bridgeSetup = new BridgeSetup(){Verbose=true};
try
{
@@ -27,7 +30,7 @@ return "ok";
//using java.util;
//using net.sf.jni4net;
//using net.sf.jni4net.adaptors;
-//O2Ref:Jni4Net/lib/jni4net.n-0.8.6.0.dll
-//_O2Ref:E:\_Code_Tests\Jni4Net\jni4net-read-only\target\jni4net-0.8.7.0-bin\lib\jni4net.n-0.8.7.0.dll
+//O2Ref:jni4net.n-0.8.7.0_Patched.dll
+//O2Ref:Jni4Net_Patched/jni4net-0.8.7.0-bin/lib/jni4net.n-0.8.7.0_Patched.dll
//O2File:API_ConsoleOut.cs
//O2EmbedTool:Jni4Net
@@ -0,0 +1,37 @@
+using System;
+using System.Text;
+using System.Diagnostics;
+using FluentSharp.CoreLib;
+using FluentSharp.CoreLib.API;
+
+//Installer:ZAProxy_Installer.cs!ZAP_D-2013-08-12\jar.jar
+
+//O2File:_Extra_methods_To_Add_to_Main_CodeBase.cs
+
+namespace OWASP
+{
+ public class API_Zap
+ {
+ public Process ZapProcess { get; set; }
+ public string ZapLaunchCmd { get; set; }
+ public string ZapDir { get; set; }
+ public Action<string> OnLogEntry { get; set; }
+ public StringBuilder ExecutionLog { get; set; }
+
+ public API_Zap()
+ {
+ ZapDir = PublicDI.config.ToolsOrApis.folder("ZAProxy").folders().first();
+ ZapLaunchCmd = "-Xmx512m -XX:PermSize=256M -jar zap.jar %*";
+ ExecutionLog = new StringBuilder();
+ OnLogEntry = (line)=> ExecutionLog.AppendLine(line.info());
+ }
+
+ public API_Zap Launch()
+ {
+ ZapProcess = "java".startProcess(ZapLaunchCmd, ZapDir, OnLogEntry);
+ return this;
+ }
+ }
+
+
+}
@@ -18,8 +18,9 @@ public class ZAProxy_Install : Tool_API
public ZAProxy_Install()
{
config("ZAProxy",
- "https://zaproxy.googlecode.com/files/ZAP_WEEKLY_D-2013-05-20.zip".uri(),
- @"ZAP_D-2013-05-20\zap.bat");
+ "https://zaproxy.googlecode.com/files/ZAP_WEEKLY_D-2013-08-12.zip".url(),
+ // "https://zaproxy.googlecode.com/files/ZAP_WEEKLY_D-2013-05-20.zip".uri(),
+ @"ZAP_D-2013-08-12\zap.bat");
installFromZip_Web();
}
//
@@ -38,11 +38,15 @@ public void default_OnConsoleData(string data)
"[cURL]: {0}".info(data);
}
-
- public API_cURL execute(string arguments)
+ public API_cURL execute(string url)
+ {
+ return execute("", url);
+ }
+ public API_cURL execute(string url, string optionalArguments)
{
- " *** Executing cURL with commands: {0} **** ".debug(arguments);
- CURL_Process = Processes.startProcessAndRedirectIO(CURL_Exe, arguments, OnConsoleData);
+ var processArguments = "{0} {1}".format(optionalArguments, url);
+ " *** Executing cURL with commands: {0} **** ".debug(processArguments);
+ CURL_Process = Processes.startProcessAndRedirectIO(CURL_Exe, processArguments, OnConsoleData);
return this;
}
@@ -1,16 +1,35 @@
//var topPanel = panel.clear().add_Panel();
var topPanel = "Util - cUrl Execution GUI".popupWindow(600,300);
-var consoleOut = topPanel.add_RichTextBox();
-var urlToGet = consoleOut.insert_Above(20)
- .add_TextBox("cURL arguments:","http://www.google.com");
+var consoleOut = topPanel.add_RichTextBox();
+
var cUrl = new API_cURL();
cUrl.OnConsoleData =
(text)=>{
consoleOut.append_Line(text);
- };
+ };
+
+var urlToGet = "http://www.google.com";
+var arguments = "-v";
+
+Action executeCUrl =
+ ()=>{
+ consoleOut.set_Text("");
+ cUrl.execute(urlToGet, arguments);
+ };
+consoleOut.insert_Above(1);
+consoleOut.insert_Above(20).add_TextBox("cURL arguments:",urlToGet)
+ .onTextChange((text)=>urlToGet = text)
+ .onEnter((text)=>executeCUrl())
+ .insert_Right().add_TextBox("Arguments","-v -l")
+ .onTextChange((text)=>arguments = text)
+ .onEnter((text)=>executeCUrl())
+ .sendEnter();
+ //.insert_Right(80).add_Button("send")
+ // .onClick( ()=> executeCUrl()); // DC: I'm still not happy with this GUI (The button is not aligned)
+
-urlToGet.onEnter((text)=>{ consoleOut.set_Text(""); cUrl.execute(text); })
- .sendEnter();
+//urlToGet.onEnter((text)=>{ })
+// .sendEnter();
//using O2.XRules.Database.APIs
//O2File:API_cURL.cs
@@ -1,17 +1,48 @@
// This file is part of the OWASP O2 Platform (http://www.owasp.org/index.php/OWASP_O2_Platform) and is released under the Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0)
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using FluentSharp.CoreLib;
+using FluentSharp.CoreLib.API;
using FluentSharp.WinForms;
//O2Ref:Ionic.Zip.dll
-namespace O2.XRules.Database.APIs
+namespace FluentSharp.CoreLib
{
-
+ public static class Extra_Process
+ {
+ public static Process startProcess(this string processExe, string arguments, string workingDirectory)
+ {
+ return processExe.startProcess(arguments, workingDirectory, (line)=>line.info());
+ }
+
+ public static Process startProcess(this string processExe, string arguments, string workingDirectory, Action<string> onDataReceived)
+ {
+ return Processes.startProcessAndRedirectIO(processExe, arguments, workingDirectory, onDataReceived, onDataReceived);
+ }
+ }
+ public static class Extra_IO
+ {
+ public static string fileContents(this string folder, string file)
+ {
+ return folder.pathCombine(file).fileContents();
+ }
+ public static List<string> fileNames(this string folder)
+ {
+ return folder.files().fileNames();
+ }
+ public static string folder(this string basePath, string folderName)
+ {
+ var targetFolder = basePath.pathCombine(folderName);
+ if(targetFolder.dirExists())
+ return targetFolder;
+ return null;
+ }
+ }
public static class Extra_Misc
{
// do this propely when adding to main O2 code base since this will not work as expected when there are other textboxes and buttons on the same 'control' object

0 comments on commit bcd5abb

Please sign in to comment.