Skip to content

Commit bd0ac12

Browse files
committed
added more -restore mode tests
1 parent 546139a commit bd0ac12

6 files changed

+4042
-7230
lines changed

bitcoin_restart_rules_tst.dic

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
sjkdfafasdf
2-
fasdfbawer
3-
alej
4-
aotiaeotfg
5-
fads
6-
atoweutga
7-
baljsrdg
8-
toiauweotguaoeg
9-
lavjsdf
10-
lafjaweoigt
11-
bal;jdf
12-
aptwieuoweijga
13-
alfjadg
14-
altiuelznvb
15-
vzlht eifja
16-
aloiaytwe
17-
4890bjsi
18-
dflah
19-
atpuaoigj
20-
alfhakligaw4i
1+
111110
2+
111111
3+
111112
4+
111113
5+
111114
6+
111115
7+
111116
8+
111117
9+
111118
10+
111119
11+
111120
12+
111121
13+
111122
14+
111123
15+
111124
16+
111125
17+
111126
18+
111127
19+
111128
20+
111129

bitcoin_restart_rules_tst.in

+2,000-2,000
Large diffs are not rendered by default.

bitcoin_restart_single_tst.in

+2,003
Large diffs are not rendered by default.

jtrts.pl

+19-12
Original file line numberDiff line numberDiff line change
@@ -1365,18 +1365,18 @@ sub doInternalMode {
13651365
# types of restore test, so a common function was written to do any of them.
13661366
###############################################################################
13671367
sub doOneRestore {
1368-
my ($dic, $hashes, $cnt, $runtime, $form, $exargs) = @_;
1368+
my ($type, $dic, $hashes, $cnt, $runtime, $form, $exargs) = @_;
13691369

1370-
ScreenOutSemi("\nRunning 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("\nRunning 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");
13731373
my $results = `$cmd`;
13741374
my $ret = $?;
13751375
ScreenOutVV("Results of this run are: $results\n return code [".($ret>>8)."]\n\n");
13761376
if ($verbosity > 2) { show_eta($results); }
13771377
$cmd = "$JOHN_EXE -res=tst- 2>&1";
13781378
while ( ($ret>>8) == 1) {
1379-
ScreenOutV("Running continuing retore commands. Cmd line: $cmd\n");
1379+
ScreenOutV("Running continuing restore commands. Cmd line: $cmd\n");
13801380
$results = `$cmd`;
13811381
$ret = $?;
13821382
`stty echo >/dev/null 2>/dev/null`;
@@ -1387,7 +1387,6 @@ sub doOneRestore {
13871387
$results = `LC_ALL='C' sort tst-.pot | LC_ALL='C' uniq | LC_ALL='C' wc -l`;
13881388
chomp $results;
13891389
print ("Done with run. Results (should be $cnt) : $results ");
1390-
cleanup();
13911390

13921391
if ($results != $cnt) {
13931392
print "FAIL!\n";
@@ -1398,7 +1397,7 @@ sub doOneRestore {
13981397
exit 1;
13991398
}
14001399
print "PASS\n";
1401-
`rm -f tst-*`;
1400+
cleanup();
14021401
}
14031402
###############################################################################
14041403
# Restore mode. This will run john for 10s at a time, then restore the session
@@ -1412,19 +1411,27 @@ sub doRestoreMode {
14121411
ScreenOut("John CORE build detected.\n The -max-run-time mode ONLY works for jumbo build of john.\n");
14131412
exit 1;
14141413
}
1415-
`rm -f tst-*`;
1414+
cleanup();
14161415

14171416
# grow the pw-new.dic file:
14181417
my $cmd = "$JOHN_EXE -rules=appendNumNum --stdout --w=bitcoin_restart_rules_tst.dic > tst-pw-new.dic 2>/dev/null";
14191418
$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", "");
14211420
unlink("tst-pw-new.dic");
14221421

14231422
# 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");
14261424
# 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]");
14281435

14291436
exit 0;
14301437
}

0 commit comments

Comments
 (0)