@@ -1365,18 +1365,18 @@ sub doInternalMode {
1365
1365
# types of restore test, so a common function was written to do any of them.
1366
1366
# ##############################################################################
1367
1367
sub doOneRestore {
1368
- my ($dic , $hashes , $cnt , $runtime , $form , $exargs ) = @_ ;
1368
+ my ($type , $ dic , $hashes , $cnt , $runtime , $form , $exargs ) = @_ ;
1369
1369
1370
- ScreenOutSemi(" \n Running JTRTS in -restore mode (against a $cnt candidate $form input file $exargs )\n ** NOTE: may take a couple minutes to run\n " );
1371
- my $cmd = " $JOHN_EXE -ses=tst- $pass_thru $exargs -w= $dic $hashes -pot=tst-.pot -max-run=$runtime -form=$form 2>&1" ;
1372
- ScreenOutV(" Running 1st retore command, command line\n\n $cmd \n\n " );
1370
+ ScreenOutSemi(" \n Running JTRTS in -restore mode (against a $cnt candidate $form input file \' $type Mode \' )\n ** NOTE: may take a couple minutes to run\n " );
1371
+ my $cmd = " $JOHN_EXE -ses=tst- $pass_thru $exargs $dic $hashes -pot=tst-.pot -max-run=$runtime -form=$form 2>&1" ;
1372
+ ScreenOutV(" Running 1st restore command, command line\n\n $cmd \n\n " );
1373
1373
my $results = ` $cmd ` ;
1374
1374
my $ret = $? ;
1375
1375
ScreenOutVV(" Results of this run are: $results \n return code [" .($ret >>8)." ]\n\n " );
1376
1376
if ($verbosity > 2) { show_eta($results ); }
1377
1377
$cmd = " $JOHN_EXE -res=tst- 2>&1" ;
1378
1378
while ( ($ret >>8) == 1) {
1379
- ScreenOutV(" Running continuing retore commands. Cmd line: $cmd \n " );
1379
+ ScreenOutV(" Running continuing restore commands. Cmd line: $cmd \n " );
1380
1380
$results = ` $cmd ` ;
1381
1381
$ret = $? ;
1382
1382
` stty echo >/dev/null 2>/dev/null` ;
@@ -1387,7 +1387,6 @@ sub doOneRestore {
1387
1387
$results = ` LC_ALL='C' sort tst-.pot | LC_ALL='C' uniq | LC_ALL='C' wc -l` ;
1388
1388
chomp $results ;
1389
1389
print (" Done with run. Results (should be $cnt ) : $results " );
1390
- cleanup();
1391
1390
1392
1391
if ($results != $cnt ) {
1393
1392
print " FAIL!\n " ;
@@ -1398,7 +1397,7 @@ sub doOneRestore {
1398
1397
exit 1;
1399
1398
}
1400
1399
print " PASS\n " ;
1401
- ` rm -f tst-* ` ;
1400
+ cleanup() ;
1402
1401
}
1403
1402
# ##############################################################################
1404
1403
# Restore mode. This will run john for 10s at a time, then restore the session
@@ -1412,19 +1411,27 @@ sub doRestoreMode {
1412
1411
ScreenOut(" John CORE build detected.\n The -max-run-time mode ONLY works for jumbo build of john.\n " );
1413
1412
exit 1;
1414
1413
}
1415
- ` rm -f tst-* ` ;
1414
+ cleanup() ;
1416
1415
1417
1416
# grow the pw-new.dic file:
1418
1417
my $cmd = " $JOHN_EXE -rules=appendNumNum --stdout --w=bitcoin_restart_rules_tst.dic > tst-pw-new.dic 2>/dev/null" ;
1419
1418
$cmd = ` $cmd ` ;
1420
- doOneRestore(" tst-pw-new.dic" , " bitcoin_restart_rules_tst.in" , 2000, 10 , " bitcoin" , " " );
1419
+ doOneRestore(" Wordlist " , " -w= tst-pw-new.dic" , " bitcoin_restart_rules_tst.in" , 2000, 20 , " bitcoin" , " " );
1421
1420
unlink (" tst-pw-new.dic" );
1422
1421
1423
1422
# now test wordlist + rules.
1424
- doOneRestore(" bitcoin_restart_rules_tst.dic" , " bitcoin_restart_rules_tst.in" , 2000, 10, " bitcoin" , " -rules=appendNumNum" );
1425
-
1423
+ doOneRestore(" Wordlist+Rules" , " -w=bitcoin_restart_rules_tst.dic" , " bitcoin_restart_rules_tst.in" , 2000, 20, " bitcoin" , " -rules=appendNumNum" );
1426
1424
# now test wordlist + mask.
1427
- doOneRestore(" bitcoin_restart_rules_tst.dic" , " bitcoin_restart_rules_tst.in" , 2000, 10, " bitcoin" , " -mask=?w?d?d" );
1425
+ doOneRestore(" Wordlist+Mask" , " -w=bitcoin_restart_rules_tst.dic" , " bitcoin_restart_rules_tst.in" , 2000, 20, " bitcoin" , " -mask=?w?d?d" );
1426
+ # now test single mode.
1427
+ doOneRestore(" Single" , " " , " bitcoin_restart_single_tst.in" , 2000, 20, " bitcoin" , " " );
1428
+ # now test pure mode.
1429
+ doOneRestore(" Pure Mask" , " " , " bitcoin_restart_rules_tst.in" , 1000, 20, " bitcoin" , " -mask=11111?d?d?d" );
1430
+ doOneRestore(" Pure Mask" , " " , " bitcoin_restart_rules_tst.in" , 1000, 20, " bitcoin" , " -mask=11112?d?d?d" );
1431
+ # now test pure rexgen mode.
1432
+ doOneRestore(" Pure RexGen" , " " , " bitcoin_restart_rules_tst.in" , 2000, 20, " bitcoin" , " -rexgen=1111[1-2][0-9][0-9][0-9]" );
1433
+ # now test wordlist + rexgen mode.
1434
+ doOneRestore(" Wordlist+RexGen" , " -w=bitcoin_restart_rules_tst.dic" , " bitcoin_restart_rules_tst.in" , 2000, 20, " bitcoin" , " -rexgen=/0[0-9][0-9]" );
1428
1435
1429
1436
exit 0;
1430
1437
}
0 commit comments