Skip to content

Commit 8429465

Browse files
author
HD Moore
committed
Update the require, error handling, casing
1 parent b008eb9 commit 8429465

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

modules/auxiliary/scanner/msf/msf_rpc_login.rb

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Metasploit3 < Msf::Auxiliary
1515

1616
def initialize
1717
super(
18-
'Name' => 'Metasploit RPC interface Login Utility',
18+
'Name' => 'Metasploit RPC Interface Login Utility',
1919
'Description' => %q{
2020
This module simply attempts to login to a
2121
Metasploit RPC interface using a specific
@@ -36,21 +36,29 @@ def initialize
3636

3737
end
3838

39+
@@loaded_msfrpc
40+
begin
41+
require 'msf/core/rpc/v10/client'
42+
@@loaded_msfrpc = true
43+
rescue LoadError
44+
end
45+
3946
def run_host(ip)
40-
begin
41-
require 'msf/core/rpc/v10/client'
42-
rescue LoadError
47+
48+
unless @@loaded_msfrpc
4349
print_error("You don't have 'msgpack', please install that gem manually.")
4450
return
4551
end
4652

4753
begin
4854
@rpc = Msf::RPC::Client.new(
49-
:host => datastore['rhost'],
50-
:port => datastore['rport'],
55+
:host => datastore['RHOST'],
56+
:port => datastore['RPORT'],
5157
:ssl => datastore['SSL']
5258
)
53-
rescue => e
59+
rescue ::Interrupt
60+
raise $!
61+
rescue ::Exception => e
5462
vprint_error("#{datastore['SSL'].to_s} Cannot create RPC client : #{e.to_s}")
5563
return
5664
end

0 commit comments

Comments
 (0)