Skip to content

Commit 176204d

Browse files
committed
With implemented remarks
1 parent dd7bcee commit 176204d

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

modules/auxiliary/gather/dns_reverse_lookup.rb

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def initialize(info = {})
1717
This module performs DNS reverse lookup against a given IP range in order to
1818
retrieve valid addresses and names.
1919
},
20-
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>', # Base code
21-
'Thanat0s <thanatos[at]trollprod[dot]org>'], # Output, Throttling & Db notes add
20+
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>', # Base code
21+
'Thanat0s <thanspam[at]trollprod[dot]org>'], # Output, Throttling & Db notes add
2222
'License' => BSD_LICENSE
2323
))
2424

@@ -58,11 +58,11 @@ def reverselkp(iprange)
5858
print_status("Running reverse lookup against IP range #{iprange}")
5959
ar = Rex::Socket::RangeWalker.new(iprange)
6060
tl = []
61-
# Basic Throttling
61+
# Basic Throttling
6262
sleep_time = 0.0
6363
if (datastore['THROTTLE'] != 0)
6464
sleep_time = (1.0/datastore['THROTTLE'])/datastore['THREADS']
65-
print_status("Throttle set to #{datastore['THROTTLE']} queries per seconds")
65+
print_status("Throttle set to #{datastore['THROTTLE']} queries per seconds")
6666
end
6767
# Output..
6868
if datastore['OUT_FILE']
@@ -79,10 +79,10 @@ def reverselkp(iprange)
7979
break if not ip
8080
tl << framework.threads.spawn("Module(#{self.refname})-#{ip}", false, ip.dup) do |tip|
8181
begin
82-
sleep(sleep_time)
82+
Rex.sleep(sleep_time)
8383
query = @res.query(tip)
8484
query.each_ptr do |addresstp|
85-
print_status("#Host Name: #{addresstp}, IP Address: #{tip.to_s}")
85+
print_status("Host Name: #{addresstp}, IP Address: #{tip.to_s}")
8686
if datastore['OUT_FILE']
8787
open(datastore['OUT_FILE'], 'a') do |f|
8888
f.puts "#{tip.to_s},#{addresstp}"
@@ -92,20 +92,17 @@ def reverselkp(iprange)
9292
:host => tip.to_s,
9393
:name => addresstp
9494
)
95-
if !hosts[tip]
95+
if !hosts[tip]
9696
hosts[tip] = Array.new
9797
end
9898
hosts[tip].push addresstp
9999
end
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
100+
unless hosts[tip].nil? or hosts[tip].empty?
101+
report_note(
102+
:host => tip.to_s,
103+
:type => "RDNS_Record",
104+
:data => hosts[tip]
105+
)
109106
end
110107
rescue ::Interrupt
111108
raise $!

0 commit comments

Comments
 (0)