adding the os name into the init ruby script

git-svn-id: https://beef.googlecode.com/svn/trunk@560 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
mosse.benjamin
2010-11-22 04:39:01 +00:00
parent ac96508ecc
commit 4c0a5bab80
3 changed files with 29 additions and 1 deletions

View File

@@ -17,7 +17,15 @@ module BeEF
return false if BeEF::Filter.has_non_printable_char?(str)
true
end
# check the os name value - for example, 'Windows XP'
def self.is_valid_osname?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
return false if BeEF::Filter.has_non_printable_char?(str)
return false if str.length < 2
true
end
# verify the browser version string is valid
def self.is_valid_browserversion?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)

View File

@@ -45,6 +45,11 @@ module BeEF
raise WEBrick::HTTPStatus::BadRequest, "Invalid browser browser string" if not Filter.is_valid_browserstring?(browser_string)
BD.set(session_id, 'BrowserReportedName', browser_string)
# get and store the os name
os_name = get_param(request.query, 'OsName')
raise WEBrick::HTTPStatus::BadRequest, "Invalid browser os name" if not Filter.is_valid_osname?(os_name)
BD.set(session_id, 'OsName', os_name)
# get and store page title
page_title = get_param(request.query, 'PageTitle')
raise WEBrick::HTTPStatus::BadRequest, "Invalid page title name" if not Filter.is_valid_pagetitle?(page_title)

View File

@@ -71,6 +71,21 @@ class Modules < BeEF::HttpController
summary_grid_hash['results'].push(page_name_row) # add the row
end
# set and add the return values for the os name
os_name = BD.get(zombie_session, 'OsName')
if not host_name.nil?
encoded_os_name = CGI.escapeHTML(os_name)
encoded_os_name_hash = { 'OS Name' => encoded_os_name }
page_name_row = {
'category' => 'Browser Hook Initialisation',
'data' => encoded_os_name_hash,
'from' => 'Initialisation'
}
summary_grid_hash['results'].push(page_name_row) # add the row
end
# set and add the return values for the browser name
browser_name = BD.get(zombie_session, 'BrowserName')
if not browser_name.nil?