4 ## Authors.....: Gabriele Gristina <matrix@hashcat.net>
5 ## Jens Steube <jens.steube@gmail.com>
6 ## magnum <john.magnum@hushmail.com>
11 # missing hash types: 5200,6211,6221,6231,6241,6251,6261,6271,6281
13 HASH_TYPES
="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 900 1000 1100 1400 1410 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 4300 4400 4500 4700 4800 4900 5000 5100 5300 5400 5500 5600 5700 5800 6000 6100 6300 6400 6500 6600 6700 6800 6900 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11900 12000 12100 12200 12300 12400 12600 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800"
15 #ATTACK_MODES="0 1 3 6 7"
16 ATTACK_MODES
="0 1 3 7"
18 VECTOR_WIDTHS
="1 2 4 8 16"
20 MATCH_PASS_ONLY
="2500 5300 5400 6600 6800 8200"
26 SLOW_ALGOS
="400 500 501 1600 1800 2100 2500 3200 5200 5800 6211 6221 6231 6241 6251 6261 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900 12000 12100 12200 12300 12400 12500 12800 12900 13000 13200 13400 13600"
28 OPTS
="--quiet --force --potfile-disable --runtime 200 --gpu-temp-disable --weak-hash-threshold=0"
30 OUTD
="test_$(date +%s)"
40 mask_3
[5]="?d?d?d?d?d"
41 mask_3
[6]="?d?d?d?d?d?d"
42 mask_3
[7]="?d?d?d?d?d?d?d"
43 mask_3
[8]="?d?d?d?d?d?d?d?d"
44 mask_3
[9]="?d?d?d?d?d?d?d?d?d"
45 mask_3
[10]="?d?d?d?d?d?d?d?d?d?d"
46 mask_3
[11]="?d?d?d?d?d?d?d?d?d?d?d"
47 mask_3
[12]="?d?d?d?d?d?d?d?d?d?d?d?d"
48 mask_3
[13]="?d?d?d?d?d?d?d?d?d?d?d?d?d"
49 mask_3
[14]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d"
50 mask_3
[15]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d"
51 mask_3
[16]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0"
52 mask_3
[17]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00"
53 mask_3
[18]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000"
54 mask_3
[19]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000"
55 mask_3
[20]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000"
56 mask_3
[21]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000"
57 mask_3
[22]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000"
58 mask_3
[23]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000"
59 mask_3
[24]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000"
60 mask_3
[25]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000"
61 mask_3
[26]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000000"
62 mask_3
[27]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000000"
63 mask_3
[28]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000000"
64 mask_3
[29]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000000000"
65 mask_3
[30]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000000000"
66 mask_3
[31]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000000000"
77 mask_6
[9]="?d?d?d?d?d"
78 mask_6
[10]="?d?d?d?d?d"
79 mask_6
[11]="?d?d?d?d?d?d"
80 mask_6
[12]="?d?d?d?d?d?d"
81 mask_6
[13]="?d?d?d?d?d?d?d"
82 mask_6
[14]="?d?d?d?d?d?d?d"
83 mask_6
[15]="?d?d?d?d?d?d?d?d"
84 mask_6
[16]="?d?d?d?d?d?d?d?d"
85 mask_6
[17]="?d?d?d?d?d?d?d?d0"
86 mask_6
[18]="?d?d?d?d?d?d?d?d0"
87 mask_6
[19]="?d?d?d?d?d?d?d?d00"
88 mask_6
[20]="?d?d?d?d?d?d?d?d00"
89 mask_6
[21]="?d?d?d?d?d?d?d?d000"
90 mask_6
[22]="?d?d?d?d?d?d?d?d000"
91 mask_6
[23]="?d?d?d?d?d?d?d?d0000"
92 mask_6
[24]="?d?d?d?d?d?d?d?d0000"
93 mask_6
[25]="?d?d?d?d?d?d?d?d00000"
94 mask_6
[26]="?d?d?d?d?d?d?d?d00000"
95 mask_6
[27]="?d?d?d?d?d?d?d?d000000"
96 mask_6
[28]="?d?d?d?d?d?d?d?d000000"
97 mask_6
[29]="?d?d?d?d?d?d?d?d0000000"
98 mask_6
[30]="?d?d?d?d?d?d?d?d0000000"
99 mask_6
[31]="?d?d?d?d?d?d?d?d00000000"
111 mask_7
[10]="?d?d?d?d?d"
112 mask_7
[11]="?d?d?d?d?d"
113 mask_7
[12]="?d?d?d?d?d?d"
114 mask_7
[13]="?d?d?d?d?d?d"
115 mask_7
[14]="?d?d?d?d?d?d?d"
116 mask_7
[15]="?d?d?d?d?d?d?d"
117 mask_7
[16]="?d?d?d?d?d?d?d?d"
118 mask_7
[17]="?d?d?d?d?d?d?d?d"
119 mask_7
[18]="?d?d?d?d?d?d?d?d0"
120 mask_7
[19]="?d?d?d?d?d?d?d?d0"
121 mask_7
[20]="?d?d?d?d?d?d?d?d00"
122 mask_7
[21]="?d?d?d?d?d?d?d?d00"
123 mask_7
[22]="?d?d?d?d?d?d?d?d000"
124 mask_7
[23]="?d?d?d?d?d?d?d?d000"
125 mask_7
[24]="?d?d?d?d?d?d?d?d0000"
126 mask_7
[25]="?d?d?d?d?d?d?d?d0000"
127 mask_7
[26]="?d?d?d?d?d?d?d?d00000"
128 mask_7
[27]="?d?d?d?d?d?d?d?d00000"
129 mask_7
[28]="?d?d?d?d?d?d?d?d000000"
130 mask_7
[29]="?d?d?d?d?d?d?d?d000000"
131 mask_7
[30]="?d?d?d?d?d?d?d?d0000000"
132 mask_7
[31]="?d?d?d?d?d?d?d?d0000000"
136 for element
in "${@:2}"; do
138 if [ "${element}" == "${1}" ]; then
149 if [ "${PACKAGE}" -eq 1 ]; then
151 echo "[ ${OUTD} ] > Generate tests for hash type $hash_type."
155 echo "[ ${OUTD} ] > Init test for hash type $hash_type."
159 rm -rf ${OUTD}/${hash_type}.sh ${OUTD}/${hash_type}_passwords.txt ${OUTD}/${hash_type}_hashes.txt
161 # create list of password and hashes of same type
162 grep " ${hash_type} '" ${OUTD}/all.sh > ${OUTD}/${hash_type}.sh
164 # create separate list of password and hashes
165 cat ${OUTD}/${hash_type}.sh | awk '{print $3}' > ${OUTD}/${hash_type}_passwords.txt
166 cat ${OUTD}/${hash_type}.sh | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
168 if [ "${hash_type}" -eq 10300 ]; then
169 cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
173 rm -rf ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
174 touch ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
176 # foreach password entry split password in 2 (skip first entry, is len 1)
179 # minimum password length
183 if [ "${hash_type}" -eq 2500 ]; then
185 min_len=7 # means length 8, since we start with 0
189 while read -u 9 pass; do
191 if [ ${i} -gt 1 ]; then
193 # split password, 'i' is the len
197 # special case (passwords longer than expected)
200 if [ "${pass_len}" -gt 1 ]
203 p1=$((p1 + ${min_len}))
204 p0=$((p0 + ${min_len}))
206 if [ "${p1}" -gt ${pass_len} ]; then
213 # add splitted password to dicts
215 echo ${pass} | cut -c -${p0} >> ${OUTD}/${hash_type}_dict1
216 echo ${pass} | cut -c ${p1}- >> ${OUTD}/${hash_type}_dict2
223 done 9< ${OUTD}/${hash_type}_passwords.txt
227 if [ "${hash_type}" -eq 2500 ]; then
229 min_len=7 # means length 8, since we start with 0
233 # generate multiple pass/hash foreach len (2 to 8)
234 if [ ${MODE} -ge 1 ]; then
236 for ((i = 2; i < 9; i++)); do
238 rm -rf ${OUTD}/${hash_type}_multi_${i}.txt ${OUTD}/${hash_type}_passwords_multi_${i}.txt ${OUTD}/${hash_type}_hashes_multi_${i}.txt
239 rm -rf ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i}
240 touch ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i}
242 perl tools/test.pl single ${hash_type} ${i} > ${OUTD}/${hash_type}_multi_${i}.txt
244 cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $3}' > ${OUTD}/${hash_type}_passwords_multi_${i}.txt
245 cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
247 if [ "${hash_type}" -eq 10300 ]; then
248 cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
251 # split password, 'i' is the len
255 p0=$((p0 + ${min_len}))
256 p1=$((p1 + ${min_len}))
258 while read -u 9 pass; do
260 # add splitted password to dicts
261 echo ${pass} | cut -c -${p0} >> ${OUTD}/${hash_type}_dict1_multi_${i}
262 echo ${pass} | cut -c ${p1}- >> ${OUTD}/${hash_type}_dict2_multi_${i}
264 done 9< ${OUTD}/${hash_type}_passwords_multi_${i}.txt
277 if [ ${RET} -ne 0 ]; then
280 if contains ${hash_type} ${NEVER_CRACK_ALGOS}; then
282 echo "password not found
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
289 echo "timeout reached
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
294 if [ "${pass_only}" -eq 1 ]; then
295 echo "plains not found
in output
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
297 echo "hash:plains not matched
in output
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
303 echo "! unhandled
return code
${RET}, cmdline : ${CMD}" &>> ${OUTD}/logfull.txt
304 echo "! unhandled return code, see ${OUTD}/logfull.txt for details."
315 if ! contains
${hash_type} ${FILE_BASED_ALGOS}; then
322 if [ ${MODE} -ne 1 ]; then
329 echo "> Testing hash type $hash_type with attack mode 0, markov ${MARKOV}, single hash, device-type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
333 if ! contains ${hash_type} ${TIMEOUT_ALGOS}; then
341 while read -u 9 line; do
343 if [ "${i}" -ge ${max} ]; then
349 hash="$
(echo "$line" | cut
-d\' -f2)"
350 pass="$
(echo "$line" | cut
-d' ' -f3)"
352 if [ -z "${hash}" ]; then
358 if [ "${file_only}" -eq 1 ]; then
360 temp_file="${OUTD}/${hash_type}_filebased_only_temp.txt
"
361 echo ${hash} | base64 -d > ${temp_file}
366 CMD="echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} '${hash}'"
368 echo -n "[ len $((i + 1)) ] " &>> ${OUTD}/logfull.txt
370 output
=$
(echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} "${hash}" 2>&1)
374 echo "${output}" >> ${OUTD}/logfull.txt
376 if [ "${ret}" -eq 0 ]; then
378 if [ ${pass_only} -eq 1 ]; then
381 search
="${hash}:${pass}"
384 echo "${output}" |
grep -F "${search}" &> /dev
/null
386 if [ "${?}" -ne 0 ]; then
398 done 9< ${OUTD}/${hash_type}.sh
402 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
406 elif [ "${e_to}" -ne 0 ]; then
412 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 0, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout"
417 if [ ${MODE} -ne 0 ]; then
424 echo "> Testing hash type $hash_type with attack mode 0, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
426 hash_file=${OUTD}/${hash_type}_hashes.txt
428 # if file_only -> decode all base64 "hashes
" and put them in the temporary file
430 if [ "${file_only}" -eq 1 ]; then
432 temp_file="${OUTD}/${hash_type}_filebased_only_temp.txt
"
435 hash_file=${temp_file}
437 while read base64_hash; do
439 echo -n ${base64_hash} | base64 -d >> ${temp_file}
441 done < ${OUTD}/${hash_type}_hashes.txt
445 CMD="cat ${OUTD}/${hash_type}_passwords.txt | ./${BIN} ${OPTS} -a 0 -m ${hash_type} ${hash_file}"
447 output=$(cat ${OUTD}/${hash_type}_passwords.txt | ./${BIN} ${OPTS} -a 0 -m ${hash_type} ${hash_file} 2>&1)
451 echo "${output}" >> ${OUTD}/logfull.txt
453 if [ "${ret}" -eq 0 ]; then
457 while read -u 9 hash; do
459 pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt)
461 if [ ${pass_only} -eq 1 ]; then
464 search="${hash}:${pass}"
467 echo "${output}" | grep -F "${search}" &> /dev/null
469 if [ "${?}" -ne 0 ]; then
479 done 9< ${OUTD}/${hash_type}_hashes.txt
487 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
491 elif [ "${e_to}" -ne 0 ]; then
497 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 0, Mode multi, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout
"
506 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
513 if [ ${MODE} -ne 1 ]; then
520 echo "> Testing
hash type $hash_type with attack mode
1, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
522 while read -u 9 hash; do
524 if [ $i -gt 1 ]; then
526 if [ "${file_only}" -eq 1 ]; then
528 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
529 echo ${hash} | base64
-d > ${temp_file}
534 CMD
="./${BIN} ${OPTS} -a 1 -m ${hash_type} '${hash}' ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2"
536 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
538 output
=$
(.
/${BIN} ${OPTS} -a 1 -m ${hash_type} "${hash}" ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
2>&1)
542 echo "${output}" >> ${OUTD}/logfull.txt
544 if [ "${ret}" -eq 0 ]; then
548 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
549 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
551 if [ ${pass_only} -eq 1 ]; then
552 search
=":${line_dict1}${line_dict2}"
554 search
="${hash}:${line_dict1}${line_dict2}"
557 echo "${output}" |
grep -F "${search}" &> /dev
/null
559 if [ "${?}" -ne 0 ]; then
573 done 9< ${OUTD}/${hash_type}_hashes.txt
577 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
581 elif [ "${e_to}" -ne 0 ]; then
587 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 1, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout"
592 if [ ${MODE} -ne 0 ]; then
601 if [ ${hash_type} -eq 2500 ]; then
603 elif [ ${hash_type} -eq 5800 ]; then
605 elif [ ${hash_type} -eq 3000 ]; then
607 elif [ ${hash_type} -eq 2100 ]; then
609 elif [ ${hash_type} -eq 1500 ]; then
611 elif [ ${hash_type} -eq 7700 ]; then
613 elif [ ${hash_type} -eq 8500 ]; then
617 hash_file
=${OUTD}/${hash_type}_multihash_combi.txt
619 tail -n ${offset} ${OUTD}/${hash_type}_hashes.txt > ${hash_file}
621 # if file_only -> decode all base64 "hashes" and put them in the temporary file
623 if [ "${file_only}" -eq 1 ]; then
625 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
628 hash_file
=${temp_file}
630 while read base64_hash
; do
632 echo -n ${base64_hash} | base64
-d >> ${temp_file}
634 done < ${OUTD}/${hash_type}_multihash_combi.txt
638 CMD
="./${BIN} ${OPTS} -a 1 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2"
640 echo "> Testing hash type $hash_type with attack mode 1, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
642 output=$(./${BIN} ${OPTS} -a 1 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2 2>&1)
646 echo "${output}" >> ${OUTD}/logfull.txt
648 if [ "${ret}" -eq 0 ]; then
652 while read -u 9 hash; do
654 line_nr=$((offset - i))
656 line_dict1=$(tail -n ${line_nr} ${OUTD}/${hash_type}_dict1 | head -1)
657 line_dict2=$(tail -n ${line_nr} ${OUTD}/${hash_type}_dict2 | head -1)
659 if [ ${pass_only} -eq 1 ]; then
660 search=":${line_dict1}${line_dict2}"
662 search="${hash}:${line_dict1}${line_dict2}"
665 echo "${output}" | grep -F "${search}" &> /dev/null
667 if [ "${?}" -ne 0 ]; then
677 done 9< ${OUTD}/${hash_type}_multihash_combi.txt
685 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
689 elif [ "${e_to}" -ne 0 ]; then
695 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 1, Mode multi, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout
"
704 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
711 if [ ${MODE} -ne 1 ]; then
718 echo "> Testing
hash type $hash_type with attack mode
3, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
723 # some algos have a minimum password length
725 if [ "${hash_type}" -eq 2500 ];then
734 while read -u 9 hash; do
736 if [ "${i}" -gt 6 ]; then
738 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
746 if [ "${file_only}" -eq 1 ]; then
748 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
749 echo ${hash} | base64
-d > ${temp_file}
754 mask
=${mask_3[$((i + ${mask_offset}))]}
756 # modify "default" mask if needed (and set custom charset to reduce keyspace)
758 if [ "${hash_type}" -eq 2500 ]; then
760 pass
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
764 # replace the first x positions in the mask with ?d's
766 # first: remove first i (== amount) chars
768 mask
=$
(echo ${mask} | cut
-b $
((i
+ 1))-)
772 for i
in $
(seq 1 ${i}); do
780 CMD
="./${BIN} ${OPTS} -a 3 -m ${hash_type} '${hash}' ${mask}"
782 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
784 output
=$
(.
/${BIN} ${OPTS} -a 3 -m ${hash_type} "${hash}" ${mask} 2>&1)
788 echo "${output}" >> ${OUTD}/logfull.txt
790 if [ "${ret}" -eq 0 ]; then
792 line_dict
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
794 if [ ${pass_only} -eq 1 ]; then
795 search
=":${line_dict}"
797 search
="${hash}:${line_dict}"
800 echo "${output}" |
grep -F "${search}" &> /dev
/null
802 if [ "${?}" -ne 0 ]; then
812 if [ $i -eq ${max} ]; then break; fi
816 done 9< ${OUTD}/${hash_type}_hashes.txt
820 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
824 elif [ "${e_to}" -ne 0 ]; then
830 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 3, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout"
835 if [ ${MODE} -ne 0 ]; then
844 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
852 if [ "${hash_type}" -eq 2500 ]; then
859 hash_file
=${OUTD}/${hash_type}_multihash_bruteforce.txt
861 head -n $
((increment_max
- ${increment_min} + 1)) ${OUTD}/${hash_type}_hashes.txt > ${hash_file}
863 # if file_only -> decode all base64 "hashes" and put them in the temporary file
865 if [ "${file_only}" -eq 1 ]; then
867 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
870 hash_file
=${temp_file}
872 while read base64_hash
; do
874 echo -n ${base64_hash} | base64
-d >> ${temp_file}
876 done < ${OUTD}/${hash_type}_multihash_bruteforce.txt
883 # modify "default" mask if needed (and set custom charset to reduce keyspace)
885 if [ "${hash_type}" -eq 2500 ]; then
887 mask
="?d?d?d?d?d?1?2?3?4"
894 # check positions (here we assume that mask is always composed of non literal chars
895 # i.e. something like ?d?l?u?s?1 is possible, but ?d?dsuffix not
896 charset_1_pos
=$
(expr index
"${mask}" 1)
897 charset_2_pos
=$
(expr index
"${mask}" 2)
898 charset_3_pos
=$
(expr index
"${mask}" 3)
899 charset_4_pos
=$
(expr index
"${mask}" 4)
901 # divide each charset position by 2 since each of them occupies 2 positions in the mask
903 charset_1_pos
=$
((charset_1_pos
/ 2))
904 charset_2_pos
=$
((charset_2_pos
/ 2))
905 charset_3_pos
=$
((charset_3_pos
/ 2))
906 charset_4_pos
=$
((charset_4_pos
/ 2))
910 while read -u 9 hash; do
912 pass
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
915 char
=$
(echo "${pass}" | cut
-b ${charset_1_pos})
916 charset_1
=$
(echo -e "${charset_1}\n${char}")
919 char
=$
(echo "${pass}" | cut
-b ${charset_2_pos})
920 charset_2
=$
(echo -e "${charset_2}\n${char}")
923 char
=$
(echo "${pass}" | cut
-b ${charset_3_pos})
924 charset_3
=$
(echo -e "${charset_3}\n${char}")
927 char
=$
(echo "${pass}" | cut
-b ${charset_4_pos})
928 charset_4
=$
(echo -e "${charset_4}\n${char}")
932 done 9< ${OUTD}/${hash_type}_multihash_bruteforce.txt
934 # just make sure that all custom charset fields are initialized
936 if [ -z "${charset_1}" ]; then
942 if [ -z "${charset_2}" ]; then
948 if [ -z "${charset_3}" ]; then
954 if [ -z "${charset_4}" ]; then
960 # unique and remove new lines
962 charset_1
=$
(echo "${charset_1}" |
sort -u |
tr -d '\n')
963 charset_2
=$
(echo "${charset_2}" |
sort -u |
tr -d '\n')
964 charset_3
=$
(echo "${charset_3}" |
sort -u |
tr -d '\n')
965 charset_4
=$
(echo "${charset_4}" |
sort -u |
tr -d '\n')
967 custom_charsets
="-1 ${charset_1} -2 ${charset_2} -3 ${charset_3} -4 ${charset_4}"
970 CMD
="./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} "
972 echo "> Testing hash type $hash_type with attack mode 3, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
974 output=$(./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} 2>&1)
978 echo "${output}" >> ${OUTD}/logfull.txt
980 if [ "${ret}" -eq 0 ]; then
984 while read -u 9 hash; do
986 pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt)
988 if [ ${pass_only} -eq 1 ]; then
991 search="${hash}:${pass}"
994 echo "${output}" | grep -F "${search}" &> /dev/null
996 if [ "${?}" -ne 0 ]; then
1006 done 9< ${OUTD}/${hash_type}_multihash_bruteforce.txt
1014 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1018 elif [ "${e_to}" -ne 0 ]; then
1024 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 3, Mode multi, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout
"
1033 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
1040 if [ ${MODE} -ne 1 ]; then
1047 echo "> Testing
hash type $hash_type with attack mode
6, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
1053 if [ "${hash_type}" -eq 2500 ]; then
1059 while read -u 9 hash; do
1061 if [ "${i}" -gt 6 ]; then
1063 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1071 if [ $i -gt 1 ]; then
1073 if [ "${file_only}" -eq 1 ]; then
1075 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1076 echo ${hash} | base64
-d > ${temp_file}
1081 CMD
="./${BIN} ${OPTS} -a 6 -m ${hash_type} '${hash}' ${OUTD}/${hash_type}_dict1 ${mask_6[$i]}"
1083 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
1085 output
=$
(.
/${BIN} ${OPTS} -a 6 -m ${hash_type} "${hash}" ${OUTD}/${hash_type}_dict1 ${mask_6[$i]} 2>&1)
1089 echo "${output}" >> ${OUTD}/logfull.txt
1091 if [ "${ret}" -eq 0 ]; then
1095 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1096 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1098 if [ ${pass_only} -eq 1 ]; then
1099 search
=":${line_dict1}${line_dict2}"
1101 search
="${hash}:${line_dict1}${line_dict2}"
1104 echo "${output}" |
grep -F "${search}" &> /dev
/null
1106 if [ "${?}" -ne 0 ]; then
1118 if [ "${i}" -eq ${max} ]; then break; fi
1122 done 9< ${OUTD}/${hash_type}_hashes.txt
1126 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1130 elif [ "${e_to}" -ne 0 ]; then
1136 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 6, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout"
1141 if [ ${MODE} -ne 0 ]; then
1150 if [ ${hash_type} -eq 2500 ]; then
1152 elif [ ${hash_type} -eq 3000 ]; then
1154 elif [ ${hash_type} -eq 7700 ]; then
1156 elif [ ${hash_type} -eq 8500 ]; then
1160 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1164 if [ "${hash_type}" -eq 3200 ]; then
1172 for ((i
= 2; i
< ${max}; i
++)); do
1174 hash_file
=${OUTD}/${hash_type}_hashes_multi_${i}.txt
1176 # if file_only -> decode all base64 "hashes" and put them in the temporary file
1178 if [ "${file_only}" -eq 1 ]; then
1180 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1183 hash_file
=${temp_file}
1185 while read base64_hash
; do
1187 echo -n ${base64_hash} | base64
-d >> ${temp_file}
1189 done < ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1193 CMD
="./${BIN} ${OPTS} -a 6 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1_multi_${i} ${mask_6[$i]}"
1195 echo "> Testing hash type $hash_type with attack mode 6, markov ${MARKOV}, multi hash with word len ${i}." &>> ${OUTD}/logfull.txt
1197 output=$(./${BIN} ${OPTS} -a 6 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1_multi_${i} ${mask_6[$i]} 2>&1)
1201 echo "${output}" >> ${OUTD}/logfull.txt
1203 if [ "${ret}" -eq 0 ]; then
1207 while read -u 9 hash; do
1209 line_dict1=$(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1210 line_dict2=$(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1212 if [ ${pass_only} -eq 1 ]; then
1213 search=":${line_dict1}${line_dict2}"
1215 search="${hash}:${line_dict1}${line_dict2}"
1218 echo "${output}" | grep -F "${search}" &> /dev/null
1220 if [ "${?}" -ne 0 ]; then
1230 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1240 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1244 elif [ "${e_to}" -ne 0 ]; then
1250 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 6, Mode multi, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout
"
1259 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
1266 if [ ${MODE} -ne 1 ]; then
1273 echo "> Testing
hash type $hash_type with attack mode
7, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
1277 if [ "${hash_type}" -eq 2500 ]; then
1285 while read -u 9 hash; do
1287 if [ $i -gt 1 ]; then
1289 if [ "${file_only}" -eq 1 ]; then
1291 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1292 echo ${hash} | base64
-d > ${temp_file}
1299 # adjust mask if needed
1301 if [ "${hash_type}" -eq 2500 ]; then
1305 pass_part_1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1306 pass_part_2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1308 pass_part_2_len
=${#pass_part_2}
1310 pass
=${pass_part_1}${pass_part_2}
1313 # add first x chars of password to mask and append the (old) mask
1316 mask_len
=$
((mask_len
/ 2))
1318 mask_prefix
=$
(echo ${pass} | cut -b -$((pass_len - ${mask_len} - ${pass_part_2_len})))
1319 mask
=${mask_prefix}${mask}
1323 CMD
="./${BIN} ${OPTS} -a 7 -m ${hash_type} '${hash}' ${mask} ${OUTD}/${hash_type}_dict2"
1325 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
1327 output
=$
(.
/${BIN} ${OPTS} -a 7 -m ${hash_type} "${hash}" ${mask} ${OUTD}/${hash_type}_dict2
2>&1)
1331 echo "${output}" >> ${OUTD}/logfull.txt
1333 if [ "${ret}" -eq 0 ]; then
1337 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1338 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1340 if [ ${pass_only} -eq 1 ]; then
1341 search
=":${line_dict1}${line_dict2}"
1343 search
="${hash}:${line_dict1}${line_dict2}"
1346 echo "${output}" |
grep -F "${search}" &> /dev
/null
1348 if [ "${?}" -ne 0 ]; then
1360 if [ $i -eq ${max} ]; then break; fi
1364 done 9< ${OUTD}/${hash_type}_hashes.txt
1368 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1372 elif [ "${e_to}" -ne 0 ]; then
1378 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 7, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout"
1383 if [ ${MODE} -ne 0 ]; then
1392 if [ ${hash_type} -eq 2500 ]; then
1394 elif [ ${hash_type} -eq 3000 ]; then
1396 elif [ ${hash_type} -eq 7700 ]; then
1398 elif [ ${hash_type} -eq 8500 ]; then
1402 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1406 if [ "${hash_type}" -eq 3200 ]; then
1414 for ((i
= 2; i
< ${max}; i
++)); do
1416 hash_file
=${OUTD}/${hash_type}_hashes_multi_${i}.txt
1417 dict_file
=${OUTD}/${hash_type}_dict2_multi_${i}
1421 # if file_only -> decode all base64 "hashes" and put them in the temporary file
1423 if [ "${file_only}" -eq 1 ]; then
1425 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1428 hash_file
=${temp_file}
1430 while read base64_hash
; do
1432 echo -n ${base64_hash} | base64
-d >> ${temp_file}
1434 done < ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1436 # a little hack: since we don't want to have a very large mask (and wpa has minimum length of 8),
1437 # we need to create a temporary dict file on-the-fly and use it like this: [small mask] [long(er) words in dict]
1439 dict_file
=${OUTD}/${hash_type}_dict2_multi_${i}_longer
1443 mask_len
=$
((mask_len
/ 2))
1447 while read -u 9 hash; do
1449 pass_part_1
=$
(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1450 pass_part_2
=$
(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1452 pass
="${pass_part_1}${pass_part_2}"
1454 pass_suffix
=$
(echo "${pass}" | cut
-b $
((mask_len
+ 1))-)
1456 echo "${pass_suffix}" >> ${dict_file}
1460 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1464 CMD
="./${BIN} ${OPTS} -a 7 -m ${hash_type} ${hash_file} ${mask} ${dict_file}"
1466 echo "> Testing hash type $hash_type with attack mode 7, markov ${MARKOV}, multi hash with word len ${i}." &>> ${OUTD}/logfull.txt
1468 output=$(./${BIN} ${OPTS} -a 7 -m ${hash_type} ${hash_file} ${mask} ${dict_file} 2>&1)
1472 echo "${output}" >> ${OUTD}/logfull.txt
1474 if [ "${ret}" -eq 0 ]; then
1478 while read -u 9 hash; do
1480 line_dict1=$(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1481 line_dict2=$(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1483 if [ ${pass_only} -eq 1 ]; then
1484 search=":${line_dict1}${line_dict2}"
1486 search="${hash}:${line_dict1}${line_dict2}"
1489 echo "${output}" | grep -F "${search}" &> /dev/null
1491 if [ "${?}" -ne 0 ]; then
1501 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1511 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1515 elif [ "${e_to}" -ne 0 ]; then
1521 echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 7, Mode multi, Device-Type ${TYPE}, Vector-Width ${VECTOR} ] > $msg : ${e_nf}/${cnt} not found, ${e_nm}/${cnt} not matched, ${e_to}/${cnt} timeout
"
1529 > Usage : ${0} <options>
1533 -V OpenCL vector-width (either 1, 2, 4 or 8), overrides value from device query :
1534 '1' => vector-width 1
1535 '2' => vector-width 2 (default)
1536 '4' => vector-width 4
1537 '8' => vector-width 8
1538 'all' => test sequentially vector-width ${VECTOR_WIDTHS}
1540 -T OpenCL device-types to use :
1541 'gpu' => gpu devices (default)
1542 'cpu' => cpu devices
1543 'all' => gpu and cpu devices
1545 -t Select test mode :
1546 'single' => single hash (default)
1547 'multi' => multi hash
1548 'all' => single and multi hash
1550 -m Select hash type :
1551 'all' => all hash type supported
1552 (int) => hash type integer code (default : 0)
1554 -a Select attack mode :
1555 'all' => all attack modes
1556 (int) => attack mode integer code (default : 0)
1558 -x Select cpu architecture :
1559 '32' => 32 bit architecture
1560 '64' => 64 bit architecture (default)
1562 -o Select operating system :
1563 'win' => windows operating system (use .exe file extension etc)
1564 'linux' => *nix based operating systems (.bin for binaries)
1565 'osx' => mac osx operating systems (.app for binaries)
1567 -c Disables markov-chains
1569 -p Package the tests into a .7z file
1571 -d Use this folder as input/output folder for packaged tests
1572 (string) => path to folder
1590 while getopts "V
:T
:t
:m
:a
:b
:hcpd
:x
:o
:" opt; do
1594 if [ ${OPTARG} == "1" ]; then
1596 elif [ ${OPTARG} == "2" ]; then
1598 elif [ ${OPTARG} == "4" ]; then
1600 elif [ ${OPTARG} == "8" ]; then
1602 elif [ ${OPTARG} == "16" ]; then
1604 elif [ ${OPTARG} == "all
" ]; then
1612 if [ ${OPTARG} == "gpu
" ]; then
1613 OPTS="${OPTS} --opencl-device-types 2"
1615 elif [ ${OPTARG} == "cpu
" ]; then
1616 OPTS="${OPTS} --opencl-device-types 1"
1618 elif [ ${OPTARG} == "all
" ]; then
1619 OPTS="${OPTS} --opencl-device-types 1,2"
1627 if [ ${OPTARG} == "single
" ]; then
1629 elif [ ${OPTARG} == "multi
" ]; then
1631 elif [ ${OPTARG} == "all
" ]; then
1639 if [ ${OPTARG} == "all
" ]; then
1647 if [ ${OPTARG} == "all
" ]; then
1649 elif [ ${OPTARG} == "0" ]; then
1651 elif [ ${OPTARG} == "1" ]; then
1653 elif [ ${OPTARG} == "3" ]; then
1655 elif [ ${OPTARG} == "6" ]; then
1657 elif [ ${OPTARG} == "7" ]; then
1665 OPTS="${OPTS} --markov-disable"
1670 PACKAGE_FOLDER=$( echo ${OPTARG} | sed 's!/$!!g' )
1678 if [ ${OPTARG} == "32" ]; then
1680 elif [ ${OPTARG} == "64" ]; then
1688 if [ ${OPTARG} == "win
" ]; then
1690 elif [ ${OPTARG} == "linux
" ]; then
1692 elif [ ${OPTARG} == "osx
" ]; then
1710 if [ "${TYPE}" == "null
" ]; then
1712 OPTS="${OPTS} --opencl-device-types 2"
1715 if [ -n "${ARCHITECTURE}" ]; then
1717 BIN="${BIN}${ARCHITECTURE}"
1721 if [ -n "${EXTENSION}" ]; then
1723 BIN="${BIN}.
${EXTENSION}"
1727 if [ -n "${PACKAGE_FOLDER}" ]; then
1729 if [ ! -e "${PACKAGE_FOLDER}" ]; then
1730 echo "! folder
'${PACKAGE_FOLDER}' does not exist
"
1736 if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then
1738 # check existence of binary
1739 if [ ! -e "${BIN}" ]; then
1740 echo "! ${BIN} not found
, please build binary before run
test.
"
1744 # filter by hash_type
1745 if [ ${HT} -ne 65535 ]; then
1749 for hash_type in $(echo ${HASH_TYPES}); do
1751 if [ ${HT} -ne ${hash_type} ]; then continue; fi
1759 if [ ${check} -ne 1 ]; then
1760 echo "! invalid
hash type selected ...
"
1766 if [ -z "${PACKAGE_FOLDER}" ]; then
1771 # generate random test entry
1772 if [ ${HT} -eq 65535 ]; then
1773 perl tools/test.pl single > ${OUTD}/all.sh
1775 perl tools/test.pl single ${HT} > ${OUTD}/all.sh
1780 OUTD=${PACKAGE_FOLDER}
1784 rm -rf ${OUTD}/logfull.txt && touch ${OUTD}/logfull.txt
1786 # populate array of hash types where we only should check if pass is in output (not both hash:pass)
1787 IFS=';' read -ra PASS_ONLY <<< "${MATCH_PASS_ONLY}"
1788 IFS=';' read -ra TIMEOUT_ALGOS <<< "${SLOW_ALGOS}"
1790 IFS=';' read -ra NEVER_CRACK_ALGOS <<< "${NEVER_CRACK}"
1792 # for these particular algos we need to save the output to a temporary file
1793 IFS=';' read -ra FILE_BASED_ALGOS <<< "${HASHFILE_ONLY}"
1795 for hash_type in $(echo $HASH_TYPES); do
1797 if [[ ${HT} -ne 65535 ]] && [[ ${HT} -ne ${hash_type} ]]; then continue; fi
1799 if [ -z "${PACKAGE_FOLDER}" ]; then
1806 echo "[ ${OUTD} ] > Run packaged
test for hash type $hash_type.
"
1810 if [ "${PACKAGE}" -eq 0 ]; then
1812 # should we check only the pass?
1813 contains ${hash_type} ${PASS_ONLY}
1816 contains ${hash_type} ${SLOW_ALGOS}
1819 if [[ ${hash_type} -eq 400 ]]; then
1820 # we use phpass as slow hash for testing the AMP kernel
1825 VECTOR_OLD=${VECTOR}
1826 for CUR_WIDTH in $(echo $VECTOR_WIDTHS); do
1828 if [ "${VECTOR_OLD}" == "all" ] || [ "${VECTOR_OLD}" == "default" ] || [ "${VECTOR_OLD}" == "${CUR_WIDTH}" ]; then
1830 if [ "${VECTOR_OLD}" == "default
" ] && \
1831 [ "${CUR_WIDTH}" != "1" ] && \
1832 [ "${CUR_WIDTH}" != "4" ]; then
1838 OPTS="${OPTS_OLD} --opencl-vector-width ${VECTOR}"
1840 if [[ ${IS_SLOW} -eq 1 ]]; then
1842 # run attack mode 0 (stdin)
1843 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 0 ]]; then attack_0; fi
1847 # run attack mode 0 (stdin)
1848 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 0 ]]; then attack_0; fi
1850 # run attack mode 1 (combinator)
1851 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 1 ]]; then attack_1; fi
1853 # run attack mode 3 (bruteforce)
1854 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 3 ]]; then attack_3; fi
1856 # run attack mode 6 (dict+mask)
1857 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 6 ]]; then attack_6; fi
1859 # run attack mode 7 (mask+dict)
1860 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 7 ]]; then attack_7; fi
1866 VECTOR="${VECTOR_OLD}"
1872 OUTD=${PACKAGE_FOLDER}
1877 if [ "${PACKAGE}" -eq 0 ]; then
1879 cat -A ${OUTD}/logfull.txt | sed -e 's/\^M \^M//g' | sed -e 's/\$$//g' > ${OUTD}/test_report.log
1883 rm -rf ${OUTD}/logfull.txt
1885 if [ "${PACKAGE}" -eq 1 ]; then
1887 echo "[ ${OUTD} ] > Generate package ${OUTD}/${OUTD}.7z
"
1889 cp "${BASH_SOURCE[0]}" ${OUTD}/test.sh
1891 # if we package from a given folder, we need to check if e.g. the files needed for multi mode are there
1893 if [ -n "${PACKAGE_FOLDER}" ]; then
1897 ls "${PACKAGE_FOLDER}"/*multi* &> /dev/null
1906 HT=$(grep -o -- "-m *[0-9]*" ${PACKAGE_FOLDER}/all.sh | sort -u | sed 's/-m //' 2> /dev/null)
1908 if [ -n "${HT}" ]; then
1910 HT_COUNT=$(echo "${HT}" | wc -l)
1912 if [ "${HT_COUNT}" -gt 1 ]; then
1920 #ATTACK=65535 # more appropriate ?
1923 # for convenience: 'run package' is default action for packaged test.sh ( + add other defaults too )
1925 sed -i -e 's/^\(PACKAGE_FOLDER\)=""/\1="$
( echo "${BASH_SOURCE[0]}" |
sed \"s
!test.sh
\\$
!!\" )"/' \
1926 -e "s
/^\
(HT\
)=0/\
1=${HT}/" \
1927 -e "s
/^\
(MODE\
)=0/\
1=${MODE}/" \
1928 -e "s
/^\
(ATTACK\
)=0/\
1=${ATTACK}/" \
1931 ${PACKAGE_CMD} ${OUTD}/${OUTD}.7z ${OUTD}/ &> /dev/null