I tried the following "Proxy" script:
def proxyResponse(msg):
# Debugging can be done using print like this
print(msg.getResponseBody.toString());
return True;
but all i get is a java.lang.reflect.UndeclaredThrowableException error. "Output" tab is empty and i could not find any other information. The script above was just a test. What i'm really trying to do is to make ZAP request the url returned by the JSON response mentioned above.
Does you know how to solve this or where can i find the docs about the expected language or a jython example script to help me accomplish this?
[]'s Ailton
print(msg.getResponseBody().toString());{"gxCommands":[{"redirect":{"url":"hnuc001.aspx"}}]}
--
You received this message because you are subscribed to the Google Groups "OWASP ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-user...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "OWASP ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-user...@googlegroups.com.
import net.sf.json.JSONSerializerimport org.apache.commons.httpclient.URIimport org.parosproxy.paros.network.HttpSenderimport org.parosproxy.paros.model.Modelimport sysimport timedef proxyRequest(msg):
# Debugging can be done using print like this
# print('proxyRequest called for url=' + msg.getRequestHeader().getURI().toString());return True;
def proxyResponse(msg):# Debugging can be done using print like this
#print( msg.getRequestHeader().getURI().getPath().lower() );req = msg.getRequestHeader();if( ( req.getURI().getPath().lower() == '/hnuc004.aspx' ) and ( req.getMethod() == 'POST' ) ):json = msg.getResponseBody().toString();try:print( msg.getResponseBody() );jo = net.sf.json.JSONSerializer.toJSON(json);url = jo.get('gxCommands')[0].get('redirect').get('url');print('Got url: ' + url);baseUri = msg.getRequestHeader().getURI();newLoc = org.apache.commons.httpclient.URI(baseUri, url, False);msg.getRequestHeader().setURI(newLoc);msg.getRequestHeader().setMethod('GET');msg.getRequestHeader().setHeader('Content-Length', None);sender = org.parosproxy.paros.network.HttpSender(org.parosproxy.paros.model.Model.getSingleton().getOptionsParam().getConnectionParam(), True, 6)msg.setRequestBody(''); # Nulling the request body as it is not a POST anymoresender.sendAndReceive(msg);except:# Ignoreprint ('no dice');e = sys.exc_info();print( e );return True;
- I know, i put it as a proxy script, but it was only because i couldn't find how to make a Fuzz script. Can anyone help to rewrite it as the appropriate type, so that it gets executed inside a fuzzing session?
Script types
Different types of scripts are supported:
- Stand Alone - scripts that are self contained and are only run when your start them manually
- Active Rules - these run as part of the Active Scanner and can be individually enabled
- Passive Rules - these run as part of the Passive Scanner and can be individually enabled
- Proxy Rules - these run 'inline', can change every request and response and can be individually enabled. They can also trigger break points
- Targeted Rules - scripts that invoked with a target URL and are only run when your start them manually
- Authentication - scripts that invoked when authentication is performed for a Context. To be used, they need to be selected when configuring the Script-Based Authentication Method for a Context.
- Script Input Vectors - scripts for defining exactly what ZAP should attack
<mailto:ailtoncaetanos@gmail.com>>:
<mailto:ailtoncaetanos@gmail.com>>:
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "OWASP ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to zaproxy-users+unsubscribe@googlegroups.com
<mailto:zaproxy-users+unsub...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "OWASP ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-users+unsubscribe@googlegroups.com.