Re-commiting h4sh5's reverted changes.
This commit is contained in:
@@ -29,6 +29,7 @@ module BeEF
|
||||
|
||||
# validate hook session value
|
||||
session_id = get_param(@data, 'beefhook')
|
||||
print_debug "[INIT] Processing Browser Details for session #{session_id}"
|
||||
(self.err_msg "session id is invalid"; return) if not BeEF::Filters.is_valid_hook_session_id?(session_id)
|
||||
hooked_browser = HB.where(:session => session_id).first
|
||||
return if not hooked_browser.nil? # browser is already registered with framework
|
||||
@@ -404,6 +405,17 @@ module BeEF
|
||||
self.err_msg "Invalid value for 'browser.window.size.width' returned from the hook browser's initial connection."
|
||||
end
|
||||
|
||||
# store and log IP details of host
|
||||
print_debug("Hooked browser [id:#{zombie.id}] has IP [ip: #{zombie.ip}]")
|
||||
|
||||
if os_name != nil and os_version != nil
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser => zombie, :ip => zombie.ip, :ntype => 'Host', :os => os_name + "-" + os_version)
|
||||
elsif os_name != nil
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser => zombie, :ip => zombie.ip, :ntype => 'Host', :os => os_name)
|
||||
else
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser => zombie, :ip => zombie.ip, :ntype => 'Host')
|
||||
end
|
||||
|
||||
# get and store the yes|no value for browser capabilities
|
||||
capabilities = [
|
||||
'browser.capabilities.vbscript',
|
||||
|
||||
@@ -13,6 +13,7 @@ module BeEF
|
||||
config = BeEF::Core::Configuration.instance
|
||||
@nh = BeEF::Core::Models::NetworkHost
|
||||
@ns = BeEF::Core::Models::NetworkService
|
||||
@hb = BeEF::Core::Models::HookedBrowser
|
||||
|
||||
# Require a valid API token from a valid IP address
|
||||
halt 401 unless params[:token] == config.get('beef.api_token')
|
||||
@@ -69,7 +70,8 @@ module BeEF
|
||||
begin
|
||||
id = params[:id]
|
||||
|
||||
hosts = @nh.where(hooked_browser_id: id).distinct.order(:id)
|
||||
hooked_browser = @hb.where(session: id).distinct
|
||||
hosts = @nh.where(hooked_browser: hooked_browser).distinct.order(:hooked_browser)
|
||||
count = hosts.length
|
||||
|
||||
result = {}
|
||||
@@ -121,7 +123,7 @@ module BeEF
|
||||
|
||||
host = @nh.find(id)
|
||||
raise InvalidParamError, 'id' if host.nil?
|
||||
halt 404 if host.empty?
|
||||
halt 404 if host.nil?
|
||||
|
||||
host.to_h.to_json
|
||||
rescue InvalidParamError => e
|
||||
|
||||
Reference in New Issue
Block a user