Skip to content

Commit d36fcd5

Browse files
committed
Fix smb capture error
1 parent 1f55e02 commit d36fcd5

File tree

1 file changed

+7
-6
lines changed
  • modules/auxiliary/server/capture

1 file changed

+7
-6
lines changed

modules/auxiliary/server/capture/smb.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def smb_cmd_session_setup(c, buff, esn)
339339
begin
340340
smb_get_hash(smb,arg,true)
341341
rescue ::Exception => e
342-
print_status("SMB Capture - Error processing Hash from #{smb[:name]} - #{smb[:ip]} : #{e.class} #{e} #{e.backtrace}")
342+
print_error("SMB Capture - Error processing Hash from #{smb[:name]} - #{smb[:ip]} : #{e.class} #{e} #{e.backtrace}")
343343
end
344344

345345
smb_error(CONST::SMB_COM_SESSION_SETUP_ANDX, c, CONST::SMB_STATUS_LOGON_FAILURE, true)
@@ -401,7 +401,7 @@ def smb_cmd_session_setup(c, buff, esn)
401401
smb_get_hash(smb,arg,false)
402402

403403
rescue ::Exception => e
404-
print_status("SMB Capture - Error processing Hash from #{smb[:name]} : #{e.class} #{e} #{e.backtrace}")
404+
print_error("SMB Capture - Error processing Hash from #{smb[:name]} : #{e.class} #{e} #{e.backtrace}")
405405
end
406406

407407
smb_error(CONST::SMB_COM_SESSION_SETUP_ANDX, c, CONST::SMB_STATUS_LOGON_FAILURE, true)
@@ -528,16 +528,17 @@ def smb_get_hash(smb, arg = {}, esn=true)
528528

529529
print_status(capturelogmessage)
530530

531+
lm_text = lm_hash + lm_cli_challenge.to_s ? lm_hash + lm_cli_challenge.to_s : "00" * 24
532+
nt_text = nt_hash + nt_cli_challenge.to_s ? nt_hash + nt_cli_challenge.to_s : "00" * 24
533+
pass = "#{smb[:domain]}:#{lm_text}:#{nt_text}:#{datastore['CHALLENGE'].to_s}"
534+
531535
# DB reporting
532536
report_auth_info(
533537
:host => smb[:ip],
534538
:port => datastore['SRVPORT'],
535539
:sname => 'smb_challenge',
536540
:user => smb[:username],
537-
:pass => smb[:domain] + ":" +
538-
( lm_hash + lm_cli_challenge.to_s ? lm_hash + lm_cli_challenge.to_s : "00" * 24 ) + ":" +
539-
( nt_hash + nt_cli_challenge.to_s ? nt_hash + nt_cli_challenge.to_s : "00" * 24 ) + ":" +
540-
datastore['CHALLENGE'].to_s,
541+
:pass => pass,
541542
:type => smb_db_type_hash,
542543
:proof => "NAME=#{smb[:nbsrc]} DOMAIN=#{smb[:domain]} OS=#{smb[:peer_os]}",
543544
:source_type => "captured",

0 commit comments

Comments
 (0)