Skip to content

Commit 158176a

Browse files
committed
replaced "if !" on line 41 with "unless"
replaced "$1" on line 51 with "Regexp.last_match(1) restructed the print statement on line 56 to more closely match suggestion removed "self." from line 71 changed line 78 to loop for 2 seconds insetead of 1 second
1 parent 75a34c4 commit 158176a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def initialize(info = {})
3838

3939
def parse_reply(pkt)
4040
# if empty packet, exit
41-
return if !pkt[1]
41+
return unless pkt[1]
4242

4343
# strip to just the IPv4 address
4444
if pkt[1] =~ /^::ffff:/
@@ -48,12 +48,12 @@ def parse_reply(pkt)
4848
# check for and extract the version string
4949
ver = nil
5050
if !ver && pkt[0] =~ /version>(.*)<\/version/i
51-
ver = $1
51+
ver = Regexp.last_match(1)
5252
end
5353

5454
# if a version was identified, then out and store to DB
5555
if ver
56-
print_status("Found Jenkins Server at: #{pkt[1]} version : #{ver}")
56+
print_status("#{pkt[1]} - Found Jenkins Server #{ver} Version")
5757
report_host(
5858
host: pkt[1],
5959
info: "Jenkins v.#{ver} (port typically 8080)"
@@ -68,14 +68,14 @@ def run
6868
self.udp_sock = Rex::Socket::Udp.create(
6969
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
7070
)
71-
add_socket(self.udp_sock)
71+
add_socket(udp_sock)
7272

7373
# send a dummy packet to broadcast on port 33848
7474
udp_sock.sendto('\n', '255.255.255.255', 33848, 0)
7575

76-
# loop a few times to account for slow responders
76+
# loop a few times to account for multiple or slow responders
7777
iter = 0
78-
while (r = udp_sock.recvfrom(65535, 0.1)) && (iter < 10)
78+
while (r = udp_sock.recvfrom(65535, 0.1)) && (iter < 20)
7979
parse_reply(r)
8080
iter += 1
8181
end

0 commit comments

Comments
 (0)