From a8400030f8c5c50d8fb409228a4f80c536b5737d Mon Sep 17 00:00:00 2001 From: Meatballs Date: Wed, 9 Jan 2013 10:26:57 +0000 Subject: [PATCH] Also correct outut of hash when length is 0 --- modules/auxiliary/server/capture/smb.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/auxiliary/server/capture/smb.rb b/modules/auxiliary/server/capture/smb.rb index 3377f97a2d3b..bbc4858d0c06 100644 --- a/modules/auxiliary/server/capture/smb.rb +++ b/modules/auxiliary/server/capture/smb.rb @@ -527,9 +527,8 @@ def smb_get_hash(smb, arg = {}, esn=true) end print_status(capturelogmessage) - - lm_text = lm_hash + lm_cli_challenge.to_s ? lm_hash + lm_cli_challenge.to_s : "00" * 24 - nt_text = nt_hash + nt_cli_challenge.to_s ? nt_hash + nt_cli_challenge.to_s : "00" * 24 + lm_text = (lm_hash + lm_cli_challenge.to_s).length > 0 ? lm_hash + lm_cli_challenge.to_s : "00" * 24 + nt_text = (nt_hash + nt_cli_challenge.to_s).length > 0 ? nt_hash + nt_cli_challenge.to_s : "00" * 24 pass = "#{smb[:domain]}:#{lm_text}:#{nt_text}:#{datastore['CHALLENGE'].to_s}" # DB reporting @@ -593,8 +592,8 @@ def smb_get_hash(smb, arg = {}, esn=true) [ smb[:username],"", smb[:domain] ? smb[:domain] : "NULL", - lm_hash ? lm_hash : "0" * 48, - nt_hash ? nt_hash : "0" * 48, + lm_hash.length > 0 ? lm_hash : "0" * 48, + nt_hash.length > 0 ? nt_hash : "0" * 48, @challenge.unpack("H*")[0] ].join(":").gsub(/\n/, "\\n") ) @@ -607,7 +606,7 @@ def smb_get_hash(smb, arg = {}, esn=true) smb[:username],"", smb[:domain] ? smb[:domain] : "NULL", @challenge.unpack("H*")[0], - lm_hash ? lm_hash : "0" * 32, + lm_hash.length > 0 ? lm_hash : "0" * 32, lm_cli_challenge ? lm_cli_challenge : "0" * 16 ].join(":").gsub(/\n/, "\\n") ) @@ -619,7 +618,7 @@ def smb_get_hash(smb, arg = {}, esn=true) smb[:username],"", smb[:domain] ? smb[:domain] : "NULL", @challenge.unpack("H*")[0], - nt_hash ? nt_hash : "0" * 32, + nt_hash.length > 0 ? nt_hash : "0" * 32, nt_cli_challenge ? nt_cli_challenge : "0" * 160 ].join(":").gsub(/\n/, "\\n") )