Drop explicit IPAddr to String coercion

MSP-12611
bug/bundler_fix
Matt Buck 2015-04-27 10:47:46 -05:00
parent 11f9f1557d
commit 6a4d63ca4f
32 changed files with 148 additions and 148 deletions

View File

@ -33,7 +33,7 @@ GIT
GIT
remote: git://github.com/rapid7/metasploit_data_models.git
revision: 28d2b7f40d9154f8a6a2005b33b9c54a74b59a08
revision: caa8e1a64cd145b419cbbfb5a7dad3b75090e44e
branch: staging/rails-4.0
specs:
metasploit_data_models (0.24.0.pre.rails.pre.4.0)

View File

@ -203,7 +203,7 @@ module Auxiliary::Report
port = opts[:service].port
proto = opts[:service].proto
service_name = opts[:service].name
host = opts[:service].host.address.to_s
host = opts[:service].host.address
else
port = opts.fetch(:port)
service_name = opts.fetch(:sname, nil)

View File

@ -482,7 +482,7 @@ class Export
end
site = e
el = create_xml_element("host", site.service.host.address.to_s)
el = create_xml_element("host", site.service.host.address)
report_file.write(" #{el}\n")
el = create_xml_element("port", site.service.port)
@ -509,7 +509,7 @@ class Export
el = create_xml_element("vhost", site.vhost)
report_file.write(" #{el}\n")
el = create_xml_element("host", site.service.host.address.to_s)
el = create_xml_element("host", site.service.host.address)
report_file.write(" #{el}\n")
el = create_xml_element("port", site.service.port)

View File

@ -65,13 +65,13 @@ module Msf::DBManager::Service
if addr.kind_of? ::Mdm::Host
host = addr
addr = host.address.to_s
addr = host.address
else
host = report_host(hopts)
end
if opts[:port].to_i.zero?
dlog("Skipping port zero for service '%s' on host '%s'" % [opts[:name],host.address.to_s])
dlog("Skipping port zero for service '%s' on host '%s'" % [opts[:name],host.address])
return nil
end

View File

@ -242,7 +242,7 @@ module Msf::DBManager::Web
host.save!
=end
vhost ||= host.address.to_s
vhost ||= host.address
site = ::Mdm::WebSite.where(vhost: vhost, service_id: serv[:id]).first_or_initialize
site.options = opts[:options] if opts[:options]

View File

@ -128,7 +128,7 @@ public
opts[:last_attempted_at] = opts[:last_attempted_at].to_datetime
login = create_credential_login(opts)
ret[:host] = login.service.host.address.to_s,
ret[:host] = login.service.host.address,
ret[:sname] = login.service.name
ret[:status] = login.status
end
@ -157,7 +157,7 @@ public
sname = ''
unless cred.logins.empty?
login = cred.logins.first
host = login.service.host.address.to_s
host = login.service.host.address
sname = login.service.name.to_s if login.service.name.present?
port = login.service.port.to_i
proto = login.service.proto.to_s
@ -192,7 +192,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.to_s
host[:address] = h.address
host[:mac] = h.mac.to_s
host[:name] = h.name.to_s
host[:state] = h.state.to_s
@ -228,7 +228,7 @@ public
wspace.services.includes(:host).where(conditions).offset(offset).limit(limit).each do |s|
service = {}
host = s.host
service[:host] = host.address.to_s || "unknown"
service[:host] = host.address || "unknown"
service[:created_at] = s[:created_at].to_i
service[:updated_at] = s[:updated_at].to_i
service[:port] = s[:port]
@ -267,7 +267,7 @@ public
vuln[:proto] = nil
end
vuln[:time] = v.created_at.to_i
vuln[:host] = v.host.address.to_s || nil
vuln[:host] = v.host.address || nil
vuln[:name] = v.name
vuln[:refs] = reflist.join(',')
ret[:vulns] << vuln
@ -365,7 +365,7 @@ public
if(h)
host = {}
host[:created_at] = h.created_at.to_i
host[:address] = h.address.to_s
host[:address] = h.address
host[:mac] = h.mac.to_s
host[:name] = h.name.to_s
host[:state] = h.state.to_s
@ -433,7 +433,7 @@ public
services.each do |s|
service = {}
host = s.host
service[:host] = host.address.to_s || "unknown"
service[:host] = host.address || "unknown"
service[:created_at] = s[:created_at].to_i
service[:updated_at] = s[:updated_at].to_i
service[:port] = s[:port]
@ -482,7 +482,7 @@ public
notes.each do |n|
note = {}
host = n.host
note[:host] = host.address.to_s || "unknown"
note[:host] = host.address || "unknown"
if n.service
note[:port] = n.service.port
note[:proto] = n.service.proto
@ -508,7 +508,7 @@ public
if(c)
client = {}
host = c.host
client[:host] = host.address.to_s
client[:host] = host.address
client[:created_at] = c.created_at.to_i
client[:updated_at] = c.updated_at.to_i
client[:ua_string] = c.ua_string.to_s
@ -567,7 +567,7 @@ public
note[:time] = n.created_at.to_i
note[:host] = ""
note[:service] = ""
note[:host] = n.host.address.to_s if(n.host)
note[:host] = n.host.address if(n.host)
note[:service] = n.service.name || n.service.port if(n.service)
note[:type ] = n.ntype.to_s
note[:data] = n.data.inspect
@ -641,7 +641,7 @@ public
deleted = []
vulns.each do |v|
dent = {}
dent[:address] = v.host.address.to_s if v.host
dent[:address] = v.host.address if v.host
dent[:port] = v.service.port if v.service
dent[:proto] = v.service.proto if v.service
dent[:name] = v.name
@ -709,7 +709,7 @@ public
deleted = []
notes.each do |n|
dent = {}
dent[:address] = n.host.address.to_s if n.host
dent[:address] = n.host.address if n.host
dent[:port] = n.service.port if n.service
dent[:proto] = n.service.proto if n.service
dent[:ntype] = n.ntype
@ -766,7 +766,7 @@ public
deleted = []
services.each do |s|
dent = {}
dent[:address] = s.host.address.to_s
dent[:address] = s.host.address
dent[:port] = s.port
dent[:proto] = s.proto
deleted << dent
@ -798,7 +798,7 @@ public
end
deleted = []
hosts.each do |h|
deleted << h.address.to_s
deleted << h.address
h.destroy
end
@ -828,7 +828,7 @@ public
wspace.events.offset(offset).limit(limit).each do |e|
event = {}
event[:host] = e.host.address.to_s if(e.host)
event[:host] = e.host.address if(e.host)
event[:created_at] = e.created_at.to_i
event[:updated_at] = e.updated_at.to_i
event[:name] = e.name
@ -873,7 +873,7 @@ public
ret[:loots] = []
wspace.loots.offset(offset).limit(limit).each do |l|
loot = {}
loot[:host] = l.host.address.to_s if(l.host)
loot[:host] = l.host.address if(l.host)
loot[:service] = l.service.name || l.service.port if(l.service)
loot[:ltype] = l.ltype
loot[:ctype] = l.content_type
@ -928,7 +928,7 @@ public
vulns.each do |v|
vuln= {}
host= v.host
vuln[:host] = host.address.to_s || "unknown"
vuln[:host] = host.address || "unknown"
if v.service
vuln[:port] = v.service.port
vuln[:proto] = v.service.proto
@ -963,7 +963,7 @@ public
wspace.clients.includes(:host).where(conditions).offset(offset).limit(limit).each do |c|
client = {}
client[:host] = c.host.address.to_s if c.host
client[:host] = c.host.address if c.host
client[:ua_string] = c.ua_string
client[:ua_name] = c.ua_name
client[:ua_ver] = c.ua_ver
@ -1007,7 +1007,7 @@ public
deleted = []
clients.each do |c|
dent = {}
dent[:address] = c.host.address.to_s
dent[:address] = c.host.address
dent[:ua_string] = c.ua_string
deleted << dent
c.destroy

View File

@ -3117,7 +3117,7 @@ class Core
hosts = {}
framework.db.each_service(framework.db.workspace) do |service|
if (service.port == mport)
hosts[ service.host.address.to_s ] = true
hosts[ service.host.address ] = true
end
end
@ -3128,7 +3128,7 @@ class Core
# List all hosts in the database
else
framework.db.each_host(framework.db.workspace) do |host|
res << host.address.to_s
res << host.address
end
end

View File

@ -411,7 +411,7 @@ class Db
host_ranges.each do |range|
range.each do |address|
host = framework.db.find_or_create_host(:host => address)
print_status("Time: #{host.created_at} Host: host=#{host.address.to_s}")
print_status("Time: #{host.created_at} Host: host=#{host.address}")
end
end
return
@ -483,7 +483,7 @@ class Db
tbl << columns
if set_rhosts
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s)
addr = (host.scope ? host.address + '%' + host.scope : host.address)
rhosts << addr
end
if mode == [:delete]
@ -634,7 +634,7 @@ class Db
info[:name] = names.first.downcase if names and names.first
svc = framework.db.find_or_create_service(info)
print_status("Time: #{svc.created_at} Service: host=#{svc.host.address.to_s} port=#{svc.port} proto=#{svc.proto} name=#{svc.name}")
print_status("Time: #{svc.created_at} Service: host=#{svc.host.address} port=#{svc.port} proto=#{svc.proto} name=#{svc.name}")
end
end
return
@ -665,10 +665,10 @@ class Db
)
end
columns = [host.address.to_s] + col_names.map { |n| service[n].to_s || "" }
columns = [host.address] + col_names.map { |n| service[n].to_s || "" }
tbl << columns
if set_rhosts
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s )
addr = (host.scope ? host.address + '%' + host.scope : host.address )
rhosts << addr
end
@ -789,12 +789,12 @@ class Db
next unless ports.empty? or ports.include? vuln.service.port
# Same for service names
next unless svcs.empty? or svcs.include?(vuln.service.name)
print_status("Time: #{vuln.created_at} Vuln: host=#{host.address.to_s} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
else
# This vuln has no service, so it can't match
next unless ports.empty? and svcs.empty?
print_status("Time: #{vuln.created_at} Vuln: host=#{host.address.to_s} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
print_status("Time: #{vuln.created_at} Vuln: host=#{host.address} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
end
if set_rhosts
addr = (host.scope ? host.address + '%' + host.scope : host.address)
@ -1079,11 +1079,11 @@ class Db
# the user-supplied RangeWalker, then we don't have any reason to
# print it out. However, we treat the absence of ranges as meaning
# all hosts.
if host_ranges.present? && !host_ranges.any? { |range| range.include?(login.service.host.address.to_s) }
if host_ranges.present? && !host_ranges.any? { |range| range.include?(login.service.host.address) }
next
end
row = [ login.service.host.address.to_s ]
rhosts << login.service.host.address.to_s
row = [ login.service.host.address ]
rhosts << login.service.host.address
if login.service.name.present?
row << "#{login.service.port}/#{login.service.proto} (#{login.service.name})"
else
@ -1250,7 +1250,7 @@ class Db
break if not host
note = framework.db.find_or_create_note(:host => host, :type => type, :data => data)
break if not note
print_status("Time: #{note.created_at} Note: host=#{host.address.to_s} type=#{note.ntype} data=#{note.data}")
print_status("Time: #{note.created_at} Note: host=#{host.address} type=#{note.ntype} data=#{note.data}")
}
}
return
@ -1317,9 +1317,9 @@ class Db
msg = "Time: #{note.created_at} Note:"
if (note.host)
host = note.host
msg << " host=#{note.host.address.to_s}"
msg << " host=#{note.host.address}"
if set_rhosts
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s )
addr = (host.scope ? host.address + '%' + host.scope : host.address )
rhosts << addr
end
end
@ -1475,7 +1475,7 @@ class Db
)
end
row = []
row.push( (loot.host ? loot.host.address.to_s : "") )
row.push( (loot.host ? loot.host.address : "") )
if (loot.service)
svc = (loot.service.name ? loot.service.name : "#{loot.service.port}/#{loot.service.proto}")
row.push svc

View File

@ -155,7 +155,7 @@ module Rex
return unless @state[:uri].kind_of? URI::HTTP
return unless @state[:web_site].service.host.name.to_s.empty?
host_info = {:workspace => @args[:wspace]}
host_info[:address] = @state[:web_site].service.host.address.to_s
host_info[:address] = @state[:web_site].service.host.address
host_info[:name] = @state[:uri].host
report_db(:host, host_info)
end

View File

@ -51,7 +51,7 @@ class Metasploit3 < Msf::Auxiliary
print_error("Unable to read #{myloot.path} \n #{e}")
end
oracle_array.each do |row|
hashlist.write("#{row[0]}:#{row[1]}:#{myloot.host.address.to_s}:#{myloot.service.port}\n")
hashlist.write("#{row[0]}:#{row[1]}:#{myloot.host.address}:#{myloot.service.port}\n")
end
end
hashlist.close

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.to_s}") if rr.class != Net::DNS::RR::CNAME
print_warning("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") 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.to_s
record[:address] = rr.address
results << record
end
end
@ -86,7 +86,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address.to_s
record[:address] = rr.address
results << record
end
end

View File

@ -102,13 +102,13 @@ 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.to_s}") if rr.class != Net::DNS::RR::CNAME
print_status("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
report_note(
:host => datastore['DOMAIN'],
:proto => 'UDP',
:port => 53,
:type => 'dns.wildcard',
:data => "Wildcard IP for #{rendsub}.#{target} is: #{rr.address.to_s}"
:data => "Wildcard IP for #{rendsub}.#{target} is: #{rr.address}"
)
end
return true
@ -126,7 +126,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "A"
record[:address] = rr.address.to_s
record[:address] = rr.address
results << record
end
end
@ -137,7 +137,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address.to_s
record[:address] = rr.address
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.to_s
record[:address] = rr.address
results << record
end
end
@ -192,7 +192,7 @@ class Metasploit3 < Msf::Auxiliary
record = {}
record[:host] = host
record[:type] = "AAAA"
record[:address] = rr.address.to_s
record[:address] = rr.address
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.to_s}") if rr.class != Net::DNS::RR::CNAME
print_status("Wildcard IP for #{rendsub}.#{target} is: #{rr.address}") 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.to_s},#{target},A")
:data => "#{rr.address},#{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.to_s},#{rr.mname},SOA")
:data => "#{ip.address},#{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.to_s},#{rr.nsdname},NS")
:data => "#{ip.address},#{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.to_s},#{target}.#{tld},A") if rr.class == Net::DNS::RR::A
:data => "#{rr.address},#{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.to_s}")
print_status("Hostname: #{line.chomp}.#{target} IP address: #{rr.address}")
report_note(:host => @nsinuse.to_s,
:proto => 'udp',
:sname => 'dns',
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address.to_s},#{line.chomp}.#{target},A")
:data => "#{rr.address},#{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.to_s}")
print_status("Hostname: #{line.chomp}.#{target} IPv6 Address: #{rr.address}")
report_note(:host => @nsinuse.to_s,
:proto => 'udp',
:sname => 'dns',
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address.to_s},#{line.chomp}.#{target},AAAA")
:data => "#{rr.address},#{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.to_s
nssrvip = nssrvquery.answer[0].address
end
begin
@res.nameserver=(nssrvip)
@ -395,7 +395,7 @@ class Metasploit3 < Msf::Auxiliary
:port => 53 ,
:type => 'dns.enum',
:update => :unique_data,
:data => "#{rr.address.to_s},#{rr.name},A")
:data => "#{rr.address},#{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.to_s}, AAAA")
:data => "#{rr.address}, 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.to_s
data = data.address
when Resolv::DNS::Resource::IN::TXT
data = data.strings.join
when Resolv::DNS::Resource::IN::CNAME

View File

@ -943,7 +943,7 @@ module Msf
end
targets = ""
framework.db.hosts(framework.db.workspace).each do |host|
targets << host.address.to_s
targets << host.address
targets << ","
end
targets.chop!

View File

@ -419,7 +419,7 @@ class Plugin::Nexpose < Msf::Plugin
print_status("Loading scan targets from the active database...") if opt_verbose
framework.db.hosts.each do |host|
next if host.state != ::Msf::HostState::Alive
opt_ranges << host.address.to_s
opt_ranges << host.address
end
end

View File

@ -228,12 +228,12 @@ class Plugin::Wiki < Msf::Plugin
tbl.headeri = opts[:heading_size]
framework.db.creds.each do |cred|
unless opts[:hosts].nil? or opts[:hosts].empty?
next unless opts[:hosts].include? cred.service.host.address.to_s
next unless opts[:hosts].include? cred.service.host.address
end
unless opts[:ports].nil?
next unless opts[:ports].any? {|p| cred.service.port.eql? p}
end
address = cred.service.host.address.to_s
address = cred.service.host.address
address = to_wikilink(address,opts[:namespace]) if opts[:links]
row = [
address,
@ -268,12 +268,12 @@ class Plugin::Wiki < Msf::Plugin
tbl.headeri = opts[:heading_size]
framework.db.hosts.each do |host|
unless opts[:hosts].nil? or opts[:hosts].empty?
next unless opts[:hosts].include? host.address.to_s
next unless opts[:hosts].include? host.address
end
unless opts[:ports].nil?
next unless (host.services.map{|s| s[:port]}).any? {|p| opts[:ports].include? p}
end
address = host.address.to_s
address = host.address
address = to_wikilink(address,opts[:namespace]) if opts[:links]
row = [
address,
@ -310,7 +310,7 @@ class Plugin::Wiki < Msf::Plugin
tbl.headeri = opts[:heading_size]
framework.db.loots.each do |loot|
unless opts[:hosts].nil? or opts[:hosts].empty?
next unless opts[:hosts].include? loot.host.address.to_s
next unless opts[:hosts].include? loot.host.address
end
unless opts[:ports].nil? or opts[:ports].empty?
next if loot.service.nil? or loot.service.port.nil? or not opts[:ports].include? loot.service.port
@ -318,7 +318,7 @@ class Plugin::Wiki < Msf::Plugin
if loot.service
svc = (loot.service.name ? loot.service.name : "#{loot.service.port}/#{loot.service.proto}")
end
address = loot.host.address.to_s
address = loot.host.address
address = to_wikilink(address,opts[:namespace]) if opts[:links]
row = [
address,
@ -353,12 +353,12 @@ class Plugin::Wiki < Msf::Plugin
tbl.headeri = opts[:heading_size]
framework.db.services.each do |service|
unless opts[:hosts].nil? or opts[:hosts].empty?
next unless opts[:hosts].include? service.host.address.to_s
next unless opts[:hosts].include? service.host.address
end
unless opts[:ports].nil? or opts[:ports].empty?
next unless opts[:ports].any? {|p| service[:port].eql? p}
end
address = service.host.address.to_s
address = service.host.address
address = to_wikilink(address,opts[:namespace]) if opts[:links]
row = [
address,
@ -392,12 +392,12 @@ class Plugin::Wiki < Msf::Plugin
tbl.headeri = opts[:heading_size]
framework.db.vulns.each do |vuln|
unless opts[:hosts].nil? or opts[:hosts].empty?
next unless opts[:hosts].include? vuln.host.address.to_s
next unless opts[:hosts].include? vuln.host.address
end
unless opts[:ports].nil? or opts[:ports].empty?
next unless opts[:ports].any? {|p| vuln.service.port.eql? p}
end
address = vuln.host.address.to_s
address = vuln.host.address
address = to_wikilink(address,opts[:namespace]) if opts[:links]
row = [
vuln.name,

View File

@ -1245,9 +1245,9 @@ class Plugin::Wmap < Msf::Plugin
end
to_del.each do |widx,wsite|
if wsite.delete
print_status("Deleted #{wsite.vhost} on #{wsite.service.host.address.to_s} at index #{widx}")
print_status("Deleted #{wsite.vhost} on #{wsite.service.host.address} at index #{widx}")
else
print_error("Could note delete {wsite.vhost} on #{wsite.service.host.address.to_s} at index #{widx}")
print_error("Could note delete {wsite.vhost} on #{wsite.service.host.address} at index #{widx}")
end
end
end
@ -1279,10 +1279,10 @@ class Plugin::Wmap < Msf::Plugin
serv.web_sites.each do |web|
c = web.web_pages.count
f = web.web_forms.count
tbl << [ idx.to_s, bdhost.address.to_s, web.vhost, serv.port, serv.name, c.to_s, f.to_s ]
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.to_s + ":" + serv.port.to_s + "/"
turl = web.vhost + "," + serv.name + "://" +bdhost.address + ":" + serv.port.to_s + "/"
self.lastsites << turl
end
end
@ -1419,13 +1419,13 @@ class Plugin::Wmap < Msf::Plugin
end
#site.web_forms.where(path: target.path).each do |form|
ckey = [ site.vhost, host.address.to_s, serv.port, inipath].join("|")
ckey = [ site.vhost, host.address, serv.port, inipath].join("|")
if not self.targets[ckey]
self.targets[ckey] = WebTarget.new
self.targets[ckey].merge!({
:vhost => site.vhost,
:host => host.address.to_s,
:host => host.address,
:port => serv.port,
:ssl => (serv.name == "https"),
:path => inipath
@ -2223,7 +2223,7 @@ class Plugin::Wmap < Msf::Plugin
host.services.each do |serv|
serv.web_sites.each do |site|
site.web_vulns.each do |wv|
print_status("+ [#{host.address.to_s}] (#{site.vhost}): #{wv.category} #{wv.path}")
print_status("+ [#{host.address}] (#{site.vhost}): #{wv.category} #{wv.path}")
print_status("\t#{wv.name} #{wv.description}")
print_status("\t#{wv.method} #{wv.proof}")
end

View File

@ -60,7 +60,7 @@ end
def infos(serv,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address.to_s}")
print_line("IP: #{host.address}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -91,7 +91,7 @@ framework.db.hosts.each do |host|
xprot = serv.proto
xname = serv.name
oname = host.os_name
xhost = host.address.to_s
xhost = host.address
if(xname =~ /smb/ or xname =~ /microsoft-ds/ or xname =~ /netbios-ssn/)
if(verbose == 1)

View File

@ -35,7 +35,7 @@ end
def infos(serv,creds,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address.to_s}")
print_line("IP: #{host.address}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -73,7 +73,7 @@ framework.db.creds.each do |creds|
xport = serv.port.to_i
xprot = serv.proto
xname = serv.name
xhost = host.address.to_s
xhost = host.address
if(xname =~ /smb/ or xname =~ /microsoft-ds/ or xname =~ /netbios-ssn/)
print_line("smb_login")

View File

@ -43,7 +43,7 @@ end
def infos(serv,creds,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address.to_s}")
print_line("IP: #{host.address}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -88,7 +88,7 @@ framework.db.creds.each do |creds| # just checking if we have any smb_hashes in
infos(serv,creds,host)
end
run_single("use exploit/windows/smb/psexec")
run_single("set RHOST #{host.address.to_s}")
run_single("set RHOST #{host.address}")
run_single("set RPORT #{serv.port}")
run_single("set SMBUser #{username}")
run_single("set SMBPass #{smbhash}")

View File

@ -38,7 +38,7 @@ framework.db.workspace.hosts.each do |host|
next if (serv.name !~ /http/)
if(verbose == 1)
print_line("IP: #{host.address.to_s}")
print_line("IP: #{host.address}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -46,7 +46,7 @@ framework.db.workspace.hosts.each do |host|
end
run_single("use auxiliary/scanner/http/crawler")
run_single("set MAX_THREADS #{threadspercrawler}")
run_single("set RHOST #{host.address.to_s}")
run_single("set RHOST #{host.address}")
run_single("set RPORT #{serv.port.to_i}")
if(serv.name == "https")
run_single("set SSL true")

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.to_s}")
print_good("Using #{exploit.shortname} against host #{vuln.host.address}")
run_single("use #{exploit.fullname}")
run_single("set RHOST #{vuln.host.address.to_s}")
run_single("set RHOST #{vuln.host.address}")
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.to_s
addr = vuln.host.address
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.to_s}")
print_good("Checking #{exploit.shortname} against host #{vuln.host.address}")
run_single("use #{exploit.fullname}")
run_single("set RHOST #{vuln.host.address.to_s}")
run_single("set RHOST #{vuln.host.address}")
run_single("check")
select(nil, nil, nil, 1)
run_single("back")

View File

@ -65,7 +65,7 @@ end
def infos(serv,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address.to_s}")
print_line("IP: #{host.address}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -124,7 +124,7 @@ framework.db.workspace.hosts.each do |host|
if(verbose == 1)
infos(serv,host)
end
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -141,7 +141,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -156,7 +156,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -171,7 +171,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -186,7 +186,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -201,7 +201,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -216,7 +216,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -234,7 +234,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -250,7 +250,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -268,7 +268,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -284,7 +284,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -299,7 +299,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -314,7 +314,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -332,7 +332,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -351,7 +351,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -367,7 +367,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -385,7 +385,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -404,7 +404,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -424,7 +424,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/ or serv.port == 443)
run_single("set SSL true")
else
@ -445,7 +445,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -465,7 +465,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -485,7 +485,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -505,7 +505,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -525,7 +525,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -544,7 +544,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -564,7 +564,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if (serv.name =~ /https/)
run_single("set SSL true")
else
@ -587,7 +587,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -603,7 +603,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -618,7 +618,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOST #{host.address.to_s}")
run_single("set RHOST #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -635,7 +635,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -653,7 +653,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -672,7 +672,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -690,7 +690,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -708,7 +708,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -725,7 +725,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -741,7 +741,7 @@ framework.db.workspace.hosts.each do |host|
infos(serv,host)
end
run_single("set RPORT #{serv.port}")
run_single("set RHOSTS #{host.address.to_s}")
run_single("set RHOSTS #{host.address}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")

View File

@ -10,7 +10,7 @@ hosts = []
begin
framework.db.services.each do |service|
if ( service.name =~ /mssql/i and service.state == 'open' and service.proto == 'tcp')
hosts << {'ip' => service.host.address.to_s, 'port' => service.port}
hosts << {'ip' => service.host.address, 'port' => service.port}
end
end
rescue ActiveRecord::ConnectionNotEstablished

View File

@ -11,7 +11,7 @@ host_id_to_ip = {}
begin
framework.db.hosts.each do |host|
# don't really like having to do that but only way I could tie them together as notes were missing ip
host_id_to_ip[host.id] = host.address.to_s
host_id_to_ip[host.id] = host.address
end
rescue ActiveRecord::ConnectionNotEstablished
puts "DB not connected..."

View File

@ -8,7 +8,7 @@ hosts = []
begin
framework.db.services.each do |service|
if ( (service.port == 1521 or service.port == 1522 or service.port == 1526) and (service.name =~ /oracle/i) and service.state == 'open')
hosts << {'ip' => service.host.address.to_s, 'port' => service.port}
hosts << {'ip' => service.host.address, 'port' => service.port}
end
end
rescue ActiveRecord::ConnectionNotEstablished

View File

@ -17,8 +17,8 @@ framework.db.hosts.each do |host|
host.services.each do |serv|
next if not serv.host
if (serv.state != Msf::ServiceState::Open)
print_line("cleaning closed services (Port: #{serv.port.to_i} / Host: #{host.address.to_s})")
run_single("services -d -p #{serv.port.to_i} -r #{serv.proto} #{host.address.to_s}")
print_line("cleaning closed services (Port: #{serv.port.to_i} / Host: #{host.address})")
run_single("services -d -p #{serv.port.to_i} -r #{serv.proto} #{host.address}")
counter = counter + 1
next
end

View File

@ -53,7 +53,7 @@ framework.db.hosts.each do |host|
if(verbose == 1)
print_line("")
print_line("====================================")
print_line("IP #{host.address.to_s}")
print_line("IP #{host.address}")
print_line("OS #{host.os_name}")
print_line("Servicename #{serv.name}")
print_line("Service Port #{serv.port.to_i}")
@ -64,10 +64,10 @@ framework.db.hosts.each do |host|
print_line("available sites:")
run_single("wmap_sites -l")
print_line("site which will get analyzed:")
run_single("wmap_sites -s #{host.address.to_s}:#{serv.port}")
run_single("wmap_targets -t #{host.address.to_s}:#{serv.port}")
run_single("wmap_sites -s #{host.address}:#{serv.port}")
run_single("wmap_targets -t #{host.address}:#{serv.port}")
serv.web_sites.each do |site|
run_single("wmap_targets -t #{site.vhost},#{host.address.to_s}:#{serv.port}")
run_single("wmap_targets -t #{site.vhost},#{host.address}:#{serv.port}")
end
print_line("defined target:")
run_single("wmap_targets -l")
@ -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.to_s}, Port: #{serv.port.to_s}")
print_line("finished analysing the webservern on IP #{host.address}, Port: #{serv.port.to_s}")
print_line("")
end
end

View File

@ -280,7 +280,7 @@ shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do
web_site = web_vuln.web_site
service = web_site.service
xml.host(service.host.address.to_s)
xml.host(service.host.address)
xml.path(web_vuln.path)
xml.port(service.port)
xml.query(web_vuln.query)
@ -1121,7 +1121,7 @@ shared_examples_for 'Msf::DBManager::Import::MetasploitFramework::XML' do
xml.category(web_vuln.category)
service = web_vuln.web_site.service
xml.host(service.host.address.to_s)
xml.host(service.host.address)
xml.method(web_vuln.method)
xml.name(web_vuln.name)

View File

@ -72,7 +72,7 @@ shared_examples_for 'Msf::DBManager::Session' do
session.exploit_datastore = exploit_datastore
session.info = 'Info'
session.platform = 'Platform'
session.session_host = host.address.to_s
session.session_host = host.address
session.sid = rand(100)
session.type = 'Session Type'
session.via_exploit = 'exploit/multi/handler'