Skip to content

Commit 207d92a

Browse files
committed
Use scan to do regex capture
1 parent 1b4a6a7 commit 207d92a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

modules/auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,14 @@ def parse_reply(pkt)
4747
end
4848

4949
# check for and extract the version string
50-
ver = nil
51-
if !ver && pkt[0] =~ /version>(.*)<\/version/i
52-
ver = Regexp.last_match(1)
53-
end
50+
ver = pkt[0].scan(/version>(.*)<\/version/i).flatten.first
5451

5552
# if a version was identified, then out and store to DB
5653
if ver
5754
print_status("#{pkt[1]} - Found Jenkins Server #{ver} Version")
5855
report_host(
59-
host: pkt[1],
60-
info: "Jenkins v.#{ver} (port typically 8080)"
56+
host: pkt[1],
57+
info: "Jenkins v.#{ver} (port typically 8080)"
6158
)
6259
end
6360
end

0 commit comments

Comments
 (0)