File tree Expand file tree Collapse file tree 2 files changed +44
-4
lines changed
modules/auxiliary/admin/dcerpc Expand file tree Collapse file tree 2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class MetasploitModule < Msf::Auxiliary
10
10
include Msf ::Exploit ::Remote ::SMB ::Client ::Authenticated
11
11
include Msf ::Exploit ::Remote ::DCERPC
12
12
include Msf ::Auxiliary ::Report
13
+ include Msf ::OptionalSession ::SMB
13
14
14
15
def initialize ( info = { } )
15
16
super (
@@ -61,7 +62,24 @@ def run
61
62
end
62
63
63
64
def action_request_cert
64
- request_certificate
65
+ with_ipc_tree do |opts |
66
+ request_certificate ( opts )
67
+ end
65
68
end
66
69
70
+ # @yieldparam options [Hash] If a SMB session is present, a hash with the IPC tree present. Empty hash otherwise.
71
+ # @return [void]
72
+ def with_ipc_tree
73
+ opts = { }
74
+ if session
75
+ print_status ( "Using existing session #{ session . sid } " )
76
+ client = session . client
77
+ self . simple = ::Rex ::Proto ::SMB ::SimpleClient . new ( client . dispatcher . tcp_socket , client : client )
78
+ opts [ :tree ] = simple . client . tree_connect ( "\\ \\ #{ client . dispatcher . tcp_socket . peerhost } \\ IPC$" )
79
+ end
80
+
81
+ yield opts
82
+ ensure
83
+ opts [ :tree ] . disconnect! if opts [ :tree ]
84
+ end
67
85
end
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class MetasploitModule < Msf::Auxiliary
10
10
include Msf ::Exploit ::Remote ::DCERPC
11
11
include Msf ::Auxiliary ::Report
12
12
include Msf ::Exploit ::Remote ::MsSamr
13
+ include Msf ::OptionalSession ::SMB
13
14
14
15
def initialize ( info = { } )
15
16
super (
@@ -67,17 +68,38 @@ def run
67
68
end
68
69
69
70
def action_add_computer
70
- add_computer
71
+ with_ipc_tree do |opts |
72
+ add_computer ( opts )
73
+ end
71
74
end
72
75
73
76
def action_delete_computer
74
77
fail_with ( Failure ::BadConfig , 'This action requires COMPUTER_NAME to be specified.' ) if datastore [ 'COMPUTER_NAME' ] . blank?
75
- delete_computer
78
+ with_ipc_tree do |opts |
79
+ delete_computer ( opts )
80
+ end
76
81
end
77
82
78
83
def action_lookup_computer
79
84
fail_with ( Failure ::BadConfig , 'This action requires COMPUTER_NAME to be specified.' ) if datastore [ 'COMPUTER_NAME' ] . blank?
80
- lookup_computer
85
+ with_ipc_tree do |opts |
86
+ lookup_computer ( opts )
87
+ end
81
88
end
82
89
90
+ # @yieldparam options [Hash] If a SMB session is present, a hash with the IPC tree present. Empty hash otherwise.
91
+ # @return [void]
92
+ def with_ipc_tree
93
+ opts = { }
94
+ if session
95
+ print_status ( "Using existing session #{ session . sid } " )
96
+ client = session . client
97
+ self . simple = ::Rex ::Proto ::SMB ::SimpleClient . new ( client . dispatcher . tcp_socket , client : client )
98
+ opts [ :tree ] = simple . client . tree_connect ( "\\ \\ #{ client . dispatcher . tcp_socket . peerhost } \\ IPC$" )
99
+ end
100
+
101
+ yield opts
102
+ ensure
103
+ opts [ :tree ] . disconnect! if opts [ :tree ]
104
+ end
83
105
end
You can’t perform that action at this time.
0 commit comments