Skip to content

Commit c7794a7

Browse files
committed
Clean up Ruby style in sunrpc_portmapper
1 parent 059d84e commit c7794a7

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

modules/auxiliary/scanner/misc/sunrpc_portmapper.rb

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@
66
require 'msf/core'
77

88
class Metasploit3 < Msf::Auxiliary
9-
109
include Msf::Exploit::Remote::SunRPC
1110
include Msf::Auxiliary::Report
1211
include Msf::Auxiliary::Scanner
1312

1413
def initialize
1514
super(
16-
'Name' => 'SunRPC Portmap Program Enumerator',
17-
'Description' => %q{
18-
This module calls the target portmap service and enumerates all
19-
program entries and their running port numbers.
20-
},
21-
'Author' => ['<tebo[at]attackresearch.com>'],
22-
'References' =>
15+
'Name' => 'SunRPC Portmap Program Enumerator',
16+
'Description' => '
17+
This module calls the target portmap service and enumerates all program
18+
entries and their running port numbers.
19+
',
20+
'Author' => ['<tebo[at]attackresearch.com>'],
21+
'References' =>
2322
[
24-
['URL', 'http://www.ietf.org/rfc/rfc1057.txt'],
23+
['URL', 'http://www.ietf.org/rfc/rfc1057.txt']
2524
],
2625
'License' => MSF_LICENSE
2726
)
@@ -37,29 +36,28 @@ def run_host(ip)
3736
procedure = 4
3837

3938
sunrpc_create('udp', program, progver)
40-
sunrpc_authnull()
39+
sunrpc_authnull
4140
resp = sunrpc_call(procedure, "")
4241

43-
progs = resp[3,1].unpack('C')[0]
42+
progs = resp[3, 1].unpack('C')[0]
4443
maps = []
4544
if (progs == 0x01)
46-
while XDR.decode_int!(resp) == 1 do
47-
map = XDR.decode!(resp, Integer, Integer, Integer, Integer)
48-
maps << map
45+
while XDR.decode_int!(resp) == 1
46+
maps << XDR.decode!(resp, Integer, Integer, Integer, Integer)
4947
end
5048
end
5149
sunrpc_destroy
5250
return if maps.empty?
5351
print_good("#{peer} - Found #{maps.size} programs available")
5452

5553
table = Rex::Ui::Text::Table.new(
56-
'Header' => "SunRPC Programs for #{ip}.",
54+
'Header' => "SunRPC Programs for #{ip}",
5755
'Indent' => 1,
5856
'Columns' => %w(Name Number Version Port Protocol)
5957
)
6058

6159
maps.each do |map|
62-
prog, vers, prot_num, port = map[0,4]
60+
prog, vers, prot_num, port = map[0, 4]
6361
thing = "RPC Program ##{prog} v#{vers} on port #{port} w/ protocol #{prot_num}"
6462
if prot_num == 0x06
6563
proto = 'tcp'
@@ -73,17 +71,16 @@ def run_host(ip)
7371
resolved = progresolv(prog)
7472
table << [ resolved, prog, vers, port, proto ]
7573
report_service(
76-
:host => ip,
77-
:port => port,
78-
:proto => proto,
79-
:name => resolved,
80-
:info => "Prog: #{prog} Version: #{vers} - via portmapper"
74+
host: ip,
75+
port: port,
76+
proto: proto,
77+
name: resolved,
78+
info: "Prog: #{prog} Version: #{vers} - via portmapper"
8179
)
8280
end
8381

8482
print_good(table.to_s)
8583
rescue ::Rex::Proto::SunRPC::RPCTimeout
8684
end
8785
end
88-
8986
end

0 commit comments

Comments
 (0)