Skip to content

Commit 3f797e4

Browse files
committed
Reinstate some to_s coercions that were mistakenly dropped
1 parent 5429374 commit 3f797e4

File tree

9 files changed

+37
-37
lines changed

9 files changed

+37
-37
lines changed

lib/msf/core/rpc/v10/rpc_db.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def rpc_creds(xopts)
249249
sname = ''
250250
unless cred.logins.empty?
251251
login = cred.logins.first
252-
host = login.service.host.address
252+
host = login.service.host.address.to_s
253253
sname = login.service.name.to_s if login.service.name.present?
254254
port = login.service.port.to_i
255255
proto = login.service.proto.to_s
@@ -309,7 +309,7 @@ def rpc_hosts(xopts)
309309
wspace.hosts.where(conditions).offset(offset).order(:address).limit(limit).each do |h|
310310
host = {}
311311
host[:created_at] = h.created_at.to_i
312-
host[:address] = h.address
312+
host[:address] = h.address.to_s
313313
host[:mac] = h.mac.to_s
314314
host[:name] = h.name.to_s
315315
host[:state] = h.state.to_s
@@ -630,7 +630,7 @@ def rpc_get_host(xopts)
630630
if(h)
631631
host = {}
632632
host[:created_at] = h.created_at.to_i
633-
host[:address] = h.address
633+
host[:address] = h.address.to_s
634634
host[:mac] = h.mac.to_s
635635
host[:name] = h.name.to_s
636636
host[:state] = h.state.to_s
@@ -1113,7 +1113,7 @@ def rpc_del_vuln(xopts)
11131113
deleted = []
11141114
vulns.each do |v|
11151115
dent = {}
1116-
dent[:address] = v.host.address if v.host
1116+
dent[:address] = v.host.address.to_s if v.host
11171117
dent[:port] = v.service.port if v.service
11181118
dent[:proto] = v.service.proto if v.service
11191119
dent[:name] = v.name
@@ -1205,7 +1205,7 @@ def rpc_del_note(xopts)
12051205
deleted = []
12061206
notes.each do |n|
12071207
dent = {}
1208-
dent[:address] = n.host.address if n.host
1208+
dent[:address] = n.host.address.to_s if n.host
12091209
dent[:port] = n.service.port if n.service
12101210
dent[:proto] = n.service.proto if n.service
12111211
dent[:ntype] = n.ntype
@@ -1285,7 +1285,7 @@ def rpc_del_service(xopts)
12851285
deleted = []
12861286
services.each do |s|
12871287
dent = {}
1288-
dent[:address] = s.host.address
1288+
dent[:address] = s.host.address.to_s
12891289
dent[:port] = s.port
12901290
dent[:proto] = s.proto
12911291
deleted << dent
@@ -1334,7 +1334,7 @@ def rpc_del_host(xopts)
13341334
end
13351335
deleted = []
13361336
hosts.each do |h|
1337-
deleted << h.address
1337+
deleted << h.address.to_s
13381338
h.destroy
13391339
end
13401340

@@ -1689,7 +1689,7 @@ def rpc_clients(xopts)
16891689

16901690
wspace.clients.includes(:host).where(conditions).offset(offset).limit(limit).each do |c|
16911691
client = {}
1692-
client[:host] = c.host.address if c.host
1692+
client[:host] = c.host.address.to_s if c.host
16931693
client[:ua_string] = c.ua_string
16941694
client[:ua_name] = c.ua_name
16951695
client[:ua_ver] = c.ua_ver
@@ -1754,7 +1754,7 @@ def rpc_del_client(xopts)
17541754
deleted = []
17551755
clients.each do |c|
17561756
dent = {}
1757-
dent[:address] = c.host.address
1757+
dent[:address] = c.host.address.to_s
17581758
dent[:ua_string] = c.ua_string
17591759
deleted << dent
17601760
c.destroy

modules/auxiliary/gather/dns_bruteforce.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def wildcard(target)
5353
if query.answer.length != 0
5454
print_status("This Domain has wild-cards enabled!!")
5555
query.answer.each do |rr|
56-
print_warning("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
56+
print_warning("Wild-card IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
5757
end
5858
return true
5959
else
@@ -72,7 +72,7 @@ def get_ip(host)
7272
record = {}
7373
record[:host] = host
7474
record[:type] = "AAAA"
75-
record[:address] = rr.address
75+
record[:address] = rr.address.to_s
7676
results << record
7777
end
7878
end
@@ -86,7 +86,7 @@ def get_ip(host)
8686
record = {}
8787
record[:host] = host
8888
record[:type] = "AAAA"
89-
record[:address] = rr.address
89+
record[:address] = rr.address.to_s
9090
results << record
9191
end
9292
end

modules/auxiliary/gather/dns_info.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def wildcard(target)
102102
if query.answer.length != 0
103103
print_status("This Domain has Wild-cards Enabled!!")
104104
query.answer.each do |rr|
105-
print_status("Wild-card IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
105+
print_status("Wild-card IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
106106
report_note(
107107
:host => datastore['DOMAIN'],
108108
:proto => 'UDP',
@@ -126,7 +126,7 @@ def get_ip(host)
126126
record = {}
127127
record[:host] = host
128128
record[:type] = "A"
129-
record[:address] = rr.address
129+
record[:address] = rr.address.to_s
130130
results << record
131131
end
132132
end
@@ -137,7 +137,7 @@ def get_ip(host)
137137
record = {}
138138
record[:host] = host
139139
record[:type] = "AAAA"
140-
record[:address] = rr.address
140+
record[:address] = rr.address.to_s
141141
results << record
142142
end
143143
end

modules/auxiliary/gather/dns_srv_enum.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def get_ip(host)
178178
record = {}
179179
record[:host] = host
180180
record[:type] = "AAAA"
181-
record[:address] = rr.address
181+
record[:address] = rr.address.to_s
182182
results << record
183183
end
184184
end
@@ -192,7 +192,7 @@ def get_ip(host)
192192
record = {}
193193
record[:host] = host
194194
record[:type] = "AAAA"
195-
record[:address] = rr.address
195+
record[:address] = rr.address.to_s
196196
results << record
197197
end
198198
end

modules/auxiliary/gather/enum_dns.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def wildcard(target)
7777
if query.answer.length != 0
7878
print_status("This domain has wildcards enabled!!")
7979
query.answer.each do |rr|
80-
print_status("Wildcard IP for #{rendsub}.#{target} is: #{rr.address}") if rr.class != Net::DNS::RR::CNAME
80+
print_status("Wildcard IP for #{rendsub}.#{target} is: #{rr.address.to_s}") if rr.class != Net::DNS::RR::CNAME
8181
end
8282
return true
8383
else
@@ -98,7 +98,7 @@ def genrcd(target)
9898
:port => 53 ,
9999
:type => 'dns.enum',
100100
:update => :unique_data,
101-
:data => "#{rr.address},#{target},A")
101+
:data => "#{rr.address.to_s},#{target},A")
102102
end
103103
end
104104
query = @res.query(target, "SOA")
@@ -114,7 +114,7 @@ def genrcd(target)
114114
:port => 53 ,
115115
:type => 'dns.enum',
116116
:update => :unique_data,
117-
:data => "#{ip.address},#{rr.mname},SOA")
117+
:data => "#{ip.address.to_s},#{rr.mname},SOA")
118118
end
119119
end
120120
end
@@ -133,7 +133,7 @@ def genrcd(target)
133133
:port => 53 ,
134134
:type => 'dns.enum',
135135
:update => :unique_data,
136-
:data => "#{ip.address},#{rr.nsdname},NS")
136+
:data => "#{ip.address.to_s},#{rr.nsdname},NS")
137137
end
138138
end
139139
end
@@ -213,7 +213,7 @@ def tldexpnd(targetdom,nssrv)
213213
:port => 53,
214214
:type => 'dns.enum',
215215
:update => :unique_data,
216-
:data => "#{rr.address},#{target}.#{tld},A") if rr.class == Net::DNS::RR::A
216+
:data => "#{rr.address.to_s},#{target}.#{tld},A") if rr.class == Net::DNS::RR::A
217217
end
218218
end
219219
end
@@ -233,14 +233,14 @@ def dnsbrute(target, wordlist, nssrv)
233233
if (query1)
234234
query1.answer.each do |rr|
235235
if rr.class == Net::DNS::RR::A
236-
print_status("Hostname: #{line.chomp}.#{target} IP address: #{rr.address}")
236+
print_status("Hostname: #{line.chomp}.#{target} IP address: #{rr.address.to_s}")
237237
report_note(:host => @nsinuse.to_s,
238238
:proto => 'udp',
239239
:sname => 'dns',
240240
:port => 53 ,
241241
:type => 'dns.enum',
242242
:update => :unique_data,
243-
:data => "#{rr.address},#{line.chomp}.#{target},A")
243+
:data => "#{rr.address.to_s},#{line.chomp}.#{target},A")
244244
next unless rr.class == Net::DNS::RR::CNAME
245245
end
246246
end
@@ -262,14 +262,14 @@ def bruteipv6(target, wordlist, nssrv)
262262
if (query1)
263263
query1.answer.each do |rr|
264264
if rr.class == Net::DNS::RR::AAAA
265-
print_status("Hostname: #{line.chomp}.#{target} IPv6 Address: #{rr.address}")
265+
print_status("Hostname: #{line.chomp}.#{target} IPv6 Address: #{rr.address.to_s}")
266266
report_note(:host => @nsinuse.to_s,
267267
:proto => 'udp',
268268
:sname => 'dns',
269269
:port => 53 ,
270270
:type => 'dns.enum',
271271
:update => :unique_data,
272-
:data => "#{rr.address},#{line.chomp}.#{target},AAAA")
272+
:data => "#{rr.address.to_s},#{line.chomp}.#{target},AAAA")
273273
next unless rr.class == Net::DNS::RR::CNAME
274274
end
275275
end
@@ -366,7 +366,7 @@ def axfr(target, nssrv)
366366
if nssrvquery.answer.length == 0
367367
nssrvip = Rex::Socket.gethostbyname(nsrcd.nsdname)[3].bytes.reduce {|a,b| [a,b].join(".")}
368368
else
369-
nssrvip = nssrvquery.answer[0].address
369+
nssrvip = nssrvquery.answer[0].address.to_s
370370
end
371371
begin
372372
@res.nameserver=(nssrvip)
@@ -395,7 +395,7 @@ def axfr(target, nssrv)
395395
:port => 53 ,
396396
:type => 'dns.enum',
397397
:update => :unique_data,
398-
:data => "#{rr.address},#{rr.name},A")
398+
:data => "#{rr.address.to_s},#{rr.name},A")
399399
when "SOA"
400400
print_status("Name: #{rr.mname} Record: SOA")
401401
report_note(:host => nssrvip,
@@ -440,7 +440,7 @@ def axfr(target, nssrv)
440440
:port => 53 ,
441441
:type => 'dns.enum',
442442
:update => :unique_data,
443-
:data => "#{rr.address}, AAAA")
443+
:data => "#{rr.address.to_s}, AAAA")
444444
when "NS"
445445
print_status("Name: #{rr.nsdname} Record: NS")
446446
report_note(:host => nssrvip,

modules/auxiliary/spoof/dns/compare_results.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def run
103103
when Resolv::DNS::Resource::IN::MX
104104
data = data.exchange.to_s
105105
when Resolv::DNS::Resource::IN::A
106-
data = data.address
106+
data = data.address.to_s
107107
when Resolv::DNS::Resource::IN::TXT
108108
data = data.strings.join
109109
when Resolv::DNS::Resource::IN::CNAME

plugins/wmap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ def view_sites
12821282
tbl << [ idx.to_s, bdhost.address, web.vhost, serv.port, serv.name, c.to_s, f.to_s ]
12831283
idx += 1
12841284

1285-
turl = web.vhost + "," + serv.name + "://" +bdhost.address + ":" + serv.port.to_s + "/"
1285+
turl = web.vhost + "," + serv.name + "://" +bdhost.address.to_s + ":" + serv.port.to_s + "/"
12861286
self.lastsites << turl
12871287
end
12881288
end

scripts/resource/autoexploit.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def auto_exploit(module_path)
134134

135135
framework.db.workspace.vulns.each do |vuln|
136136
next if not ref_has_match(vuln.refs, exploit_refs)
137-
print_good("Using #{exploit.shortname} against host #{vuln.host.address}")
137+
print_good("Using #{exploit.shortname} against host #{vuln.host.address.to_s}")
138138
run_single("use #{exploit.fullname}")
139-
run_single("set RHOST #{vuln.host.address}")
139+
run_single("set RHOST #{vuln.host.address.to_s}")
140140
run_single("set payload #{get_payload}")
141141
run_single("set lhost #{lhost}")
142142
run_single("exploit -z")
@@ -157,7 +157,7 @@ def dry_run(module_path)
157157

158158
framework.db.workspace.vulns.each do |vuln|
159159
next if not ref_has_match(vuln.refs, exploit_refs)
160-
addr = vuln.host.address
160+
addr = vuln.host.address.to_s
161161
print_good("#{addr} has a matching reference to #{exploit.shortname}")
162162
end
163163
end
@@ -174,9 +174,9 @@ def check_exploit(module_path)
174174

175175
framework.db.workspace.vulns.each do |vuln|
176176
next if not ref_has_match(vuln.refs, exploit_refs)
177-
print_good("Checking #{exploit.shortname} against host #{vuln.host.address}")
177+
print_good("Checking #{exploit.shortname} against host #{vuln.host.address.to_s}")
178178
run_single("use #{exploit.fullname}")
179-
run_single("set RHOST #{vuln.host.address}")
179+
run_single("set RHOST #{vuln.host.address.to_s}")
180180
run_single("check")
181181
select(nil, nil, nil, 1)
182182
run_single("back")

scripts/resource/wmap_autotest.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ framework.db.hosts.each do |host|
7878
end
7979
run_single("wmap_targets -c")
8080
print_line("")
81-
print_line("finished analysing the webservern on IP #{host.address}, Port: #{serv.port.to_s}")
81+
print_line("finished analysing the webservern on IP #{host.address.to_s}, Port: #{serv.port.to_s}")
8282
print_line("")
8383
end
8484
end

0 commit comments

Comments
 (0)