Added support for target browser detection for MSF modules #530
This commit is contained in:
@@ -326,29 +326,11 @@ class Modules < BeEF::Extension::AdminUI::HttpController
|
|||||||
if(dynamic_modules != nil)
|
if(dynamic_modules != nil)
|
||||||
all_modules = BeEF::Core::Models::CommandModule.all(:order => [:id.asc])
|
all_modules = BeEF::Core::Models::CommandModule.all(:order => [:id.asc])
|
||||||
all_modules.each{|dyn_mod|
|
all_modules.each{|dyn_mod|
|
||||||
next if !dyn_mod.path.split('/').first.match(/^Dynamic/)
|
next if !dyn_mod.path.split('/')[1].match(/^metasploit/)
|
||||||
|
command_mod_name = dyn_mod["name"]
|
||||||
hook_session_id = @params['zombie_session'] || nil
|
dyn_mod_category = "Metasploit"
|
||||||
(print_error "hook_session_id is nil";return) if hook_session_id.nil?
|
command_module_status = set_command_module_status(command_mod_name)
|
||||||
|
command_module_icon_path = set_command_module_icon(command_module_status)
|
||||||
dyn_mod_name = dyn_mod.path.split('/').last
|
|
||||||
dyn_mod_category = nil
|
|
||||||
if(dyn_mod_name == "Msf")
|
|
||||||
dyn_mod_category = "Metasploit"
|
|
||||||
else
|
|
||||||
# future dynamic modules...
|
|
||||||
end
|
|
||||||
|
|
||||||
print_debug ("Loading Dynamic command module: category [#{dyn_mod_category}] - name [#{dyn_mod.name.to_s}]")
|
|
||||||
command_mod = BeEF::Modules::Commands.const_get(dyn_mod_name.capitalize).new
|
|
||||||
command_mod.session_id = hook_session_id
|
|
||||||
command_mod.update_info(dyn_mod.id)
|
|
||||||
command_mod_name = command_mod.info['Name'].downcase
|
|
||||||
|
|
||||||
# create url path and file for the command module icon
|
|
||||||
#command_module_status = set_command_module_status(command_mod)
|
|
||||||
command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN
|
|
||||||
command_module_icon_path = set_command_module_icon(command_mod)
|
|
||||||
|
|
||||||
update_command_module_tree(tree, dyn_mod_category, command_module_icon_path, command_module_status, command_mod_name,dyn_mod.id)
|
update_command_module_tree(tree, dyn_mod_category, command_module_icon_path, command_module_status, command_mod_name,dyn_mod.id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,27 @@ module BeEF
|
|||||||
#m.split('/')[0...-1].each{|c|
|
#m.split('/')[0...-1].each{|c|
|
||||||
# categories.push(c.capitalize)
|
# categories.push(c.capitalize)
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
if m_details['description'] =~ /Java|JVM|flash|Adobe/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY => ["ALL"]}
|
||||||
|
elsif m_details['description'] =~ /IE|Internet\s+Explorer/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["IE"]}
|
||||||
|
elsif m_details['description'] =~ /Firefox/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["FF"]}
|
||||||
|
elsif m_details['description'] =~ /Chrome/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["C"]}
|
||||||
|
elsif m_details['description'] =~ /Safari/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["S"]}
|
||||||
|
elsif m_details['description'] =~ /Opera/i
|
||||||
|
target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["O"]}
|
||||||
|
end
|
||||||
|
#TODO:
|
||||||
|
# - Add support for detection of target OS
|
||||||
|
# - Add support for detection of target services (e.g. java, flash, silverlight, ...etc)
|
||||||
|
# - Add support for multiple target browsers as currently only 1 browser will match or all
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
msf_module_config[key] = {
|
msf_module_config[key] = {
|
||||||
'enable'=> true,
|
'enable'=> true,
|
||||||
'msf'=> true,
|
'msf'=> true,
|
||||||
@@ -57,7 +78,8 @@ module BeEF
|
|||||||
'description'=> m_details['description'],
|
'description'=> m_details['description'],
|
||||||
'authors'=> m_details['references'],
|
'authors'=> m_details['references'],
|
||||||
'path'=> path,
|
'path'=> path,
|
||||||
'class'=> 'Msf_module'
|
'class'=> 'Msf_module',
|
||||||
|
'target'=> target_browser
|
||||||
}
|
}
|
||||||
BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [key])
|
BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [key])
|
||||||
BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [key, nil])
|
BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [key, nil])
|
||||||
|
|||||||
Reference in New Issue
Block a user