@@ -527,8 +527,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
527
527
end
528
528
529
529
print_status ( capturelogmessage )
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
530
+ lm_text = ( lm_hash + lm_cli_challenge . to_s ) . empty? ? "00" * 24 : lm_hash + lm_cli_challenge . to_s
531
+ nt_text = ( nt_hash + nt_cli_challenge . to_s ) . empty? ? "00" * 24 : nt_hash + nt_cli_challenge . to_s
532
532
pass = "#{ smb [ :domain ] } :#{ lm_text } :#{ nt_text } :#{ datastore [ 'CHALLENGE' ] . to_s } "
533
533
534
534
# DB reporting
@@ -575,8 +575,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
575
575
smb [ :username ] ,
576
576
smb [ :domain ] ? smb [ :domain ] : "NULL" ,
577
577
@challenge . unpack ( "H*" ) [ 0 ] ,
578
- lm_hash ? lm_hash : "0" * 48 ,
579
- nt_hash ? nt_hash : "0" * 48
578
+ lm_hash . empty? ? "0" * 48 : lm_hash ,
579
+ nt_hash . empty? ? "0" * 48 : nt_hash
580
580
] . join ( ":" ) . gsub ( /\n / , "\\ n" )
581
581
)
582
582
fd . close
@@ -592,8 +592,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
592
592
[
593
593
smb [ :username ] , "" ,
594
594
smb [ :domain ] ? smb [ :domain ] : "NULL" ,
595
- lm_hash . length > 0 ? lm_hash : "0" * 48 ,
596
- nt_hash . length > 0 ? nt_hash : "0" * 48 ,
595
+ lm_hash . empty? ? "0" * 48 : lm_hash ,
596
+ nt_hash . empty? ? "0" * 48 : nt_hash ,
597
597
@challenge . unpack ( "H*" ) [ 0 ]
598
598
] . join ( ":" ) . gsub ( /\n / , "\\ n" )
599
599
)
@@ -606,8 +606,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
606
606
smb [ :username ] , "" ,
607
607
smb [ :domain ] ? smb [ :domain ] : "NULL" ,
608
608
@challenge . unpack ( "H*" ) [ 0 ] ,
609
- lm_hash . length > 0 ? lm_hash : "0" * 32 ,
610
- lm_cli_challenge ? lm_cli_challenge : "0" * 16
609
+ lm_hash . empty? ? "0" * 32 : lm_hash ,
610
+ lm_cli_challenge . empty? ? "0" * 16 : lm_cli_challenge
611
611
] . join ( ":" ) . gsub ( /\n / , "\\ n" )
612
612
)
613
613
fd . close
@@ -618,8 +618,8 @@ def smb_get_hash(smb, arg = {}, esn=true)
618
618
smb [ :username ] , "" ,
619
619
smb [ :domain ] ? smb [ :domain ] : "NULL" ,
620
620
@challenge . unpack ( "H*" ) [ 0 ] ,
621
- nt_hash . length > 0 ? nt_hash : "0" * 32 ,
622
- nt_cli_challenge ? nt_cli_challenge : "0" * 160
621
+ nt_hash . empty? ? "0" * 32 : nt_hash ,
622
+ nt_cli_challenge ? "0" * 160 : nt_cli_challenge
623
623
] . join ( ":" ) . gsub ( /\n / , "\\ n" )
624
624
)
625
625
fd . close
0 commit comments