Browse Source

Land #12995, Add support for smbv2 to pipe auditor

dwelch-r7 1 month ago
parent
commit
40d068ca8c
No account linked to committer's email address

+ 1
- 1
lib/msf/core/exploit/smb/client/pipe_auditor.rb View File

@@ -57,7 +57,7 @@ module Exploit::Remote::SMB::Client::PipeAuditor
57 57
         return pipe_name, pipe_handle if return_first
58 58
 
59 59
         @found_pipes << [pipe_name, pipe_handle]
60
-      rescue Rex::Proto::SMB::Exceptions::ErrorCode => e
60
+      rescue Rex::Proto::SMB::Exceptions::ErrorCode, RubySMB::Error::RubySMBError => e
61 61
         vprint_error("Inaccessible named pipe: #{pipe_name} - #{e.message}")
62 62
       end
63 63
     end

+ 14
- 15
modules/auxiliary/scanner/smb/pipe_auditor.rb View File

@@ -22,7 +22,7 @@ class MetasploitModule < Msf::Auxiliary
22 22
       'License'     => MSF_LICENSE
23 23
     )
24 24
 
25
-    deregister_options('RPORT')
25
+    deregister_options('RPORT', 'SMBDirect')
26 26
   end
27 27
 
28 28
   # Fingerprint a single host
@@ -32,23 +32,22 @@ class MetasploitModule < Msf::Auxiliary
32 32
 
33 33
     [[139, false], [445, true]].each do |info|
34 34
 
35
-    datastore['RPORT'] = info[0]
36
-    datastore['SMBDirect'] = info[1]
35
+      datastore['RPORT'] = info[0]
36
+      datastore['SMBDirect'] = info[1]
37 37
 
38
-    begin
39
-      connect()
40
-      smb_login()
41
-      check_named_pipes.each do |pipe_name, _|
42
-        pipes.push(pipe_name)
43
-      end
38
+      begin
39
+        connect(versions: [1, 2])
40
+        smb_login()
41
+        check_named_pipes.each do |pipe_name, _|
42
+          pipes.push(pipe_name)
43
+        end
44 44
 
45
-      disconnect()
45
+        disconnect()
46 46
 
47
-      break
48
-    rescue ::Exception => e
49
-      #print_line($!.to_s)
50
-      #print_line($!.backtrace.join("\n"))
51
-    end
47
+        break
48
+      rescue Rex::Proto::SMB::Exceptions::SimpleClientError => e
49
+        vprint_error("SMB client Error with RPORT=#{info[0]} SMBDirect=#{info[1]}: #{e.to_s}")
50
+      end
52 51
     end
53 52
 
54 53
     if(pipes.length > 0)

Loading…
Cancel
Save