Skip to content

Commit

Permalink
Also correct outut of hash when length is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Meatballs1 committed Jan 9, 2013
1 parent d36fcd5 commit a840003
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions modules/auxiliary/server/capture/smb.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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")
)
Expand All @@ -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")
)
Expand All @@ -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")
)
Expand Down

0 comments on commit a840003

Please sign in to comment.