Skip to content

Commit 7d9c0da

Browse files
committed
Record correct creds with non-success status
1 parent afe36ab commit 7d9c0da

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/rex/proto/smb/exceptions.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ def initialize(*args)
736736
super(*args)
737737
end
738738

739+
def error_name
740+
get_error(error_code)
741+
end
742+
739743
# returns an error string if it exists, otherwise just the error code
740744
def get_error(error)
741745
string = ''
@@ -807,7 +811,7 @@ def to_s
807811
class ErrorCode < InvalidPacket
808812
def to_s
809813
'The server responded with error: ' +
810-
self.get_error(self.error_code) +
814+
self.error_name +
811815
" (Command=#{self.command} WordCount=#{self.word_count})"
812816
end
813817
end

modules/auxiliary/scanner/smb/smb_login.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ def run_host(ip)
100100

101101
@scanner.scan! do |result|
102102
case result.status
103+
when :correct
104+
print_brute :level => :good, :ip => ip, :msg => "Correct credentials, but unable to login: '#{result.credential}', #{result.proof.error_name}"
105+
report_creds(ip, rport, result)
106+
:next_user
103107
when :success
104108
print_brute :level => :good, :ip => ip, :msg => "Success: '#{result.credential}' #{result.access_level}"
105109
report_creds(ip, rport, result)
@@ -108,7 +112,7 @@ def run_host(ip)
108112
print_brute :level => :verror, :ip => ip, :msg => "Could not connect"
109113
:abort
110114
when :failed
111-
print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'"
115+
print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}', #{result.proof.error_name}"
112116
invalidate_login(
113117
address: ip,
114118
port: rport,

0 commit comments

Comments
 (0)