Use filters
This commit is contained in:
@@ -29,7 +29,7 @@ class Asus_rt_series_get_info < BeEF::Core::Command
|
||||
gateway = "#{$5}"
|
||||
dns_servers = "#{$6}"
|
||||
|
||||
if !ip.nil?
|
||||
if !ip.nil? && BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found Asus RT series router [ip: #{ip}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => ip, :type => 'Asus Router', :cid => cid)
|
||||
r.save
|
||||
@@ -41,21 +41,25 @@ class Asus_rt_series_get_info < BeEF::Core::Command
|
||||
if client.to_s =~ /^([\d\.]+),([:\dA-F]{17})$/
|
||||
ip = $1
|
||||
mac = $2
|
||||
print_debug("Hooked browser found router client [ip: #{ip}, mac: #{mac}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => ip, :mac => mac, :cid => cid)
|
||||
r.save
|
||||
if BeEF::Filters.is_valid_ip?(ip)
|
||||
print_debug("Hooked browser found router client [ip: #{ip}, mac: #{mac}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => ip, :mac => mac, :cid => cid)
|
||||
r.save
|
||||
end
|
||||
end
|
||||
end
|
||||
if !gateway.nil?
|
||||
if !gateway.nil? && BeEF::Filters.is_valid_ip?(gateway)
|
||||
print_debug("Hooked browser found WAN gateway server [ip: #{gateway}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => gateway, :type => 'WAN Gateway', :cid => cid)
|
||||
r.save
|
||||
end
|
||||
if !dns_servers.nil? && dns_servers =~ /^([\d\. ]+)$/
|
||||
dns_servers.split(/ /).uniq.each do |dns|
|
||||
print_debug("Hooked browser found DNS server [ip: #{dns}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => dns, :type => 'DNS Server', :cid => cid)
|
||||
r.save
|
||||
if BeEF::Filters.is_valid_ip?(dns)
|
||||
print_debug("Hooked browser found DNS server [ip: #{dns}]")
|
||||
r = BeEF::Core::Models::NetworkHost.new(:hooked_browser_id => session_id, :ip => dns, :type => 'DNS Server', :cid => cid)
|
||||
r.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user