Added pre_execute, execute and post_execute to modules.
git-svn-id: https://beef.googlecode.com/svn/trunk@1197 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -170,6 +170,9 @@ module Core
|
||||
JSON.parse(command['data']).each{|v|
|
||||
cc[v['name']] = v['value']
|
||||
}
|
||||
if self.respond_to?(:execute)
|
||||
self.execute
|
||||
end
|
||||
@output = @eruby.evaluate(cc)
|
||||
|
||||
@output
|
||||
|
||||
@@ -51,7 +51,9 @@ module Handlers
|
||||
command = @kclass.new(BeEF::Module.get_key_by_class(@kclass)) # create the commamd module
|
||||
command.build_callback_datastore(@http_params, @http_header) # build datastore from the response
|
||||
command.session_id = beefhook
|
||||
command.callback # call the command module's callback function - it will parse and save the results
|
||||
if command.respond_to?(:post_execute)
|
||||
command.post_execute
|
||||
end
|
||||
|
||||
# get/set details for datastore and log entry
|
||||
command_friendly_name = command.friendlyname
|
||||
|
||||
@@ -31,6 +31,11 @@ module Module
|
||||
return (self.is_enabled(mod) and BeEF::Core::Configuration.instance.get('beef.module.'+mod.to_s+'.loaded') == true)
|
||||
end
|
||||
|
||||
# Returns module class definition
|
||||
def self.get_definition(mod)
|
||||
return BeEF::Core::Command.const_get(BeEF::Core::Configuration.instance.get("beef.module.#{mod.to_s}.class"))
|
||||
end
|
||||
|
||||
# Gets all module options
|
||||
def self.get_options(mod)
|
||||
if self.check_hard_load(mod)
|
||||
@@ -346,6 +351,10 @@ module Module
|
||||
print_error "Could not find hooked browser when attempting to execute module '#{mod}'"
|
||||
return false
|
||||
end
|
||||
command_module = self.get_definition(mod).new(mod)
|
||||
if command_module.respond_to?(:pre_execute)
|
||||
command_module.pre_execute
|
||||
end
|
||||
c = BeEF::Core::Models::Command.new(:data => self.merge_options(mod, opts).to_json,
|
||||
:hooked_browser_id => hb.id,
|
||||
:command_module_id => BeEF::Core::Configuration.instance.get("beef.module.#{mod}.db.id"),
|
||||
|
||||
@@ -21,7 +21,7 @@ class Detect_visited_urls < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class Hook_ie < BeEF::Core::Command
|
||||
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['result'] = @datastore['result']
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Link_rewrite < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class Site_redirect < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Site_redirect_iframe < BeEF::Core::Command
|
||||
# This method is being called when a hooked browser sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
class Test_return_ascii_chars < BeEF::Core::Command
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result String'] = @datastore['result_string']
|
||||
save content
|
||||
|
||||
@@ -23,7 +23,7 @@ class Test_return_long_string < BeEF::Core::Command
|
||||
end
|
||||
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result String'] = @datastore['result_string']
|
||||
save content
|
||||
|
||||
@@ -19,7 +19,7 @@ class Insecure_url_skype < BeEF::Core::Command
|
||||
{ 'name' => 'tel_num', 'description' => 'The telephone number to dial', 'ui_label'=>'Number', 'value' =>'5551234', 'width' => '200px' }
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result'] = @datastore['result']
|
||||
save content
|
||||
|
||||
@@ -21,7 +21,7 @@ class Iphone_tel < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result'] = @datastore['result']
|
||||
save content
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
class Physical_location < BeEF::Core::Command
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Geolocation Enabled'] = @datastore['geoLocEnabled']
|
||||
content['Latitude'] = @datastore['latitude']
|
||||
|
||||
@@ -33,7 +33,7 @@ class Browser_autopwn < BeEF::Core::Command
|
||||
# This method is being called when a hooked browser sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ class Alert_dialog < BeEF::Core::Command
|
||||
'width' => '400px'
|
||||
}]
|
||||
end
|
||||
|
||||
def callback
|
||||
|
||||
def post_execute
|
||||
content = {}
|
||||
content['User Response'] = "The user clicked the 'OK' button when presented with an alert box."
|
||||
save content
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
class Clipboard_theft < BeEF::Core::Command
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['clipboard'] = @datastore['clipboard']
|
||||
save content
|
||||
|
||||
@@ -21,7 +21,7 @@ class Deface_web_page < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result'] = @datastore['result']
|
||||
save content
|
||||
|
||||
@@ -20,7 +20,7 @@ class Extract_local_storage < BeEF::Core::Command
|
||||
# http://diveintohtml5.org/storage.html
|
||||
#
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['localStorage'] = @datastore['localStorage']
|
||||
save content
|
||||
|
||||
@@ -25,7 +25,7 @@ class Prompt_dialog < BeEF::Core::Command
|
||||
# This method is being called when a zombie sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
|
||||
# return if @datastore['answer']==''
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class Raw_javascript < BeEF::Core::Command
|
||||
# This method is being called when a zombie sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class Replace_video < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result'] = @datastore['result']
|
||||
save content
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
class Rickroll < BeEF::Core::Command
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Result'] = @datastore['result']
|
||||
save content
|
||||
|
||||
@@ -29,7 +29,7 @@ class Coldfusion_dir_traversal_exploit < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class Detect_local_settings < BeEF::Core::Command
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/network/detect_local_settings/Beeffeine.class','/Beeffeine','class')
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['internal ip'] = @datastore['internal_ip'] if not @datastore['internal_ip'].nil?
|
||||
content['internal hostname'] = @datastore['internal_hostname'] if not @datastore['internal_hostname'].nil?
|
||||
|
||||
@@ -68,7 +68,7 @@ class Inter_protocol_win_bindshell < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['result'] = @datastore['result'] if not @datastore['result'].nil?
|
||||
content['fail'] = @datastore['fail'] if not @datastore['fail'].nil?
|
||||
|
||||
@@ -30,7 +30,7 @@ class Jboss_jmx_upload_exploit < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Vtiger_crm_upload_exploit < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
return if @datastore['result'].nil?
|
||||
|
||||
save({'result' => @datastore['result']})
|
||||
|
||||
@@ -18,7 +18,7 @@ class Iframe_above < BeEF::Core::Command
|
||||
# This method is being called when a hooked browser sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Iframe_keylogger < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['keystrokes'] = @datastore['keystrokes']
|
||||
save content
|
||||
|
||||
@@ -18,7 +18,7 @@ class Popunder_window < BeEF::Core::Command
|
||||
# This method is being called when a hooked browser sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
class Collect_links < BeEF::Core::Command
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['Links'] = @datastore['links']
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class Detect_soc_nets < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['GMail'] = @datastore['gmail']
|
||||
content['Facebook'] = @datastore['facebook']
|
||||
|
||||
@@ -21,7 +21,7 @@ class Detect_tor < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
return if @datastore['result'].nil?
|
||||
|
||||
save({'result' => @datastore['result']})
|
||||
|
||||
@@ -43,7 +43,7 @@ class Internal_network_fingerprinting < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
content = {}
|
||||
content['device'] =@datastore['device'] if not @datastore['device'].nil?
|
||||
content['url'] = @datastore['url'] if not @datastore['url'].nil?
|
||||
|
||||
@@ -23,7 +23,7 @@ class Linksys_befsr41_csrf < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Linksys_wrt54g2_csrf < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Linksys_wrt54g_csrf < BeEF::Core::Command
|
||||
]
|
||||
end
|
||||
|
||||
def callback
|
||||
def post_execute
|
||||
save({'result' => @datastore['result']})
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user