Skip to content

Commit 19fa008

Browse files
committed
Land rapid7#12856, whitespace cleanup in cracker lib
2 parents 909b298 + 9a376c8 commit 19fa008

File tree

1 file changed

+30
-30
lines changed
  • lib/metasploit/framework/password_crackers

1 file changed

+30
-30
lines changed

lib/metasploit/framework/password_crackers/cracker.rb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -343,46 +343,46 @@ def cracker_version
343343
# @return [Array] An array set up for {::IO.popen} to use
344344
def john_crack_command
345345
cmd_string = binary_path
346-
cmd = [ cmd_string, '--session=' + cracker_session_id, '--nolog' ]
346+
cmd = [cmd_string, '--session=' + cracker_session_id, '--nolog']
347347

348348
if config.present?
349-
cmd << ( "--config=" + config )
349+
cmd << ("--config=" + config)
350350
else
351-
cmd << ( "--config=" + john_config_file )
351+
cmd << ("--config=" + john_config_file)
352352
end
353353

354354
if pot.present?
355-
cmd << ( "--pot=" + pot )
355+
cmd << ("--pot=" + pot)
356356
else
357-
cmd << ( "--pot=" + john_pot_file)
357+
cmd << ("--pot=" + john_pot_file)
358358
end
359359

360360
if fork.present? && fork > 1
361-
cmd << ( "--fork=" + fork.to_s )
361+
cmd << ("--fork=" + fork.to_s)
362362
end
363363

364364
if format.present?
365-
cmd << ( "--format=" + format )
365+
cmd << ("--format=" + format)
366366
end
367367

368368
if wordlist.present?
369-
cmd << ( "--wordlist=" + wordlist )
369+
cmd << ("--wordlist=" + wordlist)
370370
end
371371

372372
if incremental.present?
373-
cmd << ( "--incremental=" + incremental )
373+
cmd << ("--incremental=" + incremental)
374374
end
375375

376376
if rules.present?
377-
cmd << ( "--rules=" + rules )
377+
cmd << ("--rules=" + rules)
378378
end
379379

380380
if max_runtime.present?
381-
cmd << ( "--max-run-time=" + max_runtime.to_s)
381+
cmd << ("--max-run-time=" + max_runtime.to_s)
382382
end
383383

384384
if max_length.present?
385-
cmd << ( "--max-len=" + max_length.to_s)
385+
cmd << ("--max-len=" + max_length.to_s)
386386
end
387387

388388
cmd << hash_path
@@ -395,16 +395,16 @@ def john_crack_command
395395
# @return [Array] An array set up for {::IO.popen} to use
396396
def hashcat_crack_command
397397
cmd_string = binary_path
398-
cmd = [ cmd_string, '--session=' + cracker_session_id, '--logfile-disable' ]
398+
cmd = [cmd_string, '--session=' + cracker_session_id, '--logfile-disable']
399399

400400
if pot.present?
401-
cmd << ( "--potfile-path=" + pot )
401+
cmd << ("--potfile-path=" + pot)
402402
else
403-
cmd << ( "--potfile-path=" + john_pot_file)
403+
cmd << ("--potfile-path=" + john_pot_file)
404404
end
405405

406406
if format.present?
407-
cmd << ( "--hash-type=" + jtr_format_to_hashcat_format(format) )
407+
cmd << ("--hash-type=" + jtr_format_to_hashcat_format(format))
408408
end
409409

410410
if optimize.present?
@@ -433,33 +433,33 @@ def hashcat_crack_command
433433
# wouldn't be tested inside of MSF since most users are using the MSF modules for word list and easy cracks.
434434
# Anything of length where this would cut off is most likely being done independently (outside MSF)
435435

436-
cmd << ( "-O")
436+
cmd << ("-O")
437437
end
438438

439439
if incremental.present?
440-
cmd << ( "--increment")
440+
cmd << ("--increment")
441441
if increment_length.present?
442-
cmd << ( "--increment-min=" + increment_length[0].to_s)
443-
cmd << ( "--increment-max=" + increment_length[1].to_s)
442+
cmd << ("--increment-min=" + increment_length[0].to_s)
443+
cmd << ("--increment-max=" + increment_length[1].to_s)
444444
else
445445
# anything more than max 4 on even des took 8+min on an i7.
446446
# maybe in the future this can be adjusted or made a variable
447447
# but current time, we'll leave it as this seems like reasonable
448448
# time expectation for a module to run
449-
cmd << ( "--increment-max=4")
449+
cmd << ("--increment-max=4")
450450
end
451451
end
452452

453453
if rules.present?
454-
cmd << ( "--rules-file=" + rules )
454+
cmd << ("--rules-file=" + rules)
455455
end
456456

457457
if attack.present?
458-
cmd << ( "--attack-mode=" + attack )
458+
cmd << ("--attack-mode=" + attack)
459459
end
460460

461461
if max_runtime.present?
462-
cmd << ( "--runtime=" + max_runtime.to_s )
462+
cmd << ("--runtime=" + max_runtime.to_s)
463463
end
464464

465465
cmd << hash_path
@@ -470,7 +470,7 @@ def hashcat_crack_command
470470

471471
# must be last
472472
if wordlist.present?
473-
cmd << ( wordlist )
473+
cmd << (wordlist)
474474
end
475475
cmd
476476
end
@@ -486,14 +486,14 @@ def each_cracked_password
486486
#
487487
# @return [String] the path to the default john.conf file
488488
def john_config_file
489-
::File.join( ::Msf::Config.data_directory, "jtr", "john.conf" )
489+
::File.join(::Msf::Config.data_directory, "jtr", "john.conf")
490490
end
491491

492492
# This method returns the path to a default john.pot file.
493493
#
494494
# @return [String] the path to the default john.pot file
495495
def john_pot_file
496-
::File.join( ::Msf::Config.config_directory, "john.pot" )
496+
::File.join(::Msf::Config.config_directory, "john.pot")
497497
end
498498

499499
# This method is a getter for a random Session ID for the cracker.
@@ -513,14 +513,14 @@ def show_command
513513

514514
pot_file = pot || john_pot_file
515515
if cracker=='hashcat'
516-
cmd = [cmd_string, "--show", "--potfile-path=#{pot_file}", "--hash-type=#{jtr_format_to_hashcat_format(format)}" ]
516+
cmd = [cmd_string, "--show", "--potfile-path=#{pot_file}", "--hash-type=#{jtr_format_to_hashcat_format(format)}"]
517517
elsif cracker=='john'
518-
cmd = [cmd_string, "--show", "--pot=#{pot_file}", "--format=#{format}" ]
518+
cmd = [cmd_string, "--show", "--pot=#{pot_file}", "--format=#{format}"]
519519

520520
if config
521521
cmd << "--config=#{config}"
522522
else
523-
cmd << ( "--config=" + john_config_file )
523+
cmd << ("--config=" + john_config_file)
524524
end
525525
end
526526
cmd << hash_path

0 commit comments

Comments
 (0)