Ensure IP addresses are explicitly converted to strings

MSP-12113
bug/bundler_fix
Matt Buck 2015-03-24 16:26:00 -05:00
parent 38ded90700
commit c26dfa263d
No known key found for this signature in database
GPG Key ID: 42134E0C9C4E94BB
26 changed files with 149 additions and 149 deletions

View File

@ -205,7 +205,7 @@ module Auxiliary::Report
port = opts[:service].port
proto = opts[:service].proto
service_name = opts[:service].name
host = opts[:service].host.address
host = opts[:service].host.address.to_s
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)
el = create_xml_element("host", site.service.host.address.to_s)
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)
el = create_xml_element("host", site.service.host.address.to_s)
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
addr = host.address.to_s
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])
dlog("Skipping port zero for service '%s' on host '%s'" % [opts[:name],host.address.to_s])
return nil
end

View File

@ -137,7 +137,7 @@ module Msf::DBManager::Session
s = ::Mdm::Session.new(sess_data)
s.save!
if session and session.exploit_task and session.exploit_task.record
session_task = session.exploit_task.record
if session_task.class == Mdm::Task
@ -163,7 +163,7 @@ module Msf::DBManager::Session
end
vuln_info = {
:host => host.address,
:host => host.address.to_s,
:name => mod_name,
:refs => mod.references,
:workspace => wspace,

View File

@ -242,7 +242,7 @@ module Msf::DBManager::Web
host.save!
=end
vhost ||= host.address
vhost ||= host.address.to_s
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,
ret[:host] = login.service.host.address.to_s,
ret[:sname] = login.service.name
ret[:status] = login.status
end
@ -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 || "unknown"
service[:host] = host.address.to_s || "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 || nil
vuln[:host] = v.host.address.to_s || nil
vuln[:name] = v.name
vuln[:refs] = reflist.join(',')
ret[:vulns] << vuln
@ -433,7 +433,7 @@ public
services.each do |s|
service = {}
host = s.host
service[:host] = host.address || "unknown"
service[:host] = host.address.to_s || "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 || "unknown"
note[:host] = host.address.to_s || "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
client[:host] = host.address.to_s
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 if(n.host)
note[:host] = n.host.address.to_s 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
@ -828,7 +828,7 @@ public
wspace.events.offset(offset).limit(limit).each do |e|
event = {}
event[:host] = e.host.address if(e.host)
event[:host] = e.host.address.to_s 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 if(l.host)
loot[:host] = l.host.address.to_s 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 || "unknown"
vuln[:host] = host.address.to_s || "unknown"
if v.service
vuln[:port] = v.service.port
vuln[:proto] = v.service.proto

View File

@ -806,7 +806,7 @@ class Core
end
# This is not respecting the Protected access control, but this seems to be the only way
# to rename a job. If you know a more appropriate way, patches accepted.
# to rename a job. If you know a more appropriate way, patches accepted.
framework.jobs[job_id].send(:name=, job_name)
print_status("Job #{job_id} updated")
@ -3108,7 +3108,7 @@ class Core
hosts = {}
framework.db.each_service(framework.db.workspace) do |service|
if (service.port == mport)
hosts[ service.host.address ] = true
hosts[ service.host.address.to_s ] = true
end
end
@ -3119,7 +3119,7 @@ class Core
# List all hosts in the database
else
framework.db.each_host(framework.db.workspace) do |host|
res << host.address
res << host.address.to_s
end
end

View File

@ -301,7 +301,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}")
print_status("Time: #{host.created_at} Host: host=#{host.address.to_s}")
end
end
return
@ -338,7 +338,7 @@ class Db
tbl << columns
if set_rhosts
addr = (host.scope ? host.address + '%' + host.scope : host.address )
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s )
rhosts << addr
end
if mode == :delete
@ -489,7 +489,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} port=#{svc.port} proto=#{svc.proto} name=#{svc.name}")
print_status("Time: #{svc.created_at} Service: host=#{svc.host.address.to_s} port=#{svc.port} proto=#{svc.proto} name=#{svc.name}")
end
end
return
@ -520,10 +520,10 @@ class Db
)
end
columns = [host.address] + col_names.map { |n| service[n].to_s || "" }
columns = [host.address.to_s] + col_names.map { |n| service[n].to_s || "" }
tbl << columns
if set_rhosts
addr = (host.scope ? host.address + '%' + host.scope : host.address )
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s )
rhosts << addr
end
@ -638,12 +638,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} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
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}" : ""}")
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} name=#{vuln.name} refs=#{reflist.join(',')} #{(show_info && vuln.info) ? "info=#{vuln.info}" : ""}")
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}" : ""}")
end
end
end
@ -920,11 +920,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) }
if host_ranges.present? && !host_ranges.any? { |range| range.include?(login.service.host.address.to_s) }
next
end
row = [ login.service.host.address ]
rhosts << login.service.host.address
row = [ login.service.host.address.to_s ]
rhosts << login.service.host.address.to_s
if login.service.name.present?
row << "#{login.service.port}/#{login.service.proto} (#{login.service.name})"
else
@ -1089,7 +1089,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} type=#{note.ntype} data=#{note.data}")
print_status("Time: #{note.created_at} Note: host=#{host.address.to_s} type=#{note.ntype} data=#{note.data}")
}
}
return
@ -1156,9 +1156,9 @@ class Db
msg = "Time: #{note.created_at} Note:"
if (note.host)
host = note.host
msg << " host=#{note.host.address}"
msg << " host=#{note.host.address.to_s}"
if set_rhosts
addr = (host.scope ? host.address + '%' + host.scope : host.address )
addr = (host.scope ? host.address.to_s + '%' + host.scope : host.address.to_s )
rhosts << addr
end
end
@ -1314,7 +1314,7 @@ class Db
)
end
row = []
row.push( (loot.host ? loot.host.address : "") )
row.push( (loot.host ? loot.host.address.to_s : "") )
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
host_info[:address] = @state[:web_site].service.host.address.to_s
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}:#{myloot.service.port}\n")
hashlist.write("#{row[0]}:#{row[1]}:#{myloot.host.address.to_s}:#{myloot.service.port}\n")
end
end
hashlist.close

View File

@ -12,10 +12,10 @@ module Msf
def name
PLUGIN_NAME
end
class ConsoleCommandDispatcher
include Msf::Ui::Console::CommandDispatcher
def name
PLUGIN_NAME
end
@ -31,11 +31,11 @@ module Msf
def msf_local
"#{Msf::Config.local_directory}"
end
def cmd_nessus_index
nessus_index
end
def commands
{
"nessus_connect" => "Connect to a nessus server: nconnect username:password@hostname:port <verify_ssl>",
@ -77,7 +77,7 @@ module Msf
"nessus_folder_list" => "List folders configured on the Nessus server",
"nessus_scanner_list" => "List the configured scanners on the Nessus server",
"nessus_family_list" => "List all the plugin families along with their corresponding family IDs and plugin count"
}
}
end
def cmd_nessus_help(*args)
@ -107,7 +107,7 @@ module Msf
tbl << [ "nessus_db_import", "Import Nessus scan to the Metasploit connected database" ]
tbl << [ "", ""]
tbl << [ "Reports Commands", "" ]
tbl << [ "-----------------", "-----------------"]
tbl << [ "-----------------", "-----------------"]
tbl << [ "nessus_report_hosts", "Get list of hosts from a report" ]
tbl << [ "nessus_report_vulns", "Get list of vulns from a report" ]
tbl << [ "nessus_report_host_details", "Get detailed information from a report item on a host" ]
@ -201,7 +201,7 @@ module Msf
total = Time.now - start
print_status("It has taken : #{total} seconds to build the exploits search index")
end
def nessus_index
if File.exist?("#{xindex}")
#check if it's version line matches current version.
@ -243,7 +243,7 @@ module Msf
return
end
end
if args[0] == "-h"
print_status("%redYou must do this before any other commands.%clr")
print_status("Usage: ")
@ -255,7 +255,7 @@ module Msf
print_status("use a self signed certificate, therefore, users should use ssl_ignore.")
return
end
if !@token == ''
print_error("You are already authenticated. Call nessus_logout before authenticating again")
return
@ -264,7 +264,7 @@ module Msf
ncusage
return
end
@user = @pass = @host = @port = @sslv = nil
case args.length
when 1,2
@ -643,7 +643,7 @@ module Msf
print_line("IP Address: #{details['info']['host-ip']}")
print_line("Hostname: #{details['info']['host-name']}")
print_line("Operating System: #{details['info']['operating-system']}")
print_line
print_line
print_status("Vulnerability information")
details["vulnerabilities"].each { |vuln|
tbl << [ vuln["plugin_name"], vuln["plugin_family"], vuln["severity"] ]
@ -680,7 +680,7 @@ module Msf
report = @n.report_download(scan_id, file_id)
File.open("#{msf_local}/#{scan_id}-#{file_id}","w+") do |f|
f.puts report
print_status("Report downloaded to #{msf_local} directory")
print_status("Report downloaded to #{msf_local} directory")
end
else
print_error("Only completed scans ca be downloaded")
@ -795,7 +795,7 @@ module Msf
'Status',
'Folder'
])
list["scans"].each { |scan|
if args[0] == "-r"
if scan["status"] == "running"
@ -943,7 +943,7 @@ module Msf
end
targets = ""
framework.db.hosts(framework.db.workspace).each do |host|
targets << host.address
targets << host.address.to_s
targets << ","
end
targets.chop!
@ -1006,11 +1006,11 @@ module Msf
end
else
print_error(export)
end
end
else
print_error("Only completed scans could be used for import")
end
end
def is_scan_complete(scan_id)

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
opt_ranges << host.address.to_s
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
next unless opts[:hosts].include? cred.service.host.address.to_s
end
unless opts[:ports].nil?
next unless opts[:ports].any? {|p| cred.service.port.eql? p}
end
address = cred.service.host.address
address = cred.service.host.address.to_s
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
next unless opts[:hosts].include? host.address.to_s
end
unless opts[:ports].nil?
next unless (host.services.map{|s| s[:port]}).any? {|p| opts[:ports].include? p}
end
address = host.address
address = host.address.to_s
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
next unless opts[:hosts].include? loot.host.address.to_s
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
address = loot.host.address.to_s
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
next unless opts[:hosts].include? service.host.address.to_s
end
unless opts[:ports].nil? or opts[:ports].empty?
next unless opts[:ports].any? {|p| service[:port].eql? p}
end
address = service.host.address
address = service.host.address.to_s
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
next unless opts[:hosts].include? vuln.host.address.to_s
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
address = vuln.host.address.to_s
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} at index #{widx}")
print_status("Deleted #{wsite.vhost} on #{wsite.service.host.address.to_s} at index #{widx}")
else
print_error("Could note delete {wsite.vhost} on #{wsite.service.host.address} at index #{widx}")
print_error("Could note delete {wsite.vhost} on #{wsite.service.host.address.to_s} at index #{widx}")
end
end
end
@ -1279,7 +1279,7 @@ 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, web.vhost, serv.port, serv.name, c.to_s, f.to_s ]
tbl << [ idx.to_s, bdhost.address.to_s, 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 + "/"
@ -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, serv.port, inipath].join("|")
ckey = [ site.vhost, host.address.to_s, serv.port, inipath].join("|")
if not self.targets[ckey]
self.targets[ckey] = WebTarget.new
self.targets[ckey].merge!({
:vhost => site.vhost,
:host => host.address,
:host => host.address.to_s,
: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}] (#{site.vhost}): #{wv.category} #{wv.path}")
print_status("+ [#{host.address.to_s}] (#{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}")
print_line("IP: #{host.address.to_s}")
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
xhost = host.address.to_s
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}")
print_line("IP: #{host.address.to_s}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -58,24 +58,24 @@ framework.db.creds.each do |creds|
next if not serv.host
next if (serv.state != Msf::ServiceState::Open)
# for now we only check these services, you can add some more ...
next if not (serv.name =~ /smb/ or
serv.name =~ /microsoft-ds/ or
serv.name =~ /netbios-ssn/ or
serv.name =~ /ftp/ or
serv.name =~ /ssh/ or
serv.name =~ /telnet/ or
serv.name =~ /mysql/ or
serv.name =~ /vnc/ or
serv.name =~ /mssql/ or
serv.name =~ /pop3/ or
next if not (serv.name =~ /smb/ or
serv.name =~ /microsoft-ds/ or
serv.name =~ /netbios-ssn/ or
serv.name =~ /ftp/ or
serv.name =~ /ssh/ or
serv.name =~ /telnet/ or
serv.name =~ /mysql/ or
serv.name =~ /vnc/ or
serv.name =~ /mssql/ or
serv.name =~ /pop3/ or
serv.name =~ /postgres/)
xport = serv.port.to_i
xprot = serv.proto
xname = serv.name
xhost = host.address
xhost = host.address.to_s
if(xname =~ /smb/ or xname =~ /microsoft-ds/ or xname =~ /netbios-ssn/)
if(xname =~ /smb/ or xname =~ /microsoft-ds/ or xname =~ /netbios-ssn/)
print_line("smb_login")
if(verbose == 1)
infos(serv,creds,host)

View File

@ -9,8 +9,8 @@
<ruby>
#psexec needs a payload
if framework.datastore['PAYLOAD']
pload = framework.datastore['PAYLOAD']
if framework.datastore['PAYLOAD']
pload = framework.datastore['PAYLOAD']
else #just to get sure that we have a backup payload
pload = "windows/meterpreter/bind_tcp"
end
@ -43,7 +43,7 @@ end
def infos(serv,creds,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address}")
print_line("IP: #{host.address.to_s}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -59,7 +59,7 @@ framework.db.creds.each do |creds| # just checking if we have any smb_hashes in
if (jotr == 1)
# first checking weak windows hashes with john ... because of the filtering before, we are sure that
# this is a windows hash
# this is a windows hash
# on the first found hash we are going to analyse all hashes - then we set jotr to 0
print_line("using jtr_crack_fast")
@ -74,21 +74,21 @@ framework.db.creds.each do |creds| # just checking if we have any smb_hashes in
smbhash = creds.pass
username = creds.user
framework.db.hosts.each do |host|
next if (host.os_name !~ /Windows/) # pass the hash works just for Win
host.services.each do |serv|
next if not serv.host
next if (serv.state != Msf::ServiceState::Open)
next if (serv.name !~ /smb/)
next if (serv.name !~ /smb/)
print_line("using psexec - Pass the hash")
if(verbose == 1)
infos(serv,creds,host)
end
run_single("use exploit/windows/smb/psexec")
run_single("set RHOST #{host.address}")
run_single("set RHOST #{host.address.to_s}")
run_single("set RPORT #{serv.port}")
run_single("set SMBUser #{username}")
run_single("set SMBPass #{smbhash}")

View File

@ -36,9 +36,9 @@ framework.db.workspace.hosts.each do |host|
next if not serv.host
next if (serv.state != Msf::ServiceState::Open)
next if (serv.name !~ /http/)
if(verbose == 1)
print_line("IP: #{host.address}")
print_line("IP: #{host.address.to_s}")
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}")
run_single("set RHOST #{host.address.to_s}")
run_single("set RPORT #{serv.port.to_i}")
if(serv.name == "https")
run_single("set SSL true")

View File

@ -65,7 +65,7 @@ end
def infos(serv,host)
print_line("")
print_line("====================================")
print_line("IP: #{host.address}")
print_line("IP: #{host.address.to_s}")
print_line("OS: #{host.os_name}")
print_line("Servicename: #{serv.name}")
print_line("Service Port: #{serv.port.to_i}")
@ -109,7 +109,7 @@ print_line("starting discovery scanners ... stage 2")
print_line("============================================")
print_line("")
run_single("unsetg RHOSTS") # we dont need it anymore
run_single("unsetg RHOSTS") # we dont need it anymore
framework.db.workspace.hosts.each do |host|
host.services.each do |serv|
@ -124,7 +124,7 @@ framework.db.workspace.hosts.each do |host|
if(verbose == 1)
infos(serv,host)
end
run_single("set RHOSTS #{host.address}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -416,7 +416,7 @@ framework.db.workspace.hosts.each do |host|
end
if (serv.name =~ /http/ or serv.port == 80 or serv.port == 443)
if(versionscanners == 1 or serv.name == nil)
print_line("Module: http_version")
run_single("use auxiliary/scanner/http/http_version")
@ -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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOST #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
if(verbose == 1)
run_single("set VERBOSE true")
run_single("run -j")
@ -700,7 +700,7 @@ framework.db.workspace.hosts.each do |host|
jobwaiting(maxjobs,verbose)
end
end
if (serv.port == 7777)
print_line("Module: energizer_duo_detect")
run_single("use auxiliary/scanner/backdoor/energizer_duo_detect")
@ -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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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}")
run_single("set RHOSTS #{host.address.to_s}")
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, 'port' => service.port}
hosts << {'ip' => service.host.address.to_s, '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
host_id_to_ip[host.id] = host.address.to_s
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, 'port' => service.port}
hosts << {'ip' => service.host.address.to_s, '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})")
run_single("services -d -p #{serv.port.to_i} -r #{serv.proto} #{host.address}")
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}")
counter = counter + 1
next
end

View File

@ -24,9 +24,9 @@ end
#we look in the global datastore for a global VERBOSE option and use it
if (framework.datastore['VERBOSE'] == "true")
verbose = 1
verbose = 1
else
verbose = 0
verbose = 0
end
if (framework.plugins.to_s =~ /[Ww]map/)
@ -53,7 +53,7 @@ framework.db.hosts.each do |host|
if(verbose == 1)
print_line("")
print_line("====================================")
print_line("IP #{host.address}")
print_line("IP #{host.address.to_s}")
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}:#{serv.port}")
run_single("wmap_targets -t #{host.address}:#{serv.port}")
run_single("wmap_sites -s #{host.address.to_s}:#{serv.port}")
run_single("wmap_targets -t #{host.address.to_s}:#{serv.port}")
serv.web_sites.each do |site|
run_single("wmap_targets -t #{site.vhost},#{host.address}:#{serv.port}")
run_single("wmap_targets -t #{site.vhost},#{host.address.to_s}:#{serv.port}")
end
print_line("defined target:")
run_single("wmap_targets -l")

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)
xml.host(service.host.address.to_s)
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)
xml.host(service.host.address.to_s)
xml.method(web_vuln.method)
xml.name(web_vuln.name)

View File

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