Reinstate some to_s coercions that were mistakenly dropped

This commit is contained in:
Matt Buck 2015-04-30 11:13:19 -05:00
parent 542937415b
commit 3f797e4393
9 changed files with 37 additions and 37 deletions

View File

@ -249,7 +249,7 @@ public
sname = ''
unless cred.logins.empty?
login = cred.logins.first
host = login.service.host.address
host = login.service.host.address.to_s
sname = login.service.name.to_s if login.service.name.present?
port = login.service.port.to_i
proto = login.service.proto.to_s
@ -309,7 +309,7 @@ public
wspace.hosts.where(conditions).offset(offset).order(:address).limit(limit).each do |h|
host = {}
host[:created_at] = h.created_at.to_i
host[:address] = h.address
host[:address] = h.address.to_s
host[:mac] = h.mac.to_s
host[:name] = h.name.to_s
host[:state] = h.state.to_s
@ -630,7 +630,7 @@ public
if(h)
host = {}
host[:created_at] = h.created_at.to_i
host[:address] = h.address
host[:address] = h.address.to_s
host[:mac] = h.mac.to_s
host[:name] = h.name.to_s
host[:state] = h.state.to_s
@ -1113,7 +1113,7 @@ public
deleted = []
vulns.each do |v|
dent = {}
dent[:address] = v.host.address if v.host
dent[:address] = v.host.address.to_s if v.host
dent[:port] = v.service.port if v.service
dent[:proto] = v.service.proto if v.service
dent[:name] = v.name
@ -1205,7 +1205,7 @@ public
deleted = []
notes.each do |n|
dent = {}
dent[:address] = n.host.address if n.host
dent[:address] = n.host.address.to_s if n.host
dent[:port] = n.service.port if n.service
dent[:proto] = n.service.proto if n.service
dent[:ntype] = n.ntype
@ -1285,7 +1285,7 @@ public
deleted = []
services.each do |s|
dent = {}
dent[:address] = s.host.address
dent[:address] = s.host.address.to_s
dent[:port] = s.port
dent[:proto] = s.proto
deleted << dent
@ -1334,7 +1334,7 @@ public
end
deleted = []
hosts.each do |h|
deleted << h.address
deleted << h.address.to_s
h.destroy
end
@ -1689,7 +1689,7 @@ public
wspace.clients.includes(:host).where(conditions).offset(offset).limit(limit).each do |c|
client = {}
client[:host] = c.host.address if c.host
client[:host] = c.host.address.to_s if c.host
client[:ua_string] = c.ua_string
client[:ua_name] = c.ua_name
client[:ua_ver] = c.ua_ver
@ -1754,7 +1754,7 @@ public
deleted = []
clients.each do |c|
dent = {}
dent[:address] = c.host.address
dent[:address] = c.host.address.to_s
dent[:ua_string] = c.ua_string
deleted << dent
c.destroy

View File

@ -53,7 +53,7 @@ class Metasploit3 < Msf::Auxiliary
if query.answer.length != 0
print_status("This Domain has wild-cards enabled!!")
query.answer.each do |rr|
print_warning("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
print_warning("Wild-card IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
end
return true
else
@ -72,7 +72,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end
@ -86,7 +86,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end

View File

@ -102,7 +102,7 @@ class Metasploit3 < Msf::Auxiliary
if query.answer.length != 0
print_status("This Domain has Wild-cards Enabled!!")
query.answer.each do |rr|
print_status("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
print_status("Wild-card IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
report_note(
:host => datastore['DOMAIN'],
:proto => 'UDP',
@ -126,7 +126,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "A"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end
@ -137,7 +137,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end

View File

@ -178,7 +178,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end
@ -192,7 +192,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address
record[:address] = rr.address.to_s
results << record
end
end

View File

@ -77,7 +77,7 @@ class Metasploit3 < Msf::Auxiliary
if query.answer.length != 0
print_status("This domain has wildcards enabled!!")
query.answer.each do |rr|
print_status("Wildcard IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
print_status("Wildcard IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
end
return true
else
@ -98,7 +98,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address},#{target},A")
:data => "#{rr.address.to_s},#{target},A")
end
end
query = @res.query(target, "SOA")
@ -114,7 +114,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{ip.address},#{rr.mname},SOA")
:data => "#{ip.address.to_s},#{rr.mname},SOA")
end
end
end
@ -133,7 +133,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{ip.address},#{rr.nsdname},NS")
:data => "#{ip.address.to_s},#{rr.nsdname},NS")
end
end
end
@ -213,7 +213,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address},#{target}.#{tld},A") if rr.class == Net::DNS::RR::A
:data => "#{rr.address.to_s},#{target}.#{tld},A") if rr.class == Net::DNS::RR::A
end
end
end
@ -233,14 +233,14 @@ class Metasploit3 < Msf::Auxiliary
if (query1)
query1.answer.each do |rr|
if rr.class == Net::DNS::RR::A
print_status("Hostname: #{line.chomp}.#{target} IP address: #{rr.address}")
print_status("Hostname: #{line.chomp}.#{target} IP address: #{rr.address.to_s}")
report_note(:host => @nsinuse.to_s,
:proto => 'udp',
:sname => 'dns',
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address},#{line.chomp}.#{target},A")
:data => "#{rr.address.to_s},#{line.chomp}.#{target},A")
next unless rr.class == Net::DNS::RR::CNAME
end
end
@ -262,14 +262,14 @@ class Metasploit3 < Msf::Auxiliary
if (query1)
query1.answer.each do |rr|
if rr.class == Net::DNS::RR::AAAA
print_status("Hostname: #{line.chomp}.#{target} IPv6 Address: #{rr.address}")
print_status("Hostname: #{line.chomp}.#{target} IPv6 Address: #{rr.address.to_s}")
report_note(:host => @nsinuse.to_s,
:proto => 'udp',
:sname => 'dns',
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address},#{line.chomp}.#{target},AAAA")
:data => "#{rr.address.to_s},#{line.chomp}.#{target},AAAA")
next unless rr.class == Net::DNS::RR::CNAME
end
end
@ -366,7 +366,7 @@ class Metasploit3 < Msf::Auxiliary
if nssrvquery.answer.length == 0
nssrvip = Rex::Socket.gethostbyname(nsrcd.nsdname)[3].bytes.reduce {|a,b| [a,b].join(".")}
else
nssrvip = nssrvquery.answer[0].address
nssrvip = nssrvquery.answer[0].address.to_s
end
begin
@res.nameserver=(nssrvip)
@ -395,7 +395,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address},#{rr.name},A")
:data => "#{rr.address.to_s},#{rr.name},A")
when "SOA"
print_status("Name: #{rr.mname} Record: SOA")
report_note(:host => nssrvip,
@ -440,7 +440,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address}, AAAA")
:data => "#{rr.address.to_s}, AAAA")
when "NS"
print_status("Name: #{rr.nsdname} Record: NS")
report_note(:host => nssrvip,

View File

@ -103,7 +103,7 @@ class Metasploit3 < Msf::Auxiliary
when Resolv::DNS::Resource::IN::MX
data = data.exchange.to_s
when Resolv::DNS::Resource::IN::A
data = data.address
data = data.address.to_s
when Resolv::DNS::Resource::IN::TXT
data = data.strings.join
when Resolv::DNS::Resource::IN::CNAME

View File

@ -1282,7 +1282,7 @@ class Plugin::Wmap < Msf::Plugin
tbl << [ idx.to_s, bdhost.address, web.vhost, serv.port, serv.name, c.to_s, f.to_s ]
idx += 1
turl = web.vhost + "," + serv.name + "://" +bdhost.address + ":" + serv.port.to_s + "/"
turl = web.vhost + "," + serv.name + "://" +bdhost.address.to_s + ":" + serv.port.to_s + "/"
self.lastsites << turl
end
end

View File

@ -134,9 +134,9 @@ def auto_exploit(module_path)
framework.db.workspace.vulns.each do |vuln|
next if not ref_has_match(vuln.refs, exploit_refs)
print_good("Using #{exploit.shortname} against host #{vuln.host.address}")
print_good("Using #{exploit.shortname} against host #{vuln.host.address.to_s}")
run_single("use #{exploit.fullname}")
run_single("set RHOST #{vuln.host.address}")
run_single("set RHOST #{vuln.host.address.to_s}")
run_single("set payload #{get_payload}")
run_single("set lhost #{lhost}")
run_single("exploit -z")
@ -157,7 +157,7 @@ def dry_run(module_path)
framework.db.workspace.vulns.each do |vuln|
next if not ref_has_match(vuln.refs, exploit_refs)
addr = vuln.host.address
addr = vuln.host.address.to_s
print_good("#{addr} has a matching reference to #{exploit.shortname}")
end
end
@ -174,9 +174,9 @@ def check_exploit(module_path)
framework.db.workspace.vulns.each do |vuln|
next if not ref_has_match(vuln.refs, exploit_refs)
print_good("Checking #{exploit.shortname} against host #{vuln.host.address}")
print_good("Checking #{exploit.shortname} against host #{vuln.host.address.to_s}")
run_single("use #{exploit.fullname}")
run_single("set RHOST #{vuln.host.address}")
run_single("set RHOST #{vuln.host.address.to_s}")
run_single("check")
select(nil, nil, nil, 1)
run_single("back")

View File

@ -78,7 +78,7 @@ framework.db.hosts.each do |host|
end
run_single("wmap_targets -c")
print_line("")
print_line("finished analysing the webservern on IP #{host.address}, Port: #{serv.port.to_s}")
print_line("finished analysing the webservern on IP #{host.address.to_s}, Port: #{serv.port.to_s}")
print_line("")
end
end