More tweaking to proxy to help it work with browsers (and not just telnet :p)

git-svn-id: https://beef.googlecode.com/svn/trunk@986 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
scotty.b.brown@gmail.com
2011-05-26 06:46:19 +00:00
parent bd28ce2147
commit b9f53c8f96

View File

@@ -13,7 +13,7 @@ module Zombie
# will be sent back to use
def forward_request(hooked_browser_id, req, res)
# Generate a id for the req in the http table and check it doesnt already exist
# Generate an id for the req in the http table and check it doesnt already exist
http_id = rand(10000)
http_db = H.first(:id => http_id) || nil
@@ -22,19 +22,26 @@ module Zombie
http_db = H.first(:id => http_id) || nil
end
# Append port to domain string if not 80 or 443
if req.port != 80 or req.port != 443
domain = req.host.to_s + ':' + req.port.to_s
else
domain = req.host.to_s
end
# Saves the new HTTP request to the db for processing by browser
http = H.new(
:id => http_id,
:request => req,
:method => req.request_method.to_s,
:domain => req.host.to_s,
:domain => domain,
:path => req.path.to_s,
:date => Time.now,
:hooked_browser_id => hooked_browser_id
)
http.save
print_debug "[PROXY] Request #" + http_id.to_s + " to " + req.host.to_s + req.path.to_s + " added to queue for browser id #" + hooked_browser_id.to_s
print_debug "[PROXY] Request #" + http_id.to_s + " to " + domain + req.path.to_s + " added to queue for browser id #" + hooked_browser_id.to_s
# Polls the DB for the response and then sets it when present
http_db = H.first(:id => http_id)