add referer filed to requests

205 views
Skip to first unread message

m.pen...@gmail.com

unread,
Aug 6, 2014, 3:45:49 AM8/6/14
to zaproxy...@googlegroups.com
Hi,
I am trying to set "referer" filed to the request, the changes are:

the functions that are needed are "setHeader" in "zaproxy/src/org/parosproxy/paros/network/HttpHeader.java",
"setRequestHeader" in "zaproxy/src/org/parosproxy/paros/network/HttpMessage.java",
and set the "parent" of each URL in the "zaproxy/src/org/zaproxy/zap/spider/SpiderTask.java"
 
i have some problems!
can i use the "parent" parameter defined in the SpiderTask.java to do this work?
i want to define a new "setRequestHeader" with different inputs, but i can't use the "setHeader" function in the "HttpMessage.java" :(
how can i do that?

if you think there is an easier way, let me know :)

Best Regards

thc...@gmail.com

unread,
Aug 6, 2014, 4:37:15 AM8/6/14
to zaproxy...@googlegroups.com
Hi.

The "parent" does not contain the necessary information to get/recreate the URI of the source page. You have to get it when the URI is found.

To set the "Referer" header you just need to get the request header from the message and set it:
HttpMessage message = ...
message.getRequestHeader().setHeader(HttpRequestHeader.Referer, "some referrer");


P.S. For a quick hack to change the spider to set the "Referer" header see the attached patch (spider_referer.patch).

Best regards.
--
You received this message because you are subscribed to the Google Groups "OWASP ZAP Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

spider_referer.patch

m.pen...@gmail.com

unread,
Aug 7, 2014, 10:34:15 AM8/7/14
to zaproxy...@googlegroups.com
thanks a lot :)
Reply all
Reply to author
Forward
0 new messages