Remove :cid property from Network extension data models
This commit is contained in:
@@ -18,7 +18,6 @@ class Asus_rt_series_get_info < BeEF::Core::Command
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
|
||||
# log the network hosts
|
||||
if @datastore['results'] =~ /ip=(.+)&clients=(.+)&wanip=(.+)&netmask=(.+)&gateway=(.+)&dns=(.+)/
|
||||
@@ -31,8 +30,8 @@ class Asus_rt_series_get_info < BeEF::Core::Command
|
||||
|
||||
if !ip.nil? && BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found Asus RT series router [ip: #{ip}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :type => 'Asus Router', :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => 'http', :ip => ip, :port => 80, :type => 'HTTP Server', :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :type => 'Asus Router')
|
||||
BeEF::Core::Models::NetworkService.add(: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?
|
||||
@@ -41,19 +40,19 @@ class Asus_rt_series_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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(: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', :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(: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', :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => dns, :type => 'DNS Server')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,10 +24,9 @@ class Detect_airdrone < BeEF::Core::Command
|
||||
port = $3
|
||||
session_id = @datastore['beefhook']
|
||||
type = 'Airdrone'
|
||||
cid = @datastore['cid'].to_i
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found 'Airdrone' [proto: #{proto}, ip: #{ip}, port: #{port}]")
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,10 +24,9 @@ class Detect_cups < BeEF::Core::Command
|
||||
port = $3
|
||||
session_id = @datastore['beefhook']
|
||||
type = 'CUPS'
|
||||
cid = @datastore['cid'].to_i
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,14 +25,13 @@ class Get_internal_ip < BeEF::Core::Command
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
|
||||
# save the network host
|
||||
if @datastore['results'] =~ /^([\d\.]+)$/
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,6 @@ class Get_internal_ip_webrtc < BeEF::Core::Command
|
||||
configuration = BeEF::Core::Configuration.instance
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
# save the network host
|
||||
if @datastore['results'] =~ /IP is ([\d\.,]+)/
|
||||
ips = $1.to_s.split(/,/)
|
||||
@@ -24,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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :os => os)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,6 @@ class Cross_origin_scanner < BeEF::Core::Command
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
|
||||
# log the network service
|
||||
if @datastore['results'] =~ /ip=(.+)&port=([\d]+)&status/
|
||||
@@ -24,7 +23,7 @@ class Cross_origin_scanner < 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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,10 +32,9 @@ class Get_http_servers < BeEF::Core::Command
|
||||
port = $3
|
||||
url = $4
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
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", :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => "HTTP Server")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ class Identify_lan_subnets < BeEF::Core::Command
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
|
||||
# log the network hosts
|
||||
if @datastore['results'] =~ /^hosts=([\d\.,]+)/
|
||||
@@ -38,7 +37,7 @@ class Identify_lan_subnets < BeEF::Core::Command
|
||||
next unless ip.to_s =~ /^([\d\.]+)$/
|
||||
next unless 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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,10 +34,9 @@ class Internal_network_fingerprinting < BeEF::Core::Command
|
||||
discovered = $4
|
||||
url = $5
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => discovered)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -24,19 +24,17 @@ class Fingerprint_routers < BeEF::Core::Command
|
||||
port = $3
|
||||
service = $4
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
end
|
||||
elsif @datastore['results'] =~ /^ip=(.+)&device=(.+)/
|
||||
ip = $1
|
||||
device = $2
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip, :type => device)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,14 +31,13 @@ class Ping_sweep < BeEF::Core::Command
|
||||
if configuration.get("beef.extension.network.enable") == true
|
||||
|
||||
session_id = @datastore['beefhook']
|
||||
cid = @datastore['cid'].to_i
|
||||
|
||||
# save the network host
|
||||
if @datastore['results'] =~ /host=([\d\.]+) is alive/
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => ip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,10 +38,9 @@ class Port_scanner < BeEF::Core::Command
|
||||
service = $4
|
||||
session_id = @datastore['beefhook']
|
||||
proto = 'http'
|
||||
cid = @datastore['cid'].to_i
|
||||
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, :cid => cid)
|
||||
BeEF::Core::Models::NetworkService.add(:hooked_browser_id => session_id, :proto => proto, :ip => ip, :port => port, :type => service)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user