Merge branch 'activerecord'
This commit is contained in:
@@ -30,8 +30,8 @@ class Asus_rt_n12e_get_info < BeEF::Core::Command
|
||||
|
||||
if !ip.nil? && BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found Asus RT-N12E router [ip: #{ip}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :type => 'Asus RT-N12E Router')
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => 'http', :ip => ip, :port => 80, :type => 'HTTP Server')
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip, :type => 'Asus RT-N12E Router')
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => 'http', :ip => ip, :port => 80, :type => 'HTTP Server')
|
||||
end
|
||||
clients.scan(/([\d\.]+,[:\dA-F]{17})/).flatten.each do |client|
|
||||
next if client.nil?
|
||||
@@ -40,19 +40,19 @@ class Asus_rt_n12e_get_info < BeEF::Core::Command
|
||||
mac = $2
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found router client [ip: #{ip}, mac: #{mac}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :mac => mac)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip, :mac => mac)
|
||||
end
|
||||
end
|
||||
end
|
||||
if !gateway.nil? && BeEF::Filters.is_valid_ip?(gateway)
|
||||
print_debug("Hooked browser found WAN gateway server [ip: #{gateway}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => gateway, :type => 'WAN Gateway')
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => gateway, :type => 'WAN Gateway')
|
||||
end
|
||||
if !dns_servers.nil? && dns_servers =~ /^([\d\. ]+)$/
|
||||
dns_servers.split(/ /).uniq.each do |dns|
|
||||
if BeEF::Filters.is_valid_ip?(dns)
|
||||
print_debug("Hooked browser found DNS server [ip: #{dns}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => dns, :type => 'DNS Server')
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => dns, :type => 'DNS Server')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class Detect_airdroid < BeEF::Core::Command
|
||||
type = 'Airdroid'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found 'Airdroid' [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class Detect_cups < BeEF::Core::Command
|
||||
type = 'CUPS'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found 'CUPS' [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ class Get_internal_ip_java < BeEF::Core::Command
|
||||
ip = $1
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser has network interface #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ class Get_internal_ip_webrtc < BeEF::Core::Command
|
||||
next if ip =~ /^0\.0\.0\.0$/
|
||||
next unless BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser has network interface #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :os => os)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip, :os => os)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ class Cross_origin_scanner_cors < BeEF::Core::Command
|
||||
type = 'HTTP Server (CORS)'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found HTTP server #{ip}:#{port}")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ class Cross_origin_scanner_flash < BeEF::Core::Command
|
||||
ip = $1
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found host #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
# log discovered network services
|
||||
elsif @datastore['results'] =~ /^proto=(.+)&ip=(.+)&port=([\d]+)&title/
|
||||
@@ -35,7 +35,7 @@ class Cross_origin_scanner_flash < BeEF::Core::Command
|
||||
type = 'HTTP Server (Flash)'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found HTTP server #{ip}:#{port}")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ class Detect_burp < BeEF::Core::Command
|
||||
session_id = @datastore['beefhook']
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found network service [ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => 'http', :ip => ip, :port => port, :type => 'Burp Proxy')
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => 'http', :ip => ip, :port => port, :type => 'Burp Proxy')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ class Get_http_servers < BeEF::Core::Command
|
||||
session_id = @datastore['beefhook']
|
||||
if !ip.nil? && BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found HTTP Server [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => "HTTP Server")
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => "HTTP Server")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ class Get_ntop_network_hosts < BeEF::Core::Command
|
||||
type = 'ntop'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found 'ntop' [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
data.to_s.scan(/"hostNumIpAddress":"([\d\.]+)"/).flatten.each do |ip|
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found host #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :port => port)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip, :port => port)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class Get_proxy_servers_wpad < BeEF::Core::Command
|
||||
proto = 'SOCKS' if proxy_type =~ /SOCKS/
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found #{proto} proxy [ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto.downcase, :ip => ip, :port => port, :type => "#{proto} Proxy")
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto.downcase, :ip => ip, :port => port, :type => "#{proto} Proxy")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ class Internal_network_fingerprinting < BeEF::Core::Command
|
||||
session_id = @datastore['beefhook']
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found '#{discovered}' [ip: #{ip}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => discovered)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => discovered)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Fingerprint_routers < BeEF::Core::Command
|
||||
session_id = @datastore['beefhook']
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found network service " + service + " [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
end
|
||||
elsif @datastore['results'] =~ /^ip=(.+)&device=(.+)/
|
||||
ip = $1
|
||||
@@ -34,7 +34,7 @@ class Fingerprint_routers < BeEF::Core::Command
|
||||
session_id = @datastore['beefhook']
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found network device " + device + " [ip: #{ip}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :type => device)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip, :type => device)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class Ping_sweep < BeEF::Core::Command
|
||||
ping = $2
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found host #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ class Ping_sweep_ff < BeEF::Core::Command
|
||||
ip = $1
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser has network interface #{ip}")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
BeEF::Core::Models::NetworkHost.create(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ class Port_scanner < BeEF::Core::Command
|
||||
proto = 'http'
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found network service [ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
BeEF::Core::Models::NetworkService.create(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user