2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
19 #include <rp_kernel_on_cpu.h>
22 const char *PROGNAME
= "hashcat";
23 const uint VERSION_BIN
= 300;
24 const uint RESTORE_MIN
= 300;
26 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
28 #define INCR_RULES 10000
29 #define INCR_SALTS 100000
30 #define INCR_MASKS 1000
36 #define MARKOV_THRESHOLD 0
37 #define MARKOV_DISABLE 0
38 #define MARKOV_CLASSIC 0
42 #define RESTORE_TIMER 60
43 #define RESTORE_DISABLE 0
45 #define STATUS_TIMER 10
46 #define MACHINE_READABLE 0
48 #define WEAK_HASH_THRESHOLD 100
53 #define REMOVE_TIMER 60
57 #define POTFILE_DISABLE 0
60 #define RP_GEN_FUNC_MIN 1
61 #define RP_GEN_FUNC_MAX 4
63 #define RULE_BUF_L ":"
64 #define RULE_BUF_R ":"
69 #define HEX_WORDLIST 0
70 #define OUTFILE_FORMAT 3
71 #define OUTFILE_AUTOHEX 1
72 #define OUTFILE_CHECK_TIMER 5
75 #define SEGMENT_SIZE 32
77 #define INCREMENT_MIN 1
78 #define INCREMENT_MAX PW_MAX
82 #define NVIDIA_SPIN_DAMP 100
83 #define GPU_TEMP_DISABLE 0
84 #define GPU_TEMP_ABORT 90
85 #define GPU_TEMP_RETAIN 75
86 #define WORKLOAD_PROFILE 2
87 #define KERNEL_ACCEL 0
88 #define KERNEL_LOOPS 0
89 #define KERNEL_RULES 1024
90 #define KERNEL_COMBS 1024
91 #define KERNEL_BFS 1024
92 #define KERNEL_THREADS_MAX 256
93 #define KERNEL_THREADS_MAX_CPU 1
94 #define POWERTUNE_ENABLE 0
95 #define LOGFILE_DISABLE 0
97 #define OPENCL_VECTOR_WIDTH 0
99 #define WL_MODE_STDIN 1
100 #define WL_MODE_FILE 2
101 #define WL_MODE_MASK 3
103 #define HL_MODE_FILE 4
104 #define HL_MODE_ARG 5
106 #define HLFMTS_CNT 11
107 #define HLFMT_HASHCAT 0
108 #define HLFMT_PWDUMP 1
109 #define HLFMT_PASSWD 2
110 #define HLFMT_SHADOW 3
113 #define HLFMT_NETNTLM1 7
114 #define HLFMT_NETNTLM2 8
115 #define HLFMT_NSLDAP 9
116 #define HLFMT_NSLDAPS 10
118 #define HLFMT_TEXT_HASHCAT "native hashcat"
119 #define HLFMT_TEXT_PWDUMP "pwdump"
120 #define HLFMT_TEXT_PASSWD "passwd"
121 #define HLFMT_TEXT_SHADOW "shadow"
122 #define HLFMT_TEXT_DCC "DCC"
123 #define HLFMT_TEXT_DCC2 "DCC 2"
124 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
125 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
126 #define HLFMT_TEXT_NSLDAP "nsldap"
127 #define HLFMT_TEXT_NSLDAPS "nsldaps"
129 #define ATTACK_MODE_STRAIGHT 0
130 #define ATTACK_MODE_COMBI 1
131 #define ATTACK_MODE_TOGGLE 2
132 #define ATTACK_MODE_BF 3
133 #define ATTACK_MODE_PERM 4
134 #define ATTACK_MODE_TABLE 5
135 #define ATTACK_MODE_HYBRID1 6
136 #define ATTACK_MODE_HYBRID2 7
137 #define ATTACK_MODE_NONE 100
139 #define ATTACK_KERN_STRAIGHT 0
140 #define ATTACK_KERN_COMBI 1
141 #define ATTACK_KERN_BF 3
142 #define ATTACK_KERN_NONE 100
144 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
145 #define ATTACK_EXEC_INSIDE_KERNEL 11
147 #define COMBINATOR_MODE_BASE_LEFT 10001
148 #define COMBINATOR_MODE_BASE_RIGHT 10002
150 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
151 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
153 #define MAX_CUT_TRIES 4
155 #define MAX_DICTSTAT 10000
157 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
159 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
161 #define global_free(attr) \
163 myfree ((void *) data.attr); \
168 #define local_free(attr) \
170 myfree ((void *) attr); \
175 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
176 #define HC_API_CALL __stdcall
181 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
332 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
338 static unsigned int full01
= 0x01010101;
339 static unsigned int full80
= 0x80808080;
341 int SUPPRESS_OUTPUT
= 0;
343 hc_thread_mutex_t mux_adl
;
344 hc_thread_mutex_t mux_counter
;
345 hc_thread_mutex_t mux_dispatcher
;
346 hc_thread_mutex_t mux_display
;
348 hc_global_data_t data
;
350 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
352 const char *USAGE_MINI
[] =
354 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
356 "Try --help for more help.",
360 const char *USAGE_BIG
[] =
362 "%s, advanced password recovery",
364 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
368 " Options Short / Long | Type | Description | Example",
369 "===============================+======+======================================================+=======================",
370 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
371 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
372 " -V, --version | | Print version |",
373 " -h, --help | | Print help |",
374 " --quiet | | Suppress output |",
375 " --hex-charset | | Assume charset is given in hex |",
376 " --hex-salt | | Assume salt is given in hex |",
377 " --hex-wordlist | | Assume words in wordlist is given in hex |",
378 " --force | | Ignore warnings |",
379 " --status | | Enable automatic update of the status-screen |",
380 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
381 " --machine-readable | | Display the status view in a machine readable format |",
382 " --loopback | | Add new plains to induct directory |",
383 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
384 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
385 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
386 " --markov-classic | | Enables classic markov-chains, no per-position |",
387 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
388 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
389 " --session | Str | Define specific session name | --session=mysession",
390 " --restore | | Restore session from --session |",
391 " --restore-disable | | Do not write restore file |",
392 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
393 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
394 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
395 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
396 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
397 " --stdout | | Do not crack a hash, instead print candidates only |",
398 " --show | | Compare hashlist with potfile; Show cracked hashes |",
399 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
400 " --username | | Enable ignoring of usernames in hashfile |",
401 " --remove | | Enable remove of hash once it is cracked |",
402 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
403 " --potfile-disable | | Do not write potfile |",
404 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
405 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
406 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
407 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
408 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
409 " --logfile-disable | | Disable the logfile |",
410 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
411 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
412 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
413 " -b, --benchmark | | Run benchmark |",
414 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
415 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
416 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
417 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
418 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
419 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
420 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
421 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
422 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
423 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
424 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
425 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
426 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
428 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
429 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
430 " --powertune-enable | | Enable power tuning, restores settings when finished |",
432 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
433 " -s, --skip | Num | Skip X words from the start | -s 1000000",
434 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
435 " --keyspace | | Show keyspace base:mod values and quit |",
436 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
437 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
438 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
439 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
440 " --generate-rules-func-min | Num | Force min X funcs per rule |",
441 " --generate-rules-func-max | Num | Force max X funcs per rule |",
442 " --generate-rules-seed | Num | Force RNG seed set to X |",
443 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
444 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
445 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
446 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
447 " -i, --increment | | Enable mask increment mode |",
448 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
449 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
451 "- [ Hash modes ] -",
453 " # | Name | Category",
454 " ======+==================================================+======================================",
455 " 900 | MD4 | Raw Hash",
456 " 0 | MD5 | Raw Hash",
457 " 5100 | Half MD5 | Raw Hash",
458 " 100 | SHA1 | Raw Hash",
459 " 10800 | SHA-384 | Raw Hash",
460 " 1400 | SHA-256 | Raw Hash",
461 " 1700 | SHA-512 | Raw Hash",
462 " 5000 | SHA-3(Keccak) | Raw Hash",
463 " 10100 | SipHash | Raw Hash",
464 " 6000 | RipeMD160 | Raw Hash",
465 " 6100 | Whirlpool | Raw Hash",
466 " 6900 | GOST R 34.11-94 | Raw Hash",
467 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
468 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
469 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
471 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
472 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
473 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
474 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
475 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
476 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
477 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
478 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
479 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
480 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
481 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
482 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
483 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
484 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
485 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
486 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
487 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
488 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
489 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
490 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
491 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
492 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
493 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
494 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
495 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
496 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
497 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
498 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
499 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
500 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
501 " 400 | phpass | Generic KDF",
502 " 8900 | scrypt | Generic KDF",
503 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
504 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
505 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
506 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
507 " 23 | Skype | Network protocols",
508 " 2500 | WPA/WPA2 | Network protocols",
509 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
510 " 5300 | IKE-PSK MD5 | Network protocols",
511 " 5400 | IKE-PSK SHA1 | Network protocols",
512 " 5500 | NetNTLMv1 | Network protocols",
513 " 5500 | NetNTLMv1 + ESS | Network protocols",
514 " 5600 | NetNTLMv2 | Network protocols",
515 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
516 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
517 " 8300 | DNSSEC (NSEC3) | Network protocols",
518 " 10200 | Cram MD5 | Network protocols",
519 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
520 " 11200 | MySQL CRAM (SHA1) | Network protocols",
521 " 11400 | SIP digest authentication (MD5) | Network protocols",
522 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
523 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
524 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
525 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
526 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
527 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
528 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
529 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
530 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
531 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
532 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
533 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
534 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
535 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
536 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
537 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
538 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
539 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
540 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
541 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
542 " 12 | PostgreSQL | Database Server",
543 " 131 | MSSQL(2000) | Database Server",
544 " 132 | MSSQL(2005) | Database Server",
545 " 1731 | MSSQL(2012) | Database Server",
546 " 1731 | MSSQL(2014) | Database Server",
547 " 200 | MySQL323 | Database Server",
548 " 300 | MySQL4.1/MySQL5 | Database Server",
549 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
550 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
551 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
552 " 8000 | Sybase ASE | Database Server",
553 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
554 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
555 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
556 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
557 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
558 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
559 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
560 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
561 " 11500 | CRC32 | Checksums",
562 " 3000 | LM | Operating-Systems",
563 " 1000 | NTLM | Operating-Systems",
564 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
565 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
566 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
567 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
568 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
569 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
570 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
571 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
572 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
573 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
574 " 1722 | OSX v10.7 | Operating-Systems",
575 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
576 " 6300 | AIX {smd5} | Operating-Systems",
577 " 6700 | AIX {ssha1} | Operating-Systems",
578 " 6400 | AIX {ssha256} | Operating-Systems",
579 " 6500 | AIX {ssha512} | Operating-Systems",
580 " 2400 | Cisco-PIX | Operating-Systems",
581 " 2410 | Cisco-ASA | Operating-Systems",
582 " 500 | Cisco-IOS $1$ | Operating-Systems",
583 " 5700 | Cisco-IOS $4$ | Operating-Systems",
584 " 9200 | Cisco-IOS $8$ | Operating-Systems",
585 " 9300 | Cisco-IOS $9$ | Operating-Systems",
586 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
587 " 501 | Juniper IVE | Operating-Systems",
588 " 5800 | Android PIN | Operating-Systems",
589 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
590 " 8100 | Citrix Netscaler | Operating-Systems",
591 " 8500 | RACF | Operating-Systems",
592 " 7200 | GRUB 2 | Operating-Systems",
593 " 9900 | Radmin2 | Operating-Systems",
594 " 125 | ArubaOS | Operating-Systems",
595 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
596 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
597 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
598 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
599 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
600 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
601 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
602 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
603 " 11600 | 7-Zip | Archives",
604 " 12500 | RAR3-hp | Archives",
605 " 13000 | RAR5 | Archives",
606 " 13200 | AxCrypt | Archives",
607 " 13300 | AxCrypt in memory SHA1 | Archives",
608 " 13600 | WinZip | Archives",
609 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
610 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
611 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
612 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
613 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
614 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
615 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
616 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
617 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
618 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
619 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
623 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
624 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
625 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
626 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
627 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
628 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
629 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
630 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
631 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
632 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
633 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
634 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
635 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
636 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
637 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
638 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
639 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
640 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
641 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
642 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
643 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
644 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
645 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
646 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
647 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
648 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
649 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
650 " 9400 | MS Office 2007 | Documents",
651 " 9500 | MS Office 2010 | Documents",
652 " 9600 | MS Office 2013 | Documents",
653 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
654 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
655 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
656 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
657 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
658 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
659 " 9000 | Password Safe v2 | Password Managers",
660 " 5200 | Password Safe v3 | Password Managers",
661 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
662 " 6600 | 1Password, agilekeychain | Password Managers",
663 " 8200 | 1Password, cloudkeychain | Password Managers",
664 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
665 " 12700 | Blockchain, My Wallet | Password Managers",
666 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
668 "- [ Outfile Formats ] -",
674 " 3 | hash[:salt]:plain",
676 " 5 | hash[:salt]:hex_plain",
677 " 6 | plain:hex_plain",
678 " 7 | hash[:salt]:plain:hex_plain",
680 " 9 | hash[:salt]:crack_pos",
681 " 10 | plain:crack_pos",
682 " 11 | hash[:salt]:plain:crack_pos",
683 " 12 | hex_plain:crack_pos",
684 " 13 | hash[:salt]:hex_plain:crack_pos",
685 " 14 | plain:hex_plain:crack_pos",
686 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
688 "- [ Rule Debugging Modes ] -",
693 " 2 | Original-Word",
694 " 3 | Original-Word:Finding-Rule",
695 " 4 | Original-Word:Finding-Rule:Processed-Word",
697 "- [ Attack Modes ] -",
704 " 6 | Hybrid Wordlist + Mask",
705 " 7 | Hybrid Mask + Wordlist",
707 "- [ Built-in Charsets ] -",
711 " l | abcdefghijklmnopqrstuvwxyz",
712 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
714 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
718 "- [ OpenCL Device Types ] -",
721 " ===+=============",
724 " 3 | FPGA, DSP, Co-Processor",
726 "- [ Workload Profiles ] -",
728 " # | Performance | Runtime | Power Consumption | Desktop Impact",
729 " ===+=============+=========+===================+=================",
730 " 1 | Low | 2 ms | Low | Minimal",
731 " 2 | Default | 12 ms | Economic | Noticeable",
732 " 3 | High | 96 ms | High | Unresponsive",
733 " 4 | Nightmare | 480 ms | Insane | Headless",
735 "- [ Basic Examples ] -",
737 " Attack- | Hash- |",
738 " Mode | Type | Example command",
739 " ==================+=======+==================================================================",
740 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
741 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
742 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
743 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
745 "If you still have no idea what just happened try following pages:",
747 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
748 "* https://hashcat.net/wiki/#frequently_asked_questions",
753 * hashcat specific functions
756 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
758 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
760 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
762 double exec_ms_sum
= 0;
766 for (int i
= 0; i
< last_num_entries
; i
++)
768 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
772 exec_ms_sum
+= exec_ms
;
778 if (exec_ms_cnt
== 0) return 0;
780 return exec_ms_sum
/ exec_ms_cnt
;
783 void status_display_machine_readable ()
787 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
793 fprintf (out
, "SPEED\t");
795 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
797 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
799 if (device_param
->skipped
) continue;
804 for (int i
= 0; i
< SPEED_CACHE
; i
++)
806 speed_cnt
+= device_param
->speed_cnt
[i
];
807 speed_ms
+= device_param
->speed_ms
[i
];
810 speed_cnt
/= SPEED_CACHE
;
811 speed_ms
/= SPEED_CACHE
;
813 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
820 fprintf (out
, "EXEC_RUNTIME\t");
822 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
824 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
826 if (device_param
->skipped
) continue;
828 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
830 fprintf (out
, "%f\t", exec_ms_avg
);
837 u64 words_cur
= get_lowest_words_done ();
839 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
845 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
848 u64 all_rejected
= 0;
849 u64 all_restored
= 0;
851 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
853 all_done
+= data
.words_progress_done
[salt_pos
];
854 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
855 all_restored
+= data
.words_progress_restored
[salt_pos
];
858 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
859 u64 progress_end
= progress_total
;
861 u64 progress_skip
= 0;
865 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
867 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
868 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
869 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
874 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
876 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
877 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
878 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
881 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
882 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
884 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
890 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
891 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
898 if (data
.gpu_temp_disable
== 0)
900 fprintf (out
, "TEMP\t");
902 hc_thread_mutex_lock (mux_adl
);
904 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
906 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
908 if (device_param
->skipped
) continue;
910 int temp
= hm_get_temperature_with_device_id (device_id
);
912 fprintf (out
, "%d\t", temp
);
915 hc_thread_mutex_unlock (mux_adl
);
927 void status_display ()
929 if (data
.devices_status
== STATUS_INIT
) return;
930 if (data
.devices_status
== STATUS_STARTING
) return;
932 // in this case some required buffers are free'd, ascii_digest() would run into segfault
933 if (data
.shutdown_inner
== 1) return;
935 if (data
.machine_readable
== 1)
937 status_display_machine_readable ();
942 char tmp_buf
[1000] = { 0 };
946 log_info ("Session.Name...: %s", data
.session
);
948 char *status_type
= strstatus (data
.devices_status
);
950 uint hash_mode
= data
.hash_mode
;
952 char *hash_type
= strhashtype (hash_mode
); // not a bug
954 log_info ("Status.........: %s", status_type
);
960 if (data
.rp_files_cnt
)
964 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
966 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
969 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
971 log_info ("Rules.Type.....: %s", tmp_buf
);
978 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
980 if (data
.rp_gen_seed
)
982 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
990 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
992 if (data
.wordlist_mode
== WL_MODE_FILE
)
994 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
996 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
998 log_info ("Input.Mode.....: Pipe");
1001 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1003 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1004 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1006 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1008 char *mask
= data
.mask
;
1012 uint mask_len
= data
.css_cnt
;
1014 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1018 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1020 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1022 mask_len
-= data
.salts_buf
[0].salt_len
;
1026 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1028 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1031 if (data
.maskcnt
> 1)
1033 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1035 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1038 log_info ("Input.Mode.....: %s", tmp_buf
);
1043 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1045 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1046 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1048 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1050 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1051 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1054 if (data
.digests_cnt
== 1)
1056 if (data
.hash_mode
== 2500)
1058 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1060 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1061 (char *) data
.salts_buf
[0].salt_buf
,
1075 else if (data
.hash_mode
== 5200)
1077 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1079 else if (data
.hash_mode
== 9000)
1081 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1083 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1085 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1087 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1089 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1093 char out_buf
[HCBUFSIZ
] = { 0 };
1095 ascii_digest (out_buf
, 0, 0);
1098 if (strlen (out_buf
) > 40)
1106 log_info ("Hash.Target....: %s", out_buf
);
1111 if (data
.hash_mode
== 3000)
1113 char out_buf1
[32] = { 0 };
1114 char out_buf2
[32] = { 0 };
1116 ascii_digest (out_buf1
, 0, 0);
1117 ascii_digest (out_buf2
, 0, 1);
1119 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1123 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1127 log_info ("Hash.Type......: %s", hash_type
);
1133 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1134 double speed_ms
[DEVICES_MAX
] = { 0 };
1136 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1138 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1140 if (device_param
->skipped
) continue;
1142 speed_cnt
[device_id
] = 0;
1143 speed_ms
[device_id
] = 0;
1145 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1147 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1148 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1151 speed_cnt
[device_id
] /= SPEED_CACHE
;
1152 speed_ms
[device_id
] /= SPEED_CACHE
;
1155 double hashes_all_ms
= 0;
1157 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1159 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1161 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1163 if (device_param
->skipped
) continue;
1165 hashes_dev_ms
[device_id
] = 0;
1167 if (speed_ms
[device_id
])
1169 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1171 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1179 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1181 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1183 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1185 if (device_param
->skipped
) continue;
1187 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1189 exec_all_ms
[device_id
] = exec_ms_avg
;
1196 double ms_running
= 0;
1198 hc_timer_get (data
.timer_running
, ms_running
);
1200 double ms_paused
= data
.ms_paused
;
1202 if (data
.devices_status
== STATUS_PAUSED
)
1204 double ms_paused_tmp
= 0;
1206 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1208 ms_paused
+= ms_paused_tmp
;
1213 __time64_t sec_run
= ms_running
/ 1000;
1217 time_t sec_run
= ms_running
/ 1000;
1223 char display_run
[32] = { 0 };
1227 struct tm
*tmp
= NULL
;
1231 tmp
= _gmtime64 (&sec_run
);
1235 tmp
= gmtime (&sec_run
);
1241 memset (&tm_run
, 0, sizeof (tm_run
));
1243 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1245 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1247 char *start
= ctime (&data
.proc_start
);
1249 size_t start_len
= strlen (start
);
1251 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1252 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1254 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1259 log_info ("Time.Started...: 0 secs");
1266 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1269 u64 all_rejected
= 0;
1270 u64 all_restored
= 0;
1272 u64 progress_noneed
= 0;
1274 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1276 all_done
+= data
.words_progress_done
[salt_pos
];
1277 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1278 all_restored
+= data
.words_progress_restored
[salt_pos
];
1280 // Important for ETA only
1282 if (data
.salts_shown
[salt_pos
] == 1)
1284 const u64 all
= data
.words_progress_done
[salt_pos
]
1285 + data
.words_progress_rejected
[salt_pos
]
1286 + data
.words_progress_restored
[salt_pos
];
1288 const u64 left
= data
.words_cnt
- all
;
1290 progress_noneed
+= left
;
1294 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1295 u64 progress_end
= progress_total
;
1297 u64 progress_skip
= 0;
1301 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1303 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1304 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1305 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1310 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1312 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1313 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1314 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1317 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1318 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1320 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1322 if (data
.devices_status
!= STATUS_CRACKED
)
1325 __time64_t sec_etc
= 0;
1332 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1334 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1336 sec_etc
= ms_left
/ 1000;
1341 //log_info ("Time.Estimated.: 0 secs");
1343 else if ((u64
) sec_etc
> ETC_MAX
)
1345 log_info ("Time.Estimated.: > 10 Years");
1349 char display_etc
[32] = { 0 };
1350 char display_runtime
[32] = { 0 };
1353 struct tm tm_runtime
;
1355 struct tm
*tmp
= NULL
;
1358 tmp
= _gmtime64 (&sec_etc
);
1360 tmp
= gmtime (&sec_etc
);
1365 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1367 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1375 char *etc
= ctime (&now
);
1377 size_t etc_len
= strlen (etc
);
1379 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1380 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1386 time (&runtime_cur
);
1390 __time64_t runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
1392 tmp
= _gmtime64 (&runtime_left
);
1396 time_t runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
1398 tmp
= gmtime (&runtime_left
);
1402 if ((tmp
!= NULL
) && (runtime_left
> 0) && (runtime_left
< sec_etc
))
1404 memcpy (&tm_runtime
, tmp
, sizeof (tm_runtime
));
1406 format_timer_display (&tm_runtime
, display_runtime
, sizeof (display_runtime
));
1408 log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc
, display_etc
, display_runtime
);
1412 log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc
, display_etc
);
1417 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1424 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1426 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1428 if (device_param
->skipped
) continue;
1430 char display_dev_cur
[16] = { 0 };
1432 strncpy (display_dev_cur
, "0.00", 4);
1434 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1436 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1439 char display_all_cur
[16] = { 0 };
1441 strncpy (display_all_cur
, "0.00", 4);
1443 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1445 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1447 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1448 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1450 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1454 if (data
.digests_cnt
> 100)
1456 time_t now
= time (NULL
);
1458 int cpt_cur_min
= 0;
1459 int cpt_cur_hour
= 0;
1460 int cpt_cur_day
= 0;
1462 for (int i
= 0; i
< CPT_BUF
; i
++)
1464 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1465 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1467 if ((timestamp
+ 60) > now
)
1469 cpt_cur_min
+= cracked
;
1472 if ((timestamp
+ 3600) > now
)
1474 cpt_cur_hour
+= cracked
;
1477 if ((timestamp
+ 86400) > now
)
1479 cpt_cur_day
+= cracked
;
1483 double ms_real
= ms_running
- ms_paused
;
1485 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1486 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1487 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1489 if ((data
.cpt_start
+ 86400) < now
)
1491 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1499 else if ((data
.cpt_start
+ 3600) < now
)
1501 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1508 else if ((data
.cpt_start
+ 60) < now
)
1510 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1518 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1527 u64 restore_point
= get_lowest_words_done ();
1529 u64 restore_total
= data
.words_base
;
1531 float percent_restore
= 0;
1533 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1535 if (progress_end_relative_skip
)
1537 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1539 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1540 float percent_rejected
= 0.0;
1544 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1547 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1548 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1550 if (data
.restore_disable
== 0)
1552 if (percent_finished
!= 1)
1554 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1561 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1563 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1564 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1566 if (data
.restore_disable
== 0)
1568 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1573 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1574 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1576 // --restore not allowed if stdin is used -- really? why?
1578 //if (data.restore_disable == 0)
1580 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1587 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1588 if (data
.devices_status
== STATUS_CRACKED
) return;
1589 if (data
.devices_status
== STATUS_ABORTED
) return;
1590 if (data
.devices_status
== STATUS_QUIT
) return;
1592 if (data
.gpu_temp_disable
== 0)
1594 hc_thread_mutex_lock (mux_adl
);
1596 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1598 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1600 if (device_param
->skipped
) continue;
1602 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1603 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1604 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1605 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1606 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1607 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1608 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1610 char output_buf
[256] = { 0 };
1614 if (num_temperature
>= 0)
1616 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1618 output_len
= strlen (output_buf
);
1621 if (num_fanspeed
>= 0)
1623 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1625 output_len
= strlen (output_buf
);
1628 if (num_utilization
>= 0)
1630 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1632 output_len
= strlen (output_buf
);
1635 if (num_corespeed
>= 0)
1637 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1639 output_len
= strlen (output_buf
);
1642 if (num_memoryspeed
>= 0)
1644 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1646 output_len
= strlen (output_buf
);
1649 if (num_buslanes
>= 0)
1651 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1653 output_len
= strlen (output_buf
);
1656 if (num_throttle
== 1)
1658 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1660 output_len
= strlen (output_buf
);
1663 if (output_len
== 0)
1665 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1667 output_len
= strlen (output_buf
);
1670 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1673 hc_thread_mutex_unlock (mux_adl
);
1676 #endif // HAVE_HWMON
1679 static void status_benchmark_automate ()
1681 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1682 double speed_ms
[DEVICES_MAX
] = { 0 };
1684 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1686 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1688 if (device_param
->skipped
) continue;
1690 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1691 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1694 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1696 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1698 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1700 if (device_param
->skipped
) continue;
1702 hashes_dev_ms
[device_id
] = 0;
1704 if (speed_ms
[device_id
])
1706 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1710 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1712 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1714 if (device_param
->skipped
) continue;
1716 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1720 static void status_benchmark ()
1722 if (data
.devices_status
== STATUS_INIT
) return;
1723 if (data
.devices_status
== STATUS_STARTING
) return;
1725 if (data
.shutdown_inner
== 1) return;
1727 if (data
.machine_readable
== 1)
1729 status_benchmark_automate ();
1734 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1735 double speed_ms
[DEVICES_MAX
] = { 0 };
1737 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1739 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1741 if (device_param
->skipped
) continue;
1743 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1744 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1747 double hashes_all_ms
= 0;
1749 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1751 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1753 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1755 if (device_param
->skipped
) continue;
1757 hashes_dev_ms
[device_id
] = 0;
1759 if (speed_ms
[device_id
])
1761 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1763 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1771 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1773 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1775 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1777 if (device_param
->skipped
) continue;
1779 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1781 exec_all_ms
[device_id
] = exec_ms_avg
;
1784 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1786 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1788 if (device_param
->skipped
) continue;
1790 char display_dev_cur
[16] = { 0 };
1792 strncpy (display_dev_cur
, "0.00", 4);
1794 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1796 if (data
.devices_active
>= 10)
1798 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1802 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1806 char display_all_cur
[16] = { 0 };
1808 strncpy (display_all_cur
, "0.00", 4);
1810 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1812 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1816 * hashcat -only- functions
1819 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1821 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1823 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1824 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1825 else if (attack_kern
== ATTACK_KERN_COMBI
)
1826 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1827 else if (attack_kern
== ATTACK_KERN_BF
)
1828 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1831 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1834 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1836 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1838 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1839 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1840 else if (attack_kern
== ATTACK_KERN_COMBI
)
1841 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1842 else if (attack_kern
== ATTACK_KERN_BF
)
1843 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1847 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1851 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1853 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1855 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1859 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1863 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1865 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1867 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1871 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1875 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1877 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1880 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1882 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1885 static char *filename_from_filepath (char *filepath
)
1889 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1893 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1905 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1907 if (line_len
& 1) return (line_len
); // not in hex
1909 if (data
.hex_wordlist
== 1)
1914 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1916 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1919 memset (line_buf
+ i
, 0, line_len
- i
);
1923 else if (line_len
>= 6) // $HEX[] = 6
1925 if (line_buf
[0] != '$') return (line_len
);
1926 if (line_buf
[1] != 'H') return (line_len
);
1927 if (line_buf
[2] != 'E') return (line_len
);
1928 if (line_buf
[3] != 'X') return (line_len
);
1929 if (line_buf
[4] != '[') return (line_len
);
1930 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1935 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1937 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1940 memset (line_buf
+ i
, 0, line_len
- i
);
1948 static void clear_prompt ()
1950 fputc ('\r', stdout
);
1952 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1954 fputc (' ', stdout
);
1957 fputc ('\r', stdout
);
1962 static int gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1964 cl_int CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1966 if (CL_err
!= CL_SUCCESS
)
1968 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
1976 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1978 char *outfile
= data
.outfile
;
1979 uint quiet
= data
.quiet
;
1980 FILE *pot_fp
= data
.pot_fp
;
1981 uint loopback
= data
.loopback
;
1982 uint debug_mode
= data
.debug_mode
;
1983 char *debug_file
= data
.debug_file
;
1985 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1986 int debug_rule_len
= 0; // -1 error
1987 uint debug_plain_len
= 0;
1989 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1993 char out_buf
[HCBUFSIZ
] = { 0 };
1995 const u32 salt_pos
= plain
->salt_pos
;
1996 const u32 digest_pos
= plain
->digest_pos
; // relative
1997 const u32 gidvid
= plain
->gidvid
;
1998 const u32 il_pos
= plain
->il_pos
;
2000 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2004 u64 crackpos
= device_param
->words_off
;
2006 uint plain_buf
[16] = { 0 };
2008 u8
*plain_ptr
= (u8
*) plain_buf
;
2010 unsigned int plain_len
= 0;
2012 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2016 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2018 for (int i
= 0; i
< 16; i
++)
2020 plain_buf
[i
] = pw
.i
[i
];
2023 plain_len
= pw
.pw_len
;
2025 const uint off
= device_param
->innerloop_pos
+ il_pos
;
2032 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
2034 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
2036 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
2040 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
2042 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
2044 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
2046 debug_plain_len
= plain_len
;
2050 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2053 crackpos
*= data
.kernel_rules_cnt
;
2054 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2056 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2058 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2062 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2064 for (int i
= 0; i
< 16; i
++)
2066 plain_buf
[i
] = pw
.i
[i
];
2069 plain_len
= pw
.pw_len
;
2071 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2072 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2074 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2076 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2080 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2082 memcpy (plain_ptr
, comb_buf
, comb_len
);
2085 plain_len
+= comb_len
;
2088 crackpos
*= data
.combs_cnt
;
2089 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2091 if (data
.pw_max
!= PW_DICTMAX1
)
2093 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2096 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2098 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2099 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2101 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2102 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2104 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2105 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2107 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2108 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2110 plain_len
= data
.css_cnt
;
2113 crackpos
*= data
.bfs_cnt
;
2114 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2116 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2120 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2122 for (int i
= 0; i
< 16; i
++)
2124 plain_buf
[i
] = pw
.i
[i
];
2127 plain_len
= pw
.pw_len
;
2129 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2132 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2134 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2136 plain_len
+= start
+ stop
;
2139 crackpos
*= data
.combs_cnt
;
2140 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2142 if (data
.pw_max
!= PW_DICTMAX1
)
2144 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2147 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2151 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2153 for (int i
= 0; i
< 16; i
++)
2155 plain_buf
[i
] = pw
.i
[i
];
2158 plain_len
= pw
.pw_len
;
2160 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2163 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2165 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2167 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2169 plain_len
+= start
+ stop
;
2172 crackpos
*= data
.combs_cnt
;
2173 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2175 if (data
.pw_max
!= PW_DICTMAX1
)
2177 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2181 if (data
.attack_mode
== ATTACK_MODE_BF
)
2183 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2185 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2187 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2189 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2193 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2195 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2197 plain_ptr
[j
] = plain_ptr
[i
];
2200 plain_len
= plain_len
/ 2;
2205 // if enabled, update also the potfile
2211 fprintf (pot_fp
, "%s:", out_buf
);
2213 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2215 fputc ('\n', pot_fp
);
2219 unlock_file (pot_fp
);
2224 FILE *out_fp
= NULL
;
2226 if (outfile
!= NULL
)
2228 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2230 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2241 if (quiet
== 0) clear_prompt ();
2244 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2246 if (outfile
!= NULL
)
2248 if (out_fp
!= stdout
)
2255 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2257 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2259 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2260 if (quiet
== 0) fflush (stdout
);
2269 char *loopback_file
= data
.loopback_file
;
2273 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2277 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2279 fputc ('\n', fb_fp
);
2285 // (rule) debug mode
2287 // the next check implies that:
2288 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2291 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2293 if (debug_rule_len
< 0) debug_rule_len
= 0;
2295 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2297 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2299 if ((quiet
== 0) && (debug_file
== NULL
))
2301 fprintf (stdout
, "%s", PROMPT
);
2308 static int check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2310 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2316 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2318 if (CL_err
!= CL_SUCCESS
)
2320 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2327 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2331 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2333 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, 0, num_cracked
* sizeof (plain_t
), cracked
, 0, NULL
, NULL
);
2335 if (CL_err
!= CL_SUCCESS
)
2337 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2342 uint cpt_cracked
= 0;
2344 hc_thread_mutex_lock (mux_display
);
2346 for (uint i
= 0; i
< num_cracked
; i
++)
2348 const uint hash_pos
= cracked
[i
].hash_pos
;
2350 if (data
.digests_shown
[hash_pos
] == 1) continue;
2352 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2354 data
.digests_shown
[hash_pos
] = 1;
2356 data
.digests_done
++;
2360 salt_buf
->digests_done
++;
2362 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2364 data
.salts_shown
[salt_pos
] = 1;
2370 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2372 check_hash (device_param
, &cracked
[i
]);
2375 hc_thread_mutex_unlock (mux_display
);
2379 if (cpt_cracked
> 0)
2381 hc_thread_mutex_lock (mux_display
);
2383 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2384 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2388 data
.cpt_total
+= cpt_cracked
;
2390 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2392 hc_thread_mutex_unlock (mux_display
);
2395 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2397 // we need to reset cracked state on the device
2398 // otherwise host thinks again and again the hash was cracked
2399 // and returns invalid password each time
2401 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2403 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, salt_buf
->digests_offset
* sizeof (uint
), salt_buf
->digests_cnt
* sizeof (uint
), &data
.digests_shown_tmp
[salt_buf
->digests_offset
], 0, NULL
, NULL
);
2405 if (CL_err
!= CL_SUCCESS
)
2407 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2415 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2417 if (CL_err
!= CL_SUCCESS
)
2419 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2428 // stolen from princeprocessor ;)
2439 static void out_flush (out_t
*out
)
2441 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2446 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2448 char *ptr
= out
->buf
+ out
->len
;
2450 memcpy (ptr
, pw_buf
, pw_len
);
2454 out
->len
+= pw_len
+ 1;
2456 if (out
->len
>= BUFSIZ
- 100)
2462 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2469 uint plain_buf
[16] = { 0 };
2471 u8
*plain_ptr
= (u8
*) plain_buf
;
2475 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2477 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2481 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2483 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2485 const uint pos
= device_param
->innerloop_pos
;
2487 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2489 for (int i
= 0; i
< 8; i
++)
2491 plain_buf
[i
] = pw
.i
[i
];
2494 plain_len
= pw
.pw_len
;
2496 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2498 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2500 out_push (&out
, plain_ptr
, plain_len
);
2504 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2508 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2510 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2512 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2514 for (int i
= 0; i
< 8; i
++)
2516 plain_buf
[i
] = pw
.i
[i
];
2519 plain_len
= pw
.pw_len
;
2521 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2522 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2524 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2526 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2530 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2532 memcpy (plain_ptr
, comb_buf
, comb_len
);
2535 plain_len
+= comb_len
;
2537 if (data
.pw_max
!= PW_DICTMAX1
)
2539 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2542 out_push (&out
, plain_ptr
, plain_len
);
2546 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2548 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2550 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2552 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2553 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2555 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2556 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2558 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2559 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2561 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2562 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2564 plain_len
= data
.css_cnt
;
2566 out_push (&out
, plain_ptr
, plain_len
);
2570 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2574 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2576 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2578 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2580 for (int i
= 0; i
< 8; i
++)
2582 plain_buf
[i
] = pw
.i
[i
];
2585 plain_len
= pw
.pw_len
;
2587 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2590 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2592 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2594 plain_len
+= start
+ stop
;
2596 out_push (&out
, plain_ptr
, plain_len
);
2600 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2604 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2606 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2608 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2610 for (int i
= 0; i
< 8; i
++)
2612 plain_buf
[i
] = pw
.i
[i
];
2615 plain_len
= pw
.pw_len
;
2617 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2620 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2622 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2624 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2626 plain_len
+= start
+ stop
;
2628 out_push (&out
, plain_ptr
, plain_len
);
2636 static void save_hash ()
2638 char *hashfile
= data
.hashfile
;
2640 char new_hashfile
[256] = { 0 };
2641 char old_hashfile
[256] = { 0 };
2643 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2644 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2646 unlink (new_hashfile
);
2648 char separator
= data
.separator
;
2650 FILE *fp
= fopen (new_hashfile
, "wb");
2654 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2659 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2661 if (data
.salts_shown
[salt_pos
] == 1) continue;
2663 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2665 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2667 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2669 if (data
.digests_shown
[idx
] == 1) continue;
2671 if (data
.hash_mode
!= 2500)
2673 if (data
.username
== 1)
2675 user_t
*user
= data
.hash_info
[idx
]->user
;
2679 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2681 fputc (separator
, fp
);
2684 char out_buf
[HCBUFSIZ
]; // scratch buffer
2688 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2690 fputs (out_buf
, fp
);
2698 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2700 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2709 unlink (old_hashfile
);
2711 if (rename (hashfile
, old_hashfile
) != 0)
2713 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2720 if (rename (new_hashfile
, hashfile
) != 0)
2722 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2727 unlink (old_hashfile
);
2730 static int run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2732 cl_int CL_err
= CL_SUCCESS
;
2734 uint num_elements
= num
;
2736 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2737 device_param
->kernel_params_buf32
[34] = num
;
2739 uint kernel_threads
= device_param
->kernel_threads
;
2741 while (num_elements
% kernel_threads
) num_elements
++;
2743 cl_kernel kernel
= NULL
;
2747 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2748 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2749 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2750 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2751 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2754 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2755 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2756 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2757 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2758 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2759 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2760 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2761 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2762 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2763 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2764 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2766 if (CL_err
!= CL_SUCCESS
)
2768 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2775 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2777 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2778 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2780 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2782 if (CL_err
!= CL_SUCCESS
)
2784 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2791 if (kern_run
== KERN_RUN_2
)
2793 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2795 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2799 while (num_elements
% kernel_threads
) num_elements
++;
2801 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2802 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2804 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2806 if (CL_err
!= CL_SUCCESS
)
2808 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2814 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2816 if (CL_err
!= CL_SUCCESS
)
2818 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2823 if (device_param
->nvidia_spin_damp
)
2825 if (data
.devices_status
== STATUS_RUNNING
)
2827 if (iteration
< EXPECTED_ITERATIONS
)
2831 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2832 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2833 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2839 CL_err
= hc_clWaitForEvents (data
.ocl
, 1, &event
);
2841 if (CL_err
!= CL_SUCCESS
)
2843 log_error ("ERROR: clWaitForEvents(): %s\n", val2cstr_cl (CL_err
));
2848 cl_ulong time_start
;
2851 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2852 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2854 if (CL_err
!= CL_SUCCESS
)
2856 log_error ("ERROR: clGetEventProfilingInfo(): %s\n", val2cstr_cl (CL_err
));
2861 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2863 if (data
.devices_status
== STATUS_RUNNING
)
2865 if (iteration
< EXPECTED_ITERATIONS
)
2869 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2870 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2871 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2878 uint exec_pos
= device_param
->exec_pos
;
2880 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2884 if (exec_pos
== EXEC_CACHE
)
2889 device_param
->exec_pos
= exec_pos
;
2892 CL_err
= hc_clReleaseEvent (data
.ocl
, event
);
2894 if (CL_err
!= CL_SUCCESS
)
2896 log_error ("ERROR: clReleaseEvent(): %s\n", val2cstr_cl (CL_err
));
2901 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2903 if (CL_err
!= CL_SUCCESS
)
2905 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
2913 static int run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2915 cl_int CL_err
= CL_SUCCESS
;
2917 uint num_elements
= num
;
2921 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2922 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2923 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2926 // causes problems with special threads like in bcrypt
2927 // const uint kernel_threads = device_param->kernel_threads;
2929 uint kernel_threads
= device_param
->kernel_threads
;
2931 while (num_elements
% kernel_threads
) num_elements
++;
2933 cl_kernel kernel
= NULL
;
2937 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2938 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2939 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2944 case KERN_RUN_MP
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2945 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2946 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2947 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2948 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2949 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2951 case KERN_RUN_MP_R
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2952 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2953 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2954 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2955 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2956 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2958 case KERN_RUN_MP_L
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2959 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2960 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2961 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2962 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2963 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2964 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2968 if (CL_err
!= CL_SUCCESS
)
2970 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2975 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2976 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2978 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2980 if (CL_err
!= CL_SUCCESS
)
2982 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2987 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2989 if (CL_err
!= CL_SUCCESS
)
2991 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2996 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2998 if (CL_err
!= CL_SUCCESS
)
3000 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3008 static int run_kernel_tm (hc_device_param_t
*device_param
)
3010 cl_int CL_err
= CL_SUCCESS
;
3012 const uint num_elements
= 1024; // fixed
3014 uint kernel_threads
= 32;
3016 cl_kernel kernel
= device_param
->kernel_tm
;
3018 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3019 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3021 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3023 if (CL_err
!= CL_SUCCESS
)
3025 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3030 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3032 if (CL_err
!= CL_SUCCESS
)
3034 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3039 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3041 if (CL_err
!= CL_SUCCESS
)
3043 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3051 static int run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
3053 cl_int CL_err
= CL_SUCCESS
;
3055 uint num_elements
= num
;
3057 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
3058 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
3060 // causes problems with special threads like in bcrypt
3061 // const uint kernel_threads = device_param->kernel_threads;
3063 uint kernel_threads
= device_param
->kernel_threads
;
3065 while (num_elements
% kernel_threads
) num_elements
++;
3067 cl_kernel kernel
= device_param
->kernel_amp
;
3069 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
3070 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
3072 if (CL_err
!= CL_SUCCESS
)
3074 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3079 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3080 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3082 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3084 if (CL_err
!= CL_SUCCESS
)
3086 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3091 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3093 if (CL_err
!= CL_SUCCESS
)
3095 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3100 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3102 if (CL_err
!= CL_SUCCESS
)
3104 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3112 static int run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
3114 cl_int CL_err
= CL_SUCCESS
;
3116 const u32 num16d
= num
/ 16;
3117 const u32 num16m
= num
% 16;
3121 device_param
->kernel_params_memset_buf32
[1] = value
;
3122 device_param
->kernel_params_memset_buf32
[2] = num16d
;
3124 uint kernel_threads
= device_param
->kernel_threads
;
3126 uint num_elements
= num16d
;
3128 while (num_elements
% kernel_threads
) num_elements
++;
3130 cl_kernel kernel
= device_param
->kernel_memset
;
3132 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
3133 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
3134 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
3136 if (CL_err
!= CL_SUCCESS
)
3138 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3143 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3144 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3146 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3148 if (CL_err
!= CL_SUCCESS
)
3150 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3155 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3157 if (CL_err
!= CL_SUCCESS
)
3159 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3164 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3166 if (CL_err
!= CL_SUCCESS
)
3168 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3183 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
3185 if (CL_err
!= CL_SUCCESS
)
3187 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3196 static int run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
3198 return run_kernel_memset (device_param
, buf
, 0, size
);
3201 static int choose_kernel (hc_device_param_t
*device_param
, const uint attack_exec
, const uint attack_mode
, const uint opts_type
, const salt_t
*salt_buf
, const uint highest_pw_len
, const uint pws_cnt
, const uint fast_iteration
)
3203 cl_int CL_err
= CL_SUCCESS
;
3205 if (data
.hash_mode
== 2000)
3207 process_stdout (device_param
, pws_cnt
);
3212 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3214 if (attack_mode
== ATTACK_MODE_BF
)
3216 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
3218 const uint size_tm
= 32 * sizeof (bs_word_t
);
3220 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
3222 run_kernel_tm (device_param
);
3224 CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
3226 if (CL_err
!= CL_SUCCESS
)
3228 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3235 if (highest_pw_len
< 16)
3237 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
3239 else if (highest_pw_len
< 32)
3241 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3245 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3250 run_kernel_amp (device_param
, pws_cnt
);
3252 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3254 if (opts_type
& OPTS_TYPE_HOOK12
)
3256 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3258 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3260 if (CL_err
!= CL_SUCCESS
)
3262 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3267 // do something with data
3269 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3271 if (CL_err
!= CL_SUCCESS
)
3273 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3279 uint iter
= salt_buf
->salt_iter
;
3281 uint loop_step
= device_param
->kernel_loops
;
3283 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3285 uint loop_left
= iter
- loop_pos
;
3287 loop_left
= MIN (loop_left
, loop_step
);
3289 device_param
->kernel_params_buf32
[28] = loop_pos
;
3290 device_param
->kernel_params_buf32
[29] = loop_left
;
3292 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3294 if (data
.devices_status
== STATUS_CRACKED
) break;
3295 if (data
.devices_status
== STATUS_ABORTED
) break;
3296 if (data
.devices_status
== STATUS_QUIT
) break;
3297 if (data
.devices_status
== STATUS_BYPASS
) break;
3303 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3305 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3309 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3311 const u32 speed_pos
= device_param
->speed_pos
;
3313 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3315 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3317 if (data
.benchmark
== 1)
3319 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3323 if (opts_type
& OPTS_TYPE_HOOK23
)
3325 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3327 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3329 if (CL_err
!= CL_SUCCESS
)
3331 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3336 // do something with data
3338 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3340 if (CL_err
!= CL_SUCCESS
)
3342 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3348 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3354 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3360 else if (rule_len
== 1)
3362 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3368 static int run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3370 cl_int CL_err
= CL_SUCCESS
;
3372 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3374 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3376 if (CL_err
!= CL_SUCCESS
)
3378 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3383 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3385 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3387 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3389 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3391 for (u32 i
= 0; i
< pws_cnt
; i
++)
3393 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3395 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3400 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3402 for (u32 i
= 0; i
< pws_cnt
; i
++)
3404 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3406 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3413 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3415 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3417 for (u32 i
= 0; i
< pws_cnt
; i
++)
3419 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3421 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3426 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3428 for (u32 i
= 0; i
< pws_cnt
; i
++)
3430 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3432 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3439 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3441 if (CL_err
!= CL_SUCCESS
)
3443 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3448 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3450 const u64 off
= device_param
->words_off
;
3452 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3454 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3460 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3462 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3464 device_param
->kernel_params_buf32
[28] = 0;
3465 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3466 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3468 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3470 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3474 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3477 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3479 return exec_ms_prev
;
3482 static int autotune (hc_device_param_t
*device_param
)
3484 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3486 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3487 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3489 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3490 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3492 u32 kernel_accel
= kernel_accel_min
;
3493 u32 kernel_loops
= kernel_loops_min
;
3495 // in this case the user specified a fixed -u and -n on the commandline
3496 // no way to tune anything
3497 // but we need to run a few caching rounds
3499 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3501 if (data
.hash_mode
!= 2000)
3503 try_run (device_param
, kernel_accel
, kernel_loops
);
3504 try_run (device_param
, kernel_accel
, kernel_loops
);
3505 try_run (device_param
, kernel_accel
, kernel_loops
);
3506 try_run (device_param
, kernel_accel
, kernel_loops
);
3509 device_param
->kernel_accel
= kernel_accel
;
3510 device_param
->kernel_loops
= kernel_loops
;
3512 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3514 device_param
->kernel_power
= kernel_power
;
3519 // from here it's clear we are allowed to autotune
3520 // so let's init some fake words
3522 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3524 if (data
.attack_kern
== ATTACK_KERN_BF
)
3526 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3530 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3532 device_param
->pws_buf
[i
].i
[0] = i
;
3533 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3534 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3537 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, kernel_power_max
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3539 if (CL_err
!= CL_SUCCESS
)
3541 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3547 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3549 if (data
.kernel_rules_cnt
> 1)
3551 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3553 if (CL_err
!= CL_SUCCESS
)
3555 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3563 run_kernel_amp (device_param
, kernel_power_max
);
3566 #define VERIFIER_CNT 1
3568 // first find out highest kernel-loops that stays below target_ms
3570 if (kernel_loops_min
< kernel_loops_max
)
3572 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3574 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3576 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3578 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3580 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3583 if (exec_ms
< target_ms
) break;
3587 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3589 #define STEPS_CNT 10
3591 if (kernel_accel_min
< kernel_accel_max
)
3593 for (int i
= 0; i
< STEPS_CNT
; i
++)
3595 const u32 kernel_accel_try
= 1 << i
;
3597 if (kernel_accel_try
< kernel_accel_min
) continue;
3598 if (kernel_accel_try
> kernel_accel_max
) break;
3600 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3602 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3604 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3606 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3609 if (exec_ms
> target_ms
) break;
3611 kernel_accel
= kernel_accel_try
;
3615 // at this point we want to know the actual runtime for the following reason:
3616 // we need a reference for the balancing loop following up, and this
3617 // the balancing loop can have an effect that the creates a new opportunity, for example:
3618 // if the target is 95 ms and the current runtime is 48ms the above loop
3619 // stopped the execution because the previous exec_ms was > 95ms
3620 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3621 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3623 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3625 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3627 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3629 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3632 u32 diff
= kernel_loops
- kernel_accel
;
3634 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3636 u32 kernel_accel_orig
= kernel_accel
;
3637 u32 kernel_loops_orig
= kernel_loops
;
3639 for (u32 f
= 1; f
< 1024; f
++)
3641 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3642 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3644 if (kernel_accel_try
> kernel_accel_max
) break;
3645 if (kernel_loops_try
< kernel_loops_min
) break;
3647 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3649 if (diff_new
> diff
) break;
3653 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3655 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3657 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3659 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3662 if (exec_ms
< exec_ms_pre_final
)
3664 exec_ms_pre_final
= exec_ms
;
3666 kernel_accel
= kernel_accel_try
;
3667 kernel_loops
= kernel_loops_try
;
3672 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3674 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3676 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3678 if (exec_accel_min
>= 1.0)
3680 // this is safe to not overflow kernel_accel_max because of accel_left
3682 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3685 // reset them fake words
3688 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3690 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3691 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3694 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3696 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3698 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3703 device_param
->exec_pos
= 0;
3705 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3707 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3708 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3709 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3713 device_param
->kernel_accel
= kernel_accel
;
3714 device_param
->kernel_loops
= kernel_loops
;
3716 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3718 device_param
->kernel_power
= kernel_power
;
3722 if (data
.quiet
== 0)
3726 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3727 "- Device #%u: autotuned kernel-loops to %u\n",
3728 device_param
->device_id
+ 1, kernel_accel
,
3729 device_param
->device_id
+ 1, kernel_loops
);
3731 fprintf (stdout
, "%s", PROMPT
);
3741 static int run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3743 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3747 uint speed_pos
= device_param
->speed_pos
;
3750 if (device_param
->timer_speed
.tv_sec
== 0)
3752 hc_timer_set (&device_param
->timer_speed
);
3757 if (device_param
->timer_speed
.QuadPart
== 0)
3759 hc_timer_set (&device_param
->timer_speed
);
3763 // find higest password length, this is for optimization stuff
3765 uint highest_pw_len
= 0;
3767 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3770 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3773 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3775 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3776 + device_param
->kernel_params_mp_l_buf32
[5];
3781 uint innerloop_step
= 0;
3782 uint innerloop_cnt
= 0;
3784 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3785 else innerloop_step
= 1;
3787 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3788 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3789 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3791 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3793 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3795 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3797 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3799 if (data
.devices_status
== STATUS_CRACKED
) break;
3800 if (data
.devices_status
== STATUS_ABORTED
) break;
3801 if (data
.devices_status
== STATUS_QUIT
) break;
3802 if (data
.devices_status
== STATUS_BYPASS
) break;
3804 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3806 device_param
->kernel_params_buf32
[27] = salt_pos
;
3807 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3808 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3810 FILE *combs_fp
= device_param
->combs_fp
;
3812 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3819 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3821 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3823 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3825 if (data
.devices_status
== STATUS_CRACKED
) break;
3826 if (data
.devices_status
== STATUS_ABORTED
) break;
3827 if (data
.devices_status
== STATUS_QUIT
) break;
3828 if (data
.devices_status
== STATUS_BYPASS
) break;
3830 uint fast_iteration
= 0;
3832 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3834 if (innerloop_left
> innerloop_step
)
3836 innerloop_left
= innerloop_step
;
3841 device_param
->innerloop_pos
= innerloop_pos
;
3842 device_param
->innerloop_left
= innerloop_left
;
3844 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3846 // i think we can get rid of this
3847 if (innerloop_left
== 0)
3849 puts ("bug, how should this happen????\n");
3854 if (data
.salts_shown
[salt_pos
] == 1)
3856 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3861 // initialize amplifiers
3863 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3867 while (i
< innerloop_left
)
3869 if (feof (combs_fp
)) break;
3871 int line_len
= fgetl (combs_fp
, line_buf
);
3873 if (line_len
>= PW_MAX1
) continue;
3875 line_len
= convert_from_hex (line_buf
, line_len
);
3877 char *line_buf_new
= line_buf
;
3879 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3881 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3883 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3885 if (rule_len_out
< 0)
3887 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3892 line_len
= rule_len_out
;
3894 line_buf_new
= rule_buf_out
;
3897 line_len
= MIN (line_len
, PW_DICTMAX
);
3899 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3901 memcpy (ptr
, line_buf_new
, line_len
);
3903 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3905 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3907 uppercase (ptr
, line_len
);
3910 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3912 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3914 ptr
[line_len
] = 0x80;
3917 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3919 ptr
[line_len
] = 0x01;
3923 device_param
->combs_buf
[i
].pw_len
= line_len
;
3928 for (uint j
= i
; j
< innerloop_left
; j
++)
3930 device_param
->combs_buf
[j
].i
[0] = 0;
3931 device_param
->combs_buf
[j
].i
[1] = 0;
3932 device_param
->combs_buf
[j
].i
[2] = 0;
3933 device_param
->combs_buf
[j
].i
[3] = 0;
3934 device_param
->combs_buf
[j
].i
[4] = 0;
3935 device_param
->combs_buf
[j
].i
[5] = 0;
3936 device_param
->combs_buf
[j
].i
[6] = 0;
3937 device_param
->combs_buf
[j
].i
[7] = 0;
3939 device_param
->combs_buf
[j
].pw_len
= 0;
3944 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3946 u64 off
= innerloop_pos
;
3948 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3950 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3952 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3954 u64 off
= innerloop_pos
;
3956 device_param
->kernel_params_mp_buf64
[3] = off
;
3958 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3960 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3962 u64 off
= innerloop_pos
;
3964 device_param
->kernel_params_mp_buf64
[3] = off
;
3966 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3971 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3973 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (kernel_rule_t
), 0, innerloop_left
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3975 if (CL_err
!= CL_SUCCESS
)
3977 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3982 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3984 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
3986 if (CL_err
!= CL_SUCCESS
)
3988 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3993 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3995 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
3997 if (CL_err
!= CL_SUCCESS
)
3999 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4004 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
4006 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4008 if (CL_err
!= CL_SUCCESS
)
4010 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4015 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
4017 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4019 if (CL_err
!= CL_SUCCESS
)
4021 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4027 if (data
.benchmark
== 1)
4029 hc_timer_set (&device_param
->timer_speed
);
4032 int rc
= choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
4034 if (rc
== -1) return -1;
4036 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4038 if (data
.devices_status
== STATUS_CRACKED
) break;
4039 if (data
.devices_status
== STATUS_ABORTED
) break;
4040 if (data
.devices_status
== STATUS_QUIT
) break;
4041 if (data
.devices_status
== STATUS_BYPASS
) break;
4047 if (data
.benchmark
== 0)
4049 check_cracked (device_param
, salt_pos
);
4056 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
4058 hc_thread_mutex_lock (mux_counter
);
4060 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
4062 hc_thread_mutex_unlock (mux_counter
);
4070 hc_timer_get (device_param
->timer_speed
, speed_ms
);
4072 hc_timer_set (&device_param
->timer_speed
);
4076 //hc_thread_mutex_lock (mux_display);
4078 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
4080 device_param
->speed_ms
[speed_pos
] = speed_ms
;
4082 //hc_thread_mutex_unlock (mux_display);
4086 if (speed_pos
== SPEED_CACHE
)
4095 if (data
.benchmark
== 1) break;
4099 device_param
->speed_pos
= speed_pos
;
4106 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
4108 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
4112 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
4114 wl_data
->buf
[wl_data
->cnt
] = 0;
4116 if (wl_data
->cnt
== 0) return;
4118 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
4122 if (wl_data
->cnt
== wl_data
->avail
)
4124 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
4126 wl_data
->avail
+= wl_data
->incr
;
4129 const int c
= fgetc (fd
);
4131 if (c
== EOF
) break;
4133 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
4137 if (c
== '\n') break;
4140 // ensure stream ends with a newline
4142 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
4146 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
4152 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4156 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4158 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4168 if (*ptr
!= '\n') continue;
4172 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4183 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4187 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4189 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4191 if (*ptr
!= '\n') continue;
4195 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4206 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4210 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4212 if (*ptr
!= '\n') continue;
4216 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4227 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
4229 while (wl_data
->pos
< wl_data
->cnt
)
4234 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
4236 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
4238 wl_data
->pos
+= off
;
4240 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4242 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4244 int rule_len_out
= -1;
4246 if (len
< BLOCK_SIZE
)
4248 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
4251 if (rule_len_out
< 0)
4256 if (rule_len_out
> PW_MAX
)
4277 fprintf (stderr
, "BUG feof()!!\n");
4282 load_segment (wl_data
, fd
);
4284 get_next_word (wl_data
, fd
, out_buf
, out_len
);
4288 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
4292 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
4302 fstat (fileno (fd
), &d
.stat
);
4306 _fstat64 (fileno (fd
), &d
.stat
);
4310 d
.stat
.st_nlink
= 0;
4314 d
.stat
.st_atime
= 0;
4317 d
.stat
.st_blksize
= 0;
4318 d
.stat
.st_blocks
= 0;
4321 if (d
.stat
.st_size
== 0) return 0;
4323 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4325 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
4329 u64 cnt
= d_cache
->cnt
;
4333 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4335 keyspace
*= data
.kernel_rules_cnt
;
4337 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4339 keyspace
*= data
.combs_cnt
;
4342 if (data
.quiet
== 0) log_info ("Cache-hit dictionary stats %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) d
.stat
.st_size
, (unsigned long long int) cnt
, (unsigned long long int) keyspace
);
4343 if (data
.quiet
== 0) log_info ("");
4345 hc_signal (sigHandler_default
);
4360 load_segment (wl_data
, fd
);
4362 comp
+= wl_data
->cnt
;
4366 while (i
< wl_data
->cnt
)
4371 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4373 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4375 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4377 int rule_len_out
= -1;
4379 if (len
< BLOCK_SIZE
)
4381 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4384 if (rule_len_out
< 0)
4396 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4398 cnt
+= data
.kernel_rules_cnt
;
4400 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4402 cnt
+= data
.combs_cnt
;
4415 if ((now
- prev
) == 0) continue;
4417 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4419 if (data
.quiet
== 0) log_info_nn ("Generating dictionary stats for %s: %llu bytes (%.2f%%), %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, percent
* 100, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4424 if (data
.quiet
== 0) log_info ("Generated dictionary stats for %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4425 if (data
.quiet
== 0) log_info ("");
4427 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4429 hc_signal (sigHandler_default
);
4434 static void *thread_monitor (void *p
)
4436 uint runtime_check
= 0;
4437 uint remove_check
= 0;
4438 uint status_check
= 0;
4439 uint restore_check
= 0;
4441 uint restore_left
= data
.restore_timer
;
4442 uint remove_left
= data
.remove_timer
;
4443 uint status_left
= data
.status_timer
;
4446 uint hwmon_check
= 0;
4448 int slowdown_warnings
= 0;
4450 // these variables are mainly used for fan control
4452 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4454 // temperature controller "loopback" values
4456 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4457 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4459 int temp_threshold
= 1; // degrees celcius
4461 int fan_speed_min
= 15; // in percentage
4462 int fan_speed_max
= 100;
4464 time_t last_temp_check_time
;
4465 #endif // HAVE_HWMON
4467 uint sleep_time
= 1;
4474 if (data
.restore_timer
)
4479 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4484 if (data
.status
== 1)
4490 if (data
.gpu_temp_disable
== 0)
4492 time (&last_temp_check_time
);
4498 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4501 if (hwmon_check
== 0)
4506 while (data
.shutdown_inner
== 0)
4508 hc_sleep (sleep_time
);
4510 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4514 if (hwmon_check
== 1)
4516 hc_thread_mutex_lock (mux_adl
);
4518 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4520 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4522 if (device_param
->skipped
) continue;
4524 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4528 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
;
4529 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
;
4531 memset (&perfPolicies_info
, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
));
4532 memset (&perfPolicies_status
, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
));
4534 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4535 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4537 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4539 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4541 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4543 if (perfPolicies_status
.throttle
& 2)
4545 if (slowdown_warnings
< 3)
4547 if (data
.quiet
== 0) clear_prompt ();
4549 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4551 if (slowdown_warnings
== 2)
4556 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4557 if (data
.quiet
== 0) fflush (stdout
);
4559 slowdown_warnings
++;
4564 slowdown_warnings
= 0;
4570 hc_thread_mutex_unlock (mux_adl
);
4573 if (hwmon_check
== 1)
4575 hc_thread_mutex_lock (mux_adl
);
4577 time_t temp_check_time
;
4579 time (&temp_check_time
);
4581 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4583 if (Ta
== 0) Ta
= 1;
4585 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4587 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4589 if (device_param
->skipped
) continue;
4591 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4593 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4595 if (temperature
> (int) data
.gpu_temp_abort
)
4597 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4599 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4604 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4606 if (gpu_temp_retain
)
4608 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4610 int temp_cur
= temperature
;
4612 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4614 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4616 // calculate Ta value (time difference in seconds between the last check and this check)
4618 last_temp_check_time
= temp_check_time
;
4624 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4626 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[device_id
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[device_id
])) / Ta
);
4628 if (abs (fan_diff_required
) >= temp_threshold
)
4630 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4632 int fan_speed_level
= fan_speed_cur
;
4634 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4636 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4638 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4639 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4641 if (fan_speed_new
!= fan_speed_cur
)
4643 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4644 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4646 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4648 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4650 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4652 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4655 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4659 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4663 fan_speed_chgd
[device_id
] = 1;
4666 temp_diff_old
[device_id
] = temp_diff_new
;
4673 hc_thread_mutex_unlock (mux_adl
);
4675 #endif // HAVE_HWMON
4677 if (restore_check
== 1)
4681 if (restore_left
== 0)
4683 if (data
.restore_disable
== 0) cycle_restore ();
4685 restore_left
= data
.restore_timer
;
4689 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4693 time (&runtime_cur
);
4695 int runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
4697 if (runtime_left
<= 0)
4699 if (data
.benchmark
== 0)
4701 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4704 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4708 if (remove_check
== 1)
4712 if (remove_left
== 0)
4714 if (data
.digests_saved
!= data
.digests_done
)
4716 data
.digests_saved
= data
.digests_done
;
4721 remove_left
= data
.remove_timer
;
4725 if (status_check
== 1)
4729 if (status_left
== 0)
4731 hc_thread_mutex_lock (mux_display
);
4733 if (data
.quiet
== 0) clear_prompt ();
4735 if (data
.quiet
== 0) log_info ("");
4739 if (data
.quiet
== 0) log_info ("");
4741 hc_thread_mutex_unlock (mux_display
);
4743 status_left
= data
.status_timer
;
4749 myfree (fan_speed_chgd
);
4751 myfree (temp_diff_old
);
4752 myfree (temp_diff_sum
);
4760 static void *thread_outfile_remove (void *p
)
4762 // some hash-dependent constants
4763 char *outfile_dir
= data
.outfile_check_directory
;
4764 uint dgst_size
= data
.dgst_size
;
4765 uint isSalted
= data
.isSalted
;
4766 uint esalt_size
= data
.esalt_size
;
4767 uint hash_mode
= data
.hash_mode
;
4769 uint outfile_check_timer
= data
.outfile_check_timer
;
4771 char separator
= data
.separator
;
4773 // some hash-dependent functions
4774 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4775 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4778 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4780 hash_buf
.digest
= mymalloc (dgst_size
);
4782 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4784 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4786 uint digest_buf
[64] = { 0 };
4788 outfile_data_t
*out_info
= NULL
;
4790 char **out_files
= NULL
;
4792 time_t folder_mtime
= 0;
4796 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4798 while (data
.shutdown_inner
== 0)
4802 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4806 if (check_left
== 0)
4808 struct stat outfile_check_stat
;
4810 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4812 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4816 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4818 char **out_files_new
= scan_directory (outfile_dir
);
4820 int out_cnt_new
= count_dictionaries (out_files_new
);
4822 outfile_data_t
*out_info_new
= NULL
;
4824 if (out_cnt_new
> 0)
4826 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4828 for (int i
= 0; i
< out_cnt_new
; i
++)
4830 out_info_new
[i
].file_name
= out_files_new
[i
];
4832 // check if there are files that we have seen/checked before (and not changed)
4834 for (int j
= 0; j
< out_cnt
; j
++)
4836 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4838 struct stat outfile_stat
;
4840 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4842 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4844 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4845 out_info_new
[i
].seek
= out_info
[j
].seek
;
4853 local_free (out_info
);
4854 local_free (out_files
);
4856 out_files
= out_files_new
;
4857 out_cnt
= out_cnt_new
;
4858 out_info
= out_info_new
;
4860 folder_mtime
= outfile_check_stat
.st_mtime
;
4863 for (int j
= 0; j
< out_cnt
; j
++)
4865 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4869 //hc_thread_mutex_lock (mux_display);
4872 struct stat outfile_stat
;
4874 fstat (fileno (fp
), &outfile_stat
);
4878 struct stat64 outfile_stat
;
4880 _fstat64 (fileno (fp
), &outfile_stat
);
4883 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4885 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4886 out_info
[j
].seek
= 0;
4889 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4891 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4895 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4897 if (ptr
== NULL
) break;
4899 int line_len
= strlen (line_buf
);
4901 if (line_len
<= 0) continue;
4903 int iter
= MAX_CUT_TRIES
;
4905 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4907 if (line_buf
[i
] != separator
) continue;
4909 int parser_status
= PARSER_OK
;
4911 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4913 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4918 if (parser_status
== PARSER_OK
)
4920 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4922 if (data
.salts_shown
[salt_pos
] == 1) continue;
4924 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4926 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4928 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4930 if (data
.digests_shown
[idx
] == 1) continue;
4934 if (hash_mode
== 6800)
4936 if (i
== salt_buf
->salt_len
)
4938 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4941 else if (hash_mode
== 2500)
4943 // BSSID : MAC1 : MAC2 (:plain)
4944 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4946 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4948 if (!cracked
) continue;
4950 // now compare MAC1 and MAC2 too, since we have this additional info
4951 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4952 char *mac2_pos
= mac1_pos
+ 12 + 1;
4954 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4955 wpa_t
*wpa
= &wpas
[salt_pos
];
4957 // compare hex string(s) vs binary MAC address(es)
4959 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4961 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4970 if (!cracked
) continue;
4972 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4974 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4985 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4987 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4989 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4996 data
.digests_shown
[idx
] = 1;
4998 data
.digests_done
++;
5000 salt_buf
->digests_done
++;
5002 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
5004 data
.salts_shown
[salt_pos
] = 1;
5008 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
5013 if (data
.devices_status
== STATUS_CRACKED
) break;
5019 if (data
.devices_status
== STATUS_CRACKED
) break;
5024 if (data
.devices_status
== STATUS_CRACKED
) break;
5029 out_info
[j
].seek
= ftell (fp
);
5031 //hc_thread_mutex_unlock (mux_display);
5039 check_left
= outfile_check_timer
;
5043 if (esalt_size
) local_free (hash_buf
.esalt
);
5045 if (isSalted
) local_free (hash_buf
.salt
);
5047 local_free (hash_buf
.digest
);
5049 local_free (out_info
);
5051 local_free (out_files
);
5058 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
5060 //if (device_param->pws_cnt < device_param->kernel_power)
5062 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
5064 u8
*ptr
= (u8
*) pw
->i
;
5066 memcpy (ptr
, pw_buf
, pw_len
);
5068 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
5070 pw
->pw_len
= pw_len
;
5072 device_param
->pws_cnt
++;
5076 // fprintf (stderr, "BUG pw_add()!!\n");
5082 static void set_kernel_power_final (const u64 kernel_power_final
)
5084 if (data
.quiet
== 0)
5090 log_info ("INFO: approaching final keyspace, workload adjusted");
5093 fprintf (stdout
, "%s", PROMPT
);
5098 data
.kernel_power_final
= kernel_power_final
;
5101 static u32
get_power (hc_device_param_t
*device_param
)
5103 const u64 kernel_power_final
= data
.kernel_power_final
;
5105 if (kernel_power_final
)
5107 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
5109 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
5111 // work should be at least the hardware power available without any accelerator
5113 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
5118 return device_param
->kernel_power
;
5121 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
5123 hc_thread_mutex_lock (mux_dispatcher
);
5125 const u64 words_cur
= data
.words_cur
;
5126 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
5128 device_param
->words_off
= words_cur
;
5130 const u64 kernel_power_all
= data
.kernel_power_all
;
5132 const u64 words_left
= words_base
- words_cur
;
5134 if (words_left
< kernel_power_all
)
5136 if (data
.kernel_power_final
== 0)
5138 set_kernel_power_final (words_left
);
5142 const u32 kernel_power
= get_power (device_param
);
5144 uint work
= MIN (words_left
, kernel_power
);
5146 work
= MIN (work
, max
);
5148 data
.words_cur
+= work
;
5150 hc_thread_mutex_unlock (mux_dispatcher
);
5155 static void *thread_autotune (void *p
)
5157 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5159 if (device_param
->skipped
) return NULL
;
5161 autotune (device_param
);
5166 static void *thread_calc_stdin (void *p
)
5168 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5170 if (device_param
->skipped
) return NULL
;
5172 char *buf
= (char *) mymalloc (HCBUFSIZ
);
5174 const uint attack_kern
= data
.attack_kern
;
5176 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5178 hc_thread_mutex_lock (mux_dispatcher
);
5180 if (feof (stdin
) != 0)
5182 hc_thread_mutex_unlock (mux_dispatcher
);
5189 while (words_cur
< device_param
->kernel_power
)
5191 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
5193 if (line_buf
== NULL
) break;
5195 uint line_len
= in_superchop (line_buf
);
5197 line_len
= convert_from_hex (line_buf
, line_len
);
5199 // post-process rule engine
5201 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5203 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5205 int rule_len_out
= -1;
5207 if (line_len
< BLOCK_SIZE
)
5209 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5212 if (rule_len_out
< 0) continue;
5214 line_buf
= rule_buf_out
;
5215 line_len
= rule_len_out
;
5218 if (line_len
> PW_MAX
)
5223 // hmm that's always the case, or?
5225 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5227 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5229 hc_thread_mutex_lock (mux_counter
);
5231 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5233 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5236 hc_thread_mutex_unlock (mux_counter
);
5242 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5246 if (data
.devices_status
== STATUS_CRACKED
) break;
5247 if (data
.devices_status
== STATUS_ABORTED
) break;
5248 if (data
.devices_status
== STATUS_QUIT
) break;
5249 if (data
.devices_status
== STATUS_BYPASS
) break;
5252 hc_thread_mutex_unlock (mux_dispatcher
);
5254 if (data
.devices_status
== STATUS_CRACKED
) break;
5255 if (data
.devices_status
== STATUS_ABORTED
) break;
5256 if (data
.devices_status
== STATUS_QUIT
) break;
5257 if (data
.devices_status
== STATUS_BYPASS
) break;
5261 const uint pws_cnt
= device_param
->pws_cnt
;
5265 run_copy (device_param
, pws_cnt
);
5267 run_cracker (device_param
, pws_cnt
);
5269 device_param
->pws_cnt
= 0;
5273 if (attack_kern == ATTACK_KERN_STRAIGHT)
5275 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5277 else if (attack_kern == ATTACK_KERN_COMBI)
5279 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5285 device_param
->kernel_accel
= 0;
5286 device_param
->kernel_loops
= 0;
5293 static void *thread_calc (void *p
)
5295 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5297 if (device_param
->skipped
) return NULL
;
5299 const uint attack_mode
= data
.attack_mode
;
5300 const uint attack_kern
= data
.attack_kern
;
5302 if (attack_mode
== ATTACK_MODE_BF
)
5304 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5306 const uint work
= get_work (device_param
, -1);
5308 if (work
== 0) break;
5310 const u64 words_off
= device_param
->words_off
;
5311 const u64 words_fin
= words_off
+ work
;
5313 const uint pws_cnt
= work
;
5315 device_param
->pws_cnt
= pws_cnt
;
5319 run_copy (device_param
, pws_cnt
);
5321 run_cracker (device_param
, pws_cnt
);
5323 device_param
->pws_cnt
= 0;
5327 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
5331 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5333 if (data
.devices_status
== STATUS_CRACKED
) break;
5334 if (data
.devices_status
== STATUS_ABORTED
) break;
5335 if (data
.devices_status
== STATUS_QUIT
) break;
5336 if (data
.devices_status
== STATUS_BYPASS
) break;
5338 if (data
.benchmark
== 1) break;
5340 device_param
->words_done
= words_fin
;
5345 const uint segment_size
= data
.segment_size
;
5347 char *dictfile
= data
.dictfile
;
5349 if (attack_mode
== ATTACK_MODE_COMBI
)
5351 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5353 dictfile
= data
.dictfile2
;
5357 FILE *fd
= fopen (dictfile
, "rb");
5361 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5366 if (attack_mode
== ATTACK_MODE_COMBI
)
5368 const uint combs_mode
= data
.combs_mode
;
5370 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5372 const char *dictfilec
= data
.dictfile2
;
5374 FILE *combs_fp
= fopen (dictfilec
, "rb");
5376 if (combs_fp
== NULL
)
5378 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5385 device_param
->combs_fp
= combs_fp
;
5387 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5389 const char *dictfilec
= data
.dictfile
;
5391 FILE *combs_fp
= fopen (dictfilec
, "rb");
5393 if (combs_fp
== NULL
)
5395 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5402 device_param
->combs_fp
= combs_fp
;
5406 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5408 wl_data
->buf
= (char *) mymalloc (segment_size
);
5409 wl_data
->avail
= segment_size
;
5410 wl_data
->incr
= segment_size
;
5416 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5425 const uint work
= get_work (device_param
, max
);
5427 if (work
== 0) break;
5431 words_off
= device_param
->words_off
;
5432 words_fin
= words_off
+ work
;
5437 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5439 for ( ; words_cur
< words_fin
; words_cur
++)
5441 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5443 line_len
= convert_from_hex (line_buf
, line_len
);
5445 // post-process rule engine
5447 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5449 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5451 int rule_len_out
= -1;
5453 if (line_len
< BLOCK_SIZE
)
5455 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5458 if (rule_len_out
< 0) continue;
5460 line_buf
= rule_buf_out
;
5461 line_len
= rule_len_out
;
5464 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5466 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5470 hc_thread_mutex_lock (mux_counter
);
5472 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5474 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5477 hc_thread_mutex_unlock (mux_counter
);
5482 else if (attack_kern
== ATTACK_KERN_COMBI
)
5484 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5485 // since we still need to combine the plains
5487 if (line_len
> data
.pw_max
)
5491 hc_thread_mutex_lock (mux_counter
);
5493 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5495 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5498 hc_thread_mutex_unlock (mux_counter
);
5504 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5506 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5508 if (data
.devices_status
== STATUS_CRACKED
) break;
5509 if (data
.devices_status
== STATUS_ABORTED
) break;
5510 if (data
.devices_status
== STATUS_QUIT
) break;
5511 if (data
.devices_status
== STATUS_BYPASS
) break;
5514 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5516 if (data
.devices_status
== STATUS_CRACKED
) break;
5517 if (data
.devices_status
== STATUS_ABORTED
) break;
5518 if (data
.devices_status
== STATUS_QUIT
) break;
5519 if (data
.devices_status
== STATUS_BYPASS
) break;
5522 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5524 if (data
.devices_status
== STATUS_CRACKED
) break;
5525 if (data
.devices_status
== STATUS_ABORTED
) break;
5526 if (data
.devices_status
== STATUS_QUIT
) break;
5527 if (data
.devices_status
== STATUS_BYPASS
) break;
5533 const uint pws_cnt
= device_param
->pws_cnt
;
5537 run_copy (device_param
, pws_cnt
);
5539 run_cracker (device_param
, pws_cnt
);
5541 device_param
->pws_cnt
= 0;
5545 if (attack_kern == ATTACK_KERN_STRAIGHT)
5547 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5549 else if (attack_kern == ATTACK_KERN_COMBI)
5551 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5556 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5558 if (data
.devices_status
== STATUS_CRACKED
) break;
5559 if (data
.devices_status
== STATUS_ABORTED
) break;
5560 if (data
.devices_status
== STATUS_QUIT
) break;
5561 if (data
.devices_status
== STATUS_BYPASS
) break;
5563 if (words_fin
== 0) break;
5565 device_param
->words_done
= words_fin
;
5568 if (attack_mode
== ATTACK_MODE_COMBI
)
5570 fclose (device_param
->combs_fp
);
5573 free (wl_data
->buf
);
5579 device_param
->kernel_accel
= 0;
5580 device_param
->kernel_loops
= 0;
5585 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5589 log_error ("ERROR: %s : Invalid argument", __func__
);
5594 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5596 device_param
->kernel_params_buf32
[27] = salt_pos
;
5597 device_param
->kernel_params_buf32
[30] = 1;
5598 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5599 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5600 device_param
->kernel_params_buf32
[33] = 0;
5601 device_param
->kernel_params_buf32
[34] = 1;
5603 char *dictfile_old
= data
.dictfile
;
5605 const char *weak_hash_check
= "weak-hash-check";
5607 data
.dictfile
= (char *) weak_hash_check
;
5609 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5611 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5617 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5619 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5623 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5625 uint loop_step
= 16;
5627 const uint iter
= salt_buf
->salt_iter
;
5629 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5631 uint loop_left
= iter
- loop_pos
;
5633 loop_left
= MIN (loop_left
, loop_step
);
5635 device_param
->kernel_params_buf32
[28] = loop_pos
;
5636 device_param
->kernel_params_buf32
[29] = loop_left
;
5638 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5641 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5648 check_cracked (device_param
, salt_pos
);
5654 device_param
->kernel_params_buf32
[27] = 0;
5655 device_param
->kernel_params_buf32
[28] = 0;
5656 device_param
->kernel_params_buf32
[29] = 0;
5657 device_param
->kernel_params_buf32
[30] = 0;
5658 device_param
->kernel_params_buf32
[31] = 0;
5659 device_param
->kernel_params_buf32
[32] = 0;
5660 device_param
->kernel_params_buf32
[33] = 0;
5661 device_param
->kernel_params_buf32
[34] = 0;
5663 data
.dictfile
= dictfile_old
;
5665 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5670 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5672 if (data
.username
== 0)
5674 *hashbuf_pos
= line_buf
;
5675 *hashbuf_len
= line_len
;
5679 char *pos
= line_buf
;
5682 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5684 if (line_buf
[i
] == data
.separator
)
5699 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5706 for (int i
= 0; i
< line_len
; i
++)
5708 if (line_buf
[i
] == data
.separator
)
5717 if (pos
== NULL
) pos
= line_buf
+ i
;
5729 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5736 for (int i
= 0; i
< line_len
; i
++)
5738 if (line_buf
[i
] == ':')
5745 if (sep_cnt
== 2) sep2_len
++;
5746 if (sep_cnt
== 3) sep3_len
++;
5749 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5754 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5761 for (int i
= 0; i
< line_len
; i
++)
5763 if (line_buf
[i
] == ':')
5770 if (data
.hash_mode
== 1000)
5774 if (pos
== NULL
) pos
= line_buf
+ i
;
5779 else if (data
.hash_mode
== 3000)
5783 if (pos
== NULL
) pos
= line_buf
+ i
;
5794 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5801 for (int i
= 0; i
< line_len
; i
++)
5803 if (line_buf
[i
] == ':')
5812 if (pos
== NULL
) pos
= line_buf
+ i
;
5824 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5828 char sep5_first
= 0;
5829 char sep6_first
= 0;
5831 for (int i
= 0; i
< line_len
; i
++)
5833 if (line_buf
[i
] == ':')
5840 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5841 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5844 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5849 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5856 for (int i
= 0; i
< line_len
; i
++)
5858 if (line_buf
[i
] == ':')
5867 if (pos
== NULL
) pos
= line_buf
+ i
;
5877 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5884 for (int i
= 0; i
< line_len
; i
++)
5886 if (line_buf
[i
] == ':')
5895 if (pos
== NULL
) pos
= line_buf
+ i
;
5907 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5911 for (int i
= 0; i
< line_len
; i
++)
5913 if (line_buf
[i
] == ':') sep_cnt
++;
5916 if (sep_cnt
== 8) return 1;
5921 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5923 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5926 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5928 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5933 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5935 switch (hashfile_format
)
5937 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5938 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5939 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5940 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5944 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5946 switch (hashfile_format
)
5948 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5949 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5950 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5951 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5955 char *strhlfmt (const uint hashfile_format
)
5957 switch (hashfile_format
)
5959 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5960 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5961 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5962 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5963 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5964 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5965 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5966 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5967 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5968 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5971 return ((char *) "Unknown");
5974 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5976 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5978 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5979 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5981 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5985 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5989 int line_len
= fgetl (fp
, line_buf
);
5991 if (line_len
== 0) continue;
5993 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5994 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5995 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5997 if (num_check
== max_check
) break;
6004 uint hashlist_format
= HLFMT_HASHCAT
;
6006 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
6008 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
6010 hashlist_format
= i
;
6015 return hashlist_format
;
6019 * some further helper function
6022 // wrapper around mymalloc for ADL
6024 #if defined(HAVE_HWMON)
6025 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
6027 return mymalloc (iSize
);
6031 static uint
generate_bitmaps (const uint digests_cnt
, const uint dgst_size
, const uint dgst_shifts
, char *digests_buf_ptr
, const uint bitmap_mask
, const uint bitmap_size
, uint
*bitmap_a
, uint
*bitmap_b
, uint
*bitmap_c
, uint
*bitmap_d
, const u64 collisions_max
)
6035 const uint dgst_pos0
= data
.dgst_pos0
;
6036 const uint dgst_pos1
= data
.dgst_pos1
;
6037 const uint dgst_pos2
= data
.dgst_pos2
;
6038 const uint dgst_pos3
= data
.dgst_pos3
;
6040 memset (bitmap_a
, 0, bitmap_size
);
6041 memset (bitmap_b
, 0, bitmap_size
);
6042 memset (bitmap_c
, 0, bitmap_size
);
6043 memset (bitmap_d
, 0, bitmap_size
);
6045 for (uint i
= 0; i
< digests_cnt
; i
++)
6047 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
6049 digests_buf_ptr
+= dgst_size
;
6051 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
6052 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
6053 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
6054 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
6056 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
6057 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
6058 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
6059 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
6061 if (bitmap_a
[idx0
] & val0
) collisions
++;
6062 if (bitmap_b
[idx1
] & val1
) collisions
++;
6063 if (bitmap_c
[idx2
] & val2
) collisions
++;
6064 if (bitmap_d
[idx3
] & val3
) collisions
++;
6066 bitmap_a
[idx0
] |= val0
;
6067 bitmap_b
[idx1
] |= val1
;
6068 bitmap_c
[idx2
] |= val2
;
6069 bitmap_d
[idx3
] |= val3
;
6071 if (collisions
>= collisions_max
) return 0x7fffffff;
6082 void SetConsoleWindowSize (const int x
)
6084 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
6086 if (h
== INVALID_HANDLE_VALUE
) return;
6088 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
6090 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
6092 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
6094 sr
->Right
= MAX (sr
->Right
, x
- 1);
6098 co
.X
= sr
->Right
+ 1;
6101 if (!SetConsoleScreenBufferSize (h
, co
)) return;
6103 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
6107 int main (int argc
, char **argv
)
6110 SetConsoleWindowSize (132);
6114 * To help users a bit
6117 char *compute
= getenv ("COMPUTE");
6121 static char display
[100];
6123 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
6129 if (getenv ("DISPLAY") == NULL
)
6130 putenv ((char *) "DISPLAY=:0");
6133 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
6134 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
6136 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
6137 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
6139 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
6140 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
6142 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
6143 putenv ((char *) "CUDA_CACHE_DISABLE=1");
6145 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
6146 putenv ((char *) "POCL_KERNEL_CACHE=0");
6151 * There's some buggy OpenCL runtime that do not support -I.
6152 * A workaround is to chdir() to the OpenCL folder,
6153 * then compile the kernels,
6154 * then chdir() back to where we came from so we need to save it first
6159 if (getcwd (cwd
, sizeof (cwd
) - 1) == NULL
)
6161 log_error ("ERROR: getcwd(): %s", strerror (errno
));
6170 memset (&data
, 0, sizeof (hc_global_data_t
));
6176 data
.proc_start
= proc_start
;
6179 char **myargv
= argv
;
6181 hc_thread_mutex_init (mux_dispatcher
);
6182 hc_thread_mutex_init (mux_counter
);
6183 hc_thread_mutex_init (mux_display
);
6184 hc_thread_mutex_init (mux_adl
);
6187 * commandline parameters
6191 uint version
= VERSION
;
6193 uint benchmark
= BENCHMARK
;
6194 uint stdout_flag
= STDOUT_FLAG
;
6197 uint username
= USERNAME
;
6198 uint remove
= REMOVE
;
6199 uint remove_timer
= REMOVE_TIMER
;
6202 uint keyspace
= KEYSPACE
;
6203 uint potfile_disable
= POTFILE_DISABLE
;
6204 char *potfile_path
= NULL
;
6205 uint debug_mode
= DEBUG_MODE
;
6206 char *debug_file
= NULL
;
6207 char *induction_dir
= NULL
;
6208 char *outfile_check_dir
= NULL
;
6210 uint runtime
= RUNTIME
;
6211 uint hash_mode
= HASH_MODE
;
6212 uint attack_mode
= ATTACK_MODE
;
6213 uint markov_disable
= MARKOV_DISABLE
;
6214 uint markov_classic
= MARKOV_CLASSIC
;
6215 uint markov_threshold
= MARKOV_THRESHOLD
;
6216 char *markov_hcstat
= NULL
;
6217 char *outfile
= NULL
;
6218 uint outfile_format
= OUTFILE_FORMAT
;
6219 uint outfile_autohex
= OUTFILE_AUTOHEX
;
6220 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
6221 uint restore
= RESTORE
;
6222 uint restore_timer
= RESTORE_TIMER
;
6223 uint restore_disable
= RESTORE_DISABLE
;
6224 uint status
= STATUS
;
6225 uint status_timer
= STATUS_TIMER
;
6226 uint machine_readable
= MACHINE_READABLE
;
6227 uint loopback
= LOOPBACK
;
6228 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
6229 char *session
= NULL
;
6230 uint hex_charset
= HEX_CHARSET
;
6231 uint hex_salt
= HEX_SALT
;
6232 uint hex_wordlist
= HEX_WORDLIST
;
6233 uint rp_gen
= RP_GEN
;
6234 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
6235 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
6236 uint rp_gen_seed
= RP_GEN_SEED
;
6237 char *rule_buf_l
= (char *) RULE_BUF_L
;
6238 char *rule_buf_r
= (char *) RULE_BUF_R
;
6239 uint increment
= INCREMENT
;
6240 uint increment_min
= INCREMENT_MIN
;
6241 uint increment_max
= INCREMENT_MAX
;
6242 char *cpu_affinity
= NULL
;
6243 OCL_PTR
*ocl
= NULL
;
6244 char *opencl_devices
= NULL
;
6245 char *opencl_platforms
= NULL
;
6246 char *opencl_device_types
= NULL
;
6247 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
6248 char *truecrypt_keyfiles
= NULL
;
6249 char *veracrypt_keyfiles
= NULL
;
6250 uint veracrypt_pim
= 0;
6251 uint workload_profile
= WORKLOAD_PROFILE
;
6252 uint kernel_accel
= KERNEL_ACCEL
;
6253 uint kernel_loops
= KERNEL_LOOPS
;
6254 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
6255 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
6257 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
6258 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
6259 uint powertune_enable
= POWERTUNE_ENABLE
;
6261 uint logfile_disable
= LOGFILE_DISABLE
;
6262 uint segment_size
= SEGMENT_SIZE
;
6263 uint scrypt_tmto
= SCRYPT_TMTO
;
6264 char separator
= SEPARATOR
;
6265 uint bitmap_min
= BITMAP_MIN
;
6266 uint bitmap_max
= BITMAP_MAX
;
6267 char *custom_charset_1
= NULL
;
6268 char *custom_charset_2
= NULL
;
6269 char *custom_charset_3
= NULL
;
6270 char *custom_charset_4
= NULL
;
6272 #define IDX_HELP 'h'
6273 #define IDX_VERSION 'V'
6274 #define IDX_VERSION_LOWER 'v'
6275 #define IDX_QUIET 0xff02
6276 #define IDX_SHOW 0xff03
6277 #define IDX_LEFT 0xff04
6278 #define IDX_REMOVE 0xff05
6279 #define IDX_REMOVE_TIMER 0xff37
6280 #define IDX_SKIP 's'
6281 #define IDX_LIMIT 'l'
6282 #define IDX_KEYSPACE 0xff35
6283 #define IDX_POTFILE_DISABLE 0xff06
6284 #define IDX_POTFILE_PATH 0xffe0
6285 #define IDX_DEBUG_MODE 0xff43
6286 #define IDX_DEBUG_FILE 0xff44
6287 #define IDX_INDUCTION_DIR 0xff46
6288 #define IDX_OUTFILE_CHECK_DIR 0xff47
6289 #define IDX_USERNAME 0xff07
6290 #define IDX_FORCE 0xff08
6291 #define IDX_RUNTIME 0xff09
6292 #define IDX_BENCHMARK 'b'
6293 #define IDX_STDOUT_FLAG 0xff77
6294 #define IDX_HASH_MODE 'm'
6295 #define IDX_ATTACK_MODE 'a'
6296 #define IDX_RP_FILE 'r'
6297 #define IDX_RP_GEN 'g'
6298 #define IDX_RP_GEN_FUNC_MIN 0xff10
6299 #define IDX_RP_GEN_FUNC_MAX 0xff11
6300 #define IDX_RP_GEN_SEED 0xff34
6301 #define IDX_RULE_BUF_L 'j'
6302 #define IDX_RULE_BUF_R 'k'
6303 #define IDX_INCREMENT 'i'
6304 #define IDX_INCREMENT_MIN 0xff12
6305 #define IDX_INCREMENT_MAX 0xff13
6306 #define IDX_OUTFILE 'o'
6307 #define IDX_OUTFILE_FORMAT 0xff14
6308 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
6309 #define IDX_OUTFILE_CHECK_TIMER 0xff45
6310 #define IDX_RESTORE 0xff15
6311 #define IDX_RESTORE_DISABLE 0xff27
6312 #define IDX_STATUS 0xff17
6313 #define IDX_STATUS_TIMER 0xff18
6314 #define IDX_MACHINE_READABLE 0xff50
6315 #define IDX_LOOPBACK 0xff38
6316 #define IDX_WEAK_HASH_THRESHOLD 0xff42
6317 #define IDX_SESSION 0xff19
6318 #define IDX_HEX_CHARSET 0xff20
6319 #define IDX_HEX_SALT 0xff21
6320 #define IDX_HEX_WORDLIST 0xff40
6321 #define IDX_MARKOV_DISABLE 0xff22
6322 #define IDX_MARKOV_CLASSIC 0xff23
6323 #define IDX_MARKOV_THRESHOLD 't'
6324 #define IDX_MARKOV_HCSTAT 0xff24
6325 #define IDX_CPU_AFFINITY 0xff25
6326 #define IDX_OPENCL_DEVICES 'd'
6327 #define IDX_OPENCL_PLATFORMS 0xff72
6328 #define IDX_OPENCL_DEVICE_TYPES 'D'
6329 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
6330 #define IDX_WORKLOAD_PROFILE 'w'
6331 #define IDX_KERNEL_ACCEL 'n'
6332 #define IDX_KERNEL_LOOPS 'u'
6333 #define IDX_NVIDIA_SPIN_DAMP 0xff79
6334 #define IDX_GPU_TEMP_DISABLE 0xff29
6335 #define IDX_GPU_TEMP_ABORT 0xff30
6336 #define IDX_GPU_TEMP_RETAIN 0xff31
6337 #define IDX_POWERTUNE_ENABLE 0xff41
6338 #define IDX_LOGFILE_DISABLE 0xff51
6339 #define IDX_TRUECRYPT_KEYFILES 0xff52
6340 #define IDX_VERACRYPT_KEYFILES 0xff53
6341 #define IDX_VERACRYPT_PIM 0xff54
6342 #define IDX_SCRYPT_TMTO 0xff61
6343 #define IDX_SEGMENT_SIZE 'c'
6344 #define IDX_SEPARATOR 'p'
6345 #define IDX_BITMAP_MIN 0xff70
6346 #define IDX_BITMAP_MAX 0xff71
6347 #define IDX_CUSTOM_CHARSET_1 '1'
6348 #define IDX_CUSTOM_CHARSET_2 '2'
6349 #define IDX_CUSTOM_CHARSET_3 '3'
6350 #define IDX_CUSTOM_CHARSET_4 '4'
6352 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
6354 struct option long_options
[] =
6356 {"help", no_argument
, 0, IDX_HELP
},
6357 {"version", no_argument
, 0, IDX_VERSION
},
6358 {"quiet", no_argument
, 0, IDX_QUIET
},
6359 {"show", no_argument
, 0, IDX_SHOW
},
6360 {"left", no_argument
, 0, IDX_LEFT
},
6361 {"username", no_argument
, 0, IDX_USERNAME
},
6362 {"remove", no_argument
, 0, IDX_REMOVE
},
6363 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
6364 {"skip", required_argument
, 0, IDX_SKIP
},
6365 {"limit", required_argument
, 0, IDX_LIMIT
},
6366 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6367 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6368 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6369 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6370 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6371 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6372 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6373 {"force", no_argument
, 0, IDX_FORCE
},
6374 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6375 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6376 {"restore", no_argument
, 0, IDX_RESTORE
},
6377 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6378 {"status", no_argument
, 0, IDX_STATUS
},
6379 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6380 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6381 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6382 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6383 {"session", required_argument
, 0, IDX_SESSION
},
6384 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6385 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6386 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6387 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6388 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6389 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6390 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6391 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6392 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6393 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6394 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6395 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6396 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6397 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6398 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6399 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6400 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6401 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6402 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6403 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6404 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6405 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6406 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6407 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6408 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6409 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6410 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6411 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6412 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6413 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6414 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6416 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6417 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6418 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6419 #endif // HAVE_HWMON
6420 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6421 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6422 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6423 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6424 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6425 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6426 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6427 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6428 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6429 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6430 {"increment", no_argument
, 0, IDX_INCREMENT
},
6431 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6432 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6433 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6434 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6435 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6436 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6440 uint rp_files_cnt
= 0;
6442 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6444 int option_index
= 0;
6450 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6454 case IDX_HELP
: usage
= 1; break;
6456 case IDX_VERSION_LOWER
: version
= 1; break;
6457 case IDX_RESTORE
: restore
= 1; break;
6458 case IDX_SESSION
: session
= optarg
; break;
6459 case IDX_SHOW
: show
= 1; break;
6460 case IDX_LEFT
: left
= 1; break;
6461 case '?': return -1;
6467 log_error ("ERROR: Invalid argument specified");
6478 log_info ("%s", VERSION_TAG
);
6485 usage_big_print (PROGNAME
);
6491 * session needs to be set, always!
6494 if (session
== NULL
) session
= (char *) PROGNAME
;
6497 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6500 char *exec_path
= get_exec_path ();
6503 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
6505 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6506 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6508 if (resolved_install_folder
== NULL
)
6510 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6515 if (resolved_exec_path
== NULL
)
6517 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6522 char *install_dir
= get_install_dir (resolved_exec_path
);
6523 char *profile_dir
= NULL
;
6524 char *session_dir
= NULL
;
6525 char *shared_dir
= NULL
;
6527 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6529 struct passwd
*pw
= getpwuid (getuid ());
6531 const char *homedir
= pw
->pw_dir
;
6533 profile_dir
= get_profile_dir (homedir
);
6534 session_dir
= get_session_dir (profile_dir
);
6535 shared_dir
= strdup (SHARED_FOLDER
);
6537 mkdir (profile_dir
, 0700);
6538 mkdir (session_dir
, 0700);
6542 profile_dir
= install_dir
;
6543 session_dir
= install_dir
;
6544 shared_dir
= install_dir
;
6547 myfree (resolved_install_folder
);
6548 myfree (resolved_exec_path
);
6552 char *install_dir
= get_install_dir (exec_path
);
6553 char *profile_dir
= install_dir
;
6554 char *session_dir
= install_dir
;
6555 char *shared_dir
= install_dir
;
6559 data
.install_dir
= install_dir
;
6560 data
.profile_dir
= profile_dir
;
6561 data
.session_dir
= session_dir
;
6562 data
.shared_dir
= shared_dir
;
6567 * kernel cache, we need to make sure folder exist
6570 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6572 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6574 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6576 mkdir (kernels_folder
, 0700);
6578 myfree (kernels_folder
);
6584 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6586 data
.session
= session
;
6588 char *eff_restore_file
= (char *) mymalloc (session_size
);
6589 char *new_restore_file
= (char *) mymalloc (session_size
);
6591 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6592 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6594 data
.eff_restore_file
= eff_restore_file
;
6595 data
.new_restore_file
= new_restore_file
;
6597 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6599 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6600 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6605 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6606 if ((show
== 1) || (left
== 1))
6608 restore_disable
= 1;
6613 data
.restore_disable
= restore_disable
;
6615 restore_data_t
*rd
= init_restore (argc
, argv
);
6625 read_restore (eff_restore_file
, rd
);
6627 if (rd
->version_bin
< RESTORE_MIN
)
6629 log_error ("ERROR: Incompatible restore-file version");
6638 rd
->pid
= getpid ();
6640 rd
->pid
= GetCurrentProcessId ();
6644 uint hash_mode_chgd
= 0;
6645 uint runtime_chgd
= 0;
6646 uint kernel_loops_chgd
= 0;
6647 uint kernel_accel_chgd
= 0;
6648 uint nvidia_spin_damp_chgd
= 0;
6649 uint attack_mode_chgd
= 0;
6650 uint outfile_format_chgd
= 0;
6651 uint rp_gen_seed_chgd
= 0;
6652 uint remove_timer_chgd
= 0;
6653 uint increment_min_chgd
= 0;
6654 uint increment_max_chgd
= 0;
6655 uint workload_profile_chgd
= 0;
6656 uint opencl_vector_width_chgd
= 0;
6662 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6666 //case IDX_HELP: usage = 1; break;
6667 //case IDX_VERSION: version = 1; break;
6668 //case IDX_RESTORE: restore = 1; break;
6669 case IDX_QUIET
: quiet
= 1; break;
6670 //case IDX_SHOW: show = 1; break;
6671 case IDX_SHOW
: break;
6672 //case IDX_LEFT: left = 1; break;
6673 case IDX_LEFT
: break;
6674 case IDX_USERNAME
: username
= 1; break;
6675 case IDX_REMOVE
: remove
= 1; break;
6676 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6677 remove_timer_chgd
= 1; break;
6678 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6679 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6680 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6681 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6682 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6683 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6684 case IDX_FORCE
: force
= 1; break;
6685 case IDX_SKIP
: skip
= atoll (optarg
); break;
6686 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6687 case IDX_KEYSPACE
: keyspace
= 1; break;
6688 case IDX_BENCHMARK
: benchmark
= 1; break;
6689 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6690 case IDX_RESTORE
: break;
6691 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6692 case IDX_STATUS
: status
= 1; break;
6693 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6694 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6695 case IDX_LOOPBACK
: loopback
= 1; break;
6696 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6697 //case IDX_SESSION: session = optarg; break;
6698 case IDX_SESSION
: break;
6699 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6700 hash_mode_chgd
= 1; break;
6701 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6702 runtime_chgd
= 1; break;
6703 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6704 attack_mode_chgd
= 1; break;
6705 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6706 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6707 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6708 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6709 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6710 rp_gen_seed_chgd
= 1; break;
6711 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6712 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6713 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6714 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6715 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6716 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6717 case IDX_OUTFILE
: outfile
= optarg
; break;
6718 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6719 outfile_format_chgd
= 1; break;
6720 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6721 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6722 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6723 case IDX_HEX_SALT
: hex_salt
= 1; break;
6724 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6725 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6726 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6727 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6728 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6729 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6730 opencl_vector_width_chgd
= 1; break;
6731 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6732 workload_profile_chgd
= 1; break;
6733 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6734 kernel_accel_chgd
= 1; break;
6735 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6736 kernel_loops_chgd
= 1; break;
6737 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6738 nvidia_spin_damp_chgd
= 1; break;
6739 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6741 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6742 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6743 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6744 #endif // HAVE_HWMON
6745 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6746 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6747 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6748 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6749 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6750 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6751 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6752 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6753 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6754 case IDX_INCREMENT
: increment
= 1; break;
6755 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6756 increment_min_chgd
= 1; break;
6757 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6758 increment_max_chgd
= 1; break;
6759 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6760 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6761 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6762 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6765 log_error ("ERROR: Invalid argument specified");
6772 log_error ("ERROR: Invalid argument specified");
6778 * Inform user things getting started,
6779 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6780 * - we do not need to check algorithm_pos
6787 if (machine_readable
== 0)
6789 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6794 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6797 else if (restore
== 1)
6799 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6802 else if (stdout_flag
== 1)
6806 else if (keyspace
== 1)
6812 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6821 if (attack_mode
> 7)
6823 log_error ("ERROR: Invalid attack-mode specified");
6828 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6830 log_error ("ERROR: Invalid runtime specified");
6835 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6837 log_error ("ERROR: Invalid hash-type specified");
6842 // renamed hash modes
6856 log_error ("Old -m specified, use -m %d instead", n
);
6864 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6866 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6872 if (outfile_format
> 16)
6874 log_error ("ERROR: Invalid outfile-format specified");
6881 if (outfile_format_chgd
== 1)
6883 if (outfile_format
> 1)
6885 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6892 outfile_format
= OUTFILE_FMT_HASH
;
6898 if (outfile_format_chgd
== 1)
6900 if ((outfile_format
> 7) && (outfile_format
< 16))
6902 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6909 if (increment_min
< INCREMENT_MIN
)
6911 log_error ("ERROR: Invalid increment-min specified");
6916 if (increment_max
> INCREMENT_MAX
)
6918 log_error ("ERROR: Invalid increment-max specified");
6923 if (increment_min
> increment_max
)
6925 log_error ("ERROR: Invalid increment-min specified");
6930 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6932 log_error ("ERROR: Increment is not allowed in attack-mode 0");
6937 if ((increment
== 0) && (increment_min_chgd
== 1))
6939 log_error ("ERROR: Increment-min is only supported combined with increment switch");
6944 if ((increment
== 0) && (increment_max_chgd
== 1))
6946 log_error ("ERROR: Increment-max is only supported combined with increment switch");
6951 if (rp_files_cnt
&& rp_gen
)
6953 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6958 if (rp_files_cnt
|| rp_gen
)
6960 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6962 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6968 if (rp_gen_func_min
> rp_gen_func_max
)
6970 log_error ("ERROR: Invalid rp-gen-func-min specified");
6975 if (kernel_accel_chgd
== 1)
6979 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
6980 log_info ("Please consider using the -w option instead");
6981 log_info ("You can use --force to override this but do not post error reports if you do so");
6987 if (kernel_accel
< 1)
6989 log_error ("ERROR: Invalid kernel-accel specified");
6994 if (kernel_accel
> 1024)
6996 log_error ("ERROR: Invalid kernel-accel specified");
7002 if (kernel_loops_chgd
== 1)
7006 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
7007 log_info ("Please consider using the -w option instead");
7008 log_info ("You can use --force to override this but do not post error reports if you do so");
7014 if (kernel_loops
< 1)
7016 log_error ("ERROR: Invalid kernel-loops specified");
7021 if (kernel_loops
> 1024)
7023 log_error ("ERROR: Invalid kernel-loops specified");
7029 if ((workload_profile
< 1) || (workload_profile
> 4))
7031 log_error ("ERROR: workload-profile %i not available", workload_profile
);
7036 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
7038 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
7043 if (show
== 1 || left
== 1)
7045 attack_mode
= ATTACK_MODE_NONE
;
7049 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
7054 if (potfile_disable
== 1)
7056 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
7062 uint attack_kern
= ATTACK_KERN_NONE
;
7064 switch (attack_mode
)
7066 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
7067 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
7068 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
7069 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
7070 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
7075 if (myargv
[optind
] != 0)
7077 log_error ("ERROR: Invalid argument for benchmark mode specified");
7082 if (attack_mode_chgd
== 1)
7084 if (attack_mode
!= ATTACK_MODE_BF
)
7086 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
7094 if (stdout_flag
== 1) // no hash here
7101 int num_additional_params
= 1;
7103 if (attack_kern
== ATTACK_KERN_COMBI
)
7105 num_additional_params
= 2;
7108 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
7110 if (keyspace_wordlist_specified
== 0) optind
--;
7113 if (attack_kern
== ATTACK_KERN_NONE
)
7115 if ((optind
+ 1) != myargc
)
7117 usage_mini_print (myargv
[0]);
7122 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
7124 if ((optind
+ 1) > myargc
)
7126 usage_mini_print (myargv
[0]);
7131 else if (attack_kern
== ATTACK_KERN_COMBI
)
7133 if ((optind
+ 3) != myargc
)
7135 usage_mini_print (myargv
[0]);
7140 else if (attack_kern
== ATTACK_KERN_BF
)
7142 if ((optind
+ 1) > myargc
)
7144 usage_mini_print (myargv
[0]);
7151 usage_mini_print (myargv
[0]);
7157 if (skip
!= 0 && limit
!= 0)
7166 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
7172 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
7177 potfile_disable
= 1;
7179 restore_disable
= 1;
7183 weak_hash_threshold
= 0;
7188 if (stdout_flag
== 1)
7192 restore_disable
= 1;
7194 potfile_disable
= 1;
7195 weak_hash_threshold
= 0;
7196 gpu_temp_disable
= 1;
7199 outfile_format
= OUTFILE_FMT_PLAIN
;
7200 kernel_accel
= 1024;
7201 kernel_loops
= 1024;
7203 outfile_check_timer
= 0;
7205 opencl_vector_width
= 1;
7208 if (remove_timer_chgd
== 1)
7212 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
7217 if (remove_timer
< 1)
7219 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
7227 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
7229 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7231 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
7238 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
7246 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7248 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
7253 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7255 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
7263 log_error ("ERROR: Invalid debug-mode specified");
7268 if (debug_file
!= NULL
)
7272 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
7278 if (induction_dir
!= NULL
)
7280 if (attack_mode
== ATTACK_MODE_BF
)
7282 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
7288 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7290 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
7292 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
7297 weak_hash_threshold
= 0;
7300 if (nvidia_spin_damp
> 100)
7302 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
7309 * induction directory
7312 char *induction_directory
= NULL
;
7314 if (attack_mode
!= ATTACK_MODE_BF
)
7316 if (induction_dir
== NULL
)
7318 induction_directory
= (char *) mymalloc (session_size
);
7320 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
7322 // create induction folder if it does not already exist
7326 if (rmdir (induction_directory
) == -1)
7328 if (errno
== ENOENT
)
7330 // good, we can ignore
7332 else if (errno
== ENOTEMPTY
)
7334 char *induction_directory_mv
= (char *) mymalloc (session_size
);
7336 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
7338 if (rename (induction_directory
, induction_directory_mv
) != 0)
7340 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
7347 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7353 if (mkdir (induction_directory
, 0700) == -1)
7355 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7363 induction_directory
= induction_dir
;
7367 data
.induction_directory
= induction_directory
;
7373 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7375 char *loopback_file
= (char *) mymalloc (loopback_size
);
7381 char tuning_db_file
[256] = { 0 };
7383 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7385 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7388 * outfile-check directory
7391 char *outfile_check_directory
= NULL
;
7393 if (outfile_check_dir
== NULL
)
7395 outfile_check_directory
= (char *) mymalloc (session_size
);
7397 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7401 outfile_check_directory
= outfile_check_dir
;
7404 data
.outfile_check_directory
= outfile_check_directory
;
7408 struct stat outfile_check_stat
;
7410 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7412 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7416 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7421 else if (outfile_check_dir
== NULL
)
7423 if (mkdir (outfile_check_directory
, 0700) == -1)
7425 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7433 * special other stuff
7436 if (hash_mode
== 9710)
7439 outfile_format_chgd
= 1;
7442 if (hash_mode
== 9810)
7445 outfile_format_chgd
= 1;
7448 if (hash_mode
== 10410)
7451 outfile_format_chgd
= 1;
7458 data
.hash_mode
= hash_mode
;
7459 data
.restore
= restore
;
7460 data
.restore_timer
= restore_timer
;
7461 data
.restore_disable
= restore_disable
;
7462 data
.status
= status
;
7463 data
.status_timer
= status_timer
;
7464 data
.machine_readable
= machine_readable
;
7465 data
.loopback
= loopback
;
7466 data
.runtime
= runtime
;
7467 data
.remove
= remove
;
7468 data
.remove_timer
= remove_timer
;
7469 data
.debug_mode
= debug_mode
;
7470 data
.debug_file
= debug_file
;
7471 data
.username
= username
;
7473 data
.outfile
= outfile
;
7474 data
.outfile_format
= outfile_format
;
7475 data
.outfile_autohex
= outfile_autohex
;
7476 data
.hex_charset
= hex_charset
;
7477 data
.hex_salt
= hex_salt
;
7478 data
.hex_wordlist
= hex_wordlist
;
7479 data
.separator
= separator
;
7480 data
.rp_files
= rp_files
;
7481 data
.rp_files_cnt
= rp_files_cnt
;
7482 data
.rp_gen
= rp_gen
;
7483 data
.rp_gen_seed
= rp_gen_seed
;
7485 data
.benchmark
= benchmark
;
7489 data
.powertune_enable
= powertune_enable
;
7491 data
.logfile_disable
= logfile_disable
;
7492 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7493 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7494 data
.veracrypt_pim
= veracrypt_pim
;
7495 data
.scrypt_tmto
= scrypt_tmto
;
7496 data
.workload_profile
= workload_profile
;
7504 set_cpu_affinity (cpu_affinity
);
7507 if (rp_gen_seed_chgd
== 0)
7513 srand (rp_gen_seed
);
7520 if (logfile_disable
== 0)
7522 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7524 char *logfile
= (char *) mymalloc (logfile_size
);
7526 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7528 data
.logfile
= logfile
;
7530 char *topid
= logfile_generate_topid ();
7535 // logfile_append() checks for logfile_disable internally to make it easier from here
7537 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7538 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7539 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7540 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7541 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7542 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7543 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7544 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7545 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7546 #define logfile_sub_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s\t%s", data.topid, data.subid, (var), (val));
7548 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7549 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7550 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7551 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7552 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7553 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7554 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7555 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7557 logfile_top_msg ("START");
7559 logfile_top_uint (attack_mode
);
7560 logfile_top_uint (attack_kern
);
7561 logfile_top_uint (benchmark
);
7562 logfile_top_uint (stdout_flag
);
7563 logfile_top_uint (bitmap_min
);
7564 logfile_top_uint (bitmap_max
);
7565 logfile_top_uint (debug_mode
);
7566 logfile_top_uint (force
);
7567 logfile_top_uint (kernel_accel
);
7568 logfile_top_uint (kernel_loops
);
7569 logfile_top_uint (nvidia_spin_damp
);
7570 logfile_top_uint (gpu_temp_disable
);
7572 logfile_top_uint (gpu_temp_abort
);
7573 logfile_top_uint (gpu_temp_retain
);
7575 logfile_top_uint (hash_mode
);
7576 logfile_top_uint (hex_charset
);
7577 logfile_top_uint (hex_salt
);
7578 logfile_top_uint (hex_wordlist
);
7579 logfile_top_uint (increment
);
7580 logfile_top_uint (increment_max
);
7581 logfile_top_uint (increment_min
);
7582 logfile_top_uint (keyspace
);
7583 logfile_top_uint (left
);
7584 logfile_top_uint (logfile_disable
);
7585 logfile_top_uint (loopback
);
7586 logfile_top_uint (markov_classic
);
7587 logfile_top_uint (markov_disable
);
7588 logfile_top_uint (markov_threshold
);
7589 logfile_top_uint (outfile_autohex
);
7590 logfile_top_uint (outfile_check_timer
);
7591 logfile_top_uint (outfile_format
);
7592 logfile_top_uint (potfile_disable
);
7593 logfile_top_string (potfile_path
);
7594 #if defined(HAVE_HWMON)
7595 logfile_top_uint (powertune_enable
);
7597 logfile_top_uint (scrypt_tmto
);
7598 logfile_top_uint (quiet
);
7599 logfile_top_uint (remove
);
7600 logfile_top_uint (remove_timer
);
7601 logfile_top_uint (restore
);
7602 logfile_top_uint (restore_disable
);
7603 logfile_top_uint (restore_timer
);
7604 logfile_top_uint (rp_gen
);
7605 logfile_top_uint (rp_gen_func_max
);
7606 logfile_top_uint (rp_gen_func_min
);
7607 logfile_top_uint (rp_gen_seed
);
7608 logfile_top_uint (runtime
);
7609 logfile_top_uint (segment_size
);
7610 logfile_top_uint (show
);
7611 logfile_top_uint (status
);
7612 logfile_top_uint (machine_readable
);
7613 logfile_top_uint (status_timer
);
7614 logfile_top_uint (usage
);
7615 logfile_top_uint (username
);
7616 logfile_top_uint (version
);
7617 logfile_top_uint (weak_hash_threshold
);
7618 logfile_top_uint (workload_profile
);
7619 logfile_top_uint64 (limit
);
7620 logfile_top_uint64 (skip
);
7621 logfile_top_char (separator
);
7622 logfile_top_string (cpu_affinity
);
7623 logfile_top_string (custom_charset_1
);
7624 logfile_top_string (custom_charset_2
);
7625 logfile_top_string (custom_charset_3
);
7626 logfile_top_string (custom_charset_4
);
7627 logfile_top_string (debug_file
);
7628 logfile_top_string (opencl_devices
);
7629 logfile_top_string (opencl_platforms
);
7630 logfile_top_string (opencl_device_types
);
7631 logfile_top_uint (opencl_vector_width
);
7632 logfile_top_string (induction_dir
);
7633 logfile_top_string (markov_hcstat
);
7634 logfile_top_string (outfile
);
7635 logfile_top_string (outfile_check_dir
);
7636 logfile_top_string (rule_buf_l
);
7637 logfile_top_string (rule_buf_r
);
7638 logfile_top_string (session
);
7639 logfile_top_string (truecrypt_keyfiles
);
7640 logfile_top_string (veracrypt_keyfiles
);
7641 logfile_top_uint (veracrypt_pim
);
7644 * Init OpenCL library loader
7649 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7657 * OpenCL platform selection
7660 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7663 * OpenCL device selection
7666 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7669 * OpenCL device type selection
7672 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7681 * disable useless stuff for benchmark
7686 restore_disable
= 1;
7687 potfile_disable
= 1;
7688 weak_hash_threshold
= 0;
7689 nvidia_spin_damp
= 0;
7690 gpu_temp_disable
= 1;
7691 outfile_check_timer
= 0;
7694 if (powertune_enable
== 1)
7696 gpu_temp_disable
= 0;
7700 data
.status_timer
= status_timer
;
7701 data
.restore_timer
= restore_timer
;
7702 data
.restore_disable
= restore_disable
;
7703 data
.outfile_check_timer
= outfile_check_timer
;
7706 * force attack mode to be bruteforce
7709 attack_mode
= ATTACK_MODE_BF
;
7710 attack_kern
= ATTACK_KERN_BF
;
7712 if (workload_profile_chgd
== 0)
7714 workload_profile
= 3;
7716 data
.workload_profile
= workload_profile
;
7721 * status, monitor and outfile remove threads
7724 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7726 data
.wordlist_mode
= wordlist_mode
;
7728 if (wordlist_mode
== WL_MODE_STDIN
)
7732 data
.status
= status
;
7735 uint outer_threads_cnt
= 0;
7737 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7739 data
.shutdown_outer
= 0;
7741 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7743 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7745 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7747 outer_threads_cnt
++;
7757 uint attack_exec
= 0;
7761 uint esalt_size
= 0;
7763 uint dgst_pos0
= -1;
7764 uint dgst_pos1
= -1;
7765 uint dgst_pos2
= -1;
7766 uint dgst_pos3
= -1;
7768 int (*parse_func
) (char *, uint
, hash_t
*);
7769 int (*sort_by_digest
) (const void *, const void *);
7771 uint algorithm_pos
= 0;
7772 uint algorithm_max
= 1;
7774 uint
*algorithms
= default_benchmark_algorithms
;
7776 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7778 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7781 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7782 * the following algos are skipped entirely
7785 if (algorithm_pos
> 0)
7789 rd
= init_restore (argc
, argv
);
7795 * update hash_mode in case of multihash benchmark
7800 if (hash_mode_chgd
== 0)
7802 hash_mode
= algorithms
[algorithm_pos
];
7804 data
.hash_mode
= hash_mode
;
7814 case 0: hash_type
= HASH_TYPE_MD5
;
7815 salt_type
= SALT_TYPE_NONE
;
7816 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7817 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7818 | OPTS_TYPE_PT_ADD80
7819 | OPTS_TYPE_PT_ADDBITS14
;
7820 kern_type
= KERN_TYPE_MD5
;
7821 dgst_size
= DGST_SIZE_4_4
;
7822 parse_func
= md5_parse_hash
;
7823 sort_by_digest
= sort_by_digest_4_4
;
7824 opti_type
= OPTI_TYPE_ZERO_BYTE
7825 | OPTI_TYPE_PRECOMPUTE_INIT
7826 | OPTI_TYPE_PRECOMPUTE_MERKLE
7827 | OPTI_TYPE_MEET_IN_MIDDLE
7828 | OPTI_TYPE_EARLY_SKIP
7829 | OPTI_TYPE_NOT_ITERATED
7830 | OPTI_TYPE_NOT_SALTED
7831 | OPTI_TYPE_RAW_HASH
;
7838 case 10: hash_type
= HASH_TYPE_MD5
;
7839 salt_type
= SALT_TYPE_INTERN
;
7840 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7841 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7842 | OPTS_TYPE_ST_ADD80
7843 | OPTS_TYPE_ST_ADDBITS14
;
7844 kern_type
= KERN_TYPE_MD5_PWSLT
;
7845 dgst_size
= DGST_SIZE_4_4
;
7846 parse_func
= md5s_parse_hash
;
7847 sort_by_digest
= sort_by_digest_4_4
;
7848 opti_type
= OPTI_TYPE_ZERO_BYTE
7849 | OPTI_TYPE_PRECOMPUTE_INIT
7850 | OPTI_TYPE_PRECOMPUTE_MERKLE
7851 | OPTI_TYPE_MEET_IN_MIDDLE
7852 | OPTI_TYPE_EARLY_SKIP
7853 | OPTI_TYPE_NOT_ITERATED
7854 | OPTI_TYPE_APPENDED_SALT
7855 | OPTI_TYPE_RAW_HASH
;
7862 case 11: hash_type
= HASH_TYPE_MD5
;
7863 salt_type
= SALT_TYPE_INTERN
;
7864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7865 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7866 | OPTS_TYPE_ST_ADD80
7867 | OPTS_TYPE_ST_ADDBITS14
;
7868 kern_type
= KERN_TYPE_MD5_PWSLT
;
7869 dgst_size
= DGST_SIZE_4_4
;
7870 parse_func
= joomla_parse_hash
;
7871 sort_by_digest
= sort_by_digest_4_4
;
7872 opti_type
= OPTI_TYPE_ZERO_BYTE
7873 | OPTI_TYPE_PRECOMPUTE_INIT
7874 | OPTI_TYPE_PRECOMPUTE_MERKLE
7875 | OPTI_TYPE_MEET_IN_MIDDLE
7876 | OPTI_TYPE_EARLY_SKIP
7877 | OPTI_TYPE_NOT_ITERATED
7878 | OPTI_TYPE_APPENDED_SALT
7879 | OPTI_TYPE_RAW_HASH
;
7886 case 12: hash_type
= HASH_TYPE_MD5
;
7887 salt_type
= SALT_TYPE_INTERN
;
7888 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7889 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7890 | OPTS_TYPE_ST_ADD80
7891 | OPTS_TYPE_ST_ADDBITS14
;
7892 kern_type
= KERN_TYPE_MD5_PWSLT
;
7893 dgst_size
= DGST_SIZE_4_4
;
7894 parse_func
= postgresql_parse_hash
;
7895 sort_by_digest
= sort_by_digest_4_4
;
7896 opti_type
= OPTI_TYPE_ZERO_BYTE
7897 | OPTI_TYPE_PRECOMPUTE_INIT
7898 | OPTI_TYPE_PRECOMPUTE_MERKLE
7899 | OPTI_TYPE_MEET_IN_MIDDLE
7900 | OPTI_TYPE_EARLY_SKIP
7901 | OPTI_TYPE_NOT_ITERATED
7902 | OPTI_TYPE_APPENDED_SALT
7903 | OPTI_TYPE_RAW_HASH
;
7910 case 20: hash_type
= HASH_TYPE_MD5
;
7911 salt_type
= SALT_TYPE_INTERN
;
7912 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7913 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7914 | OPTS_TYPE_PT_ADD80
7915 | OPTS_TYPE_PT_ADDBITS14
;
7916 kern_type
= KERN_TYPE_MD5_SLTPW
;
7917 dgst_size
= DGST_SIZE_4_4
;
7918 parse_func
= md5s_parse_hash
;
7919 sort_by_digest
= sort_by_digest_4_4
;
7920 opti_type
= OPTI_TYPE_ZERO_BYTE
7921 | OPTI_TYPE_PRECOMPUTE_INIT
7922 | OPTI_TYPE_PRECOMPUTE_MERKLE
7923 | OPTI_TYPE_EARLY_SKIP
7924 | OPTI_TYPE_NOT_ITERATED
7925 | OPTI_TYPE_PREPENDED_SALT
7926 | OPTI_TYPE_RAW_HASH
;
7933 case 21: hash_type
= HASH_TYPE_MD5
;
7934 salt_type
= SALT_TYPE_INTERN
;
7935 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7936 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7937 | OPTS_TYPE_PT_ADD80
7938 | OPTS_TYPE_PT_ADDBITS14
;
7939 kern_type
= KERN_TYPE_MD5_SLTPW
;
7940 dgst_size
= DGST_SIZE_4_4
;
7941 parse_func
= osc_parse_hash
;
7942 sort_by_digest
= sort_by_digest_4_4
;
7943 opti_type
= OPTI_TYPE_ZERO_BYTE
7944 | OPTI_TYPE_PRECOMPUTE_INIT
7945 | OPTI_TYPE_PRECOMPUTE_MERKLE
7946 | OPTI_TYPE_EARLY_SKIP
7947 | OPTI_TYPE_NOT_ITERATED
7948 | OPTI_TYPE_PREPENDED_SALT
7949 | OPTI_TYPE_RAW_HASH
;
7956 case 22: hash_type
= HASH_TYPE_MD5
;
7957 salt_type
= SALT_TYPE_EMBEDDED
;
7958 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7959 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7960 | OPTS_TYPE_PT_ADD80
7961 | OPTS_TYPE_PT_ADDBITS14
;
7962 kern_type
= KERN_TYPE_MD5_SLTPW
;
7963 dgst_size
= DGST_SIZE_4_4
;
7964 parse_func
= netscreen_parse_hash
;
7965 sort_by_digest
= sort_by_digest_4_4
;
7966 opti_type
= OPTI_TYPE_ZERO_BYTE
7967 | OPTI_TYPE_PRECOMPUTE_INIT
7968 | OPTI_TYPE_PRECOMPUTE_MERKLE
7969 | OPTI_TYPE_EARLY_SKIP
7970 | OPTI_TYPE_NOT_ITERATED
7971 | OPTI_TYPE_PREPENDED_SALT
7972 | OPTI_TYPE_RAW_HASH
;
7979 case 23: hash_type
= HASH_TYPE_MD5
;
7980 salt_type
= SALT_TYPE_EMBEDDED
;
7981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7982 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7983 | OPTS_TYPE_PT_ADD80
7984 | OPTS_TYPE_PT_ADDBITS14
;
7985 kern_type
= KERN_TYPE_MD5_SLTPW
;
7986 dgst_size
= DGST_SIZE_4_4
;
7987 parse_func
= skype_parse_hash
;
7988 sort_by_digest
= sort_by_digest_4_4
;
7989 opti_type
= OPTI_TYPE_ZERO_BYTE
7990 | OPTI_TYPE_PRECOMPUTE_INIT
7991 | OPTI_TYPE_PRECOMPUTE_MERKLE
7992 | OPTI_TYPE_EARLY_SKIP
7993 | OPTI_TYPE_NOT_ITERATED
7994 | OPTI_TYPE_PREPENDED_SALT
7995 | OPTI_TYPE_RAW_HASH
;
8002 case 30: hash_type
= HASH_TYPE_MD5
;
8003 salt_type
= SALT_TYPE_INTERN
;
8004 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8005 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8006 | OPTS_TYPE_PT_UNICODE
8007 | OPTS_TYPE_ST_ADD80
8008 | OPTS_TYPE_ST_ADDBITS14
;
8009 kern_type
= KERN_TYPE_MD5_PWUSLT
;
8010 dgst_size
= DGST_SIZE_4_4
;
8011 parse_func
= md5s_parse_hash
;
8012 sort_by_digest
= sort_by_digest_4_4
;
8013 opti_type
= OPTI_TYPE_ZERO_BYTE
8014 | OPTI_TYPE_PRECOMPUTE_INIT
8015 | OPTI_TYPE_PRECOMPUTE_MERKLE
8016 | OPTI_TYPE_MEET_IN_MIDDLE
8017 | OPTI_TYPE_EARLY_SKIP
8018 | OPTI_TYPE_NOT_ITERATED
8019 | OPTI_TYPE_APPENDED_SALT
8020 | OPTI_TYPE_RAW_HASH
;
8027 case 40: hash_type
= HASH_TYPE_MD5
;
8028 salt_type
= SALT_TYPE_INTERN
;
8029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8030 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8031 | OPTS_TYPE_PT_ADD80
8032 | OPTS_TYPE_PT_ADDBITS14
8033 | OPTS_TYPE_PT_UNICODE
;
8034 kern_type
= KERN_TYPE_MD5_SLTPWU
;
8035 dgst_size
= DGST_SIZE_4_4
;
8036 parse_func
= md5s_parse_hash
;
8037 sort_by_digest
= sort_by_digest_4_4
;
8038 opti_type
= OPTI_TYPE_ZERO_BYTE
8039 | OPTI_TYPE_PRECOMPUTE_INIT
8040 | OPTI_TYPE_PRECOMPUTE_MERKLE
8041 | OPTI_TYPE_EARLY_SKIP
8042 | OPTI_TYPE_NOT_ITERATED
8043 | OPTI_TYPE_PREPENDED_SALT
8044 | OPTI_TYPE_RAW_HASH
;
8051 case 50: hash_type
= HASH_TYPE_MD5
;
8052 salt_type
= SALT_TYPE_INTERN
;
8053 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8054 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8055 | OPTS_TYPE_ST_ADD80
8056 | OPTS_TYPE_ST_ADDBITS14
;
8057 kern_type
= KERN_TYPE_HMACMD5_PW
;
8058 dgst_size
= DGST_SIZE_4_4
;
8059 parse_func
= hmacmd5_parse_hash
;
8060 sort_by_digest
= sort_by_digest_4_4
;
8061 opti_type
= OPTI_TYPE_ZERO_BYTE
8062 | OPTI_TYPE_NOT_ITERATED
;
8069 case 60: hash_type
= HASH_TYPE_MD5
;
8070 salt_type
= SALT_TYPE_INTERN
;
8071 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8072 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8073 | OPTS_TYPE_PT_ADD80
8074 | OPTS_TYPE_PT_ADDBITS14
;
8075 kern_type
= KERN_TYPE_HMACMD5_SLT
;
8076 dgst_size
= DGST_SIZE_4_4
;
8077 parse_func
= hmacmd5_parse_hash
;
8078 sort_by_digest
= sort_by_digest_4_4
;
8079 opti_type
= OPTI_TYPE_ZERO_BYTE
8080 | OPTI_TYPE_NOT_ITERATED
;
8087 case 100: hash_type
= HASH_TYPE_SHA1
;
8088 salt_type
= SALT_TYPE_NONE
;
8089 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8090 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8091 | OPTS_TYPE_PT_ADD80
8092 | OPTS_TYPE_PT_ADDBITS15
;
8093 kern_type
= KERN_TYPE_SHA1
;
8094 dgst_size
= DGST_SIZE_4_5
;
8095 parse_func
= sha1_parse_hash
;
8096 sort_by_digest
= sort_by_digest_4_5
;
8097 opti_type
= OPTI_TYPE_ZERO_BYTE
8098 | OPTI_TYPE_PRECOMPUTE_INIT
8099 | OPTI_TYPE_PRECOMPUTE_MERKLE
8100 | OPTI_TYPE_EARLY_SKIP
8101 | OPTI_TYPE_NOT_ITERATED
8102 | OPTI_TYPE_NOT_SALTED
8103 | OPTI_TYPE_RAW_HASH
;
8110 case 101: hash_type
= HASH_TYPE_SHA1
;
8111 salt_type
= SALT_TYPE_NONE
;
8112 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8113 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8114 | OPTS_TYPE_PT_ADD80
8115 | OPTS_TYPE_PT_ADDBITS15
;
8116 kern_type
= KERN_TYPE_SHA1
;
8117 dgst_size
= DGST_SIZE_4_5
;
8118 parse_func
= sha1b64_parse_hash
;
8119 sort_by_digest
= sort_by_digest_4_5
;
8120 opti_type
= OPTI_TYPE_ZERO_BYTE
8121 | OPTI_TYPE_PRECOMPUTE_INIT
8122 | OPTI_TYPE_PRECOMPUTE_MERKLE
8123 | OPTI_TYPE_EARLY_SKIP
8124 | OPTI_TYPE_NOT_ITERATED
8125 | OPTI_TYPE_NOT_SALTED
8126 | OPTI_TYPE_RAW_HASH
;
8133 case 110: hash_type
= HASH_TYPE_SHA1
;
8134 salt_type
= SALT_TYPE_INTERN
;
8135 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8136 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8137 | OPTS_TYPE_ST_ADD80
8138 | OPTS_TYPE_ST_ADDBITS15
;
8139 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8140 dgst_size
= DGST_SIZE_4_5
;
8141 parse_func
= sha1s_parse_hash
;
8142 sort_by_digest
= sort_by_digest_4_5
;
8143 opti_type
= OPTI_TYPE_ZERO_BYTE
8144 | OPTI_TYPE_PRECOMPUTE_INIT
8145 | OPTI_TYPE_PRECOMPUTE_MERKLE
8146 | OPTI_TYPE_EARLY_SKIP
8147 | OPTI_TYPE_NOT_ITERATED
8148 | OPTI_TYPE_APPENDED_SALT
8149 | OPTI_TYPE_RAW_HASH
;
8156 case 111: hash_type
= HASH_TYPE_SHA1
;
8157 salt_type
= SALT_TYPE_EMBEDDED
;
8158 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8159 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8160 | OPTS_TYPE_ST_ADD80
8161 | OPTS_TYPE_ST_ADDBITS15
;
8162 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8163 dgst_size
= DGST_SIZE_4_5
;
8164 parse_func
= sha1b64s_parse_hash
;
8165 sort_by_digest
= sort_by_digest_4_5
;
8166 opti_type
= OPTI_TYPE_ZERO_BYTE
8167 | OPTI_TYPE_PRECOMPUTE_INIT
8168 | OPTI_TYPE_PRECOMPUTE_MERKLE
8169 | OPTI_TYPE_EARLY_SKIP
8170 | OPTI_TYPE_NOT_ITERATED
8171 | OPTI_TYPE_APPENDED_SALT
8172 | OPTI_TYPE_RAW_HASH
;
8179 case 112: hash_type
= HASH_TYPE_SHA1
;
8180 salt_type
= SALT_TYPE_INTERN
;
8181 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8182 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8183 | OPTS_TYPE_ST_ADD80
8184 | OPTS_TYPE_ST_ADDBITS15
8186 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8187 dgst_size
= DGST_SIZE_4_5
;
8188 parse_func
= oracles_parse_hash
;
8189 sort_by_digest
= sort_by_digest_4_5
;
8190 opti_type
= OPTI_TYPE_ZERO_BYTE
8191 | OPTI_TYPE_PRECOMPUTE_INIT
8192 | OPTI_TYPE_PRECOMPUTE_MERKLE
8193 | OPTI_TYPE_EARLY_SKIP
8194 | OPTI_TYPE_NOT_ITERATED
8195 | OPTI_TYPE_APPENDED_SALT
8196 | OPTI_TYPE_RAW_HASH
;
8203 case 120: hash_type
= HASH_TYPE_SHA1
;
8204 salt_type
= SALT_TYPE_INTERN
;
8205 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8206 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8207 | OPTS_TYPE_PT_ADD80
8208 | OPTS_TYPE_PT_ADDBITS15
;
8209 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8210 dgst_size
= DGST_SIZE_4_5
;
8211 parse_func
= sha1s_parse_hash
;
8212 sort_by_digest
= sort_by_digest_4_5
;
8213 opti_type
= OPTI_TYPE_ZERO_BYTE
8214 | OPTI_TYPE_PRECOMPUTE_INIT
8215 | OPTI_TYPE_PRECOMPUTE_MERKLE
8216 | OPTI_TYPE_EARLY_SKIP
8217 | OPTI_TYPE_NOT_ITERATED
8218 | OPTI_TYPE_PREPENDED_SALT
8219 | OPTI_TYPE_RAW_HASH
;
8226 case 121: hash_type
= HASH_TYPE_SHA1
;
8227 salt_type
= SALT_TYPE_INTERN
;
8228 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8229 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8230 | OPTS_TYPE_PT_ADD80
8231 | OPTS_TYPE_PT_ADDBITS15
8232 | OPTS_TYPE_ST_LOWER
;
8233 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8234 dgst_size
= DGST_SIZE_4_5
;
8235 parse_func
= smf_parse_hash
;
8236 sort_by_digest
= sort_by_digest_4_5
;
8237 opti_type
= OPTI_TYPE_ZERO_BYTE
8238 | OPTI_TYPE_PRECOMPUTE_INIT
8239 | OPTI_TYPE_PRECOMPUTE_MERKLE
8240 | OPTI_TYPE_EARLY_SKIP
8241 | OPTI_TYPE_NOT_ITERATED
8242 | OPTI_TYPE_PREPENDED_SALT
8243 | OPTI_TYPE_RAW_HASH
;
8250 case 122: hash_type
= HASH_TYPE_SHA1
;
8251 salt_type
= SALT_TYPE_EMBEDDED
;
8252 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8253 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8254 | OPTS_TYPE_PT_ADD80
8255 | OPTS_TYPE_PT_ADDBITS15
8257 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8258 dgst_size
= DGST_SIZE_4_5
;
8259 parse_func
= osx1_parse_hash
;
8260 sort_by_digest
= sort_by_digest_4_5
;
8261 opti_type
= OPTI_TYPE_ZERO_BYTE
8262 | OPTI_TYPE_PRECOMPUTE_INIT
8263 | OPTI_TYPE_PRECOMPUTE_MERKLE
8264 | OPTI_TYPE_EARLY_SKIP
8265 | OPTI_TYPE_NOT_ITERATED
8266 | OPTI_TYPE_PREPENDED_SALT
8267 | OPTI_TYPE_RAW_HASH
;
8274 case 124: hash_type
= HASH_TYPE_SHA1
;
8275 salt_type
= SALT_TYPE_EMBEDDED
;
8276 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8277 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8278 | OPTS_TYPE_PT_ADD80
8279 | OPTS_TYPE_PT_ADDBITS15
;
8280 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8281 dgst_size
= DGST_SIZE_4_5
;
8282 parse_func
= djangosha1_parse_hash
;
8283 sort_by_digest
= sort_by_digest_4_5
;
8284 opti_type
= OPTI_TYPE_ZERO_BYTE
8285 | OPTI_TYPE_PRECOMPUTE_INIT
8286 | OPTI_TYPE_PRECOMPUTE_MERKLE
8287 | OPTI_TYPE_EARLY_SKIP
8288 | OPTI_TYPE_NOT_ITERATED
8289 | OPTI_TYPE_PREPENDED_SALT
8290 | OPTI_TYPE_RAW_HASH
;
8297 case 125: hash_type
= HASH_TYPE_SHA1
;
8298 salt_type
= SALT_TYPE_EMBEDDED
;
8299 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8300 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8301 | OPTS_TYPE_PT_ADD80
8302 | OPTS_TYPE_PT_ADDBITS15
8304 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8305 dgst_size
= DGST_SIZE_4_5
;
8306 parse_func
= arubaos_parse_hash
;
8307 sort_by_digest
= sort_by_digest_4_5
;
8308 opti_type
= OPTI_TYPE_ZERO_BYTE
8309 | OPTI_TYPE_PRECOMPUTE_INIT
8310 | OPTI_TYPE_PRECOMPUTE_MERKLE
8311 | OPTI_TYPE_EARLY_SKIP
8312 | OPTI_TYPE_NOT_ITERATED
8313 | OPTI_TYPE_PREPENDED_SALT
8314 | OPTI_TYPE_RAW_HASH
;
8321 case 130: hash_type
= HASH_TYPE_SHA1
;
8322 salt_type
= SALT_TYPE_INTERN
;
8323 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8325 | OPTS_TYPE_PT_UNICODE
8326 | OPTS_TYPE_ST_ADD80
8327 | OPTS_TYPE_ST_ADDBITS15
;
8328 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8329 dgst_size
= DGST_SIZE_4_5
;
8330 parse_func
= sha1s_parse_hash
;
8331 sort_by_digest
= sort_by_digest_4_5
;
8332 opti_type
= OPTI_TYPE_ZERO_BYTE
8333 | OPTI_TYPE_PRECOMPUTE_INIT
8334 | OPTI_TYPE_PRECOMPUTE_MERKLE
8335 | OPTI_TYPE_EARLY_SKIP
8336 | OPTI_TYPE_NOT_ITERATED
8337 | OPTI_TYPE_APPENDED_SALT
8338 | OPTI_TYPE_RAW_HASH
;
8345 case 131: hash_type
= HASH_TYPE_SHA1
;
8346 salt_type
= SALT_TYPE_EMBEDDED
;
8347 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8348 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8349 | OPTS_TYPE_PT_UNICODE
8350 | OPTS_TYPE_PT_UPPER
8351 | OPTS_TYPE_ST_ADD80
8352 | OPTS_TYPE_ST_ADDBITS15
8354 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8355 dgst_size
= DGST_SIZE_4_5
;
8356 parse_func
= mssql2000_parse_hash
;
8357 sort_by_digest
= sort_by_digest_4_5
;
8358 opti_type
= OPTI_TYPE_ZERO_BYTE
8359 | OPTI_TYPE_PRECOMPUTE_INIT
8360 | OPTI_TYPE_PRECOMPUTE_MERKLE
8361 | OPTI_TYPE_EARLY_SKIP
8362 | OPTI_TYPE_NOT_ITERATED
8363 | OPTI_TYPE_APPENDED_SALT
8364 | OPTI_TYPE_RAW_HASH
;
8371 case 132: hash_type
= HASH_TYPE_SHA1
;
8372 salt_type
= SALT_TYPE_EMBEDDED
;
8373 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8374 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8375 | OPTS_TYPE_PT_UNICODE
8376 | OPTS_TYPE_ST_ADD80
8377 | OPTS_TYPE_ST_ADDBITS15
8379 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8380 dgst_size
= DGST_SIZE_4_5
;
8381 parse_func
= mssql2005_parse_hash
;
8382 sort_by_digest
= sort_by_digest_4_5
;
8383 opti_type
= OPTI_TYPE_ZERO_BYTE
8384 | OPTI_TYPE_PRECOMPUTE_INIT
8385 | OPTI_TYPE_PRECOMPUTE_MERKLE
8386 | OPTI_TYPE_EARLY_SKIP
8387 | OPTI_TYPE_NOT_ITERATED
8388 | OPTI_TYPE_APPENDED_SALT
8389 | OPTI_TYPE_RAW_HASH
;
8396 case 133: hash_type
= HASH_TYPE_SHA1
;
8397 salt_type
= SALT_TYPE_EMBEDDED
;
8398 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8399 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8400 | OPTS_TYPE_PT_UNICODE
8401 | OPTS_TYPE_ST_ADD80
8402 | OPTS_TYPE_ST_ADDBITS15
;
8403 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8404 dgst_size
= DGST_SIZE_4_5
;
8405 parse_func
= peoplesoft_parse_hash
;
8406 sort_by_digest
= sort_by_digest_4_5
;
8407 opti_type
= OPTI_TYPE_ZERO_BYTE
8408 | OPTI_TYPE_PRECOMPUTE_INIT
8409 | OPTI_TYPE_PRECOMPUTE_MERKLE
8410 | OPTI_TYPE_EARLY_SKIP
8411 | OPTI_TYPE_NOT_ITERATED
8412 | OPTI_TYPE_APPENDED_SALT
8413 | OPTI_TYPE_RAW_HASH
;
8420 case 140: hash_type
= HASH_TYPE_SHA1
;
8421 salt_type
= SALT_TYPE_INTERN
;
8422 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8423 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8424 | OPTS_TYPE_PT_ADD80
8425 | OPTS_TYPE_PT_ADDBITS15
8426 | OPTS_TYPE_PT_UNICODE
;
8427 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8428 dgst_size
= DGST_SIZE_4_5
;
8429 parse_func
= sha1s_parse_hash
;
8430 sort_by_digest
= sort_by_digest_4_5
;
8431 opti_type
= OPTI_TYPE_ZERO_BYTE
8432 | OPTI_TYPE_PRECOMPUTE_INIT
8433 | OPTI_TYPE_PRECOMPUTE_MERKLE
8434 | OPTI_TYPE_EARLY_SKIP
8435 | OPTI_TYPE_NOT_ITERATED
8436 | OPTI_TYPE_PREPENDED_SALT
8437 | OPTI_TYPE_RAW_HASH
;
8444 case 141: hash_type
= HASH_TYPE_SHA1
;
8445 salt_type
= SALT_TYPE_EMBEDDED
;
8446 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8447 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8448 | OPTS_TYPE_PT_ADD80
8449 | OPTS_TYPE_PT_ADDBITS15
8450 | OPTS_TYPE_PT_UNICODE
8451 | OPTS_TYPE_ST_BASE64
;
8452 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8453 dgst_size
= DGST_SIZE_4_5
;
8454 parse_func
= episerver_parse_hash
;
8455 sort_by_digest
= sort_by_digest_4_5
;
8456 opti_type
= OPTI_TYPE_ZERO_BYTE
8457 | OPTI_TYPE_PRECOMPUTE_INIT
8458 | OPTI_TYPE_PRECOMPUTE_MERKLE
8459 | OPTI_TYPE_EARLY_SKIP
8460 | OPTI_TYPE_NOT_ITERATED
8461 | OPTI_TYPE_PREPENDED_SALT
8462 | OPTI_TYPE_RAW_HASH
;
8469 case 150: hash_type
= HASH_TYPE_SHA1
;
8470 salt_type
= SALT_TYPE_INTERN
;
8471 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8472 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8473 | OPTS_TYPE_ST_ADD80
8474 | OPTS_TYPE_ST_ADDBITS15
;
8475 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8476 dgst_size
= DGST_SIZE_4_5
;
8477 parse_func
= hmacsha1_parse_hash
;
8478 sort_by_digest
= sort_by_digest_4_5
;
8479 opti_type
= OPTI_TYPE_ZERO_BYTE
8480 | OPTI_TYPE_NOT_ITERATED
;
8487 case 160: hash_type
= HASH_TYPE_SHA1
;
8488 salt_type
= SALT_TYPE_INTERN
;
8489 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8490 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8491 | OPTS_TYPE_PT_ADD80
8492 | OPTS_TYPE_PT_ADDBITS15
;
8493 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8494 dgst_size
= DGST_SIZE_4_5
;
8495 parse_func
= hmacsha1_parse_hash
;
8496 sort_by_digest
= sort_by_digest_4_5
;
8497 opti_type
= OPTI_TYPE_ZERO_BYTE
8498 | OPTI_TYPE_NOT_ITERATED
;
8505 case 200: hash_type
= HASH_TYPE_MYSQL
;
8506 salt_type
= SALT_TYPE_NONE
;
8507 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8509 kern_type
= KERN_TYPE_MYSQL
;
8510 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8511 parse_func
= mysql323_parse_hash
;
8512 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8513 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8520 case 300: hash_type
= HASH_TYPE_SHA1
;
8521 salt_type
= SALT_TYPE_NONE
;
8522 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8523 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8524 | OPTS_TYPE_PT_ADD80
8525 | OPTS_TYPE_PT_ADDBITS15
;
8526 kern_type
= KERN_TYPE_MYSQL41
;
8527 dgst_size
= DGST_SIZE_4_5
;
8528 parse_func
= sha1_parse_hash
;
8529 sort_by_digest
= sort_by_digest_4_5
;
8530 opti_type
= OPTI_TYPE_ZERO_BYTE
8531 | OPTI_TYPE_PRECOMPUTE_INIT
8532 | OPTI_TYPE_PRECOMPUTE_MERKLE
8533 | OPTI_TYPE_EARLY_SKIP
8534 | OPTI_TYPE_NOT_ITERATED
8535 | OPTI_TYPE_NOT_SALTED
;
8542 case 400: hash_type
= HASH_TYPE_MD5
;
8543 salt_type
= SALT_TYPE_EMBEDDED
;
8544 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8546 kern_type
= KERN_TYPE_PHPASS
;
8547 dgst_size
= DGST_SIZE_4_4
;
8548 parse_func
= phpass_parse_hash
;
8549 sort_by_digest
= sort_by_digest_4_4
;
8550 opti_type
= OPTI_TYPE_ZERO_BYTE
8551 | OPTI_TYPE_SLOW_HASH_SIMD
;
8558 case 500: hash_type
= HASH_TYPE_MD5
;
8559 salt_type
= SALT_TYPE_EMBEDDED
;
8560 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8561 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8562 kern_type
= KERN_TYPE_MD5CRYPT
;
8563 dgst_size
= DGST_SIZE_4_4
;
8564 parse_func
= md5crypt_parse_hash
;
8565 sort_by_digest
= sort_by_digest_4_4
;
8566 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8573 case 501: hash_type
= HASH_TYPE_MD5
;
8574 salt_type
= SALT_TYPE_EMBEDDED
;
8575 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8576 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8577 | OPTS_TYPE_HASH_COPY
;
8578 kern_type
= KERN_TYPE_MD5CRYPT
;
8579 dgst_size
= DGST_SIZE_4_4
;
8580 parse_func
= juniper_parse_hash
;
8581 sort_by_digest
= sort_by_digest_4_4
;
8582 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8589 case 900: hash_type
= HASH_TYPE_MD4
;
8590 salt_type
= SALT_TYPE_NONE
;
8591 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8592 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8593 | OPTS_TYPE_PT_ADD80
8594 | OPTS_TYPE_PT_ADDBITS14
;
8595 kern_type
= KERN_TYPE_MD4
;
8596 dgst_size
= DGST_SIZE_4_4
;
8597 parse_func
= md4_parse_hash
;
8598 sort_by_digest
= sort_by_digest_4_4
;
8599 opti_type
= OPTI_TYPE_ZERO_BYTE
8600 | OPTI_TYPE_PRECOMPUTE_INIT
8601 | OPTI_TYPE_PRECOMPUTE_MERKLE
8602 | OPTI_TYPE_MEET_IN_MIDDLE
8603 | OPTI_TYPE_EARLY_SKIP
8604 | OPTI_TYPE_NOT_ITERATED
8605 | OPTI_TYPE_NOT_SALTED
8606 | OPTI_TYPE_RAW_HASH
;
8613 case 1000: hash_type
= HASH_TYPE_MD4
;
8614 salt_type
= SALT_TYPE_NONE
;
8615 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8616 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8617 | OPTS_TYPE_PT_ADD80
8618 | OPTS_TYPE_PT_ADDBITS14
8619 | OPTS_TYPE_PT_UNICODE
;
8620 kern_type
= KERN_TYPE_MD4_PWU
;
8621 dgst_size
= DGST_SIZE_4_4
;
8622 parse_func
= md4_parse_hash
;
8623 sort_by_digest
= sort_by_digest_4_4
;
8624 opti_type
= OPTI_TYPE_ZERO_BYTE
8625 | OPTI_TYPE_PRECOMPUTE_INIT
8626 | OPTI_TYPE_PRECOMPUTE_MERKLE
8627 | OPTI_TYPE_MEET_IN_MIDDLE
8628 | OPTI_TYPE_EARLY_SKIP
8629 | OPTI_TYPE_NOT_ITERATED
8630 | OPTI_TYPE_NOT_SALTED
8631 | OPTI_TYPE_RAW_HASH
;
8638 case 1100: hash_type
= HASH_TYPE_MD4
;
8639 salt_type
= SALT_TYPE_INTERN
;
8640 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8641 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8642 | OPTS_TYPE_PT_ADD80
8643 | OPTS_TYPE_PT_ADDBITS14
8644 | OPTS_TYPE_PT_UNICODE
8645 | OPTS_TYPE_ST_ADD80
8646 | OPTS_TYPE_ST_UNICODE
8647 | OPTS_TYPE_ST_LOWER
;
8648 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8649 dgst_size
= DGST_SIZE_4_4
;
8650 parse_func
= dcc_parse_hash
;
8651 sort_by_digest
= sort_by_digest_4_4
;
8652 opti_type
= OPTI_TYPE_ZERO_BYTE
8653 | OPTI_TYPE_PRECOMPUTE_INIT
8654 | OPTI_TYPE_PRECOMPUTE_MERKLE
8655 | OPTI_TYPE_EARLY_SKIP
8656 | OPTI_TYPE_NOT_ITERATED
;
8663 case 1400: hash_type
= HASH_TYPE_SHA256
;
8664 salt_type
= SALT_TYPE_NONE
;
8665 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8666 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8667 | OPTS_TYPE_PT_ADD80
8668 | OPTS_TYPE_PT_ADDBITS15
;
8669 kern_type
= KERN_TYPE_SHA256
;
8670 dgst_size
= DGST_SIZE_4_8
;
8671 parse_func
= sha256_parse_hash
;
8672 sort_by_digest
= sort_by_digest_4_8
;
8673 opti_type
= OPTI_TYPE_ZERO_BYTE
8674 | OPTI_TYPE_PRECOMPUTE_INIT
8675 | OPTI_TYPE_PRECOMPUTE_MERKLE
8676 | OPTI_TYPE_EARLY_SKIP
8677 | OPTI_TYPE_NOT_ITERATED
8678 | OPTI_TYPE_NOT_SALTED
8679 | OPTI_TYPE_RAW_HASH
;
8686 case 1410: hash_type
= HASH_TYPE_SHA256
;
8687 salt_type
= SALT_TYPE_INTERN
;
8688 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8689 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8690 | OPTS_TYPE_ST_ADD80
8691 | OPTS_TYPE_ST_ADDBITS15
;
8692 kern_type
= KERN_TYPE_SHA256_PWSLT
;
8693 dgst_size
= DGST_SIZE_4_8
;
8694 parse_func
= sha256s_parse_hash
;
8695 sort_by_digest
= sort_by_digest_4_8
;
8696 opti_type
= OPTI_TYPE_ZERO_BYTE
8697 | OPTI_TYPE_PRECOMPUTE_INIT
8698 | OPTI_TYPE_PRECOMPUTE_MERKLE
8699 | OPTI_TYPE_EARLY_SKIP
8700 | OPTI_TYPE_NOT_ITERATED
8701 | OPTI_TYPE_APPENDED_SALT
8702 | OPTI_TYPE_RAW_HASH
;
8709 case 1420: hash_type
= HASH_TYPE_SHA256
;
8710 salt_type
= SALT_TYPE_INTERN
;
8711 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8712 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8713 | OPTS_TYPE_PT_ADD80
8714 | OPTS_TYPE_PT_ADDBITS15
;
8715 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8716 dgst_size
= DGST_SIZE_4_8
;
8717 parse_func
= sha256s_parse_hash
;
8718 sort_by_digest
= sort_by_digest_4_8
;
8719 opti_type
= OPTI_TYPE_ZERO_BYTE
8720 | OPTI_TYPE_PRECOMPUTE_INIT
8721 | OPTI_TYPE_PRECOMPUTE_MERKLE
8722 | OPTI_TYPE_EARLY_SKIP
8723 | OPTI_TYPE_NOT_ITERATED
8724 | OPTI_TYPE_PREPENDED_SALT
8725 | OPTI_TYPE_RAW_HASH
;
8732 case 1421: hash_type
= HASH_TYPE_SHA256
;
8733 salt_type
= SALT_TYPE_EMBEDDED
;
8734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8735 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8736 | OPTS_TYPE_PT_ADD80
8737 | OPTS_TYPE_PT_ADDBITS15
;
8738 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8739 dgst_size
= DGST_SIZE_4_8
;
8740 parse_func
= hmailserver_parse_hash
;
8741 sort_by_digest
= sort_by_digest_4_8
;
8742 opti_type
= OPTI_TYPE_ZERO_BYTE
8743 | OPTI_TYPE_PRECOMPUTE_INIT
8744 | OPTI_TYPE_PRECOMPUTE_MERKLE
8745 | OPTI_TYPE_EARLY_SKIP
8746 | OPTI_TYPE_NOT_ITERATED
8747 | OPTI_TYPE_PREPENDED_SALT
8748 | OPTI_TYPE_RAW_HASH
;
8755 case 1430: hash_type
= HASH_TYPE_SHA256
;
8756 salt_type
= SALT_TYPE_INTERN
;
8757 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8758 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8759 | OPTS_TYPE_PT_UNICODE
8760 | OPTS_TYPE_ST_ADD80
8761 | OPTS_TYPE_ST_ADDBITS15
;
8762 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8763 dgst_size
= DGST_SIZE_4_8
;
8764 parse_func
= sha256s_parse_hash
;
8765 sort_by_digest
= sort_by_digest_4_8
;
8766 opti_type
= OPTI_TYPE_ZERO_BYTE
8767 | OPTI_TYPE_PRECOMPUTE_INIT
8768 | OPTI_TYPE_PRECOMPUTE_MERKLE
8769 | OPTI_TYPE_EARLY_SKIP
8770 | OPTI_TYPE_NOT_ITERATED
8771 | OPTI_TYPE_APPENDED_SALT
8772 | OPTI_TYPE_RAW_HASH
;
8779 case 1440: hash_type
= HASH_TYPE_SHA256
;
8780 salt_type
= SALT_TYPE_INTERN
;
8781 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8782 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8783 | OPTS_TYPE_PT_ADD80
8784 | OPTS_TYPE_PT_ADDBITS15
8785 | OPTS_TYPE_PT_UNICODE
;
8786 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8787 dgst_size
= DGST_SIZE_4_8
;
8788 parse_func
= sha256s_parse_hash
;
8789 sort_by_digest
= sort_by_digest_4_8
;
8790 opti_type
= OPTI_TYPE_ZERO_BYTE
8791 | OPTI_TYPE_PRECOMPUTE_INIT
8792 | OPTI_TYPE_PRECOMPUTE_MERKLE
8793 | OPTI_TYPE_EARLY_SKIP
8794 | OPTI_TYPE_NOT_ITERATED
8795 | OPTI_TYPE_PREPENDED_SALT
8796 | OPTI_TYPE_RAW_HASH
;
8803 case 1441: hash_type
= HASH_TYPE_SHA256
;
8804 salt_type
= SALT_TYPE_EMBEDDED
;
8805 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8806 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8807 | OPTS_TYPE_PT_ADD80
8808 | OPTS_TYPE_PT_ADDBITS15
8809 | OPTS_TYPE_PT_UNICODE
8810 | OPTS_TYPE_ST_BASE64
;
8811 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8812 dgst_size
= DGST_SIZE_4_8
;
8813 parse_func
= episerver4_parse_hash
;
8814 sort_by_digest
= sort_by_digest_4_8
;
8815 opti_type
= OPTI_TYPE_ZERO_BYTE
8816 | OPTI_TYPE_PRECOMPUTE_INIT
8817 | OPTI_TYPE_PRECOMPUTE_MERKLE
8818 | OPTI_TYPE_EARLY_SKIP
8819 | OPTI_TYPE_NOT_ITERATED
8820 | OPTI_TYPE_PREPENDED_SALT
8821 | OPTI_TYPE_RAW_HASH
;
8828 case 1450: hash_type
= HASH_TYPE_SHA256
;
8829 salt_type
= SALT_TYPE_INTERN
;
8830 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8831 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8832 | OPTS_TYPE_ST_ADD80
;
8833 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8834 dgst_size
= DGST_SIZE_4_8
;
8835 parse_func
= hmacsha256_parse_hash
;
8836 sort_by_digest
= sort_by_digest_4_8
;
8837 opti_type
= OPTI_TYPE_ZERO_BYTE
8838 | OPTI_TYPE_NOT_ITERATED
;
8845 case 1460: hash_type
= HASH_TYPE_SHA256
;
8846 salt_type
= SALT_TYPE_INTERN
;
8847 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8848 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8849 | OPTS_TYPE_PT_ADD80
8850 | OPTS_TYPE_PT_ADDBITS15
;
8851 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8852 dgst_size
= DGST_SIZE_4_8
;
8853 parse_func
= hmacsha256_parse_hash
;
8854 sort_by_digest
= sort_by_digest_4_8
;
8855 opti_type
= OPTI_TYPE_ZERO_BYTE
8856 | OPTI_TYPE_NOT_ITERATED
;
8863 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8864 salt_type
= SALT_TYPE_EMBEDDED
;
8865 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8867 | OPTS_TYPE_PT_BITSLICE
;
8868 kern_type
= KERN_TYPE_DESCRYPT
;
8869 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8870 parse_func
= descrypt_parse_hash
;
8871 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8872 opti_type
= OPTI_TYPE_ZERO_BYTE
8873 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8880 case 1600: hash_type
= HASH_TYPE_MD5
;
8881 salt_type
= SALT_TYPE_EMBEDDED
;
8882 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8883 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8884 kern_type
= KERN_TYPE_APR1CRYPT
;
8885 dgst_size
= DGST_SIZE_4_4
;
8886 parse_func
= md5apr1_parse_hash
;
8887 sort_by_digest
= sort_by_digest_4_4
;
8888 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8895 case 1700: hash_type
= HASH_TYPE_SHA512
;
8896 salt_type
= SALT_TYPE_NONE
;
8897 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8898 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8899 | OPTS_TYPE_PT_ADD80
8900 | OPTS_TYPE_PT_ADDBITS15
;
8901 kern_type
= KERN_TYPE_SHA512
;
8902 dgst_size
= DGST_SIZE_8_8
;
8903 parse_func
= sha512_parse_hash
;
8904 sort_by_digest
= sort_by_digest_8_8
;
8905 opti_type
= OPTI_TYPE_ZERO_BYTE
8906 | OPTI_TYPE_PRECOMPUTE_INIT
8907 | OPTI_TYPE_PRECOMPUTE_MERKLE
8908 | OPTI_TYPE_EARLY_SKIP
8909 | OPTI_TYPE_NOT_ITERATED
8910 | OPTI_TYPE_NOT_SALTED
8911 | OPTI_TYPE_USES_BITS_64
8912 | OPTI_TYPE_RAW_HASH
;
8919 case 1710: hash_type
= HASH_TYPE_SHA512
;
8920 salt_type
= SALT_TYPE_INTERN
;
8921 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8922 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8923 | OPTS_TYPE_ST_ADD80
8924 | OPTS_TYPE_ST_ADDBITS15
;
8925 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8926 dgst_size
= DGST_SIZE_8_8
;
8927 parse_func
= sha512s_parse_hash
;
8928 sort_by_digest
= sort_by_digest_8_8
;
8929 opti_type
= OPTI_TYPE_ZERO_BYTE
8930 | OPTI_TYPE_PRECOMPUTE_INIT
8931 | OPTI_TYPE_PRECOMPUTE_MERKLE
8932 | OPTI_TYPE_EARLY_SKIP
8933 | OPTI_TYPE_NOT_ITERATED
8934 | OPTI_TYPE_APPENDED_SALT
8935 | OPTI_TYPE_USES_BITS_64
8936 | OPTI_TYPE_RAW_HASH
;
8943 case 1711: hash_type
= HASH_TYPE_SHA512
;
8944 salt_type
= SALT_TYPE_EMBEDDED
;
8945 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8946 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8947 | OPTS_TYPE_ST_ADD80
8948 | OPTS_TYPE_ST_ADDBITS15
;
8949 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8950 dgst_size
= DGST_SIZE_8_8
;
8951 parse_func
= sha512b64s_parse_hash
;
8952 sort_by_digest
= sort_by_digest_8_8
;
8953 opti_type
= OPTI_TYPE_ZERO_BYTE
8954 | OPTI_TYPE_PRECOMPUTE_INIT
8955 | OPTI_TYPE_PRECOMPUTE_MERKLE
8956 | OPTI_TYPE_EARLY_SKIP
8957 | OPTI_TYPE_NOT_ITERATED
8958 | OPTI_TYPE_APPENDED_SALT
8959 | OPTI_TYPE_USES_BITS_64
8960 | OPTI_TYPE_RAW_HASH
;
8967 case 1720: hash_type
= HASH_TYPE_SHA512
;
8968 salt_type
= SALT_TYPE_INTERN
;
8969 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8970 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8971 | OPTS_TYPE_PT_ADD80
8972 | OPTS_TYPE_PT_ADDBITS15
;
8973 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8974 dgst_size
= DGST_SIZE_8_8
;
8975 parse_func
= sha512s_parse_hash
;
8976 sort_by_digest
= sort_by_digest_8_8
;
8977 opti_type
= OPTI_TYPE_ZERO_BYTE
8978 | OPTI_TYPE_PRECOMPUTE_INIT
8979 | OPTI_TYPE_PRECOMPUTE_MERKLE
8980 | OPTI_TYPE_EARLY_SKIP
8981 | OPTI_TYPE_NOT_ITERATED
8982 | OPTI_TYPE_PREPENDED_SALT
8983 | OPTI_TYPE_USES_BITS_64
8984 | OPTI_TYPE_RAW_HASH
;
8991 case 1722: hash_type
= HASH_TYPE_SHA512
;
8992 salt_type
= SALT_TYPE_EMBEDDED
;
8993 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8994 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8995 | OPTS_TYPE_PT_ADD80
8996 | OPTS_TYPE_PT_ADDBITS15
8998 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8999 dgst_size
= DGST_SIZE_8_8
;
9000 parse_func
= osx512_parse_hash
;
9001 sort_by_digest
= sort_by_digest_8_8
;
9002 opti_type
= OPTI_TYPE_ZERO_BYTE
9003 | OPTI_TYPE_PRECOMPUTE_INIT
9004 | OPTI_TYPE_PRECOMPUTE_MERKLE
9005 | OPTI_TYPE_EARLY_SKIP
9006 | OPTI_TYPE_NOT_ITERATED
9007 | OPTI_TYPE_PREPENDED_SALT
9008 | OPTI_TYPE_USES_BITS_64
9009 | OPTI_TYPE_RAW_HASH
;
9016 case 1730: hash_type
= HASH_TYPE_SHA512
;
9017 salt_type
= SALT_TYPE_INTERN
;
9018 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9019 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9020 | OPTS_TYPE_PT_UNICODE
9021 | OPTS_TYPE_ST_ADD80
9022 | OPTS_TYPE_ST_ADDBITS15
;
9023 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9024 dgst_size
= DGST_SIZE_8_8
;
9025 parse_func
= sha512s_parse_hash
;
9026 sort_by_digest
= sort_by_digest_8_8
;
9027 opti_type
= OPTI_TYPE_ZERO_BYTE
9028 | OPTI_TYPE_PRECOMPUTE_INIT
9029 | OPTI_TYPE_PRECOMPUTE_MERKLE
9030 | OPTI_TYPE_EARLY_SKIP
9031 | OPTI_TYPE_NOT_ITERATED
9032 | OPTI_TYPE_APPENDED_SALT
9033 | OPTI_TYPE_USES_BITS_64
9034 | OPTI_TYPE_RAW_HASH
;
9041 case 1731: hash_type
= HASH_TYPE_SHA512
;
9042 salt_type
= SALT_TYPE_EMBEDDED
;
9043 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9044 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9045 | OPTS_TYPE_PT_UNICODE
9046 | OPTS_TYPE_ST_ADD80
9047 | OPTS_TYPE_ST_ADDBITS15
9049 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9050 dgst_size
= DGST_SIZE_8_8
;
9051 parse_func
= mssql2012_parse_hash
;
9052 sort_by_digest
= sort_by_digest_8_8
;
9053 opti_type
= OPTI_TYPE_ZERO_BYTE
9054 | OPTI_TYPE_PRECOMPUTE_INIT
9055 | OPTI_TYPE_PRECOMPUTE_MERKLE
9056 | OPTI_TYPE_EARLY_SKIP
9057 | OPTI_TYPE_NOT_ITERATED
9058 | OPTI_TYPE_APPENDED_SALT
9059 | OPTI_TYPE_USES_BITS_64
9060 | OPTI_TYPE_RAW_HASH
;
9067 case 1740: hash_type
= HASH_TYPE_SHA512
;
9068 salt_type
= SALT_TYPE_INTERN
;
9069 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9070 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9071 | OPTS_TYPE_PT_ADD80
9072 | OPTS_TYPE_PT_ADDBITS15
9073 | OPTS_TYPE_PT_UNICODE
;
9074 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
9075 dgst_size
= DGST_SIZE_8_8
;
9076 parse_func
= sha512s_parse_hash
;
9077 sort_by_digest
= sort_by_digest_8_8
;
9078 opti_type
= OPTI_TYPE_ZERO_BYTE
9079 | OPTI_TYPE_PRECOMPUTE_INIT
9080 | OPTI_TYPE_PRECOMPUTE_MERKLE
9081 | OPTI_TYPE_EARLY_SKIP
9082 | OPTI_TYPE_NOT_ITERATED
9083 | OPTI_TYPE_PREPENDED_SALT
9084 | OPTI_TYPE_USES_BITS_64
9085 | OPTI_TYPE_RAW_HASH
;
9092 case 1750: hash_type
= HASH_TYPE_SHA512
;
9093 salt_type
= SALT_TYPE_INTERN
;
9094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9095 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9096 | OPTS_TYPE_ST_ADD80
;
9097 kern_type
= KERN_TYPE_HMACSHA512_PW
;
9098 dgst_size
= DGST_SIZE_8_8
;
9099 parse_func
= hmacsha512_parse_hash
;
9100 sort_by_digest
= sort_by_digest_8_8
;
9101 opti_type
= OPTI_TYPE_ZERO_BYTE
9102 | OPTI_TYPE_USES_BITS_64
9103 | OPTI_TYPE_NOT_ITERATED
;
9110 case 1760: hash_type
= HASH_TYPE_SHA512
;
9111 salt_type
= SALT_TYPE_INTERN
;
9112 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9113 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9114 | OPTS_TYPE_PT_ADD80
9115 | OPTS_TYPE_PT_ADDBITS15
;
9116 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
9117 dgst_size
= DGST_SIZE_8_8
;
9118 parse_func
= hmacsha512_parse_hash
;
9119 sort_by_digest
= sort_by_digest_8_8
;
9120 opti_type
= OPTI_TYPE_ZERO_BYTE
9121 | OPTI_TYPE_USES_BITS_64
9122 | OPTI_TYPE_NOT_ITERATED
;
9129 case 1800: hash_type
= HASH_TYPE_SHA512
;
9130 salt_type
= SALT_TYPE_EMBEDDED
;
9131 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9132 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9133 kern_type
= KERN_TYPE_SHA512CRYPT
;
9134 dgst_size
= DGST_SIZE_8_8
;
9135 parse_func
= sha512crypt_parse_hash
;
9136 sort_by_digest
= sort_by_digest_8_8
;
9137 opti_type
= OPTI_TYPE_ZERO_BYTE
9138 | OPTI_TYPE_USES_BITS_64
;
9145 case 2000: hash_type
= HASH_TYPE_STDOUT
;
9146 salt_type
= SALT_TYPE_NONE
;
9147 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9148 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9149 kern_type
= KERN_TYPE_STDOUT
;
9150 dgst_size
= DGST_SIZE_4_4
;
9152 sort_by_digest
= NULL
;
9160 case 2100: hash_type
= HASH_TYPE_DCC2
;
9161 salt_type
= SALT_TYPE_EMBEDDED
;
9162 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9164 | OPTS_TYPE_ST_LOWER
9165 | OPTS_TYPE_ST_UNICODE
;
9166 kern_type
= KERN_TYPE_DCC2
;
9167 dgst_size
= DGST_SIZE_4_4
;
9168 parse_func
= dcc2_parse_hash
;
9169 sort_by_digest
= sort_by_digest_4_4
;
9170 opti_type
= OPTI_TYPE_ZERO_BYTE
9171 | OPTI_TYPE_SLOW_HASH_SIMD
;
9178 case 2400: hash_type
= HASH_TYPE_MD5
;
9179 salt_type
= SALT_TYPE_NONE
;
9180 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9182 kern_type
= KERN_TYPE_MD5PIX
;
9183 dgst_size
= DGST_SIZE_4_4
;
9184 parse_func
= md5pix_parse_hash
;
9185 sort_by_digest
= sort_by_digest_4_4
;
9186 opti_type
= OPTI_TYPE_ZERO_BYTE
9187 | OPTI_TYPE_PRECOMPUTE_INIT
9188 | OPTI_TYPE_PRECOMPUTE_MERKLE
9189 | OPTI_TYPE_EARLY_SKIP
9190 | OPTI_TYPE_NOT_ITERATED
9191 | OPTI_TYPE_NOT_SALTED
;
9198 case 2410: hash_type
= HASH_TYPE_MD5
;
9199 salt_type
= SALT_TYPE_INTERN
;
9200 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9201 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9202 kern_type
= KERN_TYPE_MD5ASA
;
9203 dgst_size
= DGST_SIZE_4_4
;
9204 parse_func
= md5asa_parse_hash
;
9205 sort_by_digest
= sort_by_digest_4_4
;
9206 opti_type
= OPTI_TYPE_ZERO_BYTE
9207 | OPTI_TYPE_PRECOMPUTE_INIT
9208 | OPTI_TYPE_PRECOMPUTE_MERKLE
9209 | OPTI_TYPE_EARLY_SKIP
9210 | OPTI_TYPE_NOT_ITERATED
;
9217 case 2500: hash_type
= HASH_TYPE_WPA
;
9218 salt_type
= SALT_TYPE_EMBEDDED
;
9219 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9220 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9221 kern_type
= KERN_TYPE_WPA
;
9222 dgst_size
= DGST_SIZE_4_4
;
9223 parse_func
= wpa_parse_hash
;
9224 sort_by_digest
= sort_by_digest_4_4
;
9225 opti_type
= OPTI_TYPE_ZERO_BYTE
9226 | OPTI_TYPE_SLOW_HASH_SIMD
;
9233 case 2600: hash_type
= HASH_TYPE_MD5
;
9234 salt_type
= SALT_TYPE_VIRTUAL
;
9235 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9236 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9237 | OPTS_TYPE_PT_ADD80
9238 | OPTS_TYPE_PT_ADDBITS14
9239 | OPTS_TYPE_ST_ADD80
;
9240 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9241 dgst_size
= DGST_SIZE_4_4
;
9242 parse_func
= md5md5_parse_hash
;
9243 sort_by_digest
= sort_by_digest_4_4
;
9244 opti_type
= OPTI_TYPE_ZERO_BYTE
9245 | OPTI_TYPE_PRECOMPUTE_INIT
9246 | OPTI_TYPE_PRECOMPUTE_MERKLE
9247 | OPTI_TYPE_EARLY_SKIP
;
9254 case 2611: hash_type
= HASH_TYPE_MD5
;
9255 salt_type
= SALT_TYPE_INTERN
;
9256 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9257 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9258 | OPTS_TYPE_PT_ADD80
9259 | OPTS_TYPE_PT_ADDBITS14
9260 | OPTS_TYPE_ST_ADD80
;
9261 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9262 dgst_size
= DGST_SIZE_4_4
;
9263 parse_func
= vb3_parse_hash
;
9264 sort_by_digest
= sort_by_digest_4_4
;
9265 opti_type
= OPTI_TYPE_ZERO_BYTE
9266 | OPTI_TYPE_PRECOMPUTE_INIT
9267 | OPTI_TYPE_PRECOMPUTE_MERKLE
9268 | OPTI_TYPE_EARLY_SKIP
;
9275 case 2612: hash_type
= HASH_TYPE_MD5
;
9276 salt_type
= SALT_TYPE_EMBEDDED
;
9277 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9278 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9279 | OPTS_TYPE_PT_ADD80
9280 | OPTS_TYPE_PT_ADDBITS14
9281 | OPTS_TYPE_ST_ADD80
9283 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9284 dgst_size
= DGST_SIZE_4_4
;
9285 parse_func
= phps_parse_hash
;
9286 sort_by_digest
= sort_by_digest_4_4
;
9287 opti_type
= OPTI_TYPE_ZERO_BYTE
9288 | OPTI_TYPE_PRECOMPUTE_INIT
9289 | OPTI_TYPE_PRECOMPUTE_MERKLE
9290 | OPTI_TYPE_EARLY_SKIP
;
9297 case 2711: hash_type
= HASH_TYPE_MD5
;
9298 salt_type
= SALT_TYPE_INTERN
;
9299 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9301 | OPTS_TYPE_PT_ADD80
9302 | OPTS_TYPE_PT_ADDBITS14
9303 | OPTS_TYPE_ST_ADD80
;
9304 kern_type
= KERN_TYPE_MD55_PWSLT2
;
9305 dgst_size
= DGST_SIZE_4_4
;
9306 parse_func
= vb30_parse_hash
;
9307 sort_by_digest
= sort_by_digest_4_4
;
9308 opti_type
= OPTI_TYPE_ZERO_BYTE
9309 | OPTI_TYPE_PRECOMPUTE_INIT
9310 | OPTI_TYPE_EARLY_SKIP
;
9317 case 2811: hash_type
= HASH_TYPE_MD5
;
9318 salt_type
= SALT_TYPE_INTERN
;
9319 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9320 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9321 | OPTS_TYPE_PT_ADD80
9322 | OPTS_TYPE_PT_ADDBITS14
;
9323 kern_type
= KERN_TYPE_MD55_SLTPW
;
9324 dgst_size
= DGST_SIZE_4_4
;
9325 parse_func
= ipb2_parse_hash
;
9326 sort_by_digest
= sort_by_digest_4_4
;
9327 opti_type
= OPTI_TYPE_ZERO_BYTE
9328 | OPTI_TYPE_PRECOMPUTE_INIT
9329 | OPTI_TYPE_EARLY_SKIP
;
9336 case 3000: hash_type
= HASH_TYPE_LM
;
9337 salt_type
= SALT_TYPE_NONE
;
9338 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9339 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9340 | OPTS_TYPE_PT_UPPER
9341 | OPTS_TYPE_PT_BITSLICE
;
9342 kern_type
= KERN_TYPE_LM
;
9343 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9344 parse_func
= lm_parse_hash
;
9345 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9346 opti_type
= OPTI_TYPE_ZERO_BYTE
9347 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9354 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
9355 salt_type
= SALT_TYPE_INTERN
;
9356 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9357 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9358 | OPTS_TYPE_PT_UPPER
9359 | OPTS_TYPE_ST_UPPER
;
9360 kern_type
= KERN_TYPE_ORACLEH
;
9361 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9362 parse_func
= oracleh_parse_hash
;
9363 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9364 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9371 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9372 salt_type
= SALT_TYPE_EMBEDDED
;
9373 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9374 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9375 | OPTS_TYPE_ST_GENERATE_LE
;
9376 kern_type
= KERN_TYPE_BCRYPT
;
9377 dgst_size
= DGST_SIZE_4_6
;
9378 parse_func
= bcrypt_parse_hash
;
9379 sort_by_digest
= sort_by_digest_4_6
;
9380 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9387 case 3710: hash_type
= HASH_TYPE_MD5
;
9388 salt_type
= SALT_TYPE_INTERN
;
9389 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9390 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9391 | OPTS_TYPE_PT_ADD80
9392 | OPTS_TYPE_PT_ADDBITS14
;
9393 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9394 dgst_size
= DGST_SIZE_4_4
;
9395 parse_func
= md5s_parse_hash
;
9396 sort_by_digest
= sort_by_digest_4_4
;
9397 opti_type
= OPTI_TYPE_ZERO_BYTE
9398 | OPTI_TYPE_PRECOMPUTE_INIT
9399 | OPTI_TYPE_PRECOMPUTE_MERKLE
9400 | OPTI_TYPE_EARLY_SKIP
;
9407 case 3711: hash_type
= HASH_TYPE_MD5
;
9408 salt_type
= SALT_TYPE_EMBEDDED
;
9409 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9410 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9411 | OPTS_TYPE_PT_ADD80
9412 | OPTS_TYPE_PT_ADDBITS14
;
9413 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9414 dgst_size
= DGST_SIZE_4_4
;
9415 parse_func
= mediawiki_b_parse_hash
;
9416 sort_by_digest
= sort_by_digest_4_4
;
9417 opti_type
= OPTI_TYPE_ZERO_BYTE
9418 | OPTI_TYPE_PRECOMPUTE_INIT
9419 | OPTI_TYPE_PRECOMPUTE_MERKLE
9420 | OPTI_TYPE_EARLY_SKIP
;
9427 case 3800: hash_type
= HASH_TYPE_MD5
;
9428 salt_type
= SALT_TYPE_INTERN
;
9429 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9430 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9431 | OPTS_TYPE_ST_ADDBITS14
;
9432 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9433 dgst_size
= DGST_SIZE_4_4
;
9434 parse_func
= md5s_parse_hash
;
9435 sort_by_digest
= sort_by_digest_4_4
;
9436 opti_type
= OPTI_TYPE_ZERO_BYTE
9437 | OPTI_TYPE_PRECOMPUTE_INIT
9438 | OPTI_TYPE_PRECOMPUTE_MERKLE
9439 | OPTI_TYPE_EARLY_SKIP
9440 | OPTI_TYPE_NOT_ITERATED
9441 | OPTI_TYPE_RAW_HASH
;
9448 case 4300: hash_type
= HASH_TYPE_MD5
;
9449 salt_type
= SALT_TYPE_VIRTUAL
;
9450 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9451 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9452 | OPTS_TYPE_PT_ADD80
9453 | OPTS_TYPE_PT_ADDBITS14
9454 | OPTS_TYPE_ST_ADD80
;
9455 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9456 dgst_size
= DGST_SIZE_4_4
;
9457 parse_func
= md5md5_parse_hash
;
9458 sort_by_digest
= sort_by_digest_4_4
;
9459 opti_type
= OPTI_TYPE_ZERO_BYTE
9460 | OPTI_TYPE_PRECOMPUTE_INIT
9461 | OPTI_TYPE_PRECOMPUTE_MERKLE
9462 | OPTI_TYPE_EARLY_SKIP
;
9470 case 4400: hash_type
= HASH_TYPE_MD5
;
9471 salt_type
= SALT_TYPE_NONE
;
9472 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9473 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9474 | OPTS_TYPE_PT_ADD80
9475 | OPTS_TYPE_PT_ADDBITS15
;
9476 kern_type
= KERN_TYPE_MD5_SHA1
;
9477 dgst_size
= DGST_SIZE_4_4
;
9478 parse_func
= md5_parse_hash
;
9479 sort_by_digest
= sort_by_digest_4_4
;
9480 opti_type
= OPTI_TYPE_ZERO_BYTE
9481 | OPTI_TYPE_PRECOMPUTE_INIT
9482 | OPTI_TYPE_PRECOMPUTE_MERKLE
9483 | OPTI_TYPE_EARLY_SKIP
9484 | OPTI_TYPE_NOT_ITERATED
9485 | OPTI_TYPE_NOT_SALTED
9486 | OPTI_TYPE_RAW_HASH
;
9493 case 4500: hash_type
= HASH_TYPE_SHA1
;
9494 salt_type
= SALT_TYPE_NONE
;
9495 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9496 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9497 | OPTS_TYPE_PT_ADD80
9498 | OPTS_TYPE_PT_ADDBITS15
;
9499 kern_type
= KERN_TYPE_SHA11
;
9500 dgst_size
= DGST_SIZE_4_5
;
9501 parse_func
= sha1_parse_hash
;
9502 sort_by_digest
= sort_by_digest_4_5
;
9503 opti_type
= OPTI_TYPE_ZERO_BYTE
9504 | OPTI_TYPE_PRECOMPUTE_INIT
9505 | OPTI_TYPE_PRECOMPUTE_MERKLE
9506 | OPTI_TYPE_EARLY_SKIP
9507 | OPTI_TYPE_NOT_SALTED
;
9514 case 4700: hash_type
= HASH_TYPE_SHA1
;
9515 salt_type
= SALT_TYPE_NONE
;
9516 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9518 | OPTS_TYPE_PT_ADD80
9519 | OPTS_TYPE_PT_ADDBITS14
;
9520 kern_type
= KERN_TYPE_SHA1_MD5
;
9521 dgst_size
= DGST_SIZE_4_5
;
9522 parse_func
= sha1_parse_hash
;
9523 sort_by_digest
= sort_by_digest_4_5
;
9524 opti_type
= OPTI_TYPE_ZERO_BYTE
9525 | OPTI_TYPE_PRECOMPUTE_INIT
9526 | OPTI_TYPE_PRECOMPUTE_MERKLE
9527 | OPTI_TYPE_EARLY_SKIP
9528 | OPTI_TYPE_NOT_ITERATED
9529 | OPTI_TYPE_NOT_SALTED
9530 | OPTI_TYPE_RAW_HASH
;
9537 case 4800: hash_type
= HASH_TYPE_MD5
;
9538 salt_type
= SALT_TYPE_EMBEDDED
;
9539 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9540 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9541 | OPTS_TYPE_PT_ADDBITS14
;
9542 kern_type
= KERN_TYPE_MD5_CHAP
;
9543 dgst_size
= DGST_SIZE_4_4
;
9544 parse_func
= chap_parse_hash
;
9545 sort_by_digest
= sort_by_digest_4_4
;
9546 opti_type
= OPTI_TYPE_ZERO_BYTE
9547 | OPTI_TYPE_PRECOMPUTE_INIT
9548 | OPTI_TYPE_PRECOMPUTE_MERKLE
9549 | OPTI_TYPE_MEET_IN_MIDDLE
9550 | OPTI_TYPE_EARLY_SKIP
9551 | OPTI_TYPE_NOT_ITERATED
9552 | OPTI_TYPE_RAW_HASH
;
9559 case 4900: hash_type
= HASH_TYPE_SHA1
;
9560 salt_type
= SALT_TYPE_INTERN
;
9561 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9563 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9564 dgst_size
= DGST_SIZE_4_5
;
9565 parse_func
= sha1s_parse_hash
;
9566 sort_by_digest
= sort_by_digest_4_5
;
9567 opti_type
= OPTI_TYPE_ZERO_BYTE
9568 | OPTI_TYPE_PRECOMPUTE_INIT
9569 | OPTI_TYPE_PRECOMPUTE_MERKLE
9570 | OPTI_TYPE_EARLY_SKIP
;
9577 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9578 salt_type
= SALT_TYPE_EMBEDDED
;
9579 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9580 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9581 | OPTS_TYPE_PT_ADD01
;
9582 kern_type
= KERN_TYPE_KECCAK
;
9583 dgst_size
= DGST_SIZE_8_25
;
9584 parse_func
= keccak_parse_hash
;
9585 sort_by_digest
= sort_by_digest_8_25
;
9586 opti_type
= OPTI_TYPE_ZERO_BYTE
9587 | OPTI_TYPE_USES_BITS_64
9588 | OPTI_TYPE_RAW_HASH
;
9595 case 5100: hash_type
= HASH_TYPE_MD5H
;
9596 salt_type
= SALT_TYPE_NONE
;
9597 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9599 | OPTS_TYPE_PT_ADD80
9600 | OPTS_TYPE_PT_ADDBITS14
;
9601 kern_type
= KERN_TYPE_MD5H
;
9602 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9603 parse_func
= md5half_parse_hash
;
9604 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9605 opti_type
= OPTI_TYPE_ZERO_BYTE
9606 | OPTI_TYPE_RAW_HASH
;
9613 case 5200: hash_type
= HASH_TYPE_SHA256
;
9614 salt_type
= SALT_TYPE_EMBEDDED
;
9615 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9616 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9617 kern_type
= KERN_TYPE_PSAFE3
;
9618 dgst_size
= DGST_SIZE_4_8
;
9619 parse_func
= psafe3_parse_hash
;
9620 sort_by_digest
= sort_by_digest_4_8
;
9621 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9628 case 5300: hash_type
= HASH_TYPE_MD5
;
9629 salt_type
= SALT_TYPE_EMBEDDED
;
9630 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9631 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9632 | OPTS_TYPE_ST_ADD80
;
9633 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9634 dgst_size
= DGST_SIZE_4_4
;
9635 parse_func
= ikepsk_md5_parse_hash
;
9636 sort_by_digest
= sort_by_digest_4_4
;
9637 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9644 case 5400: hash_type
= HASH_TYPE_SHA1
;
9645 salt_type
= SALT_TYPE_EMBEDDED
;
9646 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9647 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9648 | OPTS_TYPE_ST_ADD80
;
9649 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9650 dgst_size
= DGST_SIZE_4_5
;
9651 parse_func
= ikepsk_sha1_parse_hash
;
9652 sort_by_digest
= sort_by_digest_4_5
;
9653 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9660 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9661 salt_type
= SALT_TYPE_EMBEDDED
;
9662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9664 | OPTS_TYPE_PT_ADD80
9665 | OPTS_TYPE_PT_ADDBITS14
9666 | OPTS_TYPE_PT_UNICODE
9668 kern_type
= KERN_TYPE_NETNTLMv1
;
9669 dgst_size
= DGST_SIZE_4_4
;
9670 parse_func
= netntlmv1_parse_hash
;
9671 sort_by_digest
= sort_by_digest_4_4
;
9672 opti_type
= OPTI_TYPE_ZERO_BYTE
9673 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9680 case 5600: hash_type
= HASH_TYPE_MD5
;
9681 salt_type
= SALT_TYPE_EMBEDDED
;
9682 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9683 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9684 | OPTS_TYPE_PT_ADD80
9685 | OPTS_TYPE_PT_ADDBITS14
9686 | OPTS_TYPE_PT_UNICODE
;
9687 kern_type
= KERN_TYPE_NETNTLMv2
;
9688 dgst_size
= DGST_SIZE_4_4
;
9689 parse_func
= netntlmv2_parse_hash
;
9690 sort_by_digest
= sort_by_digest_4_4
;
9691 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9698 case 5700: hash_type
= HASH_TYPE_SHA256
;
9699 salt_type
= SALT_TYPE_NONE
;
9700 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9701 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9702 | OPTS_TYPE_PT_ADD80
9703 | OPTS_TYPE_PT_ADDBITS15
;
9704 kern_type
= KERN_TYPE_SHA256
;
9705 dgst_size
= DGST_SIZE_4_8
;
9706 parse_func
= cisco4_parse_hash
;
9707 sort_by_digest
= sort_by_digest_4_8
;
9708 opti_type
= OPTI_TYPE_ZERO_BYTE
9709 | OPTI_TYPE_PRECOMPUTE_INIT
9710 | OPTI_TYPE_PRECOMPUTE_MERKLE
9711 | OPTI_TYPE_EARLY_SKIP
9712 | OPTI_TYPE_NOT_ITERATED
9713 | OPTI_TYPE_NOT_SALTED
9714 | OPTI_TYPE_RAW_HASH
;
9721 case 5800: hash_type
= HASH_TYPE_SHA1
;
9722 salt_type
= SALT_TYPE_INTERN
;
9723 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9724 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9725 | OPTS_TYPE_ST_ADD80
;
9726 kern_type
= KERN_TYPE_ANDROIDPIN
;
9727 dgst_size
= DGST_SIZE_4_5
;
9728 parse_func
= androidpin_parse_hash
;
9729 sort_by_digest
= sort_by_digest_4_5
;
9730 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9737 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9738 salt_type
= SALT_TYPE_NONE
;
9739 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9740 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9741 | OPTS_TYPE_PT_ADD80
;
9742 kern_type
= KERN_TYPE_RIPEMD160
;
9743 dgst_size
= DGST_SIZE_4_5
;
9744 parse_func
= ripemd160_parse_hash
;
9745 sort_by_digest
= sort_by_digest_4_5
;
9746 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9753 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9754 salt_type
= SALT_TYPE_NONE
;
9755 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9756 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9757 | OPTS_TYPE_PT_ADD80
;
9758 kern_type
= KERN_TYPE_WHIRLPOOL
;
9759 dgst_size
= DGST_SIZE_4_16
;
9760 parse_func
= whirlpool_parse_hash
;
9761 sort_by_digest
= sort_by_digest_4_16
;
9762 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9769 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9770 salt_type
= SALT_TYPE_EMBEDDED
;
9771 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9772 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9773 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9774 dgst_size
= DGST_SIZE_4_5
;
9775 parse_func
= truecrypt_parse_hash_2k
;
9776 sort_by_digest
= sort_by_digest_4_5
;
9777 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9784 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9785 salt_type
= SALT_TYPE_EMBEDDED
;
9786 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9787 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9788 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9789 dgst_size
= DGST_SIZE_4_5
;
9790 parse_func
= truecrypt_parse_hash_2k
;
9791 sort_by_digest
= sort_by_digest_4_5
;
9792 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9799 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9800 salt_type
= SALT_TYPE_EMBEDDED
;
9801 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9802 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9803 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9804 dgst_size
= DGST_SIZE_4_5
;
9805 parse_func
= truecrypt_parse_hash_2k
;
9806 sort_by_digest
= sort_by_digest_4_5
;
9807 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9814 case 6221: hash_type
= HASH_TYPE_SHA512
;
9815 salt_type
= SALT_TYPE_EMBEDDED
;
9816 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9817 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9818 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9819 dgst_size
= DGST_SIZE_8_8
;
9820 parse_func
= truecrypt_parse_hash_1k
;
9821 sort_by_digest
= sort_by_digest_8_8
;
9822 opti_type
= OPTI_TYPE_ZERO_BYTE
9823 | OPTI_TYPE_USES_BITS_64
;
9830 case 6222: hash_type
= HASH_TYPE_SHA512
;
9831 salt_type
= SALT_TYPE_EMBEDDED
;
9832 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9833 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9834 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9835 dgst_size
= DGST_SIZE_8_8
;
9836 parse_func
= truecrypt_parse_hash_1k
;
9837 sort_by_digest
= sort_by_digest_8_8
;
9838 opti_type
= OPTI_TYPE_ZERO_BYTE
9839 | OPTI_TYPE_USES_BITS_64
;
9846 case 6223: hash_type
= HASH_TYPE_SHA512
;
9847 salt_type
= SALT_TYPE_EMBEDDED
;
9848 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9849 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9850 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9851 dgst_size
= DGST_SIZE_8_8
;
9852 parse_func
= truecrypt_parse_hash_1k
;
9853 sort_by_digest
= sort_by_digest_8_8
;
9854 opti_type
= OPTI_TYPE_ZERO_BYTE
9855 | OPTI_TYPE_USES_BITS_64
;
9862 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9863 salt_type
= SALT_TYPE_EMBEDDED
;
9864 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9865 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9866 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9867 dgst_size
= DGST_SIZE_4_8
;
9868 parse_func
= truecrypt_parse_hash_1k
;
9869 sort_by_digest
= sort_by_digest_4_8
;
9870 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9877 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9878 salt_type
= SALT_TYPE_EMBEDDED
;
9879 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9880 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9881 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9882 dgst_size
= DGST_SIZE_4_8
;
9883 parse_func
= truecrypt_parse_hash_1k
;
9884 sort_by_digest
= sort_by_digest_4_8
;
9885 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9892 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9893 salt_type
= SALT_TYPE_EMBEDDED
;
9894 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9895 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9896 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9897 dgst_size
= DGST_SIZE_4_8
;
9898 parse_func
= truecrypt_parse_hash_1k
;
9899 sort_by_digest
= sort_by_digest_4_8
;
9900 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9907 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9908 salt_type
= SALT_TYPE_EMBEDDED
;
9909 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9910 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9911 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9912 dgst_size
= DGST_SIZE_4_5
;
9913 parse_func
= truecrypt_parse_hash_1k
;
9914 sort_by_digest
= sort_by_digest_4_5
;
9915 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9922 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9923 salt_type
= SALT_TYPE_EMBEDDED
;
9924 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9926 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9927 dgst_size
= DGST_SIZE_4_5
;
9928 parse_func
= truecrypt_parse_hash_1k
;
9929 sort_by_digest
= sort_by_digest_4_5
;
9930 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9937 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9938 salt_type
= SALT_TYPE_EMBEDDED
;
9939 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9940 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9941 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9942 dgst_size
= DGST_SIZE_4_5
;
9943 parse_func
= truecrypt_parse_hash_1k
;
9944 sort_by_digest
= sort_by_digest_4_5
;
9945 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9952 case 6300: hash_type
= HASH_TYPE_MD5
;
9953 salt_type
= SALT_TYPE_EMBEDDED
;
9954 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9955 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9956 kern_type
= KERN_TYPE_MD5AIX
;
9957 dgst_size
= DGST_SIZE_4_4
;
9958 parse_func
= md5aix_parse_hash
;
9959 sort_by_digest
= sort_by_digest_4_4
;
9960 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9967 case 6400: hash_type
= HASH_TYPE_SHA256
;
9968 salt_type
= SALT_TYPE_EMBEDDED
;
9969 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9970 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9971 kern_type
= KERN_TYPE_SHA256AIX
;
9972 dgst_size
= DGST_SIZE_4_8
;
9973 parse_func
= sha256aix_parse_hash
;
9974 sort_by_digest
= sort_by_digest_4_8
;
9975 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9982 case 6500: hash_type
= HASH_TYPE_SHA512
;
9983 salt_type
= SALT_TYPE_EMBEDDED
;
9984 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9985 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9986 kern_type
= KERN_TYPE_SHA512AIX
;
9987 dgst_size
= DGST_SIZE_8_8
;
9988 parse_func
= sha512aix_parse_hash
;
9989 sort_by_digest
= sort_by_digest_8_8
;
9990 opti_type
= OPTI_TYPE_ZERO_BYTE
9991 | OPTI_TYPE_USES_BITS_64
;
9998 case 6600: hash_type
= HASH_TYPE_AES
;
9999 salt_type
= SALT_TYPE_EMBEDDED
;
10000 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10001 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10002 kern_type
= KERN_TYPE_AGILEKEY
;
10003 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10004 parse_func
= agilekey_parse_hash
;
10005 sort_by_digest
= sort_by_digest_4_5
;
10006 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10013 case 6700: hash_type
= HASH_TYPE_SHA1
;
10014 salt_type
= SALT_TYPE_EMBEDDED
;
10015 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10016 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10017 kern_type
= KERN_TYPE_SHA1AIX
;
10018 dgst_size
= DGST_SIZE_4_5
;
10019 parse_func
= sha1aix_parse_hash
;
10020 sort_by_digest
= sort_by_digest_4_5
;
10021 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10028 case 6800: hash_type
= HASH_TYPE_AES
;
10029 salt_type
= SALT_TYPE_EMBEDDED
;
10030 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10031 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10032 kern_type
= KERN_TYPE_LASTPASS
;
10033 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
10034 parse_func
= lastpass_parse_hash
;
10035 sort_by_digest
= sort_by_digest_4_8
;
10036 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10043 case 6900: hash_type
= HASH_TYPE_GOST
;
10044 salt_type
= SALT_TYPE_NONE
;
10045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10047 kern_type
= KERN_TYPE_GOST
;
10048 dgst_size
= DGST_SIZE_4_8
;
10049 parse_func
= gost_parse_hash
;
10050 sort_by_digest
= sort_by_digest_4_8
;
10051 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10058 case 7100: hash_type
= HASH_TYPE_SHA512
;
10059 salt_type
= SALT_TYPE_EMBEDDED
;
10060 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10062 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10063 dgst_size
= DGST_SIZE_8_16
;
10064 parse_func
= sha512osx_parse_hash
;
10065 sort_by_digest
= sort_by_digest_8_16
;
10066 opti_type
= OPTI_TYPE_ZERO_BYTE
10067 | OPTI_TYPE_USES_BITS_64
10068 | OPTI_TYPE_SLOW_HASH_SIMD
;
10075 case 7200: hash_type
= HASH_TYPE_SHA512
;
10076 salt_type
= SALT_TYPE_EMBEDDED
;
10077 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10078 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10079 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10080 dgst_size
= DGST_SIZE_8_16
;
10081 parse_func
= sha512grub_parse_hash
;
10082 sort_by_digest
= sort_by_digest_8_16
;
10083 opti_type
= OPTI_TYPE_ZERO_BYTE
10084 | OPTI_TYPE_USES_BITS_64
10085 | OPTI_TYPE_SLOW_HASH_SIMD
;
10092 case 7300: hash_type
= HASH_TYPE_SHA1
;
10093 salt_type
= SALT_TYPE_EMBEDDED
;
10094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10095 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10096 | OPTS_TYPE_ST_ADD80
10097 | OPTS_TYPE_ST_ADDBITS15
;
10098 kern_type
= KERN_TYPE_RAKP
;
10099 dgst_size
= DGST_SIZE_4_5
;
10100 parse_func
= rakp_parse_hash
;
10101 sort_by_digest
= sort_by_digest_4_5
;
10102 opti_type
= OPTI_TYPE_ZERO_BYTE
10103 | OPTI_TYPE_NOT_ITERATED
;
10110 case 7400: hash_type
= HASH_TYPE_SHA256
;
10111 salt_type
= SALT_TYPE_EMBEDDED
;
10112 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10113 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10114 kern_type
= KERN_TYPE_SHA256CRYPT
;
10115 dgst_size
= DGST_SIZE_4_8
;
10116 parse_func
= sha256crypt_parse_hash
;
10117 sort_by_digest
= sort_by_digest_4_8
;
10118 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10125 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
10126 salt_type
= SALT_TYPE_EMBEDDED
;
10127 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10129 kern_type
= KERN_TYPE_KRB5PA
;
10130 dgst_size
= DGST_SIZE_4_4
;
10131 parse_func
= krb5pa_parse_hash
;
10132 sort_by_digest
= sort_by_digest_4_4
;
10133 opti_type
= OPTI_TYPE_ZERO_BYTE
10134 | OPTI_TYPE_NOT_ITERATED
;
10141 case 7600: hash_type
= HASH_TYPE_SHA1
;
10142 salt_type
= SALT_TYPE_INTERN
;
10143 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10144 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10145 | OPTS_TYPE_PT_ADD80
10146 | OPTS_TYPE_PT_ADDBITS15
;
10147 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
10148 dgst_size
= DGST_SIZE_4_5
;
10149 parse_func
= redmine_parse_hash
;
10150 sort_by_digest
= sort_by_digest_4_5
;
10151 opti_type
= OPTI_TYPE_ZERO_BYTE
10152 | OPTI_TYPE_PRECOMPUTE_INIT
10153 | OPTI_TYPE_EARLY_SKIP
10154 | OPTI_TYPE_NOT_ITERATED
10155 | OPTI_TYPE_PREPENDED_SALT
;
10162 case 7700: hash_type
= HASH_TYPE_SAPB
;
10163 salt_type
= SALT_TYPE_EMBEDDED
;
10164 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10166 | OPTS_TYPE_PT_UPPER
10167 | OPTS_TYPE_ST_UPPER
;
10168 kern_type
= KERN_TYPE_SAPB
;
10169 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10170 parse_func
= sapb_parse_hash
;
10171 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10172 opti_type
= OPTI_TYPE_ZERO_BYTE
10173 | OPTI_TYPE_PRECOMPUTE_INIT
10174 | OPTI_TYPE_NOT_ITERATED
;
10181 case 7800: hash_type
= HASH_TYPE_SAPG
;
10182 salt_type
= SALT_TYPE_EMBEDDED
;
10183 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10184 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10185 | OPTS_TYPE_ST_ADD80
10186 | OPTS_TYPE_ST_UPPER
;
10187 kern_type
= KERN_TYPE_SAPG
;
10188 dgst_size
= DGST_SIZE_4_5
;
10189 parse_func
= sapg_parse_hash
;
10190 sort_by_digest
= sort_by_digest_4_5
;
10191 opti_type
= OPTI_TYPE_ZERO_BYTE
10192 | OPTI_TYPE_PRECOMPUTE_INIT
10193 | OPTI_TYPE_NOT_ITERATED
;
10200 case 7900: hash_type
= HASH_TYPE_SHA512
;
10201 salt_type
= SALT_TYPE_EMBEDDED
;
10202 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10204 kern_type
= KERN_TYPE_DRUPAL7
;
10205 dgst_size
= DGST_SIZE_8_8
;
10206 parse_func
= drupal7_parse_hash
;
10207 sort_by_digest
= sort_by_digest_8_8
;
10208 opti_type
= OPTI_TYPE_ZERO_BYTE
10209 | OPTI_TYPE_USES_BITS_64
;
10216 case 8000: hash_type
= HASH_TYPE_SHA256
;
10217 salt_type
= SALT_TYPE_EMBEDDED
;
10218 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10219 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10220 | OPTS_TYPE_PT_UNICODE
10221 | OPTS_TYPE_ST_ADD80
10222 | OPTS_TYPE_ST_HEX
;
10223 kern_type
= KERN_TYPE_SYBASEASE
;
10224 dgst_size
= DGST_SIZE_4_8
;
10225 parse_func
= sybasease_parse_hash
;
10226 sort_by_digest
= sort_by_digest_4_8
;
10227 opti_type
= OPTI_TYPE_ZERO_BYTE
10228 | OPTI_TYPE_PRECOMPUTE_INIT
10229 | OPTI_TYPE_EARLY_SKIP
10230 | OPTI_TYPE_NOT_ITERATED
10231 | OPTI_TYPE_RAW_HASH
;
10238 case 8100: hash_type
= HASH_TYPE_SHA1
;
10239 salt_type
= SALT_TYPE_EMBEDDED
;
10240 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10241 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
10242 kern_type
= KERN_TYPE_NETSCALER
;
10243 dgst_size
= DGST_SIZE_4_5
;
10244 parse_func
= netscaler_parse_hash
;
10245 sort_by_digest
= sort_by_digest_4_5
;
10246 opti_type
= OPTI_TYPE_ZERO_BYTE
10247 | OPTI_TYPE_PRECOMPUTE_INIT
10248 | OPTI_TYPE_PRECOMPUTE_MERKLE
10249 | OPTI_TYPE_EARLY_SKIP
10250 | OPTI_TYPE_NOT_ITERATED
10251 | OPTI_TYPE_PREPENDED_SALT
10252 | OPTI_TYPE_RAW_HASH
;
10259 case 8200: hash_type
= HASH_TYPE_SHA256
;
10260 salt_type
= SALT_TYPE_EMBEDDED
;
10261 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10262 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10263 kern_type
= KERN_TYPE_CLOUDKEY
;
10264 dgst_size
= DGST_SIZE_4_8
;
10265 parse_func
= cloudkey_parse_hash
;
10266 sort_by_digest
= sort_by_digest_4_8
;
10267 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10274 case 8300: hash_type
= HASH_TYPE_SHA1
;
10275 salt_type
= SALT_TYPE_EMBEDDED
;
10276 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10277 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10279 | OPTS_TYPE_ST_ADD80
;
10280 kern_type
= KERN_TYPE_NSEC3
;
10281 dgst_size
= DGST_SIZE_4_5
;
10282 parse_func
= nsec3_parse_hash
;
10283 sort_by_digest
= sort_by_digest_4_5
;
10284 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10291 case 8400: hash_type
= HASH_TYPE_SHA1
;
10292 salt_type
= SALT_TYPE_INTERN
;
10293 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10294 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10295 | OPTS_TYPE_PT_ADD80
10296 | OPTS_TYPE_PT_ADDBITS15
;
10297 kern_type
= KERN_TYPE_WBB3
;
10298 dgst_size
= DGST_SIZE_4_5
;
10299 parse_func
= wbb3_parse_hash
;
10300 sort_by_digest
= sort_by_digest_4_5
;
10301 opti_type
= OPTI_TYPE_ZERO_BYTE
10302 | OPTI_TYPE_PRECOMPUTE_INIT
10303 | OPTI_TYPE_NOT_ITERATED
;
10310 case 8500: hash_type
= HASH_TYPE_DESRACF
;
10311 salt_type
= SALT_TYPE_EMBEDDED
;
10312 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10313 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10314 | OPTS_TYPE_ST_UPPER
;
10315 kern_type
= KERN_TYPE_RACF
;
10316 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10317 parse_func
= racf_parse_hash
;
10318 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10319 opti_type
= OPTI_TYPE_ZERO_BYTE
10320 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10327 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
10328 salt_type
= SALT_TYPE_NONE
;
10329 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10330 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10331 kern_type
= KERN_TYPE_LOTUS5
;
10332 dgst_size
= DGST_SIZE_4_4
;
10333 parse_func
= lotus5_parse_hash
;
10334 sort_by_digest
= sort_by_digest_4_4
;
10335 opti_type
= OPTI_TYPE_EARLY_SKIP
10336 | OPTI_TYPE_NOT_ITERATED
10337 | OPTI_TYPE_NOT_SALTED
10338 | OPTI_TYPE_RAW_HASH
;
10345 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
10346 salt_type
= SALT_TYPE_EMBEDDED
;
10347 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10348 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10349 kern_type
= KERN_TYPE_LOTUS6
;
10350 dgst_size
= DGST_SIZE_4_4
;
10351 parse_func
= lotus6_parse_hash
;
10352 sort_by_digest
= sort_by_digest_4_4
;
10353 opti_type
= OPTI_TYPE_EARLY_SKIP
10354 | OPTI_TYPE_NOT_ITERATED
10355 | OPTI_TYPE_RAW_HASH
;
10362 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
10363 salt_type
= SALT_TYPE_EMBEDDED
;
10364 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10365 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10366 kern_type
= KERN_TYPE_ANDROIDFDE
;
10367 dgst_size
= DGST_SIZE_4_4
;
10368 parse_func
= androidfde_parse_hash
;
10369 sort_by_digest
= sort_by_digest_4_4
;
10370 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10377 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10378 salt_type
= SALT_TYPE_EMBEDDED
;
10379 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10381 kern_type
= KERN_TYPE_SCRYPT
;
10382 dgst_size
= DGST_SIZE_4_8
;
10383 parse_func
= scrypt_parse_hash
;
10384 sort_by_digest
= sort_by_digest_4_8
;
10385 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10392 case 9000: hash_type
= HASH_TYPE_SHA1
;
10393 salt_type
= SALT_TYPE_EMBEDDED
;
10394 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10395 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10396 | OPTS_TYPE_ST_GENERATE_LE
;
10397 kern_type
= KERN_TYPE_PSAFE2
;
10398 dgst_size
= DGST_SIZE_4_5
;
10399 parse_func
= psafe2_parse_hash
;
10400 sort_by_digest
= sort_by_digest_4_5
;
10401 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10408 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10409 salt_type
= SALT_TYPE_EMBEDDED
;
10410 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10411 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10412 kern_type
= KERN_TYPE_LOTUS8
;
10413 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10414 parse_func
= lotus8_parse_hash
;
10415 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10416 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10423 case 9200: hash_type
= HASH_TYPE_SHA256
;
10424 salt_type
= SALT_TYPE_EMBEDDED
;
10425 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10426 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10427 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10428 dgst_size
= DGST_SIZE_4_32
;
10429 parse_func
= cisco8_parse_hash
;
10430 sort_by_digest
= sort_by_digest_4_32
;
10431 opti_type
= OPTI_TYPE_ZERO_BYTE
10432 | OPTI_TYPE_SLOW_HASH_SIMD
;
10439 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
10440 salt_type
= SALT_TYPE_EMBEDDED
;
10441 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10443 kern_type
= KERN_TYPE_SCRYPT
;
10444 dgst_size
= DGST_SIZE_4_8
;
10445 parse_func
= cisco9_parse_hash
;
10446 sort_by_digest
= sort_by_digest_4_8
;
10447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10454 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10455 salt_type
= SALT_TYPE_EMBEDDED
;
10456 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10458 kern_type
= KERN_TYPE_OFFICE2007
;
10459 dgst_size
= DGST_SIZE_4_4
;
10460 parse_func
= office2007_parse_hash
;
10461 sort_by_digest
= sort_by_digest_4_4
;
10462 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10469 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10470 salt_type
= SALT_TYPE_EMBEDDED
;
10471 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10472 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10473 kern_type
= KERN_TYPE_OFFICE2010
;
10474 dgst_size
= DGST_SIZE_4_4
;
10475 parse_func
= office2010_parse_hash
;
10476 sort_by_digest
= sort_by_digest_4_4
;
10477 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10484 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10485 salt_type
= SALT_TYPE_EMBEDDED
;
10486 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10488 kern_type
= KERN_TYPE_OFFICE2013
;
10489 dgst_size
= DGST_SIZE_4_4
;
10490 parse_func
= office2013_parse_hash
;
10491 sort_by_digest
= sort_by_digest_4_4
;
10492 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10499 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10500 salt_type
= SALT_TYPE_EMBEDDED
;
10501 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10502 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10503 | OPTS_TYPE_PT_ADD80
10504 | OPTS_TYPE_PT_UNICODE
;
10505 kern_type
= KERN_TYPE_OLDOFFICE01
;
10506 dgst_size
= DGST_SIZE_4_4
;
10507 parse_func
= oldoffice01_parse_hash
;
10508 sort_by_digest
= sort_by_digest_4_4
;
10509 opti_type
= OPTI_TYPE_ZERO_BYTE
10510 | OPTI_TYPE_PRECOMPUTE_INIT
10511 | OPTI_TYPE_NOT_ITERATED
;
10518 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10519 salt_type
= SALT_TYPE_EMBEDDED
;
10520 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10522 | OPTS_TYPE_PT_ADD80
;
10523 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10524 dgst_size
= DGST_SIZE_4_4
;
10525 parse_func
= oldoffice01cm1_parse_hash
;
10526 sort_by_digest
= sort_by_digest_4_4
;
10527 opti_type
= OPTI_TYPE_ZERO_BYTE
10528 | OPTI_TYPE_PRECOMPUTE_INIT
10529 | OPTI_TYPE_NOT_ITERATED
;
10536 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10537 salt_type
= SALT_TYPE_EMBEDDED
;
10538 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10540 | OPTS_TYPE_PT_ADD80
10541 | OPTS_TYPE_PT_UNICODE
10542 | OPTS_TYPE_PT_NEVERCRACK
;
10543 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10544 dgst_size
= DGST_SIZE_4_4
;
10545 parse_func
= oldoffice01cm2_parse_hash
;
10546 sort_by_digest
= sort_by_digest_4_4
;
10547 opti_type
= OPTI_TYPE_ZERO_BYTE
10548 | OPTI_TYPE_PRECOMPUTE_INIT
10549 | OPTI_TYPE_NOT_ITERATED
;
10556 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10557 salt_type
= SALT_TYPE_EMBEDDED
;
10558 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10559 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10560 | OPTS_TYPE_PT_ADD80
10561 | OPTS_TYPE_PT_UNICODE
;
10562 kern_type
= KERN_TYPE_OLDOFFICE34
;
10563 dgst_size
= DGST_SIZE_4_4
;
10564 parse_func
= oldoffice34_parse_hash
;
10565 sort_by_digest
= sort_by_digest_4_4
;
10566 opti_type
= OPTI_TYPE_ZERO_BYTE
10567 | OPTI_TYPE_PRECOMPUTE_INIT
10568 | OPTI_TYPE_NOT_ITERATED
;
10575 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10576 salt_type
= SALT_TYPE_EMBEDDED
;
10577 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10578 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10579 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10580 dgst_size
= DGST_SIZE_4_4
;
10581 parse_func
= oldoffice34cm1_parse_hash
;
10582 sort_by_digest
= sort_by_digest_4_4
;
10583 opti_type
= OPTI_TYPE_ZERO_BYTE
10584 | OPTI_TYPE_PRECOMPUTE_INIT
10585 | OPTI_TYPE_NOT_ITERATED
;
10592 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10593 salt_type
= SALT_TYPE_EMBEDDED
;
10594 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10595 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10596 | OPTS_TYPE_PT_ADD80
10597 | OPTS_TYPE_PT_UNICODE
10598 | OPTS_TYPE_PT_NEVERCRACK
;
10599 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10600 dgst_size
= DGST_SIZE_4_4
;
10601 parse_func
= oldoffice34cm2_parse_hash
;
10602 sort_by_digest
= sort_by_digest_4_4
;
10603 opti_type
= OPTI_TYPE_ZERO_BYTE
10604 | OPTI_TYPE_PRECOMPUTE_INIT
10605 | OPTI_TYPE_NOT_ITERATED
;
10612 case 9900: hash_type
= HASH_TYPE_MD5
;
10613 salt_type
= SALT_TYPE_NONE
;
10614 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10615 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10616 kern_type
= KERN_TYPE_RADMIN2
;
10617 dgst_size
= DGST_SIZE_4_4
;
10618 parse_func
= radmin2_parse_hash
;
10619 sort_by_digest
= sort_by_digest_4_4
;
10620 opti_type
= OPTI_TYPE_ZERO_BYTE
10621 | OPTI_TYPE_PRECOMPUTE_INIT
10622 | OPTI_TYPE_EARLY_SKIP
10623 | OPTI_TYPE_NOT_ITERATED
10624 | OPTI_TYPE_NOT_SALTED
;
10631 case 10000: hash_type
= HASH_TYPE_SHA256
;
10632 salt_type
= SALT_TYPE_EMBEDDED
;
10633 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10634 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10635 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10636 dgst_size
= DGST_SIZE_4_32
;
10637 parse_func
= djangopbkdf2_parse_hash
;
10638 sort_by_digest
= sort_by_digest_4_32
;
10639 opti_type
= OPTI_TYPE_ZERO_BYTE
10640 | OPTI_TYPE_SLOW_HASH_SIMD
;
10647 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10648 salt_type
= SALT_TYPE_EMBEDDED
;
10649 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10651 kern_type
= KERN_TYPE_SIPHASH
;
10652 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10653 parse_func
= siphash_parse_hash
;
10654 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10655 opti_type
= OPTI_TYPE_ZERO_BYTE
10656 | OPTI_TYPE_NOT_ITERATED
10657 | OPTI_TYPE_RAW_HASH
;
10664 case 10200: hash_type
= HASH_TYPE_MD5
;
10665 salt_type
= SALT_TYPE_EMBEDDED
;
10666 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10667 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10668 | OPTS_TYPE_ST_ADD80
10669 | OPTS_TYPE_ST_ADDBITS14
;
10670 kern_type
= KERN_TYPE_HMACMD5_PW
;
10671 dgst_size
= DGST_SIZE_4_4
;
10672 parse_func
= crammd5_parse_hash
;
10673 sort_by_digest
= sort_by_digest_4_4
;
10674 opti_type
= OPTI_TYPE_ZERO_BYTE
10675 | OPTI_TYPE_NOT_ITERATED
;
10682 case 10300: hash_type
= HASH_TYPE_SHA1
;
10683 salt_type
= SALT_TYPE_EMBEDDED
;
10684 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10685 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10686 kern_type
= KERN_TYPE_SAPH_SHA1
;
10687 dgst_size
= DGST_SIZE_4_5
;
10688 parse_func
= saph_sha1_parse_hash
;
10689 sort_by_digest
= sort_by_digest_4_5
;
10690 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10697 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10698 salt_type
= SALT_TYPE_EMBEDDED
;
10699 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10700 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10701 kern_type
= KERN_TYPE_PDF11
;
10702 dgst_size
= DGST_SIZE_4_4
;
10703 parse_func
= pdf11_parse_hash
;
10704 sort_by_digest
= sort_by_digest_4_4
;
10705 opti_type
= OPTI_TYPE_ZERO_BYTE
10706 | OPTI_TYPE_NOT_ITERATED
;
10713 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10714 salt_type
= SALT_TYPE_EMBEDDED
;
10715 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10716 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10717 kern_type
= KERN_TYPE_PDF11CM1
;
10718 dgst_size
= DGST_SIZE_4_4
;
10719 parse_func
= pdf11cm1_parse_hash
;
10720 sort_by_digest
= sort_by_digest_4_4
;
10721 opti_type
= OPTI_TYPE_ZERO_BYTE
10722 | OPTI_TYPE_NOT_ITERATED
;
10729 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10730 salt_type
= SALT_TYPE_EMBEDDED
;
10731 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10732 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10733 kern_type
= KERN_TYPE_PDF11CM2
;
10734 dgst_size
= DGST_SIZE_4_4
;
10735 parse_func
= pdf11cm2_parse_hash
;
10736 sort_by_digest
= sort_by_digest_4_4
;
10737 opti_type
= OPTI_TYPE_ZERO_BYTE
10738 | OPTI_TYPE_NOT_ITERATED
;
10745 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10746 salt_type
= SALT_TYPE_EMBEDDED
;
10747 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10748 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10749 kern_type
= KERN_TYPE_PDF14
;
10750 dgst_size
= DGST_SIZE_4_4
;
10751 parse_func
= pdf14_parse_hash
;
10752 sort_by_digest
= sort_by_digest_4_4
;
10753 opti_type
= OPTI_TYPE_ZERO_BYTE
10754 | OPTI_TYPE_NOT_ITERATED
;
10761 case 10600: hash_type
= HASH_TYPE_SHA256
;
10762 salt_type
= SALT_TYPE_EMBEDDED
;
10763 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10764 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10765 | OPTS_TYPE_ST_ADD80
10766 | OPTS_TYPE_ST_ADDBITS15
10767 | OPTS_TYPE_HASH_COPY
;
10768 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10769 dgst_size
= DGST_SIZE_4_8
;
10770 parse_func
= pdf17l3_parse_hash
;
10771 sort_by_digest
= sort_by_digest_4_8
;
10772 opti_type
= OPTI_TYPE_ZERO_BYTE
10773 | OPTI_TYPE_PRECOMPUTE_INIT
10774 | OPTI_TYPE_PRECOMPUTE_MERKLE
10775 | OPTI_TYPE_EARLY_SKIP
10776 | OPTI_TYPE_NOT_ITERATED
10777 | OPTI_TYPE_APPENDED_SALT
10778 | OPTI_TYPE_RAW_HASH
;
10785 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10786 salt_type
= SALT_TYPE_EMBEDDED
;
10787 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10788 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10789 | OPTS_TYPE_HASH_COPY
;
10790 kern_type
= KERN_TYPE_PDF17L8
;
10791 dgst_size
= DGST_SIZE_4_8
;
10792 parse_func
= pdf17l8_parse_hash
;
10793 sort_by_digest
= sort_by_digest_4_8
;
10794 opti_type
= OPTI_TYPE_ZERO_BYTE
10795 | OPTI_TYPE_NOT_ITERATED
;
10802 case 10800: hash_type
= HASH_TYPE_SHA384
;
10803 salt_type
= SALT_TYPE_NONE
;
10804 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10805 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10806 | OPTS_TYPE_PT_ADD80
10807 | OPTS_TYPE_PT_ADDBITS15
;
10808 kern_type
= KERN_TYPE_SHA384
;
10809 dgst_size
= DGST_SIZE_8_8
;
10810 parse_func
= sha384_parse_hash
;
10811 sort_by_digest
= sort_by_digest_8_8
;
10812 opti_type
= OPTI_TYPE_ZERO_BYTE
10813 | OPTI_TYPE_PRECOMPUTE_INIT
10814 | OPTI_TYPE_PRECOMPUTE_MERKLE
10815 | OPTI_TYPE_EARLY_SKIP
10816 | OPTI_TYPE_NOT_ITERATED
10817 | OPTI_TYPE_NOT_SALTED
10818 | OPTI_TYPE_USES_BITS_64
10819 | OPTI_TYPE_RAW_HASH
;
10826 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10827 salt_type
= SALT_TYPE_EMBEDDED
;
10828 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10829 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10830 | OPTS_TYPE_ST_BASE64
10831 | OPTS_TYPE_HASH_COPY
;
10832 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10833 dgst_size
= DGST_SIZE_4_32
;
10834 parse_func
= pbkdf2_sha256_parse_hash
;
10835 sort_by_digest
= sort_by_digest_4_32
;
10836 opti_type
= OPTI_TYPE_ZERO_BYTE
10837 | OPTI_TYPE_SLOW_HASH_SIMD
;
10844 case 11000: hash_type
= HASH_TYPE_MD5
;
10845 salt_type
= SALT_TYPE_INTERN
;
10846 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10847 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10848 | OPTS_TYPE_PT_ADD80
;
10849 kern_type
= KERN_TYPE_PRESTASHOP
;
10850 dgst_size
= DGST_SIZE_4_4
;
10851 parse_func
= prestashop_parse_hash
;
10852 sort_by_digest
= sort_by_digest_4_4
;
10853 opti_type
= OPTI_TYPE_ZERO_BYTE
10854 | OPTI_TYPE_PRECOMPUTE_INIT
10855 | OPTI_TYPE_NOT_ITERATED
10856 | OPTI_TYPE_PREPENDED_SALT
;
10863 case 11100: hash_type
= HASH_TYPE_MD5
;
10864 salt_type
= SALT_TYPE_EMBEDDED
;
10865 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10867 | OPTS_TYPE_ST_ADD80
;
10868 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10869 dgst_size
= DGST_SIZE_4_4
;
10870 parse_func
= postgresql_auth_parse_hash
;
10871 sort_by_digest
= sort_by_digest_4_4
;
10872 opti_type
= OPTI_TYPE_ZERO_BYTE
10873 | OPTI_TYPE_PRECOMPUTE_INIT
10874 | OPTI_TYPE_PRECOMPUTE_MERKLE
10875 | OPTI_TYPE_EARLY_SKIP
;
10882 case 11200: hash_type
= HASH_TYPE_SHA1
;
10883 salt_type
= SALT_TYPE_EMBEDDED
;
10884 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10885 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10886 | OPTS_TYPE_PT_ADD80
10887 | OPTS_TYPE_ST_HEX
;
10888 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10889 dgst_size
= DGST_SIZE_4_5
;
10890 parse_func
= mysql_auth_parse_hash
;
10891 sort_by_digest
= sort_by_digest_4_5
;
10892 opti_type
= OPTI_TYPE_ZERO_BYTE
10893 | OPTI_TYPE_EARLY_SKIP
;
10900 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10901 salt_type
= SALT_TYPE_EMBEDDED
;
10902 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10903 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10905 | OPTS_TYPE_ST_ADD80
;
10906 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10907 dgst_size
= DGST_SIZE_4_4
;
10908 parse_func
= bitcoin_wallet_parse_hash
;
10909 sort_by_digest
= sort_by_digest_4_4
;
10910 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10917 case 11400: hash_type
= HASH_TYPE_MD5
;
10918 salt_type
= SALT_TYPE_EMBEDDED
;
10919 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10920 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10921 | OPTS_TYPE_PT_ADD80
10922 | OPTS_TYPE_HASH_COPY
;
10923 kern_type
= KERN_TYPE_SIP_AUTH
;
10924 dgst_size
= DGST_SIZE_4_4
;
10925 parse_func
= sip_auth_parse_hash
;
10926 sort_by_digest
= sort_by_digest_4_4
;
10927 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10934 case 11500: hash_type
= HASH_TYPE_CRC32
;
10935 salt_type
= SALT_TYPE_INTERN
;
10936 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10937 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10938 | OPTS_TYPE_ST_GENERATE_LE
10939 | OPTS_TYPE_ST_HEX
;
10940 kern_type
= KERN_TYPE_CRC32
;
10941 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10942 parse_func
= crc32_parse_hash
;
10943 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10944 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10951 case 11600: hash_type
= HASH_TYPE_AES
;
10952 salt_type
= SALT_TYPE_EMBEDDED
;
10953 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10954 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10955 | OPTS_TYPE_PT_NEVERCRACK
;
10956 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10957 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10958 parse_func
= seven_zip_parse_hash
;
10959 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10960 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10967 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10968 salt_type
= SALT_TYPE_NONE
;
10969 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10970 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10971 | OPTS_TYPE_PT_ADD01
;
10972 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10973 dgst_size
= DGST_SIZE_4_8
;
10974 parse_func
= gost2012sbog_256_parse_hash
;
10975 sort_by_digest
= sort_by_digest_4_8
;
10976 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10983 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10984 salt_type
= SALT_TYPE_NONE
;
10985 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10986 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10987 | OPTS_TYPE_PT_ADD01
;
10988 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10989 dgst_size
= DGST_SIZE_4_16
;
10990 parse_func
= gost2012sbog_512_parse_hash
;
10991 sort_by_digest
= sort_by_digest_4_16
;
10992 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10999 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
11000 salt_type
= SALT_TYPE_EMBEDDED
;
11001 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11002 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11003 | OPTS_TYPE_ST_BASE64
11004 | OPTS_TYPE_HASH_COPY
;
11005 kern_type
= KERN_TYPE_PBKDF2_MD5
;
11006 dgst_size
= DGST_SIZE_4_32
;
11007 parse_func
= pbkdf2_md5_parse_hash
;
11008 sort_by_digest
= sort_by_digest_4_32
;
11009 opti_type
= OPTI_TYPE_ZERO_BYTE
11010 | OPTI_TYPE_SLOW_HASH_SIMD
;
11017 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11018 salt_type
= SALT_TYPE_EMBEDDED
;
11019 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11020 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11021 | OPTS_TYPE_ST_BASE64
11022 | OPTS_TYPE_HASH_COPY
;
11023 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
11024 dgst_size
= DGST_SIZE_4_32
;
11025 parse_func
= pbkdf2_sha1_parse_hash
;
11026 sort_by_digest
= sort_by_digest_4_32
;
11027 opti_type
= OPTI_TYPE_ZERO_BYTE
11028 | OPTI_TYPE_SLOW_HASH_SIMD
;
11035 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
11036 salt_type
= SALT_TYPE_EMBEDDED
;
11037 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11038 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11039 | OPTS_TYPE_ST_BASE64
11040 | OPTS_TYPE_HASH_COPY
;
11041 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
11042 dgst_size
= DGST_SIZE_8_16
;
11043 parse_func
= pbkdf2_sha512_parse_hash
;
11044 sort_by_digest
= sort_by_digest_8_16
;
11045 opti_type
= OPTI_TYPE_ZERO_BYTE
11046 | OPTI_TYPE_USES_BITS_64
11047 | OPTI_TYPE_SLOW_HASH_SIMD
;
11054 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
11055 salt_type
= SALT_TYPE_EMBEDDED
;
11056 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11057 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11058 kern_type
= KERN_TYPE_ECRYPTFS
;
11059 dgst_size
= DGST_SIZE_8_8
;
11060 parse_func
= ecryptfs_parse_hash
;
11061 sort_by_digest
= sort_by_digest_8_8
;
11062 opti_type
= OPTI_TYPE_ZERO_BYTE
11063 | OPTI_TYPE_USES_BITS_64
;
11070 case 12300: hash_type
= HASH_TYPE_ORACLET
;
11071 salt_type
= SALT_TYPE_EMBEDDED
;
11072 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11073 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11074 kern_type
= KERN_TYPE_ORACLET
;
11075 dgst_size
= DGST_SIZE_8_16
;
11076 parse_func
= oraclet_parse_hash
;
11077 sort_by_digest
= sort_by_digest_8_16
;
11078 opti_type
= OPTI_TYPE_ZERO_BYTE
11079 | OPTI_TYPE_USES_BITS_64
;
11086 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
11087 salt_type
= SALT_TYPE_EMBEDDED
;
11088 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11089 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11090 kern_type
= KERN_TYPE_BSDICRYPT
;
11091 dgst_size
= DGST_SIZE_4_4
;
11092 parse_func
= bsdicrypt_parse_hash
;
11093 sort_by_digest
= sort_by_digest_4_4
;
11094 opti_type
= OPTI_TYPE_ZERO_BYTE
11095 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
11102 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
11103 salt_type
= SALT_TYPE_EMBEDDED
;
11104 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11106 kern_type
= KERN_TYPE_RAR3
;
11107 dgst_size
= DGST_SIZE_4_4
;
11108 parse_func
= rar3hp_parse_hash
;
11109 sort_by_digest
= sort_by_digest_4_4
;
11110 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11117 case 12600: hash_type
= HASH_TYPE_SHA256
;
11118 salt_type
= SALT_TYPE_INTERN
;
11119 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11120 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11121 | OPTS_TYPE_PT_ADD80
;
11122 kern_type
= KERN_TYPE_CF10
;
11123 dgst_size
= DGST_SIZE_4_8
;
11124 parse_func
= cf10_parse_hash
;
11125 sort_by_digest
= sort_by_digest_4_8
;
11126 opti_type
= OPTI_TYPE_ZERO_BYTE
11127 | OPTI_TYPE_PRECOMPUTE_INIT
11128 | OPTI_TYPE_EARLY_SKIP
11129 | OPTI_TYPE_NOT_ITERATED
;
11136 case 12700: hash_type
= HASH_TYPE_AES
;
11137 salt_type
= SALT_TYPE_EMBEDDED
;
11138 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11139 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11140 | OPTS_TYPE_HASH_COPY
;
11141 kern_type
= KERN_TYPE_MYWALLET
;
11142 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
11143 parse_func
= mywallet_parse_hash
;
11144 sort_by_digest
= sort_by_digest_4_5
;
11145 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11152 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11153 salt_type
= SALT_TYPE_EMBEDDED
;
11154 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11156 kern_type
= KERN_TYPE_MS_DRSR
;
11157 dgst_size
= DGST_SIZE_4_8
;
11158 parse_func
= ms_drsr_parse_hash
;
11159 sort_by_digest
= sort_by_digest_4_8
;
11160 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11167 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11168 salt_type
= SALT_TYPE_EMBEDDED
;
11169 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11170 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11171 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
11172 dgst_size
= DGST_SIZE_4_8
;
11173 parse_func
= androidfde_samsung_parse_hash
;
11174 sort_by_digest
= sort_by_digest_4_8
;
11175 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11182 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11183 salt_type
= SALT_TYPE_EMBEDDED
;
11184 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11185 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11186 kern_type
= KERN_TYPE_RAR5
;
11187 dgst_size
= DGST_SIZE_4_4
;
11188 parse_func
= rar5_parse_hash
;
11189 sort_by_digest
= sort_by_digest_4_4
;
11190 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11197 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
11198 salt_type
= SALT_TYPE_EMBEDDED
;
11199 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11200 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11201 kern_type
= KERN_TYPE_KRB5TGS
;
11202 dgst_size
= DGST_SIZE_4_4
;
11203 parse_func
= krb5tgs_parse_hash
;
11204 sort_by_digest
= sort_by_digest_4_4
;
11205 opti_type
= OPTI_TYPE_ZERO_BYTE
11206 | OPTI_TYPE_NOT_ITERATED
;
11213 case 13200: hash_type
= HASH_TYPE_AES
;
11214 salt_type
= SALT_TYPE_EMBEDDED
;
11215 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11216 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11217 kern_type
= KERN_TYPE_AXCRYPT
;
11218 dgst_size
= DGST_SIZE_4_4
;
11219 parse_func
= axcrypt_parse_hash
;
11220 sort_by_digest
= sort_by_digest_4_4
;
11221 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11228 case 13300: hash_type
= HASH_TYPE_SHA1
;
11229 salt_type
= SALT_TYPE_NONE
;
11230 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11231 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11232 | OPTS_TYPE_PT_ADD80
11233 | OPTS_TYPE_PT_ADDBITS15
;
11234 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
11235 dgst_size
= DGST_SIZE_4_5
;
11236 parse_func
= sha1axcrypt_parse_hash
;
11237 sort_by_digest
= sort_by_digest_4_5
;
11238 opti_type
= OPTI_TYPE_ZERO_BYTE
11239 | OPTI_TYPE_PRECOMPUTE_INIT
11240 | OPTI_TYPE_EARLY_SKIP
11241 | OPTI_TYPE_NOT_ITERATED
11242 | OPTI_TYPE_NOT_SALTED
;
11249 case 13400: hash_type
= HASH_TYPE_AES
;
11250 salt_type
= SALT_TYPE_EMBEDDED
;
11251 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11252 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11253 kern_type
= KERN_TYPE_KEEPASS
;
11254 dgst_size
= DGST_SIZE_4_4
;
11255 parse_func
= keepass_parse_hash
;
11256 sort_by_digest
= sort_by_digest_4_4
;
11257 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11264 case 13500: hash_type
= HASH_TYPE_SHA1
;
11265 salt_type
= SALT_TYPE_EMBEDDED
;
11266 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11267 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11268 | OPTS_TYPE_PT_UNICODE
11269 | OPTS_TYPE_PT_ADD80
;
11270 kern_type
= KERN_TYPE_PSTOKEN
;
11271 dgst_size
= DGST_SIZE_4_5
;
11272 parse_func
= pstoken_parse_hash
;
11273 sort_by_digest
= sort_by_digest_4_5
;
11274 opti_type
= OPTI_TYPE_ZERO_BYTE
11275 | OPTI_TYPE_PRECOMPUTE_INIT
11276 | OPTI_TYPE_EARLY_SKIP
11277 | OPTI_TYPE_NOT_ITERATED
11278 | OPTI_TYPE_PREPENDED_SALT
11279 | OPTI_TYPE_RAW_HASH
;
11286 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11287 salt_type
= SALT_TYPE_EMBEDDED
;
11288 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11289 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11290 kern_type
= KERN_TYPE_ZIP2
;
11291 dgst_size
= DGST_SIZE_4_4
;
11292 parse_func
= zip2_parse_hash
;
11293 sort_by_digest
= sort_by_digest_4_4
;
11294 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11301 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
11302 salt_type
= SALT_TYPE_EMBEDDED
;
11303 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11304 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11305 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11306 dgst_size
= DGST_SIZE_4_5
;
11307 parse_func
= veracrypt_parse_hash_655331
;
11308 sort_by_digest
= sort_by_digest_4_5
;
11309 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11316 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
11317 salt_type
= SALT_TYPE_EMBEDDED
;
11318 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11319 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11320 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11321 dgst_size
= DGST_SIZE_4_5
;
11322 parse_func
= veracrypt_parse_hash_655331
;
11323 sort_by_digest
= sort_by_digest_4_5
;
11324 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11331 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
11332 salt_type
= SALT_TYPE_EMBEDDED
;
11333 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11334 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11335 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11336 dgst_size
= DGST_SIZE_4_5
;
11337 parse_func
= veracrypt_parse_hash_655331
;
11338 sort_by_digest
= sort_by_digest_4_5
;
11339 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11346 case 13721: hash_type
= HASH_TYPE_SHA512
;
11347 salt_type
= SALT_TYPE_EMBEDDED
;
11348 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11349 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11350 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
11351 dgst_size
= DGST_SIZE_8_8
;
11352 parse_func
= veracrypt_parse_hash_500000
;
11353 sort_by_digest
= sort_by_digest_8_8
;
11354 opti_type
= OPTI_TYPE_ZERO_BYTE
11355 | OPTI_TYPE_USES_BITS_64
;
11362 case 13722: hash_type
= HASH_TYPE_SHA512
;
11363 salt_type
= SALT_TYPE_EMBEDDED
;
11364 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11365 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11366 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11367 dgst_size
= DGST_SIZE_8_8
;
11368 parse_func
= veracrypt_parse_hash_500000
;
11369 sort_by_digest
= sort_by_digest_8_8
;
11370 opti_type
= OPTI_TYPE_ZERO_BYTE
11371 | OPTI_TYPE_USES_BITS_64
;
11378 case 13723: hash_type
= HASH_TYPE_SHA512
;
11379 salt_type
= SALT_TYPE_EMBEDDED
;
11380 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11381 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11382 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11383 dgst_size
= DGST_SIZE_8_8
;
11384 parse_func
= veracrypt_parse_hash_500000
;
11385 sort_by_digest
= sort_by_digest_8_8
;
11386 opti_type
= OPTI_TYPE_ZERO_BYTE
11387 | OPTI_TYPE_USES_BITS_64
;
11394 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
11395 salt_type
= SALT_TYPE_EMBEDDED
;
11396 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11397 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11398 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
11399 dgst_size
= DGST_SIZE_4_8
;
11400 parse_func
= veracrypt_parse_hash_500000
;
11401 sort_by_digest
= sort_by_digest_4_8
;
11402 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11409 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
11410 salt_type
= SALT_TYPE_EMBEDDED
;
11411 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11412 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11413 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
11414 dgst_size
= DGST_SIZE_4_8
;
11415 parse_func
= veracrypt_parse_hash_500000
;
11416 sort_by_digest
= sort_by_digest_4_8
;
11417 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11424 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
11425 salt_type
= SALT_TYPE_EMBEDDED
;
11426 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11427 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11428 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
11429 dgst_size
= DGST_SIZE_4_8
;
11430 parse_func
= veracrypt_parse_hash_500000
;
11431 sort_by_digest
= sort_by_digest_4_8
;
11432 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11439 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11440 salt_type
= SALT_TYPE_EMBEDDED
;
11441 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11443 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11444 dgst_size
= DGST_SIZE_4_5
;
11445 parse_func
= veracrypt_parse_hash_327661
;
11446 sort_by_digest
= sort_by_digest_4_5
;
11447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11454 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11455 salt_type
= SALT_TYPE_EMBEDDED
;
11456 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11458 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11459 dgst_size
= DGST_SIZE_4_5
;
11460 parse_func
= veracrypt_parse_hash_327661
;
11461 sort_by_digest
= sort_by_digest_4_5
;
11462 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11469 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11470 salt_type
= SALT_TYPE_EMBEDDED
;
11471 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11472 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11473 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11474 dgst_size
= DGST_SIZE_4_5
;
11475 parse_func
= veracrypt_parse_hash_327661
;
11476 sort_by_digest
= sort_by_digest_4_5
;
11477 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11484 case 13751: hash_type
= HASH_TYPE_SHA256
;
11485 salt_type
= SALT_TYPE_EMBEDDED
;
11486 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11488 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11489 dgst_size
= DGST_SIZE_4_8
;
11490 parse_func
= veracrypt_parse_hash_500000
;
11491 sort_by_digest
= sort_by_digest_4_8
;
11492 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11499 case 13752: hash_type
= HASH_TYPE_SHA256
;
11500 salt_type
= SALT_TYPE_EMBEDDED
;
11501 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11502 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11503 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11504 dgst_size
= DGST_SIZE_4_8
;
11505 parse_func
= veracrypt_parse_hash_500000
;
11506 sort_by_digest
= sort_by_digest_4_8
;
11507 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11514 case 13753: hash_type
= HASH_TYPE_SHA256
;
11515 salt_type
= SALT_TYPE_EMBEDDED
;
11516 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11518 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11519 dgst_size
= DGST_SIZE_4_8
;
11520 parse_func
= veracrypt_parse_hash_500000
;
11521 sort_by_digest
= sort_by_digest_4_8
;
11522 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11529 case 13761: hash_type
= HASH_TYPE_SHA256
;
11530 salt_type
= SALT_TYPE_EMBEDDED
;
11531 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11532 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11533 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11534 dgst_size
= DGST_SIZE_4_8
;
11535 parse_func
= veracrypt_parse_hash_200000
;
11536 sort_by_digest
= sort_by_digest_4_8
;
11537 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11544 case 13762: hash_type
= HASH_TYPE_SHA256
;
11545 salt_type
= SALT_TYPE_EMBEDDED
;
11546 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11547 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11548 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11549 dgst_size
= DGST_SIZE_4_8
;
11550 parse_func
= veracrypt_parse_hash_200000
;
11551 sort_by_digest
= sort_by_digest_4_8
;
11552 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11559 case 13763: hash_type
= HASH_TYPE_SHA256
;
11560 salt_type
= SALT_TYPE_EMBEDDED
;
11561 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11563 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11564 dgst_size
= DGST_SIZE_4_8
;
11565 parse_func
= veracrypt_parse_hash_200000
;
11566 sort_by_digest
= sort_by_digest_4_8
;
11567 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11574 case 13800: hash_type
= HASH_TYPE_SHA256
;
11575 salt_type
= SALT_TYPE_EMBEDDED
;
11576 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11577 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11578 | OPTS_TYPE_PT_UNICODE
;
11579 kern_type
= KERN_TYPE_WIN8PHONE
;
11580 dgst_size
= DGST_SIZE_4_8
;
11581 parse_func
= win8phone_parse_hash
;
11582 sort_by_digest
= sort_by_digest_4_8
;
11583 opti_type
= OPTI_TYPE_ZERO_BYTE
11584 | OPTI_TYPE_PRECOMPUTE_INIT
11585 | OPTI_TYPE_EARLY_SKIP
11586 | OPTI_TYPE_NOT_ITERATED
11587 | OPTI_TYPE_RAW_HASH
;
11594 default: usage_mini_print (PROGNAME
); return -1;
11601 data
.parse_func
= parse_func
;
11609 if (salt_type
== SALT_TYPE_INTERN
)
11611 opts_type
|= OPTS_TYPE_ST_HEX
;
11615 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11621 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11622 | (salt_type
== SALT_TYPE_EXTERN
)
11623 | (salt_type
== SALT_TYPE_EMBEDDED
)
11624 | (salt_type
== SALT_TYPE_VIRTUAL
));
11626 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11628 data
.hash_type
= hash_type
;
11629 data
.attack_mode
= attack_mode
;
11630 data
.attack_kern
= attack_kern
;
11631 data
.attack_exec
= attack_exec
;
11632 data
.kern_type
= kern_type
;
11633 data
.opts_type
= opts_type
;
11634 data
.dgst_size
= dgst_size
;
11635 data
.salt_type
= salt_type
;
11636 data
.isSalted
= isSalted
;
11637 data
.sort_by_digest
= sort_by_digest
;
11638 data
.dgst_pos0
= dgst_pos0
;
11639 data
.dgst_pos1
= dgst_pos1
;
11640 data
.dgst_pos2
= dgst_pos2
;
11641 data
.dgst_pos3
= dgst_pos3
;
11647 case 2500: esalt_size
= sizeof (wpa_t
); break;
11648 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11649 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11650 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11651 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11652 case 6211: esalt_size
= sizeof (tc_t
); break;
11653 case 6212: esalt_size
= sizeof (tc_t
); break;
11654 case 6213: esalt_size
= sizeof (tc_t
); break;
11655 case 6221: esalt_size
= sizeof (tc_t
); break;
11656 case 6222: esalt_size
= sizeof (tc_t
); break;
11657 case 6223: esalt_size
= sizeof (tc_t
); break;
11658 case 6231: esalt_size
= sizeof (tc_t
); break;
11659 case 6232: esalt_size
= sizeof (tc_t
); break;
11660 case 6233: esalt_size
= sizeof (tc_t
); break;
11661 case 6241: esalt_size
= sizeof (tc_t
); break;
11662 case 6242: esalt_size
= sizeof (tc_t
); break;
11663 case 6243: esalt_size
= sizeof (tc_t
); break;
11664 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11665 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11666 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11667 case 7300: esalt_size
= sizeof (rakp_t
); break;
11668 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11669 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11670 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11671 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11672 case 9400: esalt_size
= sizeof (office2007_t
); break;
11673 case 9500: esalt_size
= sizeof (office2010_t
); break;
11674 case 9600: esalt_size
= sizeof (office2013_t
); break;
11675 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11676 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11677 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11678 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11679 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11680 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11681 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11682 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11683 case 10400: esalt_size
= sizeof (pdf_t
); break;
11684 case 10410: esalt_size
= sizeof (pdf_t
); break;
11685 case 10420: esalt_size
= sizeof (pdf_t
); break;
11686 case 10500: esalt_size
= sizeof (pdf_t
); break;
11687 case 10600: esalt_size
= sizeof (pdf_t
); break;
11688 case 10700: esalt_size
= sizeof (pdf_t
); break;
11689 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11690 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11691 case 11400: esalt_size
= sizeof (sip_t
); break;
11692 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11693 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11694 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11695 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11696 case 13000: esalt_size
= sizeof (rar5_t
); break;
11697 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11698 case 13400: esalt_size
= sizeof (keepass_t
); break;
11699 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11700 case 13600: esalt_size
= sizeof (zip2_t
); break;
11701 case 13711: esalt_size
= sizeof (tc_t
); break;
11702 case 13712: esalt_size
= sizeof (tc_t
); break;
11703 case 13713: esalt_size
= sizeof (tc_t
); break;
11704 case 13721: esalt_size
= sizeof (tc_t
); break;
11705 case 13722: esalt_size
= sizeof (tc_t
); break;
11706 case 13723: esalt_size
= sizeof (tc_t
); break;
11707 case 13731: esalt_size
= sizeof (tc_t
); break;
11708 case 13732: esalt_size
= sizeof (tc_t
); break;
11709 case 13733: esalt_size
= sizeof (tc_t
); break;
11710 case 13741: esalt_size
= sizeof (tc_t
); break;
11711 case 13742: esalt_size
= sizeof (tc_t
); break;
11712 case 13743: esalt_size
= sizeof (tc_t
); break;
11713 case 13751: esalt_size
= sizeof (tc_t
); break;
11714 case 13752: esalt_size
= sizeof (tc_t
); break;
11715 case 13753: esalt_size
= sizeof (tc_t
); break;
11716 case 13761: esalt_size
= sizeof (tc_t
); break;
11717 case 13762: esalt_size
= sizeof (tc_t
); break;
11718 case 13763: esalt_size
= sizeof (tc_t
); break;
11719 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11722 data
.esalt_size
= esalt_size
;
11725 * choose dictionary parser
11728 if (hash_type
== HASH_TYPE_LM
)
11730 get_next_word_func
= get_next_word_lm
;
11732 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11734 get_next_word_func
= get_next_word_uc
;
11738 get_next_word_func
= get_next_word_std
;
11745 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11748 size_t dictstat_nmemb
= 0;
11752 uint dictstat_nmemb
= 0;
11755 char dictstat
[256] = { 0 };
11757 FILE *dictstat_fp
= NULL
;
11761 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11763 dictstat_fp
= fopen (dictstat
, "rb");
11768 struct stat tmpstat
;
11770 fstat (fileno (dictstat_fp
), &tmpstat
);
11774 struct stat64 tmpstat
;
11776 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11779 if (tmpstat
.st_mtime
< COMPTIME
)
11781 /* with v0.15 the format changed so we have to ensure user is using a good version
11782 since there is no version-header in the dictstat file */
11784 fclose (dictstat_fp
);
11790 while (!feof (dictstat_fp
))
11794 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11796 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11798 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11800 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11806 fclose (dictstat_fp
);
11815 char potfile
[256] = { 0 };
11817 if (potfile_path
== NULL
)
11819 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11823 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11826 data
.pot_fp
= NULL
;
11828 FILE *out_fp
= NULL
;
11829 FILE *pot_fp
= NULL
;
11831 if (show
== 1 || left
== 1)
11833 pot_fp
= fopen (potfile
, "rb");
11835 if (pot_fp
== NULL
)
11837 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11842 if (outfile
!= NULL
)
11844 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11846 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11860 if (potfile_disable
== 0)
11862 pot_fp
= fopen (potfile
, "ab");
11864 if (pot_fp
== NULL
)
11866 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11871 data
.pot_fp
= pot_fp
;
11878 uint pot_avail
= 0;
11880 if (show
== 1 || left
== 1)
11882 SUPPRESS_OUTPUT
= 1;
11884 pot_avail
= count_lines (pot_fp
);
11888 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11890 uint pot_hashes_avail
= 0;
11894 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11896 while (!feof (pot_fp
))
11900 int line_len
= fgetl (pot_fp
, line_buf
);
11902 if (line_len
== 0) continue;
11904 char *plain_buf
= line_buf
+ line_len
;
11906 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11908 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11910 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11911 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11913 if (pot_cnt
== pot_hashes_avail
)
11917 for (pos
= 0; pos
< INCR_POT
; pos
++)
11919 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11921 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11923 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11925 tmp_hash
->digest
= mymalloc (dgst_size
);
11929 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11934 tmp_hash
->esalt
= mymalloc (esalt_size
);
11937 pot_hashes_avail
++;
11945 int iter
= MAX_CUT_TRIES
;
11949 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11951 if (line_buf
[i
] == ':')
11959 if (data
.hash_mode
!= 2500)
11961 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11965 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11967 if (line_len
> max_salt_size
)
11969 parser_status
= PARSER_GLOBAL_LENGTH
;
11973 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11975 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11977 hashes_buf
->salt
->salt_len
= line_len
;
11979 parser_status
= PARSER_OK
;
11983 // if NOT parsed without error, we add the ":" to the plain
11985 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11991 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11993 if (parser_status
< PARSER_GLOBAL_ZERO
)
11995 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
12000 if (plain_len
>= 255) continue;
12002 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
12004 pot_ptr
->plain_len
= plain_len
;
12013 SUPPRESS_OUTPUT
= 0;
12015 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
12022 uint pw_min
= PW_MIN
;
12023 uint pw_max
= PW_MAX
;
12027 case 125: if (pw_max
> 32) pw_max
= 32;
12029 case 400: if (pw_max
> 40) pw_max
= 40;
12031 case 500: if (pw_max
> 16) pw_max
= 16;
12033 case 1500: if (pw_max
> 8) pw_max
= 8;
12035 case 1600: if (pw_max
> 16) pw_max
= 16;
12037 case 1800: if (pw_max
> 16) pw_max
= 16;
12039 case 2100: if (pw_max
> 16) pw_max
= 16;
12041 case 2500: if (pw_min
< 8) pw_min
= 8;
12043 case 3000: if (pw_max
> 7) pw_max
= 7;
12045 case 5200: if (pw_max
> 24) pw_max
= 24;
12047 case 5800: if (pw_max
> 16) pw_max
= 16;
12049 case 6300: if (pw_max
> 16) pw_max
= 16;
12051 case 7400: if (pw_max
> 16) pw_max
= 16;
12053 case 7700: if (pw_max
> 8) pw_max
= 8;
12055 case 7900: if (pw_max
> 48) pw_max
= 48;
12057 case 8500: if (pw_max
> 8) pw_max
= 8;
12059 case 8600: if (pw_max
> 16) pw_max
= 16;
12061 case 9710: pw_min
= 5;
12064 case 9810: pw_min
= 5;
12067 case 10410: pw_min
= 5;
12070 case 10300: if (pw_max
< 3) pw_min
= 3;
12071 if (pw_max
> 40) pw_max
= 40;
12073 case 10500: if (pw_max
< 3) pw_min
= 3;
12074 if (pw_max
> 40) pw_max
= 40;
12076 case 10700: if (pw_max
> 16) pw_max
= 16;
12078 case 11300: if (pw_max
> 40) pw_max
= 40;
12080 case 11600: if (pw_max
> 32) pw_max
= 32;
12082 case 12500: if (pw_max
> 20) pw_max
= 20;
12084 case 12800: if (pw_max
> 24) pw_max
= 24;
12088 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12090 switch (attack_kern
)
12092 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12094 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12100 * charsets : keep them together for more easy maintainnce
12103 cs_t mp_sys
[6] = { { { 0 }, 0 } };
12104 cs_t mp_usr
[4] = { { { 0 }, 0 } };
12106 mp_setup_sys (mp_sys
);
12108 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
12109 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
12110 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
12111 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
12114 * load hashes, part I: find input mode, count hashes
12117 uint hashlist_mode
= 0;
12118 uint hashlist_format
= HLFMT_HASHCAT
;
12120 uint hashes_avail
= 0;
12122 if ((benchmark
== 0) && (stdout_flag
== 0))
12126 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
12128 if ((hash_mode
== 2500) ||
12129 (hash_mode
== 5200) ||
12130 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
12131 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
12132 (hash_mode
== 9000))
12134 hashlist_mode
= HL_MODE_ARG
;
12136 char *hashfile
= myargv
[optind
];
12138 data
.hashfile
= hashfile
;
12140 logfile_top_var_string ("target", hashfile
);
12143 if (hashlist_mode
== HL_MODE_ARG
)
12145 if (hash_mode
== 2500)
12149 if (stat (data
.hashfile
, &st
) == -1)
12151 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
12156 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
12163 else if (hashlist_mode
== HL_MODE_FILE
)
12165 char *hashfile
= myargv
[optind
];
12167 data
.hashfile
= hashfile
;
12169 logfile_top_var_string ("target", hashfile
);
12173 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12175 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12180 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
12182 hashes_avail
= count_lines (fp
);
12186 if (hashes_avail
== 0)
12188 log_error ("ERROR: hashfile is empty or corrupt");
12195 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
12197 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
12199 log_error ("ERROR: remove not supported in native hashfile-format mode");
12211 hashlist_mode
= HL_MODE_ARG
;
12216 if (hash_mode
== 3000) hashes_avail
*= 2;
12218 data
.hashlist_mode
= hashlist_mode
;
12219 data
.hashlist_format
= hashlist_format
;
12221 logfile_top_uint (hashlist_mode
);
12222 logfile_top_uint (hashlist_format
);
12225 * load hashes, part II: allocate required memory, set pointers
12228 hash_t
*hashes_buf
= NULL
;
12229 void *digests_buf
= NULL
;
12230 salt_t
*salts_buf
= NULL
;
12231 void *esalts_buf
= NULL
;
12233 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
12235 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
12237 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12241 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12243 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
12245 hashes_buf
[hash_pos
].hash_info
= hash_info
;
12247 if (username
&& (remove
|| show
|| left
))
12249 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
12254 hash_info
->orighash
= (char *) mymalloc (256);
12261 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12265 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
12270 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12273 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12275 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
12279 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
12283 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
12288 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
12293 * load hashes, part III: parse hashes or generate them if benchmark
12296 uint hashes_cnt
= 0;
12298 if (benchmark
== 0)
12302 // useless to read hash file for keyspace, cheat a little bit w/ optind
12304 else if (stdout_flag
== 1)
12306 // useless to read hash file for stdout, cheat a little bit w/ optind
12308 else if (hashes_avail
== 0)
12311 else if (hashlist_mode
== HL_MODE_ARG
)
12313 char *input_buf
= myargv
[optind
];
12315 uint input_len
= strlen (input_buf
);
12317 logfile_top_var_string ("target", input_buf
);
12319 char *hash_buf
= NULL
;
12322 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
12324 bool hash_fmt_error
= 0;
12326 if (hash_len
< 1) hash_fmt_error
= 1;
12327 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12329 if (hash_fmt_error
)
12331 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12335 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12337 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12339 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12344 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
12347 int parser_status
= PARSER_OK
;
12349 if (hash_mode
== 2500)
12353 log_error ("ERROR: hccap file not specified");
12358 hashlist_mode
= HL_MODE_FILE
;
12360 data
.hashlist_mode
= hashlist_mode
;
12362 FILE *fp
= fopen (hash_buf
, "rb");
12366 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12371 if (hashes_avail
< 1)
12373 log_error ("ERROR: hccap file is empty or corrupt");
12380 uint hccap_size
= sizeof (hccap_t
);
12382 char *in
= (char *) mymalloc (hccap_size
);
12386 int n
= fread (in
, hccap_size
, 1, fp
);
12390 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12395 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12397 if (parser_status
!= PARSER_OK
)
12399 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12404 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12406 if ((show
== 1) || (left
== 1))
12408 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12410 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12412 int cur_pos
= tmp_salt
->salt_len
;
12413 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12415 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12417 // do the appending task
12419 snprintf (salt_ptr
+ cur_pos
,
12421 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12433 wpa
->orig_mac2
[5]);
12435 // memset () the remaining part of the salt
12437 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12438 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12440 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12442 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12445 if (show
== 1) handle_show_request (pot
, pot_cnt
, (char *) hashes_buf
[hashes_cnt
].salt
->salt_buf
, hashes_buf
[hashes_cnt
].salt
->salt_len
, &hashes_buf
[hashes_cnt
], sort_by_salt_buf
, out_fp
);
12446 if (left
== 1) handle_left_request (pot
, pot_cnt
, (char *) hashes_buf
[hashes_cnt
].salt
->salt_buf
, hashes_buf
[hashes_cnt
].salt
->salt_len
, &hashes_buf
[hashes_cnt
], sort_by_salt_buf
, out_fp
);
12455 else if (hash_mode
== 3000)
12457 if (hash_len
== 32)
12459 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12461 hash_t
*lm_hash_left
= NULL
;
12463 if (parser_status
== PARSER_OK
)
12465 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12471 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12474 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12476 hash_t
*lm_hash_right
= NULL
;
12478 if (parser_status
== PARSER_OK
)
12480 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12486 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12491 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12493 if (show
== 1) handle_show_request_lm (pot
, pot_cnt
, input_buf
, input_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
12494 if (left
== 1) handle_left_request_lm (pot
, pot_cnt
, input_buf
, input_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
12499 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12501 if (parser_status
== PARSER_OK
)
12503 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12504 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12507 if (parser_status
== PARSER_OK
)
12513 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12519 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12521 if (parser_status
== PARSER_OK
)
12523 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12524 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12527 if (parser_status
== PARSER_OK
)
12533 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12538 else if (hashlist_mode
== HL_MODE_FILE
)
12540 char *hashfile
= data
.hashfile
;
12544 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12546 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12553 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12559 int line_len
= fgetl (fp
, line_buf
);
12561 if (line_len
== 0) continue;
12563 char *hash_buf
= NULL
;
12566 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12568 bool hash_fmt_error
= 0;
12570 if (hash_len
< 1) hash_fmt_error
= 1;
12571 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12573 if (hash_fmt_error
)
12575 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12582 char *user_buf
= NULL
;
12585 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12587 if (remove
|| show
)
12589 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12591 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12593 user_t
*user_ptr
= *user
;
12595 if (user_buf
!= NULL
)
12597 user_ptr
->user_name
= mystrdup (user_buf
);
12601 user_ptr
->user_name
= mystrdup ("");
12604 user_ptr
->user_len
= user_len
;
12608 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12610 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12612 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12617 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12620 if (hash_mode
== 3000)
12622 if (hash_len
== 32)
12624 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12626 if (parser_status
< PARSER_GLOBAL_ZERO
)
12628 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12633 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12637 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12639 if (parser_status
< PARSER_GLOBAL_ZERO
)
12641 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12646 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12648 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
12654 if (show
== 1) handle_show_request_lm (pot
, pot_cnt
, line_buf
, line_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
12655 if (left
== 1) handle_left_request_lm (pot
, pot_cnt
, line_buf
, line_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
12659 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12661 if (parser_status
< PARSER_GLOBAL_ZERO
)
12663 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12668 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
12670 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12671 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12678 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12680 if (parser_status
< PARSER_GLOBAL_ZERO
)
12682 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12687 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
12689 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12690 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12700 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12702 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12709 hashes_buf
[0].salt
->salt_len
= 8;
12711 // special salt handling
12715 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12716 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12718 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12720 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12722 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12724 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12726 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12728 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12730 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12732 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12734 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12736 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12737 hashes_buf
[0].salt
->scrypt_N
= 1024;
12738 hashes_buf
[0].salt
->scrypt_r
= 1;
12739 hashes_buf
[0].salt
->scrypt_p
= 1;
12741 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12743 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12744 hashes_buf
[0].salt
->scrypt_N
= 16384;
12745 hashes_buf
[0].salt
->scrypt_r
= 1;
12746 hashes_buf
[0].salt
->scrypt_p
= 1;
12748 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12750 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12752 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12754 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12756 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12758 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12760 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12762 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12764 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12766 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12768 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12770 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12772 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12774 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12776 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12780 // special esalt handling
12784 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12786 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12787 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12789 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12790 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12792 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12793 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12794 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12795 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12797 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12798 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12799 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12800 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12802 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12804 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12805 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12806 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12808 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12809 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12810 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12812 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12813 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12814 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12816 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12817 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12818 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12820 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12821 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12822 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12824 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12825 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12826 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12828 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12829 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12830 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12832 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12834 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12836 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12837 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12838 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12847 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12849 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12851 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12853 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12855 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12857 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12859 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12861 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12863 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12865 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12867 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12869 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12871 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12873 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12875 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12877 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12879 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12881 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12883 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12885 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12887 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12889 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12891 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12893 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12895 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12897 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12899 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12901 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12903 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12905 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12907 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12909 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12911 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12913 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12915 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12917 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12921 // set default iterations
12925 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12927 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12929 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12931 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12933 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12935 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12937 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12939 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12941 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12943 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12945 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12947 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12949 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12951 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12953 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12955 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12957 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12959 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12961 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12963 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12965 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12967 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12969 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12971 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12973 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12975 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12977 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12979 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12981 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12983 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12985 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12987 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12989 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12991 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12993 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12995 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12997 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12999 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
13001 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
13003 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
13005 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
13007 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
13009 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
13011 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
13013 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
13015 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
13017 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
13019 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
13021 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
13023 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
13025 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
13027 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
13029 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
13031 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
13033 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
13035 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
13037 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
13039 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
13041 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
13043 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
13045 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
13047 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
13049 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
13051 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
13053 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13055 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13057 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13059 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13061 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13063 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13065 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13067 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13069 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13071 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13073 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13075 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13077 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13079 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13081 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13083 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13085 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13087 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13094 if (show
== 1 || left
== 1)
13096 for (uint i
= 0; i
< pot_cnt
; i
++)
13098 pot_t
*pot_ptr
= &pot
[i
];
13100 hash_t
*hashes_buf
= &pot_ptr
->hash
;
13102 local_free (hashes_buf
->digest
);
13106 local_free (hashes_buf
->salt
);
13112 if (data
.quiet
== 0) log_info_nn ("");
13117 if ((keyspace
== 0) && (stdout_flag
== 0))
13119 if (hashes_cnt
== 0)
13121 log_error ("ERROR: No hashes loaded");
13128 * Sanity check for hashfile vs outfile (should not point to the same physical file)
13131 if (data
.outfile
!= NULL
)
13133 if (data
.hashfile
!= NULL
)
13136 struct stat tmpstat_outfile
;
13137 struct stat tmpstat_hashfile
;
13141 struct stat64 tmpstat_outfile
;
13142 struct stat64 tmpstat_hashfile
;
13145 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
13147 if (tmp_outfile_fp
)
13150 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13154 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13157 fclose (tmp_outfile_fp
);
13160 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
13162 if (tmp_hashfile_fp
)
13165 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13169 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13172 fclose (tmp_hashfile_fp
);
13175 if (tmp_outfile_fp
&& tmp_outfile_fp
)
13177 tmpstat_outfile
.st_mode
= 0;
13178 tmpstat_outfile
.st_nlink
= 0;
13179 tmpstat_outfile
.st_uid
= 0;
13180 tmpstat_outfile
.st_gid
= 0;
13181 tmpstat_outfile
.st_rdev
= 0;
13182 tmpstat_outfile
.st_atime
= 0;
13184 tmpstat_hashfile
.st_mode
= 0;
13185 tmpstat_hashfile
.st_nlink
= 0;
13186 tmpstat_hashfile
.st_uid
= 0;
13187 tmpstat_hashfile
.st_gid
= 0;
13188 tmpstat_hashfile
.st_rdev
= 0;
13189 tmpstat_hashfile
.st_atime
= 0;
13192 tmpstat_outfile
.st_blksize
= 0;
13193 tmpstat_outfile
.st_blocks
= 0;
13195 tmpstat_hashfile
.st_blksize
= 0;
13196 tmpstat_hashfile
.st_blocks
= 0;
13200 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
13202 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13209 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
13211 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13221 * Remove duplicates
13224 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
13228 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13232 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13235 uint hashes_cnt_orig
= hashes_cnt
;
13239 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
13243 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
13245 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13250 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13253 if (hashes_pos
> hashes_cnt
)
13255 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
13265 uint potfile_remove_cracks
= 0;
13267 if (potfile_disable
== 0)
13271 hash_buf
.digest
= mymalloc (dgst_size
);
13272 hash_buf
.salt
= NULL
;
13273 hash_buf
.esalt
= NULL
;
13274 hash_buf
.hash_info
= NULL
;
13275 hash_buf
.cracked
= 0;
13279 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
13284 hash_buf
.esalt
= mymalloc (esalt_size
);
13287 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
13289 // no solution for these special hash types (for instane because they use hashfile in output etc)
13290 if ((hash_mode
!= 5200) &&
13291 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
13292 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
13293 (hash_mode
!= 9000))
13295 FILE *fp
= fopen (potfile
, "rb");
13299 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
13301 // to be safe work with a copy (because of line_len loop, i etc)
13302 // moved up here because it's easier to handle continue case
13305 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
13309 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
13311 if (ptr
== NULL
) break;
13313 int line_len
= strlen (line_buf
);
13315 if (line_len
== 0) continue;
13317 int iter
= MAX_CUT_TRIES
;
13319 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
13321 if (line_buf
[i
] != ':') continue;
13325 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
13328 hash_t
*found
= NULL
;
13330 if (hash_mode
== 6800)
13332 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13334 // manipulate salt_buf
13335 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
13337 hash_buf
.salt
->salt_len
= i
;
13339 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
13342 else if (hash_mode
== 2500)
13344 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13346 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
13347 // manipulate salt_buf
13349 memset (line_buf_cpy
, 0, HCBUFSIZ
);
13350 memcpy (line_buf_cpy
, line_buf
, i
);
13352 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
13354 if (mac2_pos
== NULL
) continue;
13359 if (strlen (mac2_pos
) != 12) continue;
13361 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
13363 if (mac1_pos
== NULL
) continue;
13368 if (strlen (mac1_pos
) != 12) continue;
13370 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13372 // here we need the ESSID
13373 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13375 hash_buf
.salt
->salt_len
= essid_length
;
13377 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13381 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13383 // compare hex string(s) vs binary MAC address(es)
13385 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13387 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13396 if (!found
) continue;
13398 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13400 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13412 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13414 if (parser_status
== PARSER_OK
)
13418 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13422 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13427 if (found
== NULL
) continue;
13429 if (!found
->cracked
) potfile_remove_cracks
++;
13431 found
->cracked
= 1;
13439 myfree (line_buf_cpy
);
13449 local_free (hash_buf
.esalt
);
13454 local_free (hash_buf
.salt
);
13457 local_free (hash_buf
.digest
);
13461 * Now generate all the buffers required for later
13464 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13466 salt_t
*salts_buf_new
= NULL
;
13467 void *esalts_buf_new
= NULL
;
13471 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13475 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13480 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13483 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13485 uint digests_cnt
= hashes_cnt
;
13486 uint digests_done
= 0;
13488 size_t size_digests
= digests_cnt
* dgst_size
;
13489 size_t size_shown
= digests_cnt
* sizeof (uint
);
13491 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13492 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13494 uint salts_cnt
= 0;
13495 uint salts_done
= 0;
13497 hashinfo_t
**hash_info
= NULL
;
13499 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13501 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13503 if (username
&& (remove
|| show
))
13507 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13509 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13511 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13516 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13521 // copied from inner loop
13523 salt_buf
= &salts_buf_new
[salts_cnt
];
13525 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13529 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13532 salt_buf
->digests_cnt
= 0;
13533 salt_buf
->digests_done
= 0;
13534 salt_buf
->digests_offset
= 0;
13539 if (hashes_buf
[0].cracked
== 1)
13541 digests_shown
[0] = 1;
13545 salt_buf
->digests_done
++;
13548 salt_buf
->digests_cnt
++;
13550 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13552 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13554 hash_info
[0] = hashes_buf
[0].hash_info
;
13557 // copy from inner loop
13559 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13563 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13565 salt_buf
= &salts_buf_new
[salts_cnt
];
13567 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13571 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13574 salt_buf
->digests_cnt
= 0;
13575 salt_buf
->digests_done
= 0;
13576 salt_buf
->digests_offset
= hashes_pos
;
13582 if (hashes_buf
[hashes_pos
].cracked
== 1)
13584 digests_shown
[hashes_pos
] = 1;
13588 salt_buf
->digests_done
++;
13591 salt_buf
->digests_cnt
++;
13593 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13595 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13597 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13601 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13603 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13605 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13607 salts_shown
[salt_pos
] = 1;
13612 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13615 local_free (digests_buf
);
13616 local_free (salts_buf
);
13617 local_free (esalts_buf
);
13619 digests_buf
= digests_buf_new
;
13620 salts_buf
= salts_buf_new
;
13621 esalts_buf
= esalts_buf_new
;
13623 local_free (hashes_buf
);
13626 * special modification not set from parser
13631 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13632 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13633 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13634 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13635 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13636 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13637 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13638 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13639 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13640 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13641 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13642 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13643 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13644 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13645 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13646 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13647 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13648 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13649 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13650 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13651 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13652 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13653 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13654 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13655 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13656 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13657 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13658 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13659 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13660 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13663 if (truecrypt_keyfiles
)
13665 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13667 char *keyfiles
= strdup (truecrypt_keyfiles
);
13669 char *keyfile
= strtok (keyfiles
, ",");
13673 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13675 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13680 if (veracrypt_keyfiles
)
13682 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13684 char *keyfiles
= strdup (veracrypt_keyfiles
);
13686 char *keyfile
= strtok (keyfiles
, ",");
13690 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13692 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13697 data
.digests_cnt
= digests_cnt
;
13698 data
.digests_done
= digests_done
;
13699 data
.digests_buf
= digests_buf
;
13700 data
.digests_shown
= digests_shown
;
13701 data
.digests_shown_tmp
= digests_shown_tmp
;
13703 data
.salts_cnt
= salts_cnt
;
13704 data
.salts_done
= salts_done
;
13705 data
.salts_buf
= salts_buf
;
13706 data
.salts_shown
= salts_shown
;
13708 data
.esalts_buf
= esalts_buf
;
13709 data
.hash_info
= hash_info
;
13712 * Automatic Optimizers
13715 if (salts_cnt
== 1)
13716 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13718 if (digests_cnt
== 1)
13719 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13721 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13722 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13724 if (attack_mode
== ATTACK_MODE_BF
)
13725 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13727 data
.opti_type
= opti_type
;
13729 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13731 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13733 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13735 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13737 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13738 opts_type
|= OPTS_TYPE_PT_ADD80
;
13741 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13743 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13744 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13747 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13749 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13750 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13757 * Some algorithm, like descrypt, can benefit from JIT compilation
13760 int force_jit_compilation
= -1;
13762 if (hash_mode
== 8900)
13764 force_jit_compilation
= 8900;
13766 else if (hash_mode
== 9300)
13768 force_jit_compilation
= 8900;
13770 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13772 force_jit_compilation
= 1500;
13776 * generate bitmap tables
13779 const uint bitmap_shift1
= 5;
13780 const uint bitmap_shift2
= 13;
13782 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13784 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13785 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13786 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13787 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13788 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13789 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13790 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13791 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13798 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13800 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13802 bitmap_nums
= 1 << bitmap_bits
;
13804 bitmap_mask
= bitmap_nums
- 1;
13806 bitmap_size
= bitmap_nums
* sizeof (uint
);
13808 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13810 if (generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift1
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, digests_cnt
/ 2) == 0x7fffffff) continue;
13811 if (generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift2
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, digests_cnt
/ 2) == 0x7fffffff) continue;
13816 bitmap_nums
= 1 << bitmap_bits
;
13818 bitmap_mask
= bitmap_nums
- 1;
13820 bitmap_size
= bitmap_nums
* sizeof (uint
);
13822 generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift1
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, -1);
13823 generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift2
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s2_a
, bitmap_s2_b
, bitmap_s2_c
, bitmap_s2_d
, -1);
13826 * prepare quick rule
13829 data
.rule_buf_l
= rule_buf_l
;
13830 data
.rule_buf_r
= rule_buf_r
;
13832 int rule_len_l
= (int) strlen (rule_buf_l
);
13833 int rule_len_r
= (int) strlen (rule_buf_r
);
13835 data
.rule_len_l
= rule_len_l
;
13836 data
.rule_len_r
= rule_len_r
;
13842 uint
*all_kernel_rules_cnt
= NULL
;
13844 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13848 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13850 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13853 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13857 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13859 uint kernel_rules_avail
= 0;
13861 uint kernel_rules_cnt
= 0;
13863 kernel_rule_t
*kernel_rules_buf
= NULL
;
13865 char *rp_file
= rp_files
[i
];
13867 char in
[BLOCK_SIZE
] = { 0 };
13868 char out
[BLOCK_SIZE
] = { 0 };
13872 uint rule_line
= 0;
13874 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13876 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13883 memset (rule_buf
, 0, HCBUFSIZ
);
13885 rule_len
= fgetl (fp
, rule_buf
);
13889 if (rule_len
== 0) continue;
13891 if (rule_buf
[0] == '#') continue;
13893 if (kernel_rules_avail
== kernel_rules_cnt
)
13895 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13897 kernel_rules_avail
+= INCR_RULES
;
13900 memset (in
, 0, BLOCK_SIZE
);
13901 memset (out
, 0, BLOCK_SIZE
);
13903 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13907 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13912 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13914 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13916 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13922 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13924 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13930 kernel_rules_cnt
++;
13935 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13937 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13941 * merge rules or automatic rule generator
13944 uint kernel_rules_cnt
= 0;
13946 kernel_rule_t
*kernel_rules_buf
= NULL
;
13948 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13952 kernel_rules_cnt
= 1;
13954 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13956 repeats
[0] = kernel_rules_cnt
;
13958 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13960 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13962 repeats
[i
+ 1] = kernel_rules_cnt
;
13965 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13967 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13969 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13973 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13975 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13977 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13980 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13982 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13984 if (out_pos
== RULES_MAX
- 1)
13986 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13991 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13996 local_free (repeats
);
14000 uint kernel_rules_avail
= 0;
14002 while (kernel_rules_cnt
< rp_gen
)
14004 if (kernel_rules_avail
== kernel_rules_cnt
)
14006 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14008 kernel_rules_avail
+= INCR_RULES
;
14011 memset (rule_buf
, 0, HCBUFSIZ
);
14013 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
14015 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
14017 kernel_rules_cnt
++;
14025 * generate NOP rules
14028 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
14030 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
14032 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
14034 kernel_rules_cnt
++;
14037 data
.kernel_rules_cnt
= kernel_rules_cnt
;
14038 data
.kernel_rules_buf
= kernel_rules_buf
;
14040 if (kernel_rules_cnt
== 0)
14042 log_error ("ERROR: No valid rules left");
14048 * OpenCL platforms: detect
14051 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
14052 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
14054 cl_uint platforms_cnt
= 0;
14055 cl_uint platform_devices_cnt
= 0;
14059 cl_int CL_err
= hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
14061 if (CL_err
!= CL_SUCCESS
)
14063 log_error ("ERROR: clGetPlatformIDs(): %s\n", val2cstr_cl (CL_err
));
14068 if (platforms_cnt
== 0)
14071 log_info ("ATTENTION! No OpenCL compatible platform found");
14073 log_info ("You're probably missing the OpenCL runtime installation");
14074 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
14075 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
14076 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
14082 if (opencl_platforms_filter
!= (uint
) -1)
14084 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
14086 if (opencl_platforms_filter
> platform_cnt_mask
)
14088 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
14095 if (opencl_device_types
== NULL
)
14098 * OpenCL device types:
14099 * In case the user did not specify --opencl-device-types and the user runs hashcat in a system with only a CPU only he probably want to use that CPU.
14102 cl_device_type device_types_all
= 0;
14104 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14106 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
14108 cl_platform_id platform
= platforms
[platform_id
];
14110 cl_int CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14112 if (CL_err
!= CL_SUCCESS
)
14114 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14118 // Silently ignore at this point, it will be reused later and create a note for the user at that point
14123 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14125 cl_device_id device
= platform_devices
[platform_devices_id
];
14127 cl_device_type device_type
;
14129 cl_int CL_err
= hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14131 if (CL_err
!= CL_SUCCESS
)
14133 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14138 device_types_all
|= device_type
;
14142 // In such a case, automatically enable CPU device type support, since it's disabled by default.
14144 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
14146 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
14149 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
14150 // If we have a CPU device, force it to be used
14152 if (stdout_flag
== 1)
14154 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
14156 device_types_filter
= CL_DEVICE_TYPE_CPU
;
14162 * OpenCL devices: simply push all devices from all platforms into the same device array
14166 int need_nvapi
= 0;
14168 int need_xnvctrl
= 0;
14170 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
14172 data
.devices_param
= devices_param
;
14174 uint devices_cnt
= 0;
14176 uint devices_active
= 0;
14178 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14180 cl_int CL_err
= CL_SUCCESS
;
14182 cl_platform_id platform
= platforms
[platform_id
];
14184 char platform_vendor
[INFOSZ
] = { 0 };
14186 CL_err
= hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
14188 if (CL_err
!= CL_SUCCESS
)
14190 log_error ("ERROR: clGetPlatformInfo(): %s\n", val2cstr_cl (CL_err
));
14195 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
14196 // this causes trouble with vendor id based macros
14197 // we'll assign generic to those without special optimization available
14199 cl_uint platform_vendor_id
= 0;
14201 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
14203 platform_vendor_id
= VENDOR_ID_AMD
;
14205 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14207 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14209 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
14211 platform_vendor_id
= VENDOR_ID_APPLE
;
14213 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14215 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14217 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14219 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
14221 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
14223 platform_vendor_id
= VENDOR_ID_MESA
;
14225 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
14227 platform_vendor_id
= VENDOR_ID_NV
;
14229 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
14231 platform_vendor_id
= VENDOR_ID_POCL
;
14235 platform_vendor_id
= VENDOR_ID_GENERIC
;
14238 uint platform_skipped
= ((opencl_platforms_filter
& (1 << platform_id
)) == 0);
14240 CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14242 if (CL_err
!= CL_SUCCESS
)
14244 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14248 platform_skipped
= 2;
14251 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14253 if (machine_readable
== 0)
14255 if (platform_skipped
== 0)
14257 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
14259 char line
[256] = { 0 };
14261 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
14265 else if (platform_skipped
== 1)
14267 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
14270 else if (platform_skipped
== 2)
14272 log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id
+ 1, platform_vendor
);
14278 if (platform_skipped
== 1) continue;
14279 if (platform_skipped
== 2) continue;
14281 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14283 size_t param_value_size
= 0;
14285 const uint device_id
= devices_cnt
;
14287 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14289 device_param
->platform_vendor_id
= platform_vendor_id
;
14291 device_param
->device
= platform_devices
[platform_devices_id
];
14293 device_param
->device_id
= device_id
;
14295 device_param
->platform_devices_id
= platform_devices_id
;
14297 device_param
->platform
= platform
;
14301 cl_device_type device_type
;
14303 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14305 if (CL_err
!= CL_SUCCESS
)
14307 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14312 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
14314 device_param
->device_type
= device_type
;
14318 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
14320 if (CL_err
!= CL_SUCCESS
)
14322 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14327 char *device_name
= (char *) mymalloc (param_value_size
);
14329 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
14331 if (CL_err
!= CL_SUCCESS
)
14333 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14338 device_param
->device_name
= device_name
;
14342 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
14344 if (CL_err
!= CL_SUCCESS
)
14346 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14351 char *device_vendor
= (char *) mymalloc (param_value_size
);
14353 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
14355 if (CL_err
!= CL_SUCCESS
)
14357 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14362 device_param
->device_vendor
= device_vendor
;
14364 cl_uint device_vendor_id
= 0;
14366 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
14368 device_vendor_id
= VENDOR_ID_AMD
;
14370 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14372 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14374 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
14376 device_vendor_id
= VENDOR_ID_APPLE
;
14378 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14380 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14382 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14384 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
14386 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
14388 device_vendor_id
= VENDOR_ID_MESA
;
14390 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
14392 device_vendor_id
= VENDOR_ID_NV
;
14394 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
14396 device_vendor_id
= VENDOR_ID_POCL
;
14400 device_vendor_id
= VENDOR_ID_GENERIC
;
14403 device_param
->device_vendor_id
= device_vendor_id
;
14407 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14411 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
14413 if (CL_err
!= CL_SUCCESS
)
14415 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14420 char *device_version
= (char *) mymalloc (param_value_size
);
14422 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
14424 if (CL_err
!= CL_SUCCESS
)
14426 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14431 device_param
->device_version
= device_version
;
14433 // device_opencl_version
14435 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
14437 if (CL_err
!= CL_SUCCESS
)
14439 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14444 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
14446 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
14448 if (CL_err
!= CL_SUCCESS
)
14450 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14455 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
14457 myfree (device_opencl_version
);
14461 cl_uint vector_width
;
14463 if (opencl_vector_width_chgd
== 0)
14465 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
14467 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
14469 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
14471 if (CL_err
!= CL_SUCCESS
)
14473 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14480 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
14482 if (CL_err
!= CL_SUCCESS
)
14484 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14492 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14497 vector_width
= opencl_vector_width
;
14500 if (vector_width
> 16) vector_width
= 16;
14502 device_param
->vector_width
= vector_width
;
14504 // max_compute_units
14506 cl_uint device_processors
;
14508 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14510 if (CL_err
!= CL_SUCCESS
)
14512 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14517 device_param
->device_processors
= device_processors
;
14519 // device_maxmem_alloc
14520 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14522 cl_ulong device_maxmem_alloc
;
14524 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14526 if (CL_err
!= CL_SUCCESS
)
14528 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14533 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14535 // device_global_mem
14537 cl_ulong device_global_mem
;
14539 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14541 if (CL_err
!= CL_SUCCESS
)
14543 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14548 device_param
->device_global_mem
= device_global_mem
;
14550 // max_work_group_size
14552 size_t device_maxworkgroup_size
;
14554 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14556 if (CL_err
!= CL_SUCCESS
)
14558 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14563 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14565 // max_clock_frequency
14567 cl_uint device_maxclock_frequency
;
14569 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14571 if (CL_err
!= CL_SUCCESS
)
14573 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14578 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14580 // device_endian_little
14582 cl_bool device_endian_little
;
14584 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14586 if (CL_err
!= CL_SUCCESS
)
14588 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14593 if (device_endian_little
== CL_FALSE
)
14595 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14597 device_param
->skipped
= 1;
14600 // device_available
14602 cl_bool device_available
;
14604 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14606 if (CL_err
!= CL_SUCCESS
)
14608 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14613 if (device_available
== CL_FALSE
)
14615 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14617 device_param
->skipped
= 1;
14620 // device_compiler_available
14622 cl_bool device_compiler_available
;
14624 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14626 if (CL_err
!= CL_SUCCESS
)
14628 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14633 if (device_compiler_available
== CL_FALSE
)
14635 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14637 device_param
->skipped
= 1;
14640 // device_execution_capabilities
14642 cl_device_exec_capabilities device_execution_capabilities
;
14644 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14646 if (CL_err
!= CL_SUCCESS
)
14648 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14653 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14655 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14657 device_param
->skipped
= 1;
14660 // device_extensions
14662 size_t device_extensions_size
;
14664 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14666 if (CL_err
!= CL_SUCCESS
)
14668 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14673 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14675 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14677 if (CL_err
!= CL_SUCCESS
)
14679 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14684 if (strstr (device_extensions
, "base_atomics") == 0)
14686 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14688 device_param
->skipped
= 1;
14691 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14693 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14695 device_param
->skipped
= 1;
14698 myfree (device_extensions
);
14700 // device_local_mem_size
14702 cl_ulong device_local_mem_size
;
14704 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14706 if (CL_err
!= CL_SUCCESS
)
14708 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14713 if (device_local_mem_size
< 32768)
14715 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14717 device_param
->skipped
= 1;
14720 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14721 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14722 // This results in both utilizing it for 50%
14723 // However, Intel has much better SIMD control over their own hardware
14724 // It makes sense to give them full control over their own hardware
14726 if (device_type
& CL_DEVICE_TYPE_CPU
)
14728 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14730 if (data
.force
== 0)
14732 if (algorithm_pos
== 0)
14734 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14735 log_info (" You can use --force to override this but do not post error reports if you do so");
14738 device_param
->skipped
= 1;
14745 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
14746 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14750 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14752 if (CL_err
!= CL_SUCCESS
)
14754 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14759 char *driver_version
= (char *) mymalloc (param_value_size
);
14761 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14763 if (CL_err
!= CL_SUCCESS
)
14765 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14770 device_param
->driver_version
= driver_version
;
14772 // device_name_chksum
14774 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14777 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
14779 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
14782 uint device_name_digest
[4] = { 0 };
14784 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14786 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14788 device_param
->device_name_chksum
= device_name_chksum
;
14792 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14794 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14799 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14813 if (device_type
& CL_DEVICE_TYPE_GPU
)
14815 if (device_vendor_id
== VENDOR_ID_NV
)
14817 cl_uint kernel_exec_timeout
= 0;
14819 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14821 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14823 if (CL_err
!= CL_SUCCESS
)
14825 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14830 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14832 cl_uint sm_minor
= 0;
14833 cl_uint sm_major
= 0;
14835 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14836 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14838 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14840 if (CL_err
!= CL_SUCCESS
)
14842 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14847 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14849 if (CL_err
!= CL_SUCCESS
)
14851 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14856 device_param
->sm_minor
= sm_minor
;
14857 device_param
->sm_major
= sm_major
;
14859 // CPU burning loop damper
14860 // Value is given as number between 0-100
14863 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14865 if (nvidia_spin_damp_chgd
== 0)
14867 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14870 * the workaround is not a friend of rule based attacks
14871 * the words from the wordlist combined with fast and slow rules cause
14872 * fluctuations which cause inaccurate wait time estimations
14873 * using a reduced damping percentage almost compensates this
14876 device_param
->nvidia_spin_damp
= 64;
14880 device_param
->nvidia_spin_damp
/= 100;
14886 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14888 if (machine_readable
== 0)
14890 if (device_param
->skipped
== 0)
14892 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
14895 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
14896 (unsigned int) (device_global_mem
/ 1024 / 1024),
14897 (unsigned int) device_processors
);
14901 log_info ("- Device #%u: %s, skipped",
14908 // common driver check
14910 if (device_param
->skipped
== 0)
14912 if (device_type
& CL_DEVICE_TYPE_GPU
)
14914 if (platform_vendor_id
== VENDOR_ID_AMD
)
14916 int catalyst_check
= (force
== 1) ? 0 : 1;
14918 int catalyst_warn
= 0;
14920 int catalyst_broken
= 0;
14922 if (catalyst_check
== 1)
14926 // v14.9 and higher
14927 if (atoi (device_param
->driver_version
) >= 1573)
14932 catalyst_check
= 0;
14935 if (catalyst_broken
== 1)
14938 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
14939 log_info ("It passes over cracked hashes and will not report them as cracked");
14940 log_info ("You are STRONGLY encouraged not to use it");
14941 log_info ("You can use --force to override this but do not post error reports if you do so");
14947 if (catalyst_warn
== 1)
14950 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
14951 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
14952 log_info ("See hashcat's homepage for official supported catalyst drivers");
14954 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
14956 log_info ("You can use --force to override this but do not post error reports if you do so");
14962 else if (platform_vendor_id
== VENDOR_ID_NV
)
14964 if (device_param
->kernel_exec_timeout
!= 0)
14966 if (data
.quiet
== 0) log_info ("- Device #%u: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id
+ 1);
14967 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
14972 /* turns out pocl still creates segfaults (because of llvm)
14973 if (device_type & CL_DEVICE_TYPE_CPU)
14975 if (platform_vendor_id == VENDOR_ID_AMD)
14980 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
14981 log_info ("You are STRONGLY encouraged not to use it");
14982 log_info ("You can use --force to override this but do not post error reports if you do so");
14983 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
14993 * kernel accel and loops tuning db adjustment
14996 device_param
->kernel_accel_min
= 1;
14997 device_param
->kernel_accel_max
= 1024;
14999 device_param
->kernel_loops_min
= 1;
15000 device_param
->kernel_loops_max
= 1024;
15002 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
15004 if (tuningdb_entry
)
15006 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
15007 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
15011 device_param
->kernel_accel_min
= _kernel_accel
;
15012 device_param
->kernel_accel_max
= _kernel_accel
;
15017 if (workload_profile
== 1)
15019 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
15021 else if (workload_profile
== 2)
15023 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
15026 device_param
->kernel_loops_min
= _kernel_loops
;
15027 device_param
->kernel_loops_max
= _kernel_loops
;
15031 // commandline parameters overwrite tuningdb entries
15035 device_param
->kernel_accel_min
= kernel_accel
;
15036 device_param
->kernel_accel_max
= kernel_accel
;
15041 device_param
->kernel_loops_min
= kernel_loops
;
15042 device_param
->kernel_loops_max
= kernel_loops
;
15057 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
15059 if (machine_readable
== 0)
15066 if (keyspace
== 0 && devices_active
== 0)
15068 log_error ("ERROR: No devices found/left");
15073 // additional check to see if the user has chosen a device that is not within the range of available devices (i.e. larger than devices_cnt)
15075 if (devices_filter
!= (uint
) -1)
15077 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
15079 if (devices_filter
> devices_cnt_mask
)
15081 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
15087 data
.devices_cnt
= devices_cnt
;
15089 data
.devices_active
= devices_active
;
15096 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
];
15097 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
];
15098 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
];
15099 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
];
15101 memset (hm_adapters_adl
, 0, sizeof (hm_adapters_adl
));
15102 memset (hm_adapters_nvapi
, 0, sizeof (hm_adapters_nvapi
));
15103 memset (hm_adapters_nvml
, 0, sizeof (hm_adapters_nvml
));
15104 memset (hm_adapters_xnvctrl
, 0, sizeof (hm_adapters_xnvctrl
));
15106 if (gpu_temp_disable
== 0)
15108 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
15109 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
15110 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
15111 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
15113 data
.hm_adl
= NULL
;
15114 data
.hm_nvapi
= NULL
;
15115 data
.hm_nvml
= NULL
;
15116 data
.hm_xnvctrl
= NULL
;
15118 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
15120 data
.hm_nvml
= nvml
;
15125 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
15127 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
15129 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
15133 for (int i
= 0; i
< tmp_in
; i
++)
15135 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
15138 for (int i
= 0; i
< tmp_out
; i
++)
15140 unsigned int speed
;
15142 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
15144 // doesn't seem to create any advantages
15145 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
15146 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
15151 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
15153 data
.hm_nvapi
= nvapi
;
15158 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
15160 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
15162 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
15166 for (int i
= 0; i
< tmp_in
; i
++)
15168 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
15173 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
15175 data
.hm_xnvctrl
= xnvctrl
;
15178 if (data
.hm_xnvctrl
)
15180 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
15182 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15184 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15186 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15188 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
15192 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
15197 if ((need_adl
== 1) && (adl_init (adl
) == 0))
15204 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
15206 // total number of adapters
15208 int hm_adapters_num
;
15210 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return -1;
15214 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
15216 if (lpAdapterInfo
== NULL
) return -1;
15218 // get a list (of ids of) valid/usable adapters
15220 int num_adl_adapters
= 0;
15222 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
15224 if (num_adl_adapters
> 0)
15226 hc_thread_mutex_lock (mux_adl
);
15228 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
15230 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15232 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15233 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15235 hc_thread_mutex_unlock (mux_adl
);
15238 myfree (valid_adl_device_list
);
15239 myfree (lpAdapterInfo
);
15243 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15245 gpu_temp_disable
= 1;
15250 * OpenCL devices: allocate buffer for device specific information
15253 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
15255 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
15257 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
15260 * User-defined GPU temp handling
15263 if (gpu_temp_disable
== 1)
15265 gpu_temp_abort
= 0;
15266 gpu_temp_retain
= 0;
15269 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
15271 if (gpu_temp_abort
< gpu_temp_retain
)
15273 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
15279 data
.gpu_temp_disable
= gpu_temp_disable
;
15280 data
.gpu_temp_abort
= gpu_temp_abort
;
15281 data
.gpu_temp_retain
= gpu_temp_retain
;
15285 * enable custom signal handler(s)
15288 if (benchmark
== 0)
15290 hc_signal (sigHandler_default
);
15294 hc_signal (sigHandler_benchmark
);
15301 if (data
.quiet
== 0)
15303 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
15305 log_info ("Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_bits
, bitmap_nums
, bitmap_mask
, bitmap_size
, bitmap_shift1
, bitmap_shift2
);
15307 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15309 log_info ("Rules: %u", kernel_rules_cnt
);
15314 log_info ("Applicable Optimizers:");
15316 for (uint i
= 0; i
< 32; i
++)
15318 const uint opti_bit
= 1u << i
;
15320 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
15325 * Watchdog and Temperature balance
15329 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15331 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
15334 if (gpu_temp_abort
== 0)
15336 log_info ("Watchdog: Temperature abort trigger disabled");
15340 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
15343 if (gpu_temp_retain
== 0)
15345 log_info ("Watchdog: Temperature retain trigger disabled");
15349 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
15352 if (data
.quiet
== 0) log_info ("");
15362 if (gpu_temp_disable
== 0)
15364 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15366 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15368 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15370 if (device_param
->skipped
) continue;
15372 const uint platform_devices_id
= device_param
->platform_devices_id
;
15374 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15376 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
15377 data
.hm_device
[device_id
].nvapi
= 0;
15378 data
.hm_device
[device_id
].nvml
= 0;
15379 data
.hm_device
[device_id
].xnvctrl
= 0;
15380 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
15381 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
15382 data
.hm_device
[device_id
].fan_set_supported
= 0;
15385 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15387 data
.hm_device
[device_id
].adl
= 0;
15388 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
15389 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
15390 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
15391 data
.hm_device
[device_id
].od_version
= 0;
15392 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
15393 data
.hm_device
[device_id
].fan_set_supported
= 0;
15399 * powertune on user request
15402 if (powertune_enable
== 1)
15404 hc_thread_mutex_lock (mux_adl
);
15406 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15408 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15410 if (device_param
->skipped
) continue;
15412 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
15416 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
15417 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
15418 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
15419 * Driver / ADL bug?
15422 if (data
.hm_device
[device_id
].od_version
== 6)
15426 // check powertune capabilities first, if not available then skip device
15428 int powertune_supported
= 0;
15430 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
15432 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15437 // first backup current value, we will restore it later
15439 if (powertune_supported
!= 0)
15441 // powercontrol settings
15443 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15445 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
15447 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
15450 if (ADL_rc
!= ADL_OK
)
15452 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15457 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15459 log_error ("ERROR: Failed to set new ADL PowerControl values");
15466 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15468 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15470 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15472 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15477 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15479 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15481 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
15483 log_error ("ERROR: Failed to get ADL device capabilities");
15488 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15489 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15491 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15492 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15494 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15495 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15497 // warning if profile has too low max values
15499 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15501 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15504 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15506 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15509 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15511 performance_state
->iNumberOfPerformanceLevels
= 2;
15513 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15514 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15515 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15516 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15518 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15520 log_info ("ERROR: Failed to set ADL performance state");
15525 local_free (performance_state
);
15528 // set powertune value only
15530 if (powertune_supported
!= 0)
15533 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15535 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
15537 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15542 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15544 log_error ("ERROR: Failed to set new ADL PowerControl values");
15552 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
15554 // first backup current value, we will restore it later
15556 unsigned int limit
;
15558 int powertune_supported
= 0;
15560 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
15562 powertune_supported
= 1;
15565 // if backup worked, activate the maximum allowed
15567 if (powertune_supported
!= 0)
15569 unsigned int minLimit
;
15570 unsigned int maxLimit
;
15572 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
15576 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
15578 // now we can be sure we need to reset later
15580 nvml_power_limit
[device_id
] = limit
;
15588 hc_thread_mutex_unlock (mux_adl
);
15591 #endif // HAVE_HWMON
15594 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
15597 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
15599 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15601 cl_int CL_err
= CL_SUCCESS
;
15607 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15609 if (device_param
->skipped
) continue;
15612 * device properties
15615 const char *device_name_chksum
= device_param
->device_name_chksum
;
15616 const u32 device_processors
= device_param
->device_processors
;
15619 * create context for each device
15622 cl_context_properties properties
[3];
15624 properties
[0] = CL_CONTEXT_PLATFORM
;
15625 properties
[1] = (cl_context_properties
) device_param
->platform
;
15628 CL_err
= hc_clCreateContext (data
.ocl
, properties
, 1, &device_param
->device
, NULL
, NULL
, &device_param
->context
);
15630 if (CL_err
!= CL_SUCCESS
)
15632 log_error ("ERROR: clCreateContext(): %s\n", val2cstr_cl (CL_err
));
15638 * create command-queue
15641 // not supported with NV
15642 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15644 CL_err
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
, &device_param
->command_queue
);
15646 if (CL_err
!= CL_SUCCESS
)
15648 log_error ("ERROR: clCreateCommandQueue(): %s\n", val2cstr_cl (CL_err
));
15654 * kernel threads: some algorithms need a fixed kernel-threads count
15655 * because of shared memory usage or bitslice
15656 * there needs to be some upper limit, otherwise there's too much overhead
15659 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15661 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15662 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15664 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15666 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15669 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15670 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15671 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15672 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15673 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15674 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15675 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15676 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15677 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15678 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15679 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15680 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15681 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15683 device_param
->kernel_threads
= kernel_threads
;
15685 device_param
->hardware_power
= device_processors
* kernel_threads
;
15688 * create input buffers on device : calculate size of fixed memory buffers
15691 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15692 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15694 device_param
->size_root_css
= size_root_css
;
15695 device_param
->size_markov_css
= size_markov_css
;
15697 size_t size_results
= sizeof (uint
);
15699 device_param
->size_results
= size_results
;
15701 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15702 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15704 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15705 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15706 size_t size_esalts
= salts_cnt
* esalt_size
;
15708 device_param
->size_plains
= size_plains
;
15709 device_param
->size_digests
= size_digests
;
15710 device_param
->size_shown
= size_shown
;
15711 device_param
->size_salts
= size_salts
;
15713 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15714 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15715 size_t size_tm
= 32 * sizeof (bs_word_t
);
15719 size_t size_scrypt
= 4;
15721 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15723 // we need to check that all hashes have the same scrypt settings
15725 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15726 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15727 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15729 for (uint i
= 1; i
< salts_cnt
; i
++)
15731 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15732 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15733 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15735 log_error ("ERROR: Mixed scrypt settings not supported");
15741 uint tmto_start
= 0;
15742 uint tmto_stop
= 10;
15746 tmto_start
= scrypt_tmto
;
15750 // in case the user did not specify the tmto manually
15751 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15753 if (hash_mode
== 8900)
15755 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15759 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15764 else if (hash_mode
== 9300)
15766 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15770 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15777 data
.scrypt_tmp_size
= (128 * scrypt_r
* scrypt_p
);
15779 device_param
->kernel_accel_min
= 1;
15780 device_param
->kernel_accel_max
= 8;
15784 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15786 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15788 size_scrypt
/= 1 << tmto
;
15790 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15792 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15794 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15799 if (size_scrypt
> device_param
->device_global_mem
)
15801 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15806 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15808 data
.scrypt_tmto_final
= tmto
;
15814 if (tmto
== tmto_stop
)
15816 log_error ("ERROR: Can't allocate enough device memory");
15821 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %llu\n", data
.scrypt_tmto_final
, (unsigned long long int) size_scrypt
);
15824 size_t size_scrypt4
= size_scrypt
/ 4;
15827 * some algorithms need a fixed kernel-loops count
15830 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15832 const u32 kernel_loops_fixed
= 1024;
15834 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15835 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15838 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15840 const u32 kernel_loops_fixed
= 1024;
15842 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15843 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15846 if (hash_mode
== 8900)
15848 const u32 kernel_loops_fixed
= 1;
15850 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15851 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15854 if (hash_mode
== 9300)
15856 const u32 kernel_loops_fixed
= 1;
15858 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15859 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15862 if (hash_mode
== 12500)
15864 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15866 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15867 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15871 * some algorithms have a maximum kernel-loops count
15874 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15876 u32 innerloop_cnt
= 0;
15878 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15880 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15881 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15882 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15886 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
15889 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
15890 (innerloop_cnt
<= device_param
->kernel_loops_max
))
15892 device_param
->kernel_loops_max
= innerloop_cnt
;
15896 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
15897 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
15899 // find out if we would request too much memory on memory blocks which are based on kernel_accel
15901 size_t size_pws
= 4;
15902 size_t size_tmps
= 4;
15903 size_t size_hooks
= 4;
15905 while (kernel_accel_max
>= kernel_accel_min
)
15907 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
15911 size_pws
= kernel_power_max
* sizeof (pw_t
);
15917 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
15918 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15919 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15920 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15921 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
15922 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
15923 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
15924 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
15925 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
15926 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
15927 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15928 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15929 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15930 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15931 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15932 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15933 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15934 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15935 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15936 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15937 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15938 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15939 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15940 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
15941 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
15942 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
15943 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
15944 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
15945 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15946 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15947 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
15948 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
15949 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15950 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
15951 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
15952 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
15953 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
15954 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15955 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
15956 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
15957 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
15958 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
15959 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15960 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
15961 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
15962 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
15963 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
15964 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15965 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
15966 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
15967 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
15968 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
15969 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15970 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
15971 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
15972 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
15973 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
15974 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
15975 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15976 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15977 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15978 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
15979 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
15980 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
15981 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15982 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15983 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15984 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15985 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15986 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15987 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15988 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15989 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15990 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15991 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15992 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15993 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15994 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15995 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15996 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15997 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15998 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16003 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
16010 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
16011 // if not, decrease amplifier and try again
16013 int memory_limit_hit
= 0;
16015 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16016 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16017 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16019 const u64 size_total
16036 + size_pws
// not a bug
16050 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
16052 if (memory_limit_hit
== 1)
16054 kernel_accel_max
--;
16062 if (kernel_accel_max
< kernel_accel_min
)
16064 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
16069 device_param
->kernel_accel_min
= kernel_accel_min
;
16070 device_param
->kernel_accel_max
= kernel_accel_max
;
16073 if (kernel_accel_max < kernel_accel)
16075 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
16077 device_param->kernel_accel = kernel_accel_max;
16081 device_param
->size_bfs
= size_bfs
;
16082 device_param
->size_combs
= size_combs
;
16083 device_param
->size_rules
= size_rules
;
16084 device_param
->size_rules_c
= size_rules_c
;
16085 device_param
->size_pws
= size_pws
;
16086 device_param
->size_tmps
= size_tmps
;
16087 device_param
->size_hooks
= size_hooks
;
16090 * default building options
16093 char cpath
[1024] = { 0 };
16095 char build_opts
[1024] = { 0 };
16099 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
16101 char *cpath_real
= mymalloc (MAX_PATH
);
16103 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
16105 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
16112 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
16114 char *cpath_real
= mymalloc (PATH_MAX
);
16116 if (realpath (cpath
, cpath_real
) == NULL
)
16118 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
16125 if (chdir (cpath_real
) == -1)
16127 log_error ("ERROR: %s: %s", cpath_real
, strerror (errno
));
16134 naive_replace (cpath_real
, '\\', '/');
16136 // not escaping here, windows has quotes
16138 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
16142 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
16144 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
16149 // this test needs to be done manually because of osx opencl runtime
16150 // if there's a problem with permission, its not reporting back and erroring out silently
16152 #define files_cnt 15
16154 const char *files_names
[files_cnt
] =
16156 "inc_cipher_aes256.cl",
16157 "inc_cipher_serpent256.cl",
16158 "inc_cipher_twofish256.cl",
16160 "inc_comp_multi_bs.cl",
16161 "inc_comp_multi.cl",
16162 "inc_comp_single_bs.cl",
16163 "inc_comp_single.cl",
16164 "inc_hash_constants.h",
16165 "inc_hash_functions.cl",
16173 for (int i
= 0; i
< files_cnt
; i
++)
16175 FILE *fd
= fopen (files_names
[i
], "r");
16179 log_error ("ERROR: %s: fopen(): %s", files_names
[i
], strerror (errno
));
16186 size_t n
= fread (buf
, 1, 1, fd
);
16190 log_error ("ERROR: %s: fread(): %s", files_names
[i
], strerror (errno
));
16198 myfree (cpath_real
);
16200 // we don't have sm_* on vendors not NV but it doesn't matter
16202 char build_opts_new
[1024] = { 0 };
16204 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1", build_opts
, device_param
->device_vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
, device_param
->vector_width
, (u32
) device_param
->device_type
, data
.dgst_pos0
, data
.dgst_pos1
, data
.dgst_pos2
, data
.dgst_pos3
, data
.dgst_size
/ 4, kern_type
);
16206 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
16209 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
16218 * kernel source filename
16221 char source_file
[256] = { 0 };
16223 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
16227 if (stat (source_file
, &sst
) == -1)
16229 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16235 * kernel cached filename
16238 char cached_file
[256] = { 0 };
16240 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
16246 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
16252 * kernel compile or load
16255 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16257 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16259 if (force_jit_compilation
== -1)
16263 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16265 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16267 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16269 if (CL_err
!= CL_SUCCESS
)
16271 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16276 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16278 if (CL_err
!= CL_SUCCESS
)
16280 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16286 size_t build_log_size
= 0;
16288 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16290 if (CL_err
!= CL_SUCCESS
)
16292 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16297 if (build_log_size
> 1)
16299 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16301 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16303 if (CL_err
!= CL_SUCCESS
)
16305 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16312 myfree (build_log
);
16316 if (CL_err
!= CL_SUCCESS
)
16318 device_param
->skipped
= true;
16320 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16325 size_t binary_size
;
16327 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16329 if (CL_err
!= CL_SUCCESS
)
16331 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16336 u8
*binary
= (u8
*) mymalloc (binary_size
);
16338 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16340 if (CL_err
!= CL_SUCCESS
)
16342 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16347 writeProgramBin (cached_file
, binary
, binary_size
);
16349 local_free (binary
);
16354 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16357 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16359 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program
);
16361 if (CL_err
!= CL_SUCCESS
)
16363 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16368 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16370 if (CL_err
!= CL_SUCCESS
)
16372 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16381 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
16384 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16386 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16388 if (CL_err
!= CL_SUCCESS
)
16390 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16395 char build_opts_update
[1024] = { 0 };
16397 if (force_jit_compilation
== 1500)
16399 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
16401 else if (force_jit_compilation
== 8900)
16403 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%u", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.scrypt_tmto_final
, data
.scrypt_tmp_size
/ 16);
16407 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
16410 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
);
16412 if (CL_err
!= CL_SUCCESS
)
16414 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16420 size_t build_log_size
= 0;
16422 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16424 if (CL_err
!= CL_SUCCESS
)
16426 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16431 if (build_log_size
> 1)
16433 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16435 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16437 if (CL_err
!= CL_SUCCESS
)
16439 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16446 myfree (build_log
);
16450 if (CL_err
!= CL_SUCCESS
)
16452 device_param
->skipped
= true;
16454 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16458 local_free (kernel_lengths
);
16459 local_free (kernel_sources
[0]);
16460 local_free (kernel_sources
);
16464 * word generator kernel
16467 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
16470 * kernel mp source filename
16473 char source_file
[256] = { 0 };
16475 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
16479 if (stat (source_file
, &sst
) == -1)
16481 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16487 * kernel mp cached filename
16490 char cached_file
[256] = { 0 };
16492 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
16498 if (stat (cached_file
, &cst
) == -1)
16504 * kernel compile or load
16507 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16509 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16513 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16514 if (quiet
== 0) log_info ("");
16516 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16518 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_mp
);
16520 if (CL_err
!= CL_SUCCESS
)
16522 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16527 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16529 if (CL_err
!= CL_SUCCESS
)
16531 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16536 if (CL_err
!= CL_SUCCESS
)
16538 device_param
->skipped
= true;
16540 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16545 size_t binary_size
;
16547 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16549 if (CL_err
!= CL_SUCCESS
)
16551 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16556 u8
*binary
= (u8
*) mymalloc (binary_size
);
16558 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16560 if (CL_err
!= CL_SUCCESS
)
16562 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16567 writeProgramBin (cached_file
, binary
, binary_size
);
16569 local_free (binary
);
16574 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16577 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16579 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_mp
);
16581 if (CL_err
!= CL_SUCCESS
)
16583 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16588 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16590 if (CL_err
!= CL_SUCCESS
)
16592 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16598 local_free (kernel_lengths
);
16599 local_free (kernel_sources
[0]);
16600 local_free (kernel_sources
);
16607 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16614 * kernel amp source filename
16617 char source_file
[256] = { 0 };
16619 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
16623 if (stat (source_file
, &sst
) == -1)
16625 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16631 * kernel amp cached filename
16634 char cached_file
[256] = { 0 };
16636 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
16642 if (stat (cached_file
, &cst
) == -1)
16648 * kernel compile or load
16651 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16653 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16657 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16658 if (quiet
== 0) log_info ("");
16660 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16662 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_amp
);
16664 if (CL_err
!= CL_SUCCESS
)
16666 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16671 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16673 if (CL_err
!= CL_SUCCESS
)
16675 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16680 if (CL_err
!= CL_SUCCESS
)
16682 device_param
->skipped
= true;
16684 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
16689 size_t binary_size
;
16691 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16693 if (CL_err
!= CL_SUCCESS
)
16695 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16700 u8
*binary
= (u8
*) mymalloc (binary_size
);
16702 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16704 if (CL_err
!= CL_SUCCESS
)
16706 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16711 writeProgramBin (cached_file
, binary
, binary_size
);
16713 local_free (binary
);
16718 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16721 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16723 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_amp
);
16725 if (CL_err
!= CL_SUCCESS
)
16727 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16732 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16734 if (CL_err
!= CL_SUCCESS
)
16736 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16742 local_free (kernel_lengths
);
16743 local_free (kernel_sources
[0]);
16744 local_free (kernel_sources
);
16747 // return back to the folder we came from initially (workaround)
16749 if (chdir (cwd
) == -1)
16751 log_error ("ERROR: %s: %s", cwd
, strerror (errno
));
16756 // some algorithm collide too fast, make that impossible
16758 if (benchmark
== 1)
16760 ((uint
*) digests_buf
)[0] = -1;
16761 ((uint
*) digests_buf
)[1] = -1;
16762 ((uint
*) digests_buf
)[2] = -1;
16763 ((uint
*) digests_buf
)[3] = -1;
16770 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_buf
);
16771 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_amp_buf
);
16772 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
, &device_param
->d_tmps
);
16773 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
, &device_param
->d_hooks
);
16774 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_a
);
16775 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_b
);
16776 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_c
);
16777 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_d
);
16778 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_a
);
16779 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_b
);
16780 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_c
);
16781 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_d
);
16782 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
, &device_param
->d_plain_bufs
);
16783 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
, &device_param
->d_digests_buf
);
16784 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
, &device_param
->d_digests_shown
);
16785 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
, &device_param
->d_salt_bufs
);
16786 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
, &device_param
->d_result
);
16787 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV0_buf
);
16788 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV1_buf
);
16789 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV2_buf
);
16790 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV3_buf
);
16792 if (CL_err
!= CL_SUCCESS
)
16794 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16799 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
16800 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
16801 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
16802 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
16803 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
16804 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
16805 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
16806 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
16807 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
16808 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
16809 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
16811 if (CL_err
!= CL_SUCCESS
)
16813 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16822 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16824 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
, &device_param
->d_rules
);
16825 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
, &device_param
->d_rules_c
);
16827 if (CL_err
!= CL_SUCCESS
)
16829 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16834 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
16836 if (CL_err
!= CL_SUCCESS
)
16838 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16843 else if (attack_kern
== ATTACK_KERN_COMBI
)
16845 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs
);
16846 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs_c
);
16847 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16848 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16850 if (CL_err
!= CL_SUCCESS
)
16852 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16857 else if (attack_kern
== ATTACK_KERN_BF
)
16859 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs
);
16860 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs_c
);
16861 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
, &device_param
->d_tm_c
);
16862 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16863 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16865 if (CL_err
!= CL_SUCCESS
)
16867 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16875 CL_err
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
, &device_param
->d_esalt_bufs
);
16877 if (CL_err
!= CL_SUCCESS
)
16879 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16884 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
16886 if (CL_err
!= CL_SUCCESS
)
16888 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16898 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16900 device_param
->pws_buf
= pws_buf
;
16902 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16904 device_param
->combs_buf
= combs_buf
;
16906 void *hooks_buf
= mymalloc (size_hooks
);
16908 device_param
->hooks_buf
= hooks_buf
;
16914 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16915 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16916 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16917 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16918 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16919 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16920 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16921 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16922 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16923 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16924 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16926 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16927 ? &device_param
->d_pws_buf
16928 : &device_param
->d_pws_amp_buf
;
16929 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16930 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
16931 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
16932 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
16933 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
16934 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
16935 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
16936 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
16937 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
16938 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
16939 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
16940 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
16941 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
16942 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
16943 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
16944 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
16945 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
16946 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
16947 device_param
->kernel_params
[19] = &device_param
->d_result
;
16948 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
16949 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
16950 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
16951 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
16952 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
16953 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
16954 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
16955 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
16956 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
16957 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
16958 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
16959 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
16960 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
16961 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
16962 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
16964 device_param
->kernel_params_mp_buf64
[3] = 0;
16965 device_param
->kernel_params_mp_buf32
[4] = 0;
16966 device_param
->kernel_params_mp_buf32
[5] = 0;
16967 device_param
->kernel_params_mp_buf32
[6] = 0;
16968 device_param
->kernel_params_mp_buf32
[7] = 0;
16969 device_param
->kernel_params_mp_buf32
[8] = 0;
16971 device_param
->kernel_params_mp
[0] = NULL
;
16972 device_param
->kernel_params_mp
[1] = NULL
;
16973 device_param
->kernel_params_mp
[2] = NULL
;
16974 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
16975 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
16976 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
16977 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
16978 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
16979 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
16981 device_param
->kernel_params_mp_l_buf64
[3] = 0;
16982 device_param
->kernel_params_mp_l_buf32
[4] = 0;
16983 device_param
->kernel_params_mp_l_buf32
[5] = 0;
16984 device_param
->kernel_params_mp_l_buf32
[6] = 0;
16985 device_param
->kernel_params_mp_l_buf32
[7] = 0;
16986 device_param
->kernel_params_mp_l_buf32
[8] = 0;
16987 device_param
->kernel_params_mp_l_buf32
[9] = 0;
16989 device_param
->kernel_params_mp_l
[0] = NULL
;
16990 device_param
->kernel_params_mp_l
[1] = NULL
;
16991 device_param
->kernel_params_mp_l
[2] = NULL
;
16992 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
16993 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
16994 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
16995 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
16996 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
16997 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
16998 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
17000 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17001 device_param
->kernel_params_mp_r_buf32
[4] = 0;
17002 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17003 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17004 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17005 device_param
->kernel_params_mp_r_buf32
[8] = 0;
17007 device_param
->kernel_params_mp_r
[0] = NULL
;
17008 device_param
->kernel_params_mp_r
[1] = NULL
;
17009 device_param
->kernel_params_mp_r
[2] = NULL
;
17010 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
17011 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
17012 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
17013 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
17014 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
17015 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
17017 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
17018 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
17020 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
17021 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
17022 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
17023 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
17024 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
17025 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
17026 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
17028 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
17029 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
17031 device_param
->kernel_params_memset_buf32
[1] = 0; // value
17032 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
17034 device_param
->kernel_params_memset
[0] = NULL
;
17035 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
17036 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
17042 size_t kernel_wgs_tmp
;
17044 char kernel_name
[64] = { 0 };
17046 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17048 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17050 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
17052 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17054 if (CL_err
!= CL_SUCCESS
)
17056 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17061 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
17063 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17065 if (CL_err
!= CL_SUCCESS
)
17067 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17072 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
17074 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17076 if (CL_err
!= CL_SUCCESS
)
17078 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17085 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
17087 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17089 if (CL_err
!= CL_SUCCESS
)
17091 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17096 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
17098 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17100 if (CL_err
!= CL_SUCCESS
)
17102 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17107 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
17109 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17111 if (CL_err
!= CL_SUCCESS
)
17113 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17119 if (data
.attack_mode
== ATTACK_MODE_BF
)
17121 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17123 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
17125 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel_tm
);
17127 if (CL_err
!= CL_SUCCESS
)
17129 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17134 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_tm
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17136 if (CL_err
!= CL_SUCCESS
)
17138 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17147 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
17149 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17151 if (CL_err
!= CL_SUCCESS
)
17153 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17158 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
17160 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17162 if (CL_err
!= CL_SUCCESS
)
17164 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17169 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
17171 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17173 if (CL_err
!= CL_SUCCESS
)
17175 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17180 if (opts_type
& OPTS_TYPE_HOOK12
)
17182 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
17184 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel12
);
17186 if (CL_err
!= CL_SUCCESS
)
17188 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17193 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel12
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17195 if (CL_err
!= CL_SUCCESS
)
17197 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17203 if (opts_type
& OPTS_TYPE_HOOK23
)
17205 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
17207 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel23
);
17209 if (CL_err
!= CL_SUCCESS
)
17211 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17216 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel23
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17218 if (CL_err
!= CL_SUCCESS
)
17220 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17227 CL_err
|= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel1
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17228 CL_err
|= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel2
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17229 CL_err
|= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel3
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17231 if (CL_err
!= CL_SUCCESS
)
17233 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17238 for (uint i
= 0; i
<= 23; i
++)
17240 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17241 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17242 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17244 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17245 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17247 if (CL_err
!= CL_SUCCESS
)
17249 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17255 for (uint i
= 24; i
<= 34; i
++)
17257 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17258 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17259 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17261 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17262 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17264 if (CL_err
!= CL_SUCCESS
)
17266 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17274 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset", &device_param
->kernel_memset
);
17276 if (CL_err
!= CL_SUCCESS
)
17278 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17283 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_memset
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17285 if (CL_err
!= CL_SUCCESS
)
17287 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17292 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
17293 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
17294 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
17296 if (CL_err
!= CL_SUCCESS
)
17298 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17305 if (attack_mode
== ATTACK_MODE_BF
)
17307 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov", &device_param
->kernel_mp_l
);
17308 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov", &device_param
->kernel_mp_r
);
17310 if (CL_err
!= CL_SUCCESS
)
17312 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17317 CL_err
|= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp_l
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17318 CL_err
|= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp_r
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17320 if (CL_err
!= CL_SUCCESS
)
17322 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17327 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17329 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
17330 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
17332 if (CL_err
!= CL_SUCCESS
)
17334 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17340 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
17342 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17344 if (CL_err
!= CL_SUCCESS
)
17346 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17351 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17353 if (CL_err
!= CL_SUCCESS
)
17355 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17360 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17362 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17364 if (CL_err
!= CL_SUCCESS
)
17366 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17371 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17373 if (CL_err
!= CL_SUCCESS
)
17375 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17381 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17387 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp", &device_param
->kernel_amp
);
17389 if (CL_err
!= CL_SUCCESS
)
17391 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17396 CL_err
= hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_amp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
17398 if (CL_err
!= CL_SUCCESS
)
17400 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17406 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17412 for (uint i
= 0; i
< 5; i
++)
17414 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
17416 if (CL_err
!= CL_SUCCESS
)
17418 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17424 for (uint i
= 5; i
< 7; i
++)
17426 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
17428 if (CL_err
!= CL_SUCCESS
)
17430 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17437 // maybe this has been updated by clGetKernelWorkGroupInfo()
17438 // value can only be decreased, so we don't need to reallocate buffers
17440 device_param
->kernel_threads
= kernel_threads
;
17442 // zero some data buffers
17444 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
17445 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
17446 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
17447 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
17448 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
17449 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
17455 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
17457 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
17459 else if (attack_kern
== ATTACK_KERN_COMBI
)
17461 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
17462 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
17463 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17464 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17466 else if (attack_kern
== ATTACK_KERN_BF
)
17468 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
17469 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
17470 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
17471 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17472 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17475 #if defined(HAVE_HWMON)
17478 * Store initial fanspeed if gpu_temp_retain is enabled
17481 if (gpu_temp_disable
== 0)
17483 if (gpu_temp_retain
!= 0)
17485 hc_thread_mutex_lock (mux_adl
);
17487 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
17489 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
17490 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
17492 // we also set it to tell the OS we take control over the fan and it's automatic controller
17493 // if it was set to automatic. we do not control user-defined fanspeeds.
17495 if (fanpolicy
== 1)
17497 data
.hm_device
[device_id
].fan_set_supported
= 1;
17501 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17503 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
17505 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17508 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
17512 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
17518 data
.hm_device
[device_id
].fan_set_supported
= 1;
17522 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
17524 data
.hm_device
[device_id
].fan_set_supported
= 0;
17529 data
.hm_device
[device_id
].fan_set_supported
= 0;
17533 hc_thread_mutex_unlock (mux_adl
);
17537 #endif // HAVE_HWMON
17540 if (data
.quiet
== 0) log_info_nn ("");
17543 * In benchmark-mode, inform user which algorithm is checked
17546 if (benchmark
== 1)
17548 if (machine_readable
== 0)
17552 data
.quiet
= quiet
;
17554 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
17556 log_info ("Hashtype: %s", hash_type
);
17562 * keep track of the progress
17565 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17566 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17567 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17574 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
17576 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
17581 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
17583 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
17588 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
17590 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
17600 segment_size
*= (1024 * 1024);
17602 data
.segment_size
= segment_size
;
17604 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
17606 wl_data
->buf
= (char *) mymalloc (segment_size
);
17607 wl_data
->avail
= segment_size
;
17608 wl_data
->incr
= segment_size
;
17612 cs_t
*css_buf
= NULL
;
17616 char **masks
= NULL
;
17617 char **dictfiles
= NULL
;
17619 uint mask_from_file
= 0;
17621 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17623 if (wordlist_mode
== WL_MODE_FILE
)
17625 int wls_left
= myargc
- (optind
+ 1);
17627 for (int i
= 0; i
< wls_left
; i
++)
17629 char *l0_filename
= myargv
[optind
+ 1 + i
];
17631 struct stat l0_stat
;
17633 if (stat (l0_filename
, &l0_stat
) == -1)
17635 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
17640 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
17644 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17648 dictfiles
[dictcnt
- 1] = l0_filename
;
17652 // do not allow --keyspace w/ a directory
17656 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17661 char **dictionary_files
= NULL
;
17663 dictionary_files
= scan_directory (l0_filename
);
17665 if (dictionary_files
!= NULL
)
17667 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17669 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17671 char *l1_filename
= dictionary_files
[d
];
17673 struct stat l1_stat
;
17675 if (stat (l1_filename
, &l1_stat
) == -1)
17677 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17682 if (S_ISREG (l1_stat
.st_mode
))
17684 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17688 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17693 local_free (dictionary_files
);
17699 log_error ("ERROR: No usable dictionary file found.");
17704 else if (wordlist_mode
== WL_MODE_STDIN
)
17709 else if (attack_mode
== ATTACK_MODE_COMBI
)
17713 char *dictfile1
= myargv
[optind
+ 1 + 0];
17714 char *dictfile2
= myargv
[optind
+ 1 + 1];
17716 // find the bigger dictionary and use as base
17721 struct stat tmp_stat
;
17723 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
17725 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17730 if (stat (dictfile1
, &tmp_stat
) == -1)
17732 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17739 if (S_ISDIR (tmp_stat
.st_mode
))
17741 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
17748 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
17750 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17757 if (stat (dictfile2
, &tmp_stat
) == -1)
17759 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17767 if (S_ISDIR (tmp_stat
.st_mode
))
17769 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
17777 data
.combs_cnt
= 1;
17781 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
17783 data
.quiet
= quiet
;
17785 if (words1_cnt
== 0)
17787 log_error ("ERROR: %s: empty file", dictfile1
);
17795 data
.combs_cnt
= 1;
17799 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17801 data
.quiet
= quiet
;
17803 if (words2_cnt
== 0)
17805 log_error ("ERROR: %s: empty file", dictfile2
);
17816 data
.dictfile
= dictfile1
;
17817 data
.dictfile2
= dictfile2
;
17819 if (words1_cnt
>= words2_cnt
)
17821 data
.combs_cnt
= words2_cnt
;
17822 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
17824 dictfiles
= &data
.dictfile
;
17830 data
.combs_cnt
= words1_cnt
;
17831 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17833 dictfiles
= &data
.dictfile2
;
17837 // we also have to switch wordlist related rules!
17839 char *tmpc
= data
.rule_buf_l
;
17841 data
.rule_buf_l
= data
.rule_buf_r
;
17842 data
.rule_buf_r
= tmpc
;
17844 int tmpi
= data
.rule_len_l
;
17846 data
.rule_len_l
= data
.rule_len_r
;
17847 data
.rule_len_r
= tmpi
;
17850 else if (attack_mode
== ATTACK_MODE_BF
)
17856 if (benchmark
== 0)
17858 mask
= myargv
[optind
+ 1];
17860 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
17862 if ((optind
+ 2) <= myargc
)
17864 struct stat file_stat
;
17866 if (stat (mask
, &file_stat
) == -1)
17870 masks
[maskcnt
- 1] = mystrdup (mask
);
17874 int wls_left
= myargc
- (optind
+ 1);
17876 uint masks_avail
= INCR_MASKS
;
17878 for (int i
= 0; i
< wls_left
; i
++)
17882 mask
= myargv
[optind
+ 1 + i
];
17884 if (stat (mask
, &file_stat
) == -1)
17886 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17892 uint is_file
= S_ISREG (file_stat
.st_mode
);
17898 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17900 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17905 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17907 while (!feof (mask_fp
))
17909 memset (line_buf
, 0, HCBUFSIZ
);
17911 int line_len
= fgetl (mask_fp
, line_buf
);
17913 if (line_len
== 0) continue;
17915 if (line_buf
[0] == '#') continue;
17917 if (masks_avail
== maskcnt
)
17919 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17921 masks_avail
+= INCR_MASKS
;
17924 masks
[maskcnt
] = mystrdup (line_buf
);
17935 log_error ("ERROR: %s: unsupported file-type", mask
);
17941 mask_from_file
= 1;
17946 custom_charset_1
= (char *) "?l?d?u";
17947 custom_charset_2
= (char *) "?l?d";
17948 custom_charset_3
= (char *) "?l?d*!$@_";
17950 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
17951 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
17952 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
17954 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
17956 wordlist_mode
= WL_MODE_MASK
;
17958 data
.wordlist_mode
= wordlist_mode
;
17968 * generate full masks and charsets
17971 masks
= (char **) mymalloc (sizeof (char *));
17975 case 1731: pw_min
= 5;
17977 mask
= mystrdup ("?b?b?b?b?b");
17979 case 12500: pw_min
= 5;
17981 mask
= mystrdup ("?b?b?b?b?b");
17983 default: pw_min
= 7;
17985 mask
= mystrdup ("?b?b?b?b?b?b?b");
17991 masks
[maskcnt
- 1] = mystrdup (mask
);
17993 wordlist_mode
= WL_MODE_MASK
;
17995 data
.wordlist_mode
= wordlist_mode
;
18000 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
18004 if (increment_min
> pw_min
) pw_min
= increment_min
;
18006 if (increment_max
< pw_max
) pw_max
= increment_max
;
18009 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
18011 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
18015 char *mask
= myargv
[myargc
- 1];
18019 masks
= (char **) mymalloc (1 * sizeof (char *));
18023 struct stat file_stat
;
18025 if (stat (mask
, &file_stat
) == -1)
18029 masks
[maskcnt
- 1] = mystrdup (mask
);
18033 uint is_file
= S_ISREG (file_stat
.st_mode
);
18039 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18041 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18046 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18048 uint masks_avail
= 1;
18050 while (!feof (mask_fp
))
18052 memset (line_buf
, 0, HCBUFSIZ
);
18054 int line_len
= fgetl (mask_fp
, line_buf
);
18056 if (line_len
== 0) continue;
18058 if (line_buf
[0] == '#') continue;
18060 if (masks_avail
== maskcnt
)
18062 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18064 masks_avail
+= INCR_MASKS
;
18067 masks
[maskcnt
] = mystrdup (line_buf
);
18076 mask_from_file
= 1;
18082 masks
[maskcnt
- 1] = mystrdup (mask
);
18088 int wls_left
= myargc
- (optind
+ 2);
18090 for (int i
= 0; i
< wls_left
; i
++)
18092 char *filename
= myargv
[optind
+ 1 + i
];
18094 struct stat file_stat
;
18096 if (stat (filename
, &file_stat
) == -1)
18098 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18103 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18107 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18111 dictfiles
[dictcnt
- 1] = filename
;
18115 // do not allow --keyspace w/ a directory
18119 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18124 char **dictionary_files
= NULL
;
18126 dictionary_files
= scan_directory (filename
);
18128 if (dictionary_files
!= NULL
)
18130 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18132 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18134 char *l1_filename
= dictionary_files
[d
];
18136 struct stat l1_stat
;
18138 if (stat (l1_filename
, &l1_stat
) == -1)
18140 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18145 if (S_ISREG (l1_stat
.st_mode
))
18147 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18151 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18156 local_free (dictionary_files
);
18162 log_error ("ERROR: No usable dictionary file found.");
18171 uint mask_min
= increment_min
; // we can't reject smaller masks here
18172 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18174 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18176 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18178 if (cur_mask
== NULL
) break;
18180 masks
[maskcnt
] = cur_mask
;
18184 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18188 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18190 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
18194 char *mask
= myargv
[optind
+ 1 + 0];
18198 masks
= (char **) mymalloc (1 * sizeof (char *));
18202 struct stat file_stat
;
18204 if (stat (mask
, &file_stat
) == -1)
18208 masks
[maskcnt
- 1] = mystrdup (mask
);
18212 uint is_file
= S_ISREG (file_stat
.st_mode
);
18218 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18220 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18225 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18227 uint masks_avail
= 1;
18229 while (!feof (mask_fp
))
18231 memset (line_buf
, 0, HCBUFSIZ
);
18233 int line_len
= fgetl (mask_fp
, line_buf
);
18235 if (line_len
== 0) continue;
18237 if (line_buf
[0] == '#') continue;
18239 if (masks_avail
== maskcnt
)
18241 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18243 masks_avail
+= INCR_MASKS
;
18246 masks
[maskcnt
] = mystrdup (line_buf
);
18255 mask_from_file
= 1;
18261 masks
[maskcnt
- 1] = mystrdup (mask
);
18267 int wls_left
= myargc
- (optind
+ 2);
18269 for (int i
= 0; i
< wls_left
; i
++)
18271 char *filename
= myargv
[optind
+ 2 + i
];
18273 struct stat file_stat
;
18275 if (stat (filename
, &file_stat
) == -1)
18277 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18282 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18286 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18290 dictfiles
[dictcnt
- 1] = filename
;
18294 // do not allow --keyspace w/ a directory
18298 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18303 char **dictionary_files
= NULL
;
18305 dictionary_files
= scan_directory (filename
);
18307 if (dictionary_files
!= NULL
)
18309 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18311 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18313 char *l1_filename
= dictionary_files
[d
];
18315 struct stat l1_stat
;
18317 if (stat (l1_filename
, &l1_stat
) == -1)
18319 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18324 if (S_ISREG (l1_stat
.st_mode
))
18326 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18330 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18335 local_free (dictionary_files
);
18341 log_error ("ERROR: No usable dictionary file found.");
18350 uint mask_min
= increment_min
; // we can't reject smaller masks here
18351 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18353 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18355 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18357 if (cur_mask
== NULL
) break;
18359 masks
[maskcnt
] = cur_mask
;
18363 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18368 data
.pw_min
= pw_min
;
18369 data
.pw_max
= pw_max
;
18375 if (weak_hash_threshold
>= salts_cnt
)
18377 hc_device_param_t
*device_param
= NULL
;
18379 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18381 device_param
= &data
.devices_param
[device_id
];
18383 if (device_param
->skipped
) continue;
18388 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
18390 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
18392 weak_hash_check (device_param
, salt_pos
);
18395 // Display hack, guarantee that there is at least one \r before real start
18397 //if (data.quiet == 0) log_info ("");
18401 * status and monitor threads
18404 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18406 data
.devices_status
= STATUS_STARTING
;
18409 uint inner_threads_cnt
= 0;
18411 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
18413 data
.shutdown_inner
= 0;
18419 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
18421 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
18423 inner_threads_cnt
++;
18425 if (outfile_check_timer
!= 0)
18427 if (data
.outfile_check_directory
!= NULL
)
18429 if ((hash_mode
!= 5200) &&
18430 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
18431 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
18432 (hash_mode
!= 9000))
18434 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
18436 inner_threads_cnt
++;
18440 outfile_check_timer
= 0;
18445 outfile_check_timer
= 0;
18451 * Inform the user if we got some hashes remove because of the pot file remove feature
18454 if (data
.quiet
== 0)
18456 if (potfile_remove_cracks
> 0)
18458 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
18459 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
18463 data
.outfile_check_timer
= outfile_check_timer
;
18469 char **induction_dictionaries
= NULL
;
18471 int induction_dictionaries_cnt
= 0;
18473 hcstat_table_t
*root_table_buf
= NULL
;
18474 hcstat_table_t
*markov_table_buf
= NULL
;
18476 uint initial_restore_done
= 0;
18478 data
.maskcnt
= maskcnt
;
18480 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
18482 if (data
.devices_status
== STATUS_CRACKED
) continue;
18483 if (data
.devices_status
== STATUS_ABORTED
) continue;
18484 if (data
.devices_status
== STATUS_QUIT
) continue;
18486 if (maskpos
> rd
->maskpos
)
18491 rd
->maskpos
= maskpos
;
18492 data
.maskpos
= maskpos
;
18494 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
18496 char *mask
= masks
[maskpos
];
18498 if (mask_from_file
== 1)
18500 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
18505 uint mask_offset
= 0;
18507 uint separator_cnt
;
18509 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
18511 str_ptr
= strstr (mask
+ mask_offset
, ",");
18513 if (str_ptr
== NULL
) break;
18515 str_pos
= str_ptr
- mask
;
18517 // escaped separator, i.e. "\,"
18521 if (mask
[str_pos
- 1] == '\\')
18525 mask_offset
= str_pos
+ 1;
18531 // reset the offset
18535 mask
[str_pos
] = '\0';
18537 switch (separator_cnt
)
18540 mp_reset_usr (mp_usr
, 0);
18542 custom_charset_1
= mask
;
18543 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18547 mp_reset_usr (mp_usr
, 1);
18549 custom_charset_2
= mask
;
18550 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18554 mp_reset_usr (mp_usr
, 2);
18556 custom_charset_3
= mask
;
18557 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18561 mp_reset_usr (mp_usr
, 3);
18563 custom_charset_4
= mask
;
18564 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
18568 mask
= mask
+ str_pos
+ 1;
18572 * What follows is a very special case where "\," is within the mask field of a line in a .hcmask file only because otherwise (without the "\")
18573 * it would be interpreted as a custom charset definition.
18575 * We need to replace all "\," with just "," within the mask (but allow the special case "\\," which means "\" followed by ",")
18576 * Note: "\\" is not needed to replace all "\" within the mask! The meaning of "\\" within a line containing the string "\\," is just to allow "\" followed by ","
18579 uint mask_len_cur
= strlen (mask
);
18581 uint mask_out_pos
= 0;
18582 char mask_prev
= 0;
18584 for (uint mask_iter
= 0; mask_iter
< mask_len_cur
; mask_iter
++, mask_out_pos
++)
18586 if (mask
[mask_iter
] == ',')
18588 if (mask_prev
== '\\')
18590 mask_out_pos
-= 1; // this means: skip the previous "\"
18594 mask_prev
= mask
[mask_iter
];
18596 mask
[mask_out_pos
] = mask
[mask_iter
];
18599 mask
[mask_out_pos
] = '\0';
18602 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18606 local_free (css_buf
);
18607 local_free (data
.root_css_buf
);
18608 local_free (data
.markov_css_buf
);
18610 local_free (masks
[maskpos
- 1]);
18613 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18616 data
.css_cnt
= css_cnt
;
18617 data
.css_buf
= css_buf
;
18619 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
18621 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
18623 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
18624 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
18626 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
18628 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
18630 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
18631 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
18633 data
.root_css_buf
= root_css_buf
;
18634 data
.markov_css_buf
= markov_css_buf
;
18636 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
18638 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
18640 local_free (root_table_buf
);
18641 local_free (markov_table_buf
);
18645 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18647 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18649 if (device_param
->skipped
) continue;
18651 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
18652 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
18653 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
18655 device_param
->kernel_params_mp_buf64
[3] = 0;
18656 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
18657 device_param
->kernel_params_mp_buf32
[5] = 0;
18658 device_param
->kernel_params_mp_buf32
[6] = 0;
18659 device_param
->kernel_params_mp_buf32
[7] = 0;
18661 if (attack_mode
== ATTACK_MODE_HYBRID1
)
18663 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
18664 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
18665 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
18666 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
18668 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18670 device_param
->kernel_params_mp_buf32
[5] = 0;
18671 device_param
->kernel_params_mp_buf32
[6] = 0;
18672 device_param
->kernel_params_mp_buf32
[7] = 0;
18675 cl_int CL_err
= CL_SUCCESS
;
18677 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
18678 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
18679 for (uint i
= 4; i
< 8; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
18681 if (CL_err
!= CL_SUCCESS
)
18683 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
18688 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
18689 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
18691 if (CL_err
!= CL_SUCCESS
)
18693 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
18699 else if (attack_mode
== ATTACK_MODE_BF
)
18701 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
18705 for (uint i
= 0; i
< dictcnt
; i
++)
18707 local_free (dictfiles
[i
]);
18710 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
18712 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
18714 if (l1_filename
== NULL
) break;
18718 dictfiles
[dictcnt
- 1] = l1_filename
;
18725 dictfiles
[dictcnt
- 1] = mask
;
18730 log_error ("ERROR: Mask is too small");
18737 free (induction_dictionaries
);
18739 // induction_dictionaries_cnt = 0; // implied
18741 if (attack_mode
!= ATTACK_MODE_BF
)
18745 induction_dictionaries
= scan_directory (induction_directory
);
18747 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18751 if (induction_dictionaries_cnt
)
18753 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18757 * prevent the user from using --keyspace together w/ maskfile and or dictfile
18761 if ((maskcnt
> 1) || (dictcnt
> 1))
18763 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
18769 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
18771 if (data
.devices_status
== STATUS_CRACKED
) continue;
18772 if (data
.devices_status
== STATUS_ABORTED
) continue;
18773 if (data
.devices_status
== STATUS_QUIT
) continue;
18775 rd
->dictpos
= dictpos
;
18777 char *subid
= logfile_generate_subid ();
18779 data
.subid
= subid
;
18781 logfile_sub_msg ("START");
18783 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18785 data
.devices_status
= STATUS_INIT
;
18788 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
18789 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
18790 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
18792 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
18796 data
.cpt_start
= time (NULL
);
18798 data
.cpt_total
= 0;
18800 if (data
.restore
== 0)
18802 rd
->words_cur
= skip
;
18809 data
.ms_paused
= 0;
18811 data
.kernel_power_final
= 0;
18813 data
.words_cur
= rd
->words_cur
;
18815 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18817 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18819 if (device_param
->skipped
) continue;
18821 device_param
->speed_pos
= 0;
18823 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
18824 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
18826 device_param
->exec_pos
= 0;
18828 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
18830 device_param
->outerloop_pos
= 0;
18831 device_param
->outerloop_left
= 0;
18832 device_param
->innerloop_pos
= 0;
18833 device_param
->innerloop_left
= 0;
18835 // some more resets:
18837 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
18839 device_param
->pws_cnt
= 0;
18841 device_param
->words_off
= 0;
18842 device_param
->words_done
= 0;
18845 // figure out some workload
18847 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18849 if (data
.wordlist_mode
== WL_MODE_FILE
)
18851 char *dictfile
= NULL
;
18853 if (induction_dictionaries_cnt
)
18855 dictfile
= induction_dictionaries
[0];
18859 dictfile
= dictfiles
[dictpos
];
18862 data
.dictfile
= dictfile
;
18864 logfile_sub_string (dictfile
);
18866 for (uint i
= 0; i
< rp_files_cnt
; i
++)
18868 logfile_sub_var_string ("rulefile", rp_files
[i
]);
18871 FILE *fd2
= fopen (dictfile
, "rb");
18875 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18880 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18884 if (data
.words_cnt
== 0)
18886 logfile_sub_msg ("STOP");
18892 else if (attack_mode
== ATTACK_MODE_COMBI
)
18894 char *dictfile
= data
.dictfile
;
18895 char *dictfile2
= data
.dictfile2
;
18897 logfile_sub_string (dictfile
);
18898 logfile_sub_string (dictfile2
);
18900 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
18902 FILE *fd2
= fopen (dictfile
, "rb");
18906 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18911 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18915 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
18917 FILE *fd2
= fopen (dictfile2
, "rb");
18921 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
18926 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
18931 if (data
.words_cnt
== 0)
18933 logfile_sub_msg ("STOP");
18938 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18940 char *dictfile
= NULL
;
18942 if (induction_dictionaries_cnt
)
18944 dictfile
= induction_dictionaries
[0];
18948 dictfile
= dictfiles
[dictpos
];
18951 data
.dictfile
= dictfile
;
18953 char *mask
= data
.mask
;
18955 logfile_sub_string (dictfile
);
18956 logfile_sub_string (mask
);
18958 FILE *fd2
= fopen (dictfile
, "rb");
18962 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18967 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18971 if (data
.words_cnt
== 0)
18973 logfile_sub_msg ("STOP");
18978 else if (attack_mode
== ATTACK_MODE_BF
)
18980 local_free (css_buf
);
18981 local_free (data
.root_css_buf
);
18982 local_free (data
.markov_css_buf
);
18984 char *mask
= dictfiles
[dictpos
];
18986 logfile_sub_string (mask
);
18990 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18992 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
18994 uint css_cnt_unicode
= css_cnt
* 2;
18996 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
18998 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
19000 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
19002 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
19003 css_buf_unicode
[j
+ 1].cs_len
= 1;
19008 css_buf
= css_buf_unicode
;
19009 css_cnt
= css_cnt_unicode
;
19012 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
19014 uint mask_min
= pw_min
;
19015 uint mask_max
= pw_max
;
19017 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19023 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
19025 if (css_cnt
< mask_min
)
19027 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
19030 if (css_cnt
> mask_max
)
19032 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
19035 // skip to next mask
19037 logfile_sub_msg ("STOP");
19042 uint save_css_cnt
= css_cnt
;
19044 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
19046 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
19048 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
19049 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
19051 uint css_cnt_salt
= css_cnt
+ salt_len
;
19053 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
19055 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
19057 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
19059 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
19060 css_buf_salt
[j
].cs_len
= 1;
19065 css_buf
= css_buf_salt
;
19066 css_cnt
= css_cnt_salt
;
19071 data
.css_cnt
= css_cnt
;
19072 data
.css_buf
= css_buf
;
19074 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
19076 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
19078 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
19080 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
19081 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
19083 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
19085 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
19087 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
19088 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
19090 data
.root_css_buf
= root_css_buf
;
19091 data
.markov_css_buf
= markov_css_buf
;
19093 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
19095 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
19097 local_free (root_table_buf
);
19098 local_free (markov_table_buf
);
19102 uint css_cnt_l
= css_cnt
;
19105 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
19107 if (save_css_cnt
< 6)
19111 else if (save_css_cnt
== 6)
19117 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19119 if (save_css_cnt
== 8 || save_css_cnt
== 10)
19130 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
19145 /* unfinished code?
19146 int sum = css_buf[css_cnt_r - 1].cs_len;
19148 for (uint i = 1; i < 4 && i < css_cnt; i++)
19150 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
19154 sum *= css_buf[css_cnt_r - 1].cs_len;
19159 css_cnt_l
-= css_cnt_r
;
19161 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
19163 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19165 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19167 if (device_param
->skipped
) continue;
19169 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
19170 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
19171 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
19173 device_param
->kernel_params_mp_l_buf64
[3] = 0;
19174 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
19175 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
19176 device_param
->kernel_params_mp_l_buf32
[6] = 0;
19177 device_param
->kernel_params_mp_l_buf32
[7] = 0;
19178 device_param
->kernel_params_mp_l_buf32
[8] = 0;
19180 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
19181 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
19182 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
19183 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
19185 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
19186 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
19187 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
19189 device_param
->kernel_params_mp_r_buf64
[3] = 0;
19190 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
19191 device_param
->kernel_params_mp_r_buf32
[5] = 0;
19192 device_param
->kernel_params_mp_r_buf32
[6] = 0;
19193 device_param
->kernel_params_mp_r_buf32
[7] = 0;
19195 cl_int CL_err
= CL_SUCCESS
;
19197 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
19198 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
19199 for (uint i
= 4; i
< 9; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
19201 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
19202 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
19203 for (uint i
= 4; i
< 8; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
19205 if (CL_err
!= CL_SUCCESS
)
19207 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
19212 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
19213 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
19215 if (CL_err
!= CL_SUCCESS
)
19217 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
19224 u64 words_base
= data
.words_cnt
;
19226 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19228 if (data
.kernel_rules_cnt
)
19230 words_base
/= data
.kernel_rules_cnt
;
19233 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19235 if (data
.combs_cnt
)
19237 words_base
/= data
.combs_cnt
;
19240 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19244 words_base
/= data
.bfs_cnt
;
19248 data
.words_base
= words_base
;
19252 log_info ("%llu", (unsigned long long int) words_base
);
19257 if (data
.words_cur
> data
.words_base
)
19259 log_error ("ERROR: Restore value greater keyspace");
19264 if (data
.words_cur
)
19266 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19268 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19270 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
19273 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19275 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19277 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
19280 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19282 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19284 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
19290 * Update loopback file
19299 uint random_num
= get_random_num (0, 9999);
19301 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
19303 data
.loopback_file
= loopback_file
;
19307 * Update dictionary statistic
19312 dictstat_fp
= fopen (dictstat
, "wb");
19316 lock_file (dictstat_fp
);
19318 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
19320 fclose (dictstat_fp
);
19325 * create autotune threads
19328 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
19330 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19332 data
.devices_status
= STATUS_AUTOTUNE
;
19335 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19337 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19339 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
19342 hc_thread_wait (data
.devices_cnt
, c_threads
);
19345 * Inform user about possible slow speeds
19348 uint hardware_power_all
= 0;
19350 uint kernel_power_all
= 0;
19352 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19354 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19356 hardware_power_all
+= device_param
->hardware_power
;
19358 kernel_power_all
+= device_param
->kernel_power
;
19361 data
.hardware_power_all
= hardware_power_all
; // hardware_power_all is the same as kernel_power_all but without the influence of kernel_accel on the devices
19363 data
.kernel_power_all
= kernel_power_all
;
19365 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19367 if (data
.words_base
< kernel_power_all
)
19373 log_info ("ATTENTION!");
19374 log_info (" The wordlist or mask you are using is too small.");
19375 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
19376 log_info (" The cracking speed will drop.");
19377 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
19384 * create cracker threads
19387 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19389 data
.devices_status
= STATUS_RUNNING
;
19392 if (initial_restore_done
== 0)
19394 if (data
.restore_disable
== 0) cycle_restore ();
19396 initial_restore_done
= 1;
19399 hc_timer_set (&data
.timer_running
);
19401 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19403 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
19405 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
19406 if (quiet
== 0) fflush (stdout
);
19409 else if (wordlist_mode
== WL_MODE_STDIN
)
19411 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
19412 if (data
.quiet
== 0) log_info ("");
19415 time_t runtime_start
;
19417 time (&runtime_start
);
19419 data
.runtime_start
= runtime_start
;
19421 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19423 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19425 if (wordlist_mode
== WL_MODE_STDIN
)
19427 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
19431 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
19435 hc_thread_wait (data
.devices_cnt
, c_threads
);
19437 local_free (c_threads
);
19439 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19441 data
.devices_status
= STATUS_EXHAUSTED
;
19444 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
19448 if (induction_dictionaries_cnt
)
19450 unlink (induction_dictionaries
[0]);
19453 free (induction_dictionaries
);
19455 if (attack_mode
!= ATTACK_MODE_BF
)
19457 induction_dictionaries
= scan_directory (induction_directory
);
19459 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
19462 if (benchmark
== 1)
19464 status_benchmark ();
19466 if (machine_readable
== 0)
19492 if (induction_dictionaries_cnt
)
19494 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
19496 // yeah, this next statement is a little hack to make sure that --loopback runs correctly (because with it we guarantee that the loop iterates one more time)
19501 time_t runtime_stop
;
19503 time (&runtime_stop
);
19505 data
.runtime_stop
= runtime_stop
;
19507 logfile_sub_uint (runtime_start
);
19508 logfile_sub_uint (runtime_stop
);
19510 logfile_sub_msg ("STOP");
19512 global_free (subid
);
19514 // from this point we handle bypass as running
19516 if (data
.devices_status
== STATUS_BYPASS
)
19518 data
.devices_status
= STATUS_RUNNING
;
19521 // and overwrite benchmark aborts as well
19523 if (data
.benchmark
== 1)
19525 if (data
.devices_status
== STATUS_ABORTED
)
19527 data
.devices_status
= STATUS_RUNNING
;
19533 if (data
.devices_status
== STATUS_CRACKED
) break;
19534 if (data
.devices_status
== STATUS_ABORTED
) break;
19535 if (data
.devices_status
== STATUS_QUIT
) break;
19538 if (data
.devices_status
== STATUS_CRACKED
) break;
19539 if (data
.devices_status
== STATUS_ABORTED
) break;
19540 if (data
.devices_status
== STATUS_QUIT
) break;
19543 // problems could occur if already at startup everything was cracked (because of .pot file reading etc), we must set some variables here to avoid NULL pointers
19544 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
19546 if (data
.wordlist_mode
== WL_MODE_FILE
)
19548 if (data
.dictfile
== NULL
)
19550 if (dictfiles
!= NULL
)
19552 data
.dictfile
= dictfiles
[0];
19554 hc_timer_set (&data
.timer_running
);
19559 // NOTE: combi is okay because it is already set beforehand
19560 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
19562 if (data
.dictfile
== NULL
)
19564 if (dictfiles
!= NULL
)
19566 hc_timer_set (&data
.timer_running
);
19568 data
.dictfile
= dictfiles
[0];
19572 else if (attack_mode
== ATTACK_MODE_BF
)
19574 if (data
.mask
== NULL
)
19576 hc_timer_set (&data
.timer_running
);
19578 data
.mask
= masks
[0];
19582 // if cracked / aborted remove last induction dictionary
19584 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
19586 struct stat induct_stat
;
19588 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
19590 unlink (induction_dictionaries
[file_pos
]);
19594 // wait for inner threads
19596 data
.shutdown_inner
= 1;
19598 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
19600 hc_thread_wait (1, &inner_threads
[thread_idx
]);
19603 local_free (inner_threads
);
19605 // we dont need restore file anymore
19606 if (data
.restore_disable
== 0)
19608 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
19610 unlink (eff_restore_file
);
19611 unlink (new_restore_file
);
19619 // finally save left hashes
19621 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
19630 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19632 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19634 if (device_param
->skipped
) continue;
19636 cl_int CL_err
= CL_SUCCESS
;
19638 local_free (device_param
->combs_buf
);
19639 local_free (device_param
->hooks_buf
);
19640 local_free (device_param
->device_name
);
19641 local_free (device_param
->device_name_chksum
);
19642 local_free (device_param
->device_version
);
19643 local_free (device_param
->driver_version
);
19645 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
19647 if (device_param
->d_pws_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
19648 if (device_param
->d_pws_amp_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
19649 if (device_param
->d_rules
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
19650 if (device_param
->d_rules_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
19651 if (device_param
->d_combs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
19652 if (device_param
->d_combs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
19653 if (device_param
->d_bfs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
19654 if (device_param
->d_bfs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
19655 if (device_param
->d_bitmap_s1_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
19656 if (device_param
->d_bitmap_s1_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
19657 if (device_param
->d_bitmap_s1_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
19658 if (device_param
->d_bitmap_s1_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
19659 if (device_param
->d_bitmap_s2_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
19660 if (device_param
->d_bitmap_s2_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
19661 if (device_param
->d_bitmap_s2_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
19662 if (device_param
->d_bitmap_s2_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
19663 if (device_param
->d_plain_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
19664 if (device_param
->d_digests_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
19665 if (device_param
->d_digests_shown
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
19666 if (device_param
->d_salt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
19667 if (device_param
->d_esalt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
19668 if (device_param
->d_tmps
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
19669 if (device_param
->d_hooks
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
19670 if (device_param
->d_result
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
19671 if (device_param
->d_scryptV0_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
19672 if (device_param
->d_scryptV1_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
19673 if (device_param
->d_scryptV2_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
19674 if (device_param
->d_scryptV3_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
19675 if (device_param
->d_root_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
19676 if (device_param
->d_markov_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
19677 if (device_param
->d_tm_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
19679 if (CL_err
!= CL_SUCCESS
)
19681 log_error ("ERROR: clReleaseMemObject(): %s\n", val2cstr_cl (CL_err
));
19686 if (device_param
->kernel1
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
19687 if (device_param
->kernel12
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
19688 if (device_param
->kernel2
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
19689 if (device_param
->kernel23
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
19690 if (device_param
->kernel3
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
19691 if (device_param
->kernel_mp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
19692 if (device_param
->kernel_mp_l
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
19693 if (device_param
->kernel_mp_r
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
19694 if (device_param
->kernel_tm
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
19695 if (device_param
->kernel_amp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
19696 if (device_param
->kernel_memset
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
19698 if (CL_err
!= CL_SUCCESS
)
19700 log_error ("ERROR: clReleaseKernel(): %s\n", val2cstr_cl (CL_err
));
19705 if (device_param
->program
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program
);
19706 if (device_param
->program_mp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
19707 if (device_param
->program_amp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
19709 if (CL_err
!= CL_SUCCESS
)
19711 log_error ("ERROR: clReleaseProgram(): %s\n", val2cstr_cl (CL_err
));
19716 if (device_param
->command_queue
) CL_err
|= hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
19718 if (CL_err
!= CL_SUCCESS
)
19720 log_error ("ERROR: clReleaseCommandQueue(): %s\n", val2cstr_cl (CL_err
));
19725 if (device_param
->context
) CL_err
|= hc_clReleaseContext (data
.ocl
, device_param
->context
);
19727 if (CL_err
!= CL_SUCCESS
)
19729 log_error ("ERROR: hc_clReleaseContext(): %s\n", val2cstr_cl (CL_err
));
19735 // reset default fan speed
19738 if (gpu_temp_disable
== 0)
19740 if (gpu_temp_retain
!= 0)
19742 hc_thread_mutex_lock (mux_adl
);
19744 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19746 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19748 if (device_param
->skipped
) continue;
19750 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
19754 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
19756 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
19758 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
19761 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
19765 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
19769 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
19773 hc_thread_mutex_unlock (mux_adl
);
19777 // reset power tuning
19779 if (powertune_enable
== 1)
19781 hc_thread_mutex_lock (mux_adl
);
19783 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19785 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19787 if (device_param
->skipped
) continue;
19789 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
19791 if (data
.hm_device
[device_id
].od_version
== 6)
19793 // check powertune capabilities first, if not available then skip device
19795 int powertune_supported
= 0;
19797 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
19799 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
19804 if (powertune_supported
!= 0)
19806 // powercontrol settings
19808 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
19810 log_info ("ERROR: Failed to restore the ADL PowerControl values");
19817 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
19819 performance_state
->iNumberOfPerformanceLevels
= 2;
19821 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
19822 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
19823 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
19824 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
19826 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
19828 log_info ("ERROR: Failed to restore ADL performance state");
19833 local_free (performance_state
);
19838 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
19840 unsigned int limit
= nvml_power_limit
[device_id
];
19844 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
19849 hc_thread_mutex_unlock (mux_adl
);
19852 if (gpu_temp_disable
== 0)
19856 hm_NVML_nvmlShutdown (data
.hm_nvml
);
19858 nvml_close (data
.hm_nvml
);
19860 data
.hm_nvml
= NULL
;
19865 hm_NvAPI_Unload (data
.hm_nvapi
);
19867 nvapi_close (data
.hm_nvapi
);
19869 data
.hm_nvapi
= NULL
;
19872 if (data
.hm_xnvctrl
)
19874 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
19876 xnvctrl_close (data
.hm_xnvctrl
);
19878 data
.hm_xnvctrl
= NULL
;
19883 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
19885 adl_close (data
.hm_adl
);
19887 data
.hm_adl
= NULL
;
19890 #endif // HAVE_HWMON
19894 local_free (masks
);
19896 local_free (dictstat_base
);
19898 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
19900 pot_t
*pot_ptr
= &pot
[pot_pos
];
19902 hash_t
*hash
= &pot_ptr
->hash
;
19904 local_free (hash
->digest
);
19908 local_free (hash
->salt
);
19914 local_free (all_kernel_rules_cnt
);
19915 local_free (all_kernel_rules_buf
);
19917 local_free (wl_data
->buf
);
19918 local_free (wl_data
);
19920 local_free (bitmap_s1_a
);
19921 local_free (bitmap_s1_b
);
19922 local_free (bitmap_s1_c
);
19923 local_free (bitmap_s1_d
);
19924 local_free (bitmap_s2_a
);
19925 local_free (bitmap_s2_b
);
19926 local_free (bitmap_s2_c
);
19927 local_free (bitmap_s2_d
);
19930 local_free (od_clock_mem_status
);
19931 local_free (od_power_control_status
);
19932 local_free (nvml_power_limit
);
19935 global_free (devices_param
);
19937 global_free (kernel_rules_buf
);
19939 global_free (root_css_buf
);
19940 global_free (markov_css_buf
);
19942 global_free (digests_buf
);
19943 global_free (digests_shown
);
19944 global_free (digests_shown_tmp
);
19946 global_free (salts_buf
);
19947 global_free (salts_shown
);
19949 global_free (esalts_buf
);
19951 global_free (words_progress_done
);
19952 global_free (words_progress_rejected
);
19953 global_free (words_progress_restored
);
19955 if (pot_fp
) fclose (pot_fp
);
19957 if (data
.devices_status
== STATUS_QUIT
) break;
19960 // wait for outer threads
19962 data
.shutdown_outer
= 1;
19964 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
19966 hc_thread_wait (1, &outer_threads
[thread_idx
]);
19969 local_free (outer_threads
);
19971 // destroy others mutex
19973 hc_thread_mutex_delete (mux_dispatcher
);
19974 hc_thread_mutex_delete (mux_counter
);
19975 hc_thread_mutex_delete (mux_display
);
19976 hc_thread_mutex_delete (mux_adl
);
19980 local_free (eff_restore_file
);
19981 local_free (new_restore_file
);
19987 tuning_db_destroy (tuning_db
);
19991 local_free (loopback_file
);
19993 if (loopback
== 1) unlink (loopback_file
);
19995 // induction directory
19997 if (induction_dir
== NULL
)
19999 if (attack_mode
!= ATTACK_MODE_BF
)
20001 if (rmdir (induction_directory
) == -1)
20003 if (errno
== ENOENT
)
20005 // good, we can ignore
20007 else if (errno
== ENOTEMPTY
)
20009 // good, we can ignore
20013 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
20019 local_free (induction_directory
);
20023 // outfile-check directory
20025 if (outfile_check_dir
== NULL
)
20027 if (rmdir (outfile_check_directory
) == -1)
20029 if (errno
== ENOENT
)
20031 // good, we can ignore
20033 else if (errno
== ENOTEMPTY
)
20035 // good, we can ignore
20039 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
20045 local_free (outfile_check_directory
);
20052 logfile_top_uint (proc_start
);
20053 logfile_top_uint (proc_stop
);
20055 logfile_top_msg ("STOP");
20057 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
20058 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
20060 if (data
.ocl
) ocl_close (data
.ocl
);
20062 if (data
.devices_status
== STATUS_ABORTED
) return 2;
20063 if (data
.devices_status
== STATUS_QUIT
) return 2;
20064 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
20065 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
20066 if (data
.devices_status
== STATUS_CRACKED
) return 0;