4 ## Authors.....: Gabriele Gristina <matrix@hashcat.net>
5 ## Jens Steube <jens.steube@gmail.com>
10 # missing hash types: 5200,6211,6221,6231,6241,6251,6261,6271,6281
12 HASH_TYPES
="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 130 131 132 140 141 150 160 190 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"
14 #ATTACK_MODES="0 1 3 6 7"
15 ATTACK_MODES
="0 1 3 7"
17 VECTOR_WIDTHS
="1 2 4 8"
19 MATCH_PASS_ONLY
="2500 5300 5400 6600 6800 8200"
25 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"
27 OPTS
="--quiet --force --potfile-disable --runtime 200 --gpu-temp-disable --weak-hash-threshold=0"
29 OUTD
="test_$(date +%s)"
39 mask_3
[5]="?d?d?d?d?d"
40 mask_3
[6]="?d?d?d?d?d?d"
41 mask_3
[7]="?d?d?d?d?d?d?d"
42 mask_3
[8]="?d?d?d?d?d?d?d?d"
43 mask_3
[9]="?d?d?d?d?d?d?d?d?d"
44 mask_3
[10]="?d?d?d?d?d?d?d?d?d?d"
45 mask_3
[11]="?d?d?d?d?d?d?d?d?d?d?d"
46 mask_3
[12]="?d?d?d?d?d?d?d?d?d?d?d?d"
47 mask_3
[13]="?d?d?d?d?d?d?d?d?d?d?d?d?d"
48 mask_3
[14]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d"
49 mask_3
[15]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d"
50 mask_3
[16]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0"
51 mask_3
[17]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00"
52 mask_3
[18]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000"
53 mask_3
[19]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000"
54 mask_3
[20]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000"
55 mask_3
[21]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000"
56 mask_3
[22]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000"
57 mask_3
[23]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000"
58 mask_3
[24]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000"
59 mask_3
[25]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000"
60 mask_3
[26]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000000"
61 mask_3
[27]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000000"
62 mask_3
[28]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000000"
63 mask_3
[29]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d00000000000000"
64 mask_3
[30]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d000000000000000"
65 mask_3
[31]="?d?d?d?d?d?d?d?d?d?d?d?d?d?d?d0000000000000000"
76 mask_6
[9]="?d?d?d?d?d"
77 mask_6
[10]="?d?d?d?d?d"
78 mask_6
[11]="?d?d?d?d?d?d"
79 mask_6
[12]="?d?d?d?d?d?d"
80 mask_6
[13]="?d?d?d?d?d?d?d"
81 mask_6
[14]="?d?d?d?d?d?d?d"
82 mask_6
[15]="?d?d?d?d?d?d?d?d"
83 mask_6
[16]="?d?d?d?d?d?d?d?d"
84 mask_6
[17]="?d?d?d?d?d?d?d?d0"
85 mask_6
[18]="?d?d?d?d?d?d?d?d0"
86 mask_6
[19]="?d?d?d?d?d?d?d?d00"
87 mask_6
[20]="?d?d?d?d?d?d?d?d00"
88 mask_6
[21]="?d?d?d?d?d?d?d?d000"
89 mask_6
[22]="?d?d?d?d?d?d?d?d000"
90 mask_6
[23]="?d?d?d?d?d?d?d?d0000"
91 mask_6
[24]="?d?d?d?d?d?d?d?d0000"
92 mask_6
[25]="?d?d?d?d?d?d?d?d00000"
93 mask_6
[26]="?d?d?d?d?d?d?d?d00000"
94 mask_6
[27]="?d?d?d?d?d?d?d?d000000"
95 mask_6
[28]="?d?d?d?d?d?d?d?d000000"
96 mask_6
[29]="?d?d?d?d?d?d?d?d0000000"
97 mask_6
[30]="?d?d?d?d?d?d?d?d0000000"
98 mask_6
[31]="?d?d?d?d?d?d?d?d00000000"
110 mask_7
[10]="?d?d?d?d?d"
111 mask_7
[11]="?d?d?d?d?d"
112 mask_7
[12]="?d?d?d?d?d?d"
113 mask_7
[13]="?d?d?d?d?d?d"
114 mask_7
[14]="?d?d?d?d?d?d?d"
115 mask_7
[15]="?d?d?d?d?d?d?d"
116 mask_7
[16]="?d?d?d?d?d?d?d?d"
117 mask_7
[17]="?d?d?d?d?d?d?d?d"
118 mask_7
[18]="?d?d?d?d?d?d?d?d0"
119 mask_7
[19]="?d?d?d?d?d?d?d?d0"
120 mask_7
[20]="?d?d?d?d?d?d?d?d00"
121 mask_7
[21]="?d?d?d?d?d?d?d?d00"
122 mask_7
[22]="?d?d?d?d?d?d?d?d000"
123 mask_7
[23]="?d?d?d?d?d?d?d?d000"
124 mask_7
[24]="?d?d?d?d?d?d?d?d0000"
125 mask_7
[25]="?d?d?d?d?d?d?d?d0000"
126 mask_7
[26]="?d?d?d?d?d?d?d?d00000"
127 mask_7
[27]="?d?d?d?d?d?d?d?d00000"
128 mask_7
[28]="?d?d?d?d?d?d?d?d000000"
129 mask_7
[29]="?d?d?d?d?d?d?d?d000000"
130 mask_7
[30]="?d?d?d?d?d?d?d?d0000000"
131 mask_7
[31]="?d?d?d?d?d?d?d?d0000000"
135 for element
in "${@:2}"; do
137 if [ "${element}" == "${1}" ]; then
148 if [ "${PACKAGE}" -eq 1 ]; then
150 echo "[ ${OUTD} ] > Generate tests for hash type $hash_type."
154 echo "[ ${OUTD} ] > Init test for hash type $hash_type."
158 rm -rf ${OUTD}/${hash_type}.sh ${OUTD}/${hash_type}_passwords.txt ${OUTD}/${hash_type}_hashes.txt
160 # create list of password and hashes of same type
161 grep " ${hash_type} '" ${OUTD}/all.sh > ${OUTD}/${hash_type}.sh
163 # create separate list of password and hashes
164 cat ${OUTD}/${hash_type}.sh | awk '{print $3}' > ${OUTD}/${hash_type}_passwords.txt
165 cat ${OUTD}/${hash_type}.sh | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
167 if [ "${hash_type}" -eq 10300 ]; then
168 cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
172 rm -rf ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
173 touch ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
175 # foreach password entry split password in 2 (skip first entry, is len 1)
178 # minimum password length
182 if [ "${hash_type}" -eq 2500 ]; then
184 min_len=7 # means length 8, since we start with 0
188 while read -u 9 pass; do
190 if [ ${i} -gt 1 ]; then
192 # split password, 'i' is the len
196 # special case (passwords longer than expected)
199 if [ "${pass_len}" -gt 1 ]
202 p1=$((p1 + ${min_len}))
203 p0=$((p0 + ${min_len}))
205 if [ "${p1}" -gt ${pass_len} ]; then
212 # add splitted password to dicts
214 echo ${pass} | cut -c -${p0} >> ${OUTD}/${hash_type}_dict1
215 echo ${pass} | cut -c ${p1}- >> ${OUTD}/${hash_type}_dict2
222 done 9< ${OUTD}/${hash_type}_passwords.txt
226 if [ "${hash_type}" -eq 2500 ]; then
228 min_len=7 # means length 8, since we start with 0
232 # generate multiple pass/hash foreach len (2 to 8)
233 if [ ${MODE} -ge 1 ]; then
235 for ((i = 2; i < 9; i++)); do
237 rm -rf ${OUTD}/${hash_type}_multi_${i}.txt ${OUTD}/${hash_type}_passwords_multi_${i}.txt ${OUTD}/${hash_type}_hashes_multi_${i}.txt
238 rm -rf ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i}
239 touch ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i}
241 perl tools/test.pl single ${hash_type} ${i} > ${OUTD}/${hash_type}_multi_${i}.txt
243 cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $3}' > ${OUTD}/${hash_type}_passwords_multi_${i}.txt
244 cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
246 if [ "${hash_type}" -eq 10300 ]; then
247 cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
250 # split password, 'i' is the len
254 p0=$((p0 + ${min_len}))
255 p1=$((p1 + ${min_len}))
257 while read -u 9 pass; do
259 # add splitted password to dicts
260 echo ${pass} | cut -c -${p0} >> ${OUTD}/${hash_type}_dict1_multi_${i}
261 echo ${pass} | cut -c ${p1}- >> ${OUTD}/${hash_type}_dict2_multi_${i}
263 done 9< ${OUTD}/${hash_type}_passwords_multi_${i}.txt
276 if [ ${RET} -ne 0 ]; then
279 if contains ${hash_type} ${NEVER_CRACK_ALGOS}; then
281 echo "password not found
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
288 echo "timeout reached
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
293 if [ "${pass_only}" -eq 1 ]; then
294 echo "plains not found
in output
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
296 echo "hash:plains not matched
in output
, cmdline
: ${CMD}" &>> ${OUTD}/logfull.txt
302 echo "! unhandled
return code
${RET}, cmdline : ${CMD}" &>> ${OUTD}/logfull.txt
303 echo "! unhandled return code, see ${OUTD}/logfull.txt for details."
314 if ! contains
${hash_type} ${FILE_BASED_ALGOS}; then
321 if [ ${MODE} -ne 1 ]; then
328 echo "> Testing hash type $hash_type with attack mode 0, markov ${MARKOV}, single hash, device-type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
332 if ! contains ${hash_type} ${TIMEOUT_ALGOS}; then
340 while read -u 9 line; do
342 if [ "${i}" -ge ${max} ]; then
348 hash="$
(echo "$line" | cut
-d\' -f2)"
349 pass="$
(echo "$line" | cut
-d' ' -f3)"
351 if [ -z "${hash}" ]; then
357 if [ "${file_only}" -eq 1 ]; then
359 temp_file="${OUTD}/${hash_type}_filebased_only_temp.txt
"
360 echo ${hash} | base64 -d > ${temp_file}
365 CMD="echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} '${hash}'"
367 echo -n "[ len $((i + 1)) ] " &>> ${OUTD}/logfull.txt
369 output
=$
(echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} "${hash}" 2>&1)
373 echo "${output}" >> ${OUTD}/logfull.txt
375 if [ "${ret}" -eq 0 ]; then
377 if [ ${pass_only} -eq 1 ]; then
380 search
="${hash}:${pass}"
383 echo "${output}" |
grep -F "${search}" &> /dev
/null
385 if [ "${?}" -ne 0 ]; then
397 done 9< ${OUTD}/${hash_type}.sh
401 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
405 elif [ "${e_to}" -ne 0 ]; then
411 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"
416 if [ ${MODE} -ne 0 ]; then
423 echo "> Testing hash type $hash_type with attack mode 0, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
425 hash_file=${OUTD}/${hash_type}_hashes.txt
427 # if file_only -> decode all base64 "hashes
" and put them in the temporary file
429 if [ "${file_only}" -eq 1 ]; then
431 temp_file="${OUTD}/${hash_type}_filebased_only_temp.txt
"
434 hash_file=${temp_file}
436 while read base64_hash; do
438 echo -n ${base64_hash} | base64 -d >> ${temp_file}
440 done < ${OUTD}/${hash_type}_hashes.txt
444 CMD="cat ${OUTD}/${hash_type}_passwords.txt | ./${BIN} ${OPTS} -a 0 -m ${hash_type} ${hash_file}"
446 output=$(cat ${OUTD}/${hash_type}_passwords.txt | ./${BIN} ${OPTS} -a 0 -m ${hash_type} ${hash_file} 2>&1)
450 echo "${output}" >> ${OUTD}/logfull.txt
452 if [ "${ret}" -eq 0 ]; then
456 while read -u 9 hash; do
458 pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt)
460 if [ ${pass_only} -eq 1 ]; then
463 search="${hash}:${pass}"
466 echo "${output}" | grep -F "${search}" &> /dev/null
468 if [ "${?}" -ne 0 ]; then
478 done 9< ${OUTD}/${hash_type}_hashes.txt
486 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
490 elif [ "${e_to}" -ne 0 ]; then
496 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
"
505 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
512 if [ ${MODE} -ne 1 ]; then
519 echo "> Testing
hash type $hash_type with attack mode
1, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
521 while read -u 9 hash; do
523 if [ $i -gt 1 ]; then
525 if [ "${file_only}" -eq 1 ]; then
527 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
528 echo ${hash} | base64
-d > ${temp_file}
533 CMD
="./${BIN} ${OPTS} -a 1 -m ${hash_type} '${hash}' ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2"
535 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
537 output
=$
(.
/${BIN} ${OPTS} -a 1 -m ${hash_type} "${hash}" ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2
2>&1)
541 echo "${output}" >> ${OUTD}/logfull.txt
543 if [ "${ret}" -eq 0 ]; then
547 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
548 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
550 if [ ${pass_only} -eq 1 ]; then
551 search
=":${line_dict1}${line_dict2}"
553 search
="${hash}:${line_dict1}${line_dict2}"
556 echo "${output}" |
grep -F "${search}" &> /dev
/null
558 if [ "${?}" -ne 0 ]; then
572 done 9< ${OUTD}/${hash_type}_hashes.txt
576 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
580 elif [ "${e_to}" -ne 0 ]; then
586 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"
591 if [ ${MODE} -ne 0 ]; then
600 if [ ${hash_type} -eq 2500 ]; then
602 elif [ ${hash_type} -eq 5800 ]; then
604 elif [ ${hash_type} -eq 3000 ]; then
606 elif [ ${hash_type} -eq 2100 ]; then
608 elif [ ${hash_type} -eq 1500 ]; then
610 elif [ ${hash_type} -eq 7700 ]; then
612 elif [ ${hash_type} -eq 8500 ]; then
616 hash_file
=${OUTD}/${hash_type}_multihash_combi.txt
618 tail -n ${offset} ${OUTD}/${hash_type}_hashes.txt > ${hash_file}
620 # if file_only -> decode all base64 "hashes" and put them in the temporary file
622 if [ "${file_only}" -eq 1 ]; then
624 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
627 hash_file
=${temp_file}
629 while read base64_hash
; do
631 echo -n ${base64_hash} | base64
-d >> ${temp_file}
633 done < ${OUTD}/${hash_type}_multihash_combi.txt
637 CMD
="./${BIN} ${OPTS} -a 1 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2"
639 echo "> Testing hash type $hash_type with attack mode 1, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
641 output=$(./${BIN} ${OPTS} -a 1 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1 ${OUTD}/${hash_type}_dict2 2>&1)
645 echo "${output}" >> ${OUTD}/logfull.txt
647 if [ "${ret}" -eq 0 ]; then
651 while read -u 9 hash; do
653 line_nr=$((offset - i))
655 line_dict1=$(tail -n ${line_nr} ${OUTD}/${hash_type}_dict1 | head -1)
656 line_dict2=$(tail -n ${line_nr} ${OUTD}/${hash_type}_dict2 | head -1)
658 if [ ${pass_only} -eq 1 ]; then
659 search=":${line_dict1}${line_dict2}"
661 search="${hash}:${line_dict1}${line_dict2}"
664 echo "${output}" | grep -F "${search}" &> /dev/null
666 if [ "${?}" -ne 0 ]; then
676 done 9< ${OUTD}/${hash_type}_multihash_combi.txt
684 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
688 elif [ "${e_to}" -ne 0 ]; then
694 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
"
703 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
710 if [ ${MODE} -ne 1 ]; then
717 echo "> Testing
hash type $hash_type with attack mode
3, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
722 # some algos have a minimum password length
724 if [ "${hash_type}" -eq 2500 ];then
733 while read -u 9 hash; do
735 if [ "${i}" -gt 6 ]; then
737 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
745 if [ "${file_only}" -eq 1 ]; then
747 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
748 echo ${hash} | base64
-d > ${temp_file}
753 mask
=${mask_3[$((i + ${mask_offset}))]}
755 # modify "default" mask if needed (and set custom charset to reduce keyspace)
757 if [ "${hash_type}" -eq 2500 ]; then
759 pass
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
763 # replace the first x positions in the mask with ?d's
765 # first: remove first i (== amount) chars
767 mask
=$
(echo ${mask} | cut
-b $
((i
+ 1))-)
771 for i
in $
(seq 1 ${i}); do
779 CMD
="./${BIN} ${OPTS} -a 3 -m ${hash_type} '${hash}' ${mask}"
781 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
783 output
=$
(.
/${BIN} ${OPTS} -a 3 -m ${hash_type} "${hash}" ${mask} 2>&1)
787 echo "${output}" >> ${OUTD}/logfull.txt
789 if [ "${ret}" -eq 0 ]; then
791 line_dict
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
793 if [ ${pass_only} -eq 1 ]; then
794 search
=":${line_dict}"
796 search
="${hash}:${line_dict}"
799 echo "${output}" |
grep -F "${search}" &> /dev
/null
801 if [ "${?}" -ne 0 ]; then
811 if [ $i -eq ${max} ]; then break; fi
815 done 9< ${OUTD}/${hash_type}_hashes.txt
819 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
823 elif [ "${e_to}" -ne 0 ]; then
829 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"
834 if [ ${MODE} -ne 0 ]; then
843 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
851 if [ "${hash_type}" -eq 2500 ]; then
858 hash_file
=${OUTD}/${hash_type}_multihash_bruteforce.txt
860 head -n $
((increment_max
- ${increment_min} + 1)) ${OUTD}/${hash_type}_hashes.txt > ${hash_file}
862 # if file_only -> decode all base64 "hashes" and put them in the temporary file
864 if [ "${file_only}" -eq 1 ]; then
866 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
869 hash_file
=${temp_file}
871 while read base64_hash
; do
873 echo -n ${base64_hash} | base64
-d >> ${temp_file}
875 done < ${OUTD}/${hash_type}_multihash_bruteforce.txt
882 # modify "default" mask if needed (and set custom charset to reduce keyspace)
884 if [ "${hash_type}" -eq 2500 ]; then
886 mask
="?d?d?d?d?d?1?2?3?4"
893 # check positions (here we assume that mask is always composed of non literal chars
894 # i.e. something like ?d?l?u?s?1 is possible, but ?d?dsuffix not
895 charset_1_pos
=$
(expr index
"${mask}" 1)
896 charset_2_pos
=$
(expr index
"${mask}" 2)
897 charset_3_pos
=$
(expr index
"${mask}" 3)
898 charset_4_pos
=$
(expr index
"${mask}" 4)
900 # divide each charset position by 2 since each of them occupies 2 positions in the mask
902 charset_1_pos
=$
((charset_1_pos
/ 2))
903 charset_2_pos
=$
((charset_2_pos
/ 2))
904 charset_3_pos
=$
((charset_3_pos
/ 2))
905 charset_4_pos
=$
((charset_4_pos
/ 2))
909 while read -u 9 hash; do
911 pass
=$
(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt
)
914 char
=$
(echo "${pass}" | cut
-b ${charset_1_pos})
915 charset_1
=$
(echo -e "${charset_1}\n${char}")
918 char
=$
(echo "${pass}" | cut
-b ${charset_2_pos})
919 charset_2
=$
(echo -e "${charset_2}\n${char}")
922 char
=$
(echo "${pass}" | cut
-b ${charset_3_pos})
923 charset_3
=$
(echo -e "${charset_3}\n${char}")
926 char
=$
(echo "${pass}" | cut
-b ${charset_4_pos})
927 charset_4
=$
(echo -e "${charset_4}\n${char}")
931 done 9< ${OUTD}/${hash_type}_multihash_bruteforce.txt
933 # just make sure that all custom charset fields are initialized
935 if [ -z "${charset_1}" ]; then
941 if [ -z "${charset_2}" ]; then
947 if [ -z "${charset_3}" ]; then
953 if [ -z "${charset_4}" ]; then
959 # unique and remove new lines
961 charset_1
=$
(echo "${charset_1}" |
sort -u |
tr -d '\n')
962 charset_2
=$
(echo "${charset_2}" |
sort -u |
tr -d '\n')
963 charset_3
=$
(echo "${charset_3}" |
sort -u |
tr -d '\n')
964 charset_4
=$
(echo "${charset_4}" |
sort -u |
tr -d '\n')
966 custom_charsets
="-1 ${charset_1} -2 ${charset_2} -3 ${charset_3} -4 ${charset_4}"
969 CMD
="./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} "
971 echo "> Testing hash type $hash_type with attack mode 3, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
973 output=$(./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} 2>&1)
977 echo "${output}" >> ${OUTD}/logfull.txt
979 if [ "${ret}" -eq 0 ]; then
983 while read -u 9 hash; do
985 pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt)
987 if [ ${pass_only} -eq 1 ]; then
990 search="${hash}:${pass}"
993 echo "${output}" | grep -F "${search}" &> /dev/null
995 if [ "${?}" -ne 0 ]; then
1005 done 9< ${OUTD}/${hash_type}_multihash_bruteforce.txt
1013 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1017 elif [ "${e_to}" -ne 0 ]; then
1023 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
"
1032 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
1039 if [ ${MODE} -ne 1 ]; then
1046 echo "> Testing
hash type $hash_type with attack mode
6, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
1052 if [ "${hash_type}" -eq 2500 ]; then
1058 while read -u 9 hash; do
1060 if [ "${i}" -gt 6 ]; then
1062 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1070 if [ $i -gt 1 ]; then
1072 if [ "${file_only}" -eq 1 ]; then
1074 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1075 echo ${hash} | base64
-d > ${temp_file}
1080 CMD
="./${BIN} ${OPTS} -a 6 -m ${hash_type} '${hash}' ${OUTD}/${hash_type}_dict1 ${mask_6[$i]}"
1082 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
1084 output
=$
(.
/${BIN} ${OPTS} -a 6 -m ${hash_type} "${hash}" ${OUTD}/${hash_type}_dict1 ${mask_6[$i]} 2>&1)
1088 echo "${output}" >> ${OUTD}/logfull.txt
1090 if [ "${ret}" -eq 0 ]; then
1094 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1095 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1097 if [ ${pass_only} -eq 1 ]; then
1098 search
=":${line_dict1}${line_dict2}"
1100 search
="${hash}:${line_dict1}${line_dict2}"
1103 echo "${output}" |
grep -F "${search}" &> /dev
/null
1105 if [ "${?}" -ne 0 ]; then
1117 if [ "${i}" -eq ${max} ]; then break; fi
1121 done 9< ${OUTD}/${hash_type}_hashes.txt
1125 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1129 elif [ "${e_to}" -ne 0 ]; then
1135 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"
1140 if [ ${MODE} -ne 0 ]; then
1149 if [ ${hash_type} -eq 2500 ]; then
1151 elif [ ${hash_type} -eq 3000 ]; then
1153 elif [ ${hash_type} -eq 7700 ]; then
1155 elif [ ${hash_type} -eq 8500 ]; then
1159 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1163 if [ "${hash_type}" -eq 3200 ]; then
1171 for ((i
= 2; i
< ${max}; i
++)); do
1173 hash_file
=${OUTD}/${hash_type}_hashes_multi_${i}.txt
1175 # if file_only -> decode all base64 "hashes" and put them in the temporary file
1177 if [ "${file_only}" -eq 1 ]; then
1179 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1182 hash_file
=${temp_file}
1184 while read base64_hash
; do
1186 echo -n ${base64_hash} | base64
-d >> ${temp_file}
1188 done < ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1192 CMD
="./${BIN} ${OPTS} -a 6 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1_multi_${i} ${mask_6[$i]}"
1194 echo "> Testing hash type $hash_type with attack mode 6, markov ${MARKOV}, multi hash with word len ${i}." &>> ${OUTD}/logfull.txt
1196 output=$(./${BIN} ${OPTS} -a 6 -m ${hash_type} ${hash_file} ${OUTD}/${hash_type}_dict1_multi_${i} ${mask_6[$i]} 2>&1)
1200 echo "${output}" >> ${OUTD}/logfull.txt
1202 if [ "${ret}" -eq 0 ]; then
1206 while read -u 9 hash; do
1208 line_dict1=$(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1209 line_dict2=$(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1211 if [ ${pass_only} -eq 1 ]; then
1212 search=":${line_dict1}${line_dict2}"
1214 search="${hash}:${line_dict1}${line_dict2}"
1217 echo "${output}" | grep -F "${search}" &> /dev/null
1219 if [ "${?}" -ne 0 ]; then
1229 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1239 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1243 elif [ "${e_to}" -ne 0 ]; then
1249 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
"
1258 if ! contains ${hash_type} ${FILE_BASED_ALGOS}; then
1265 if [ ${MODE} -ne 1 ]; then
1272 echo "> Testing
hash type $hash_type with attack mode
7, markov
${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt
1276 if [ "${hash_type}" -eq 2500 ]; then
1284 while read -u 9 hash; do
1286 if [ $i -gt 1 ]; then
1288 if [ "${file_only}" -eq 1 ]; then
1290 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1291 echo ${hash} | base64
-d > ${temp_file}
1298 # adjust mask if needed
1300 if [ "${hash_type}" -eq 2500 ]; then
1304 pass_part_1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1305 pass_part_2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1307 pass_part_2_len
=${#pass_part_2}
1309 pass
=${pass_part_1}${pass_part_2}
1312 # add first x chars of password to mask and append the (old) mask
1315 mask_len
=$
((mask_len
/ 2))
1317 mask_prefix
=$
(echo ${pass} | cut -b -$((pass_len - ${mask_len} - ${pass_part_2_len})))
1318 mask
=${mask_prefix}${mask}
1322 CMD
="./${BIN} ${OPTS} -a 7 -m ${hash_type} '${hash}' ${mask} ${OUTD}/${hash_type}_dict2"
1324 echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt
1326 output
=$
(.
/${BIN} ${OPTS} -a 7 -m ${hash_type} "${hash}" ${mask} ${OUTD}/${hash_type}_dict2
2>&1)
1330 echo "${output}" >> ${OUTD}/logfull.txt
1332 if [ "${ret}" -eq 0 ]; then
1336 line_dict1
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict1
)
1337 line_dict2
=$
(sed -n ${line_nr}p ${OUTD}/${hash_type}_dict2
)
1339 if [ ${pass_only} -eq 1 ]; then
1340 search
=":${line_dict1}${line_dict2}"
1342 search
="${hash}:${line_dict1}${line_dict2}"
1345 echo "${output}" |
grep -F "${search}" &> /dev
/null
1347 if [ "${?}" -ne 0 ]; then
1359 if [ $i -eq ${max} ]; then break; fi
1363 done 9< ${OUTD}/${hash_type}_hashes.txt
1367 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1371 elif [ "${e_to}" -ne 0 ]; then
1377 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"
1382 if [ ${MODE} -ne 0 ]; then
1391 if [ ${hash_type} -eq 2500 ]; then
1393 elif [ ${hash_type} -eq 3000 ]; then
1395 elif [ ${hash_type} -eq 7700 ]; then
1397 elif [ ${hash_type} -eq 8500 ]; then
1401 if ! contains
${hash_type} ${TIMEOUT_ALGOS}; then
1405 if [ "${hash_type}" -eq 3200 ]; then
1413 for ((i
= 2; i
< ${max}; i
++)); do
1415 hash_file
=${OUTD}/${hash_type}_hashes_multi_${i}.txt
1416 dict_file
=${OUTD}/${hash_type}_dict2_multi_${i}
1420 # if file_only -> decode all base64 "hashes" and put them in the temporary file
1422 if [ "${file_only}" -eq 1 ]; then
1424 temp_file
="${OUTD}/${hash_type}_filebased_only_temp.txt"
1427 hash_file
=${temp_file}
1429 while read base64_hash
; do
1431 echo -n ${base64_hash} | base64
-d >> ${temp_file}
1433 done < ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1435 # a little hack: since we don't want to have a very large mask (and wpa has minimum length of 8),
1436 # we need to create a temporary dict file on-the-fly and use it like this: [small mask] [long(er) words in dict]
1438 dict_file
=${OUTD}/${hash_type}_dict2_multi_${i}_longer
1442 mask_len
=$
((mask_len
/ 2))
1446 while read -u 9 hash; do
1448 pass_part_1
=$
(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1449 pass_part_2
=$
(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1451 pass
="${pass_part_1}${pass_part_2}"
1453 pass_suffix
=$
(echo "${pass}" | cut
-b $
((mask_len
+ 1))-)
1455 echo "${pass_suffix}" >> ${dict_file}
1459 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1463 CMD
="./${BIN} ${OPTS} -a 7 -m ${hash_type} ${hash_file} ${mask} ${dict_file}"
1465 echo "> Testing hash type $hash_type with attack mode 7, markov ${MARKOV}, multi hash with word len ${i}." &>> ${OUTD}/logfull.txt
1467 output=$(./${BIN} ${OPTS} -a 7 -m ${hash_type} ${hash_file} ${mask} ${dict_file} 2>&1)
1471 echo "${output}" >> ${OUTD}/logfull.txt
1473 if [ "${ret}" -eq 0 ]; then
1477 while read -u 9 hash; do
1479 line_dict1=$(sed -n ${j}p ${OUTD}/${hash_type}_dict1_multi_${i})
1480 line_dict2=$(sed -n ${j}p ${OUTD}/${hash_type}_dict2_multi_${i})
1482 if [ ${pass_only} -eq 1 ]; then
1483 search=":${line_dict1}${line_dict2}"
1485 search="${hash}:${line_dict1}${line_dict2}"
1488 echo "${output}" | grep -F "${search}" &> /dev/null
1490 if [ "${?}" -ne 0 ]; then
1500 done 9< ${OUTD}/${hash_type}_hashes_multi_${i}.txt
1510 if [ "${e_nf}" -ne 0 -o "${e_nm}" -ne 0 ]; then
1514 elif [ "${e_to}" -ne 0 ]; then
1520 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
"
1528 > Usage : ${0} <options>
1532 -V OpenCL vector-width (either 1, 2, 4 or 8), overrides value from device query :
1533 '1' => vector-width 1
1534 '2' => vector-width 2 (default)
1535 '4' => vector-width 4
1536 '8' => vector-width 8
1537 'all' => test sequentially vector-width ${VECTOR_WIDTHS}
1539 -T OpenCL device-types to use :
1540 'gpu' => gpu devices (default)
1541 'cpu' => cpu devices
1542 'all' => gpu and cpu devices
1544 -t Select test mode :
1545 'single' => single hash (default)
1546 'multi' => multi hash
1547 'all' => single and multi hash
1549 -m Select hash type :
1550 'all' => all hash type supported
1551 (int) => hash type integer code (default : 0)
1553 -a Select attack mode :
1554 'all' => all attack modes
1555 (int) => attack mode integer code (default : 0)
1557 -x Select cpu architecture :
1558 '32' => 32 bit architecture
1559 '64' => 64 bit architecture (default)
1561 -o Select operating system :
1562 'win' => windows operating system (use .exe file extension etc)
1563 'linux' => *nix based operating systems (.bin for binaries)
1564 'osx' => mac osx operating systems (.app for binaries)
1566 -c Disables markov-chains
1568 -p Package the tests into a .7z file
1570 -d Use this folder as input/output folder for packaged tests
1571 (string) => path to folder
1589 while getopts "V
:T
:t
:m
:a
:b
:hcpd
:x
:o
:" opt; do
1593 if [ ${OPTARG} == "1" ]; then
1595 elif [ ${OPTARG} == "2" ]; then
1597 elif [ ${OPTARG} == "4" ]; then
1599 elif [ ${OPTARG} == "8" ]; then
1601 elif [ ${OPTARG} == "all
" ]; then
1609 if [ ${OPTARG} == "gpu
" ]; then
1610 OPTS="${OPTS} --opencl-device-types 2"
1612 elif [ ${OPTARG} == "cpu
" ]; then
1613 OPTS="${OPTS} --opencl-device-types 1"
1615 elif [ ${OPTARG} == "all
" ]; then
1616 OPTS="${OPTS} --opencl-device-types 1,2"
1624 if [ ${OPTARG} == "single
" ]; then
1626 elif [ ${OPTARG} == "multi
" ]; then
1628 elif [ ${OPTARG} == "all
" ]; then
1636 if [ ${OPTARG} == "all
" ]; then
1644 if [ ${OPTARG} == "all
" ]; then
1646 elif [ ${OPTARG} == "0" ]; then
1648 elif [ ${OPTARG} == "1" ]; then
1650 elif [ ${OPTARG} == "3" ]; then
1652 elif [ ${OPTARG} == "6" ]; then
1654 elif [ ${OPTARG} == "7" ]; then
1662 OPTS="${OPTS} --markov-disable"
1667 PACKAGE_FOLDER=$( echo ${OPTARG} | sed 's!/$!!g' )
1675 if [ ${OPTARG} == "32" ]; then
1677 elif [ ${OPTARG} == "64" ]; then
1685 if [ ${OPTARG} == "win
" ]; then
1687 elif [ ${OPTARG} == "linux
" ]; then
1689 elif [ ${OPTARG} == "osx
" ]; then
1707 if [ "${TYPE}" == "null
" ]; then
1709 OPTS="${OPTS} --opencl-device-types 2"
1712 if [ -n "${ARCHITECTURE}" ]; then
1714 BIN="${BIN}${ARCHITECTURE}"
1718 if [ -n "${EXTENSION}" ]; then
1720 BIN="${BIN}.
${EXTENSION}"
1724 if [ -n "${PACKAGE_FOLDER}" ]; then
1726 if [ ! -e "${PACKAGE_FOLDER}" ]; then
1727 echo "! folder
'${PACKAGE_FOLDER}' does not exist
"
1733 if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then
1735 # check existence of binary
1736 if [ ! -e "${BIN}" ]; then
1737 echo "! ${BIN} not found
, please build binary before run
test.
"
1741 # filter by hash_type
1742 if [ ${HT} -ne 65535 ]; then
1746 for hash_type in $(echo ${HASH_TYPES}); do
1748 if [ ${HT} -ne ${hash_type} ]; then continue; fi
1756 if [ ${check} -ne 1 ]; then
1757 echo "! invalid
hash type selected ...
"
1763 if [ -z "${PACKAGE_FOLDER}" ]; then
1768 # generate random test entry
1769 if [ ${HT} -eq 65535 ]; then
1770 perl tools/test.pl single > ${OUTD}/all.sh
1772 perl tools/test.pl single ${HT} > ${OUTD}/all.sh
1777 OUTD=${PACKAGE_FOLDER}
1781 rm -rf ${OUTD}/logfull.txt && touch ${OUTD}/logfull.txt
1783 # populate array of hash types where we only should check if pass is in output (not both hash:pass)
1784 IFS=';' read -ra PASS_ONLY <<< "${MATCH_PASS_ONLY}"
1785 IFS=';' read -ra TIMEOUT_ALGOS <<< "${SLOW_ALGOS}"
1787 IFS=';' read -ra NEVER_CRACK_ALGOS <<< "${NEVER_CRACK}"
1789 # for these particular algos we need to save the output to a temporary file
1790 IFS=';' read -ra FILE_BASED_ALGOS <<< "${HASHFILE_ONLY}"
1792 for hash_type in $(echo $HASH_TYPES); do
1794 if [[ ${HT} -ne 65535 ]] && [[ ${HT} -ne ${hash_type} ]]; then continue; fi
1796 if [ -z "${PACKAGE_FOLDER}" ]; then
1803 echo "[ ${OUTD} ] > Run packaged
test for hash type $hash_type.
"
1807 if [ "${PACKAGE}" -eq 0 ]; then
1809 # should we check only the pass?
1810 contains ${hash_type} ${PASS_ONLY}
1813 contains ${hash_type} ${SLOW_ALGOS}
1816 if [[ ${hash_type} -eq 400 ]]; then
1817 # we use phpass as slow hash for testing the AMP kernel
1822 VECTOR_OLD=${VECTOR}
1823 for CUR_WIDTH in $(echo $VECTOR_WIDTHS); do
1825 if [ "${VECTOR_OLD}" == "all" ] || [ "${VECTOR_OLD}" == "default" ] || [ "${VECTOR_OLD}" == "${CUR_WIDTH}" ]; then
1827 if [ "${VECTOR_OLD}" == "default
" ] && \
1828 [ "${CUR_WIDTH}" != "1" ] && \
1829 [ "${CUR_WIDTH}" != "4" ]; then
1835 OPTS="${OPTS_OLD} --opencl-vector-width ${VECTOR}"
1837 if [[ ${IS_SLOW} -eq 1 ]]; then
1839 # run attack mode 0 (stdin)
1840 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 0 ]]; then attack_0; fi
1844 # run attack mode 0 (stdin)
1845 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 0 ]]; then attack_0; fi
1847 # run attack mode 1 (combinator)
1848 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 1 ]]; then attack_1; fi
1850 # run attack mode 3 (bruteforce)
1851 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 3 ]]; then attack_3; fi
1853 # run attack mode 6 (dict+mask)
1854 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 6 ]]; then attack_6; fi
1856 # run attack mode 7 (mask+dict)
1857 if [[ ${ATTACK} -eq 65535 ]] || [[ ${ATTACK} -eq 7 ]]; then attack_7; fi
1863 VECTOR="${VECTOR_OLD}"
1869 OUTD=${PACKAGE_FOLDER}
1874 if [ "${PACKAGE}" -eq 0 ]; then
1876 cat -A ${OUTD}/logfull.txt | sed -e 's/\^M \^M//g' | sed -e 's/\$$//g' > ${OUTD}/test_report.log
1880 rm -rf ${OUTD}/logfull.txt
1882 if [ "${PACKAGE}" -eq 1 ]; then
1884 echo "[ ${OUTD} ] > Generate package ${OUTD}/${OUTD}.7z
"
1886 cp "${BASH_SOURCE[0]}" ${OUTD}/test.sh
1888 # if we package from a given folder, we need to check if e.g. the files needed for multi mode are there
1890 if [ -n "${PACKAGE_FOLDER}" ]; then
1894 ls "${PACKAGE_FOLDER}"/*multi* &> /dev/null
1903 HT=$(grep -o -- "-m *[0-9]*" ${PACKAGE_FOLDER}/all.sh | sort -u | sed 's/-m //' 2> /dev/null)
1905 if [ -n "${HT}" ]; then
1907 HT_COUNT=$(echo "${HT}" | wc -l)
1909 if [ "${HT_COUNT}" -gt 1 ]; then
1917 #ATTACK=65535 # more appropriate ?
1920 # for convenience: 'run package' is default action for packaged test.sh ( + add other defaults too )
1922 sed -i -e 's/^\(PACKAGE_FOLDER\)=""/\1="$
( echo "${BASH_SOURCE[0]}" |
sed \"s
!test.sh
\\$
!!\" )"/' \
1923 -e "s
/^\
(HT\
)=0/\
1=${HT}/" \
1924 -e "s
/^\
(MODE\
)=0/\
1=${MODE}/" \
1925 -e "s
/^\
(ATTACK\
)=0/\
1=${ATTACK}/" \
1928 ${PACKAGE_CMD} ${OUTD}/${OUTD}.7z ${OUTD}/ &> /dev/null