Skip to content

Commit dd7bcee

Browse files
committed
fix threaded issues
1 parent d493c48 commit dd7bcee

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

modules/auxiliary/gather/dns_reverse_lookup.rb

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def reverselkp(iprange)
7373
end
7474
while (true)
7575
# Spawn threads for each host
76+
hosts = Hash.new
7677
while (tl.length <= @threadnum)
7778
ip = ar.next_ip
78-
hosts = Array.new
7979
break if not ip
8080
tl << framework.threads.spawn("Module(#{self.refname})-#{ip}", false, ip.dup) do |tip|
8181
begin
@@ -92,16 +92,21 @@ def reverselkp(iprange)
9292
:host => tip.to_s,
9393
:name => addresstp
9494
)
95-
hosts.push addresstp
95+
if !hosts[tip]
96+
hosts[tip] = Array.new
97+
end
98+
hosts[tip].push addresstp
9699
end
97-
if !hosts.empty?
98-
report_note(
99-
:host => tip.to_s,
100-
:type => "RDNS_Record",
101-
:data => hosts
102-
)
100+
101+
if hosts[tip]
102+
if !hosts[tip].empty?
103+
report_note(
104+
:host => tip.to_s,
105+
:type => "RDNS_Record",
106+
:data => hosts[tip]
107+
)
108+
end
103109
end
104-
hosts = Array.new
105110
rescue ::Interrupt
106111
raise $!
107112
rescue ::Rex::ConnectionError

0 commit comments

Comments
 (0)