Skip to content

Commit 110e78a

Browse files
committed
Land rapid7#2507, @todb-r7's fix to allow DCERPC misin to use RPORT
2 parents 647c867 + ac1fb2d commit 110e78a

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

lib/msf/core/exploit/dcerpc_epm.rb

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,20 @@ def dcerpc_endpoint_list
4343
print_status("Connecting to the endpoint mapper service...")
4444
begin
4545
eps = nil
46-
dport = nil
46+
dport = datastore['RPORT'] || 135
4747

48-
[135, 593].each do |i|
49-
dport = i
50-
begin
51-
eps = Rex::Socket::Tcp.create(
48+
begin
49+
eps = Rex::Socket::Tcp.create(
5250
'PeerHost' => rhost,
5351
'PeerPort' => dport,
5452
'Proxies' => proxies,
5553
'Context' =>
56-
{
57-
'Msf' => framework,
58-
'MsfExploit' => self,
59-
}
60-
)
61-
62-
break
63-
64-
rescue ::Exception
65-
end
54+
{
55+
'Msf' => framework,
56+
'MsfExploit' => self,
57+
}
58+
)
59+
rescue ::Exception
6660
end
6761

6862
if (not eps)

0 commit comments

Comments
 (0)