Skip to content

Commit a840003

Browse files
committed
Also correct outut of hash when length is 0
1 parent d36fcd5 commit a840003

File tree

1 file changed

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

1 file changed

+6
-7
lines changed

modules/auxiliary/server/capture/smb.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
527527
end
528528

529529
print_status(capturelogmessage)
530-
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
530+
lm_text = (lm_hash + lm_cli_challenge.to_s).length > 0 ? lm_hash + lm_cli_challenge.to_s : "00" * 24
531+
nt_text = (nt_hash + nt_cli_challenge.to_s).length > 0 ? nt_hash + nt_cli_challenge.to_s : "00" * 24
533532
pass = "#{smb[:domain]}:#{lm_text}:#{nt_text}:#{datastore['CHALLENGE'].to_s}"
534533

535534
# DB reporting
@@ -593,8 +592,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
593592
[
594593
smb[:username],"",
595594
smb[:domain] ? smb[:domain] : "NULL",
596-
lm_hash ? lm_hash : "0" * 48,
597-
nt_hash ? nt_hash : "0" * 48,
595+
lm_hash.length > 0 ? lm_hash : "0" * 48,
596+
nt_hash.length > 0 ? nt_hash : "0" * 48,
598597
@challenge.unpack("H*")[0]
599598
].join(":").gsub(/\n/, "\\n")
600599
)
@@ -607,7 +606,7 @@ def smb_get_hash(smb, arg = {}, esn=true)
607606
smb[:username],"",
608607
smb[:domain] ? smb[:domain] : "NULL",
609608
@challenge.unpack("H*")[0],
610-
lm_hash ? lm_hash : "0" * 32,
609+
lm_hash.length > 0 ? lm_hash : "0" * 32,
611610
lm_cli_challenge ? lm_cli_challenge : "0" * 16
612611
].join(":").gsub(/\n/, "\\n")
613612
)
@@ -619,7 +618,7 @@ def smb_get_hash(smb, arg = {}, esn=true)
619618
smb[:username],"",
620619
smb[:domain] ? smb[:domain] : "NULL",
621620
@challenge.unpack("H*")[0],
622-
nt_hash ? nt_hash : "0" * 32,
621+
nt_hash.length > 0 ? nt_hash : "0" * 32,
623622
nt_cli_challenge ? nt_cli_challenge : "0" * 160
624623
].join(":").gsub(/\n/, "\\n")
625624
)

0 commit comments

Comments
 (0)