Skip to content

Commit

Permalink
Land #12995, Add support for smbv2 to pipe auditor
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 committed Feb 26, 2020
2 parents ff8bb2e + 664e235 commit 40d068c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/msf/core/exploit/smb/client/pipe_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_named_pipes(check_first: [], return_first: false)
return pipe_name, pipe_handle if return_first

@found_pipes << [pipe_name, pipe_handle]
rescue Rex::Proto::SMB::Exceptions::ErrorCode => e
rescue Rex::Proto::SMB::Exceptions::ErrorCode, RubySMB::Error::RubySMBError => e
vprint_error("Inaccessible named pipe: #{pipe_name} - #{e.message}")
end
end
Expand Down
29 changes: 14 additions & 15 deletions modules/auxiliary/scanner/smb/pipe_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize
'License' => MSF_LICENSE
)

deregister_options('RPORT')
deregister_options('RPORT', 'SMBDirect')
end

# Fingerprint a single host
Expand All @@ -32,23 +32,22 @@ def run_host(ip)

[[139, false], [445, true]].each do |info|

datastore['RPORT'] = info[0]
datastore['SMBDirect'] = info[1]
datastore['RPORT'] = info[0]
datastore['SMBDirect'] = info[1]

begin
connect()
smb_login()
check_named_pipes.each do |pipe_name, _|
pipes.push(pipe_name)
end
begin
connect(versions: [1, 2])
smb_login()
check_named_pipes.each do |pipe_name, _|
pipes.push(pipe_name)
end

disconnect()
disconnect()

break
rescue ::Exception => e
#print_line($!.to_s)
#print_line($!.backtrace.join("\n"))
end
break
rescue Rex::Proto::SMB::Exceptions::SimpleClientError => e
vprint_error("SMB client Error with RPORT=#{info[0]} SMBDirect=#{info[1]}: #{e.to_s}")
end
end

if(pipes.length > 0)
Expand Down

0 comments on commit 40d068c

Please sign in to comment.