mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-22 14:38:55 +00:00
Update edge and backend
On backend.c - Hide 'Runtime returned CL_KERNEL_WORK_GROUP_SIZE ...' with --machine-readable On test_edge.sh - Skip attack types other than Straight with hash types with attack exec outside kernel by default - Override the previous skip with --allow-all-attacks options - Fix inconsistent error messages - Add attack exec filter with -A - Skip output check for hash-types 14000, 14100 and 22000 - Add execution time at the end of tests - Add errors counter and show a message at the end of tests
This commit is contained in:
parent
11a3d0cc74
commit
9c69d320e3
@ -9337,8 +9337,10 @@ static int get_opencl_kernel_wgs (hashcat_ctx_t *hashcat_ctx, hc_device_param_t
|
||||
if (kernel_threads < cwgs_total)
|
||||
{
|
||||
// Very likely some bug, because the runtime was unable to follow our requirement to run N threads guaranteed on this kernel
|
||||
|
||||
event_log_warning (hashcat_ctx, "* Device #%u: Runtime returned CL_KERNEL_WORK_GROUP_SIZE=%d, but CL_KERNEL_COMPILE_WORK_GROUP_SIZE=%d. Use -T%d if you run into problems.", device_param->device_id + 1, (int) kernel_threads, (int) cwgs_total, (int) kernel_threads);
|
||||
if (user_options->machine_readable == false)
|
||||
{
|
||||
event_log_warning (hashcat_ctx, "* Device #%u: Runtime returned CL_KERNEL_WORK_GROUP_SIZE=%d, but CL_KERNEL_COMPILE_WORK_GROUP_SIZE=%d. Use -T%d if you run into problems.", device_param->device_id + 1, (int) kernel_threads, (int) cwgs_total, (int) kernel_threads);
|
||||
}
|
||||
}
|
||||
|
||||
kernel_threads = cwgs_total;
|
||||
|
@ -19,6 +19,8 @@ function usage()
|
||||
echo " --hash-type-min <arg> : set min hash-type (default: 0)"
|
||||
echo " --hash-type-max <arg> : set max hash-type (default: 99999)"
|
||||
echo ""
|
||||
echo "-A / --attack-exec <arg> : set Attack Exec Type (default: all. supported: 0 (Inside kernel), 1 (Outside kernel)"
|
||||
echo ""
|
||||
echo "-a / --attack-type <arg> : set Attack Type or a list of comma-separated Attack Types"
|
||||
echo " (default: all. supported: 0 (Straight), 1 (Combination), 3 (Brute-force), 6 (Hybrid Wordlist + Mask), 7 (Hybrid Mask + Wordlist))"
|
||||
echo "-K / --kernel-type <arg> : set Kernel Type (default: all. supported: 0 (Pure), 1 (Optimized))"
|
||||
@ -41,6 +43,8 @@ function usage()
|
||||
echo ""
|
||||
echo " --backend-devices-keepfree : Keep specified percentage of device memory free (default: disabled. supported: from 1 to 100)"
|
||||
echo ""
|
||||
echo " --allow-all-attacks : Do not skip attack types other than Straight with hash types with attack exec outside kernel"
|
||||
echo ""
|
||||
echo "-f / --force : run hashcat using --force"
|
||||
echo ""
|
||||
echo "-v / --verbose : show debug messages (supported: -v or -vv)"
|
||||
@ -65,14 +69,16 @@ export LANG=C
|
||||
|
||||
OUTD="test_edge_$(date +%s)"
|
||||
|
||||
HASH_TYPE=all
|
||||
HASH_TYPE="all"
|
||||
HASH_TYPE_MIN=0
|
||||
HASH_TYPE_MAX=99999
|
||||
ATTACK_TYPE=all
|
||||
ATTACK_EXEC="all"
|
||||
ATTACK_EXECS="0 1"
|
||||
ATTACK_TYPE="all"
|
||||
ATTACK_TYPES="0 1 3 6 7"
|
||||
KERNEL_TYPE=all
|
||||
TARGET_TYPE=all
|
||||
VECTOR_WIDTH=all
|
||||
KERNEL_TYPE="all"
|
||||
TARGET_TYPE="all"
|
||||
VECTOR_WIDTH="all"
|
||||
VECTOR_WIDTHS="1 2 4 8 16"
|
||||
VECTOR_WIDTH_MIN=1
|
||||
VECTOR_WIDTH_MAX=16
|
||||
@ -84,6 +90,7 @@ RUNTIME_MAX=270 # 4.5 min
|
||||
METAL_BACKEND=0
|
||||
METAL_COMPILER_RUNTIME=120
|
||||
BACKEND_DEVICES_KEEPFREE=0
|
||||
ALL_ATTACKS=0
|
||||
|
||||
OPTS="--quiet --potfile-disable --hwmon-disable --self-test-disable --machine-readable --logfile-disable"
|
||||
|
||||
@ -91,7 +98,7 @@ SKIP_HASH_TYPES="" #2000 2500 2501 16800 16801 99999 32000"
|
||||
SKIP_HASH_TYPES_METAL="" #1800 10700 11700 11750 11760 11800 11850 11860 19200 21600"
|
||||
SKIP_METAL_SCRYPT="" #8900 15700 9300 22700 27700 28200 29800"
|
||||
|
||||
SKIP_OUT_MATCH_HASH_TYPES="" #14000 14100 18100 22000"
|
||||
SKIP_OUT_MATCH_HASH_TYPES="14000 14100 22000"
|
||||
SKIP_SAME_SALT_HASH_TYPES="6600 7100 7200 8200 13200 13400 15300 15310 15900 15910 16900 18300 18900 20200 20300 20400 27000 27100 29700 29930 29940"
|
||||
#SKIP_SAME_SALT_HASH_TYPES="400 3200 5800 6400 6500 6600 6700 7100 7200 7401 7900 8200 9100 9200 9400 10500 10901 12001 12200 12300 12400 12500 12700 12800 12900 13000 13200 13400 13600 14700 14800 15100 15200 15300 15310 15400 15600 15900 15910 16200 16300 16700 16900 18300 18400 18800 18900 19000 19100 19600 19700 19800 19900 20011 20012 20013 20200 20300 20400 21501 22100 22400 22600 23100 23300 23500 23600 23700 23900 24100 24200 24410 24420 24500 25300 25400 25500 25600 25800 26100 26500 26600 27000 27100 27400 27500 27600 28100 28400 28600 28800 28900 29600 29700 29910 29920 29930 29940 30600 31200 31900"
|
||||
|
||||
@ -125,6 +132,10 @@ while [[ $# -gt 0 ]]; do
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--allow-all-attacks)
|
||||
ALL_ATTACKS=1
|
||||
shift
|
||||
;;
|
||||
--vector-width-min)
|
||||
if [[ "$2" =~ ^(1|2|4|8|16)$ ]]; then
|
||||
VECTOR_WIDTH_MIN=$2
|
||||
@ -363,6 +374,7 @@ while [[ $# -gt 0 ]]; do
|
||||
if [[ "$optarg" == "all" ]]; then
|
||||
:
|
||||
else
|
||||
ATTACK_TYPE=""
|
||||
ATTACK_TYPES=""
|
||||
|
||||
IFS=',' read -ra INPUT_ATTACK_TYPES <<< "$optarg"
|
||||
@ -410,6 +422,50 @@ while [[ $# -gt 0 ]]; do
|
||||
|
||||
[[ "$shift_inline" -eq 0 ]] && shift
|
||||
|
||||
break
|
||||
;;
|
||||
A)
|
||||
if (( i + 1 < ${#optstring} )); then
|
||||
optarg="${optstring:$((i+1))}"
|
||||
shift_inline=1
|
||||
elif [[ -n "$2" && "$2" != -* ]]; then
|
||||
optarg="$2"
|
||||
shift_inline=0
|
||||
else
|
||||
echo "Error: -A requires an argument"
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ "$optarg" == -* ]]; then
|
||||
echo "Error: -A requires a valid argument, not another option (-$optarg)"
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ "$optarg" == "all" ]]; then
|
||||
:
|
||||
elif [[ "$optarg" =~ ^(0|1)$ ]]; then
|
||||
|
||||
ATTACK_EXEC=""
|
||||
ATTACK_EXECS=""
|
||||
|
||||
IFS=',' read -ra INPUT_ATTACK_EXECS <<< "$optarg"
|
||||
for atk in "${INPUT_ATTACK_EXECS[@]}"; do
|
||||
if [[ "$atk" =~ ^(0|1)$ ]]; then
|
||||
ATTACK_EXECS+=" $atk"
|
||||
else
|
||||
echo "Invalid attack exec: $atk"
|
||||
usage
|
||||
fi
|
||||
done
|
||||
|
||||
ATTACK_EXECS="$(echo "$ATTACK_EXECS" | xargs)" # Trim leading/trailing spaces
|
||||
else
|
||||
echo "Invalid kernel type: $optarg"
|
||||
usage
|
||||
fi
|
||||
|
||||
[[ "$shift_inline" -eq 0 ]] && shift
|
||||
|
||||
break
|
||||
;;
|
||||
*)
|
||||
@ -467,6 +523,9 @@ if [ ${VERBOSE} -ge 1 ]; then
|
||||
echo "Global hashcat options selected: ${OPTS}"
|
||||
fi
|
||||
|
||||
errors=0
|
||||
startTime=$(date +%s)
|
||||
|
||||
mkdir -p ${OUTD} &> /dev/null
|
||||
|
||||
for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 | awk '{print $1+=0}'); do
|
||||
@ -506,8 +565,6 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
|
||||
for attack_type in ${ATTACK_TYPES}; do
|
||||
|
||||
if [ $ATTACK_TYPE != "all" ] && [ $ATTACK_TYPE -ne $attack_type ]; then continue; fi
|
||||
|
||||
kernel_types=$(./hashcat -m ${hash_type} -HH | grep 'Kernel.Type(s' | cut -d: -f2 | xargs | sed -e 's/,//g')
|
||||
|
||||
for kernel_type in ${kernel_types}; do
|
||||
@ -522,7 +579,32 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
CUR_OPTS="${CUR_OPTS} -O"
|
||||
fi
|
||||
|
||||
if [ $KERNEL_TYPE != "all" ] && [ $KERNEL_TYPE -ne $optimized ]; then continue; fi
|
||||
if [ "$KERNEL_TYPE" != "all" ] && [ $KERNEL_TYPE -ne $optimized ]; then continue; fi
|
||||
|
||||
slow_hash=0
|
||||
tmp_slow_hash=$(./hashcat -m ${hash_type} -HH | grep Slow\\.Hash | awk '{print $2}')
|
||||
if [ "${tmp_slow_hash}" == "Yes" ]; then
|
||||
slow_hash=1
|
||||
fi
|
||||
|
||||
if [ "$ATTACK_EXEC" != "all" ] && ! is_in_array "${slow_hash}" ${ATTACK_EXECS}; then continue; fi
|
||||
|
||||
if [ $slow_hash -eq 1 ]; then
|
||||
if [ "$ATTACK_EXEC" == "all" ] || is_in_array "1" ${ATTACK_EXECS}; then
|
||||
if is_in_array "0" ${ATTACK_TYPES} && [ "$ALL_ATTACKS" -eq 0 ]; then
|
||||
if [ $attack_type -ne 0 ]; then
|
||||
if [ $HASH_TYPE == "all" ] && [ $hash_type -ne 400 ]; then
|
||||
if [ ${VERBOSE} -ge 2 ]; then
|
||||
echo "[ ${OUTD} ] > Skip processing Hash-Type ${hash_type} with Attack-Type ${attack_type} and Kernel-Type ${kernel_type} (disabled on ATTACK_EXEC_OUTSIDE_KERNEL by default)" | tee -a ${OUTD}/test_edge.details.log
|
||||
else
|
||||
echo "[ ${OUTD} ] > Skip processing Hash-Type ${hash_type} with Attack-Type ${attack_type} and Kernel-Type ${kernel_type} (disabled on ATTACK_EXEC_OUTSIDE_KERNEL by default)" >> ${OUTD}/test_edge.details.log
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
tmp_salt=$(./hashcat -m ${hash_type} -HH | grep Salt\\.Type)
|
||||
have_salt=$?
|
||||
@ -535,12 +617,6 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
fi
|
||||
fi
|
||||
|
||||
slow_hash=0
|
||||
tmp_slow_hash=$(./hashcat -m ${hash_type} -HH | grep Slow\\.Hash | awk '{print $2}')
|
||||
if [ "${tmp_slow_hash}" == "Yes" ]; then
|
||||
slow_hash=1
|
||||
fi
|
||||
|
||||
pt_hex=0
|
||||
tmp_pw_type=$(./hashcat -m ${hash_type} -HH | grep Password\\.Type | awk '{print $2}')
|
||||
if [ "${tmp_pw_type}" == "HEX" ]; then
|
||||
@ -562,6 +638,7 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
check_hash=$(cat ${edge_out} | cut -d, -f8- | head -1)
|
||||
if [ ${#check_hash} -eq 2 ] || [ ${#check_hash} -eq 3 ]; then
|
||||
echo "[ ${OUTD} ] !> error detected with Hash-Type ${hash_type}: empty test vectors" | tee -a ${OUTD}/test_edge.details.log
|
||||
((errors++))
|
||||
break
|
||||
fi
|
||||
|
||||
@ -716,6 +793,7 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
echo "[ ${OUTD} ] !> Hash-Type ${hash_type}, Attack-Type ${attack_type}, Kernel-Type ${kernel_type}, Vector-Width ${vector_width}, Test ID ${i}, Word len ${word_len}, Salt len ${salt_len}, Word '${word}', Hash ${hash}" | tee -a ${OUTD}/test_edge.details.log
|
||||
cat ${cmd_out} | tee -a ${OUTD}/test_edge.details.log
|
||||
echo '```' | tee -a ${OUTD}/test_edge.details.log
|
||||
((errors++))
|
||||
|
||||
if [ "${retVal}" -eq 250 ]; then
|
||||
echo "[ ${OUTD} ] > Skipping current tests due to build error ..." | tee -a ${OUTD}/test_edge.details.log
|
||||
@ -751,16 +829,17 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
|
||||
if [ $md5_1 != $md5_2 ]; then
|
||||
echo '```' | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "[ ${OUTD} ] !> error detected with CMD: ${CMD}" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "[ ${OUTD} ] !> error detected (output don't match) with CMD: ${CMD}" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "[ ${OUTD} ] !> Hash-Type ${hash_type}, Attack-Type ${attack_type}, Kernel-Type ${kernel_type}, Vector-Width ${vector_width}, Test ID ${i}, Word len ${word_len}, Salt len ${salt_len}, Word '${word}', Salt '${salt}', Hash ${hash}" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "[ ${OUTD} ] !> output don't match" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "! output" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo | tee -a ${OUTD}/test_edge.details.log
|
||||
echo ${out} | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "${out}" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "! expected output" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo | tee -a ${OUTD}/test_edge.details.log
|
||||
echo ${hc_out} | tee -a ${OUTD}/test_edge.details.log
|
||||
echo "${hc_out}" | tee -a ${OUTD}/test_edge.details.log
|
||||
echo '```' | tee -a ${OUTD}/test_edge.details.log
|
||||
((errors++))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@ -979,6 +1058,7 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
echo "[ ${OUTD} ] !> Hash-Type ${hash_type}, Attack-Type ${attack_type}, Kernel-Type ${kernel_type}, Vector-Width ${vector_width}, Words ${word_in}, Hashes ${hash_in}" | tee -a ${OUTD}/test_edge.details.log
|
||||
cat ${cmd_out} | tee -a ${OUTD}/test_edge.details.log
|
||||
echo '```' | tee -a ${OUTD}/test_edge.details.log
|
||||
((errors++))
|
||||
|
||||
if [ "${retVal}" -eq 250 ]; then
|
||||
echo "[ ${OUTD} ] > Skipping current tests due to build error ..." | tee -a ${OUTD}/test_edge.details.log
|
||||
@ -1013,6 +1093,7 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
echo | tee -a ${OUTD}/test_edge.details.log
|
||||
cat ${hc_out} | sort -s | tee -a ${OUTD}/test_edge.details.log
|
||||
echo '```' | tee -a ${OUTD}/test_edge.details.log
|
||||
((errors++))
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -1025,3 +1106,18 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 |
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
endTime=$(date +%s)
|
||||
elapsed=$((endTime - startTime))
|
||||
|
||||
days=$((elapsed / 86400))
|
||||
hours=$(((elapsed % 86400) / 3600))
|
||||
minutes=$(((elapsed % 3600) / 60))
|
||||
seconds=$((elapsed % 60))
|
||||
|
||||
echo "[ ${OUTD} ] > All tests done in ${days}d:$(printf "%02dh:%02dm:%02ds" "$hours" "$minutes" "$seconds")"
|
||||
|
||||
echo "[ ${OUTD} ] > Errors detected: $errors"
|
||||
if [ $errors -gt 0 ]; then
|
||||
echo "[ ${OUTD} ] !> Details on ${OUTD}/test_edge.details.log"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user