Skip to content

Commit

Permalink
Arachni::Browser: Small cleanup in request capturing
Browse files Browse the repository at this point in the history
[Issue #50]
  • Loading branch information
Zapotek committed Jul 28, 2013
1 parent 7f451e0 commit 8c2001d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/arachni/browser.rb
Expand Up @@ -237,10 +237,19 @@ def proxy
def request_handler( request, response )
# Signal the proxy to not actually perform the request if we have a
# preloaded or cached response for it.
return if from_preloads( request, response ) ||
from_cache( request, response )
return if from_preloads( request, response ) || from_cache( request, response )

return true if !capture?
# Capture the request as elements of pages -- let's us grab AJAX and
# other browser requests and convert them into system elements we can
# analyze and audit.
capture( request )

# Signal the proxy to continue with its request to the origin server.
true
end

def capture( request )
return if !capture?

if !@pages.include? url
page = Page.from_data( url: url )
Expand All @@ -261,12 +270,7 @@ def request_handler( request, response )
method: request.method,
inputs: Utilities.form_parse_request_body( request.body )
)

else
return true
end

true
end

def from_preloads( request, response )
Expand Down

0 comments on commit 8c2001d

Please sign in to comment.