2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 0
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
155 #define global_free(attr) \
157 myfree ((void *) data.attr); \
162 #define local_free(attr) \
164 myfree ((void *) attr); \
169 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
170 #define HC_API_CALL __stdcall
175 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
326 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
332 static unsigned int full01
= 0x01010101;
333 static unsigned int full80
= 0x80808080;
335 int SUPPRESS_OUTPUT
= 0;
337 hc_thread_mutex_t mux_adl
;
338 hc_thread_mutex_t mux_counter
;
339 hc_thread_mutex_t mux_dispatcher
;
340 hc_thread_mutex_t mux_display
;
342 hc_global_data_t data
;
344 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
346 const char *USAGE_MINI
[] =
348 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
350 "Try --help for more help.",
354 const char *USAGE_BIG
[] =
356 "%s, advanced password recovery",
358 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
362 " Options Short / Long | Type | Description | Example",
363 "===============================|======|======================================================|=======================",
364 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
365 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
366 " -V, --version | | Print version |",
367 " -h, --help | | Print help |",
368 " --quiet | | Suppress output |",
369 " --hex-charset | | Assume charset is given in hex |",
370 " --hex-salt | | Assume salt is given in hex |",
371 " --hex-wordlist | | Assume words in wordlist is given in hex |",
372 " --force | | Ignore warnings |",
373 " --status | | Enable automatic update of the status-screen |",
374 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
375 " --machine-readable | | Display the status view in a machine readable format |",
376 " --loopback | | Add new plains to induct directory |",
377 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
378 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
379 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
380 " --markov-classic | | Enables classic markov-chains, no per-position |",
381 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
382 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
383 " --session | Str | Define specific session name | --session=mysession",
384 " --restore | | Restore session from --session |",
385 " --restore-disable | | Do not write restore file |",
386 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
387 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
388 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
389 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
390 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
391 " --show | | Show cracked passwords only |",
392 " --left | | Show un-cracked passwords only |",
393 " --username | | Enable ignoring of usernames in hashfile |",
394 " --remove | | Enable remove of hash once it is cracked |",
395 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
396 " --potfile-disable | | Do not write potfile |",
397 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
398 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
399 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
400 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
401 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
402 " --logfile-disable | | Disable the logfile |",
403 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
404 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
405 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
406 " -b, --benchmark | | Run benchmark |",
407 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
408 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
409 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
410 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
411 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
412 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
413 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
414 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
415 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
416 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
417 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
418 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
420 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
421 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
422 " --powertune-enable | | Enable power tuning, restores settings when finished |",
424 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
425 " -s, --skip | Num | Skip X words from the start | -s 1000000",
426 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
427 " --keyspace | | Show keyspace base:mod values and quit |",
428 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
429 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
430 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
431 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
432 " --generate-rules-func-min | Num | Force min X funcs per rule |",
433 " --generate-rules-func-max | Num | Force max X funcs per rule |",
434 " --generate-rules-seed | Num | Force RNG seed set to X |",
435 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
436 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
437 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
438 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
439 " -i, --increment | | Enable mask increment mode |",
440 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
441 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
443 "- [ Hash modes ] -",
445 " # | Name | Category",
446 " ======+==================================================+======================================",
447 " 900 | MD4 | Raw Hash",
448 " 0 | MD5 | Raw Hash",
449 " 5100 | Half MD5 | Raw Hash",
450 " 100 | SHA1 | Raw Hash",
451 " 10800 | SHA-384 | Raw Hash",
452 " 1400 | SHA-256 | Raw Hash",
453 " 1700 | SHA-512 | Raw Hash",
454 " 5000 | SHA-3(Keccak) | Raw Hash",
455 " 10100 | SipHash | Raw Hash",
456 " 6000 | RipeMD160 | Raw Hash",
457 " 6100 | Whirlpool | Raw Hash",
458 " 6900 | GOST R 34.11-94 | Raw Hash",
459 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
460 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
461 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
462 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
463 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
464 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
465 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
466 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
467 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
468 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
469 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
470 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
471 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
472 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
473 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
474 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
475 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
476 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
477 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
478 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
479 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
480 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
481 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
482 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
483 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
484 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
485 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
486 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
487 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
488 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
489 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
490 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
491 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
492 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
493 " 400 | phpass | Generic KDF",
494 " 8900 | scrypt | Generic KDF",
495 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
496 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
497 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
498 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
499 " 23 | Skype | Network protocols",
500 " 2500 | WPA/WPA2 | Network protocols",
501 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
502 " 5300 | IKE-PSK MD5 | Network protocols",
503 " 5400 | IKE-PSK SHA1 | Network protocols",
504 " 5500 | NetNTLMv1 | Network protocols",
505 " 5500 | NetNTLMv1 + ESS | Network protocols",
506 " 5600 | NetNTLMv2 | Network protocols",
507 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
508 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
509 " 8300 | DNSSEC (NSEC3) | Network protocols",
510 " 10200 | Cram MD5 | Network protocols",
511 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
512 " 11200 | MySQL CRAM (SHA1) | Network protocols",
513 " 11400 | SIP digest authentication (MD5) | Network protocols",
514 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
515 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
516 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
517 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
518 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
519 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
520 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
521 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
522 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
523 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
524 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
525 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
526 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
527 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
528 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
529 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
530 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
531 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
532 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
533 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
534 " 12 | PostgreSQL | Database Server",
535 " 131 | MSSQL(2000) | Database Server",
536 " 132 | MSSQL(2005) | Database Server",
537 " 1731 | MSSQL(2012) | Database Server",
538 " 1731 | MSSQL(2014) | Database Server",
539 " 200 | MySQL323 | Database Server",
540 " 300 | MySQL4.1/MySQL5 | Database Server",
541 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
542 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
543 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
544 " 8000 | Sybase ASE | Database Server",
545 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
546 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
547 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
548 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
549 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
550 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
551 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
552 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
553 " 11500 | CRC32 | Checksums",
554 " 3000 | LM | Operating-Systems",
555 " 1000 | NTLM | Operating-Systems",
556 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
557 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
558 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
559 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
560 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
561 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
562 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
563 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
564 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
565 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
566 " 1722 | OSX v10.7 | Operating-Systems",
567 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
568 " 6300 | AIX {smd5} | Operating-Systems",
569 " 6700 | AIX {ssha1} | Operating-Systems",
570 " 6400 | AIX {ssha256} | Operating-Systems",
571 " 6500 | AIX {ssha512} | Operating-Systems",
572 " 2400 | Cisco-PIX | Operating-Systems",
573 " 2410 | Cisco-ASA | Operating-Systems",
574 " 500 | Cisco-IOS $1$ | Operating-Systems",
575 " 5700 | Cisco-IOS $4$ | Operating-Systems",
576 " 9200 | Cisco-IOS $8$ | Operating-Systems",
577 " 9300 | Cisco-IOS $9$ | Operating-Systems",
578 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
579 " 501 | Juniper IVE | Operating-Systems",
580 " 5800 | Android PIN | Operating-Systems",
581 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
582 " 8100 | Citrix Netscaler | Operating-Systems",
583 " 8500 | RACF | Operating-Systems",
584 " 7200 | GRUB 2 | Operating-Systems",
585 " 9900 | Radmin2 | Operating-Systems",
586 " 125 | ArubaOS | Operating-Systems",
587 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
588 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
589 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
590 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
591 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
592 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
593 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
594 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
595 " 11600 | 7-Zip | Archives",
596 " 12500 | RAR3-hp | Archives",
597 " 13000 | RAR5 | Archives",
598 " 13200 | AxCrypt | Archives",
599 " 13300 | AxCrypt in memory SHA1 | Archives",
600 " 13600 | WinZip | Archives",
601 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
602 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
603 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
604 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
605 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
606 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
607 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
608 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
609 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
610 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
611 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
612 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
613 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
614 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
615 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
616 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
617 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
618 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
619 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
620 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
621 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
622 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
623 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
624 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
625 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
626 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
627 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
628 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
629 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
630 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
631 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
632 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
633 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
634 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
635 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
636 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
637 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
638 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
639 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
640 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
641 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
642 " 9400 | MS Office 2007 | Documents",
643 " 9500 | MS Office 2010 | Documents",
644 " 9600 | MS Office 2013 | Documents",
645 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
646 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
647 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
648 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
649 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
650 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
651 " 9000 | Password Safe v2 | Password Managers",
652 " 5200 | Password Safe v3 | Password Managers",
653 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
654 " 6600 | 1Password, agilekeychain | Password Managers",
655 " 8200 | 1Password, cloudkeychain | Password Managers",
656 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
657 " 12700 | Blockchain, My Wallet | Password Managers",
658 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
660 "- [ Outfile Formats ] -",
666 " 3 | hash[:salt]:plain",
668 " 5 | hash[:salt]:hex_plain",
669 " 6 | plain:hex_plain",
670 " 7 | hash[:salt]:plain:hex_plain",
672 " 9 | hash[:salt]:crack_pos",
673 " 10 | plain:crack_pos",
674 " 11 | hash[:salt]:plain:crack_pos",
675 " 12 | hex_plain:crack_pos",
676 " 13 | hash[:salt]:hex_plain:crack_pos",
677 " 14 | plain:hex_plain:crack_pos",
678 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
680 "- [ Rule Debugging Modes ] -",
685 " 2 | Original-Word",
686 " 3 | Original-Word:Finding-Rule",
687 " 4 | Original-Word:Finding-Rule:Processed-Word",
689 "- [ Attack Modes ] -",
696 " 6 | Hybrid Wordlist + Mask",
697 " 7 | Hybrid Mask + Wordlist",
699 "- [ Built-in Charsets ] -",
703 " l | abcdefghijklmnopqrstuvwxyz",
704 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
706 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
710 "- [ OpenCL Device Types ] -",
713 " ===+=============",
716 " 3 | FPGA, DSP, Co-Processor",
718 "- [ Workload Profiles ] -",
720 " # | Performance | Runtime | Power Consumption | Desktop Impact",
721 " ===+=============+=========+===================+=================",
722 " 1 | Low | 2 ms | Low | Minimal",
723 " 2 | Default | 12 ms | Economic | Noticeable",
724 " 3 | High | 96 ms | High | Unresponsive",
725 " 4 | Nightmare | 480 ms | Insane | Headless",
727 "If you have no idea what just happened then visit the following pages:",
729 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
730 "* https://hashcat.net/wiki/#frequently_asked_questions",
736 * hashcat specific functions
739 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
741 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
743 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
745 double exec_ms_sum
= 0;
749 for (int i
= 0; i
< last_num_entries
; i
++)
751 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
755 exec_ms_sum
+= exec_ms
;
761 if (exec_ms_cnt
== 0) return 0;
763 return exec_ms_sum
/ exec_ms_cnt
;
766 void status_display_machine_readable ()
770 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
776 fprintf (out
, "SPEED\t");
778 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
780 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
782 if (device_param
->skipped
) continue;
787 for (int i
= 0; i
< SPEED_CACHE
; i
++)
789 speed_cnt
+= device_param
->speed_cnt
[i
];
790 speed_ms
+= device_param
->speed_ms
[i
];
793 speed_cnt
/= SPEED_CACHE
;
794 speed_ms
/= SPEED_CACHE
;
796 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
803 fprintf (out
, "EXEC_RUNTIME\t");
805 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
807 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
809 if (device_param
->skipped
) continue;
811 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
813 fprintf (out
, "%f\t", exec_ms_avg
);
820 u64 words_cur
= get_lowest_words_done ();
822 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
828 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
831 u64 all_rejected
= 0;
832 u64 all_restored
= 0;
834 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
836 all_done
+= data
.words_progress_done
[salt_pos
];
837 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
838 all_restored
+= data
.words_progress_restored
[salt_pos
];
841 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
842 u64 progress_end
= progress_total
;
844 u64 progress_skip
= 0;
848 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
850 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
851 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
852 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
857 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
859 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
860 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
861 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
864 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
865 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
867 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
873 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
874 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
881 if (data
.gpu_temp_disable
== 0)
883 fprintf (out
, "TEMP\t");
885 hc_thread_mutex_lock (mux_adl
);
887 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
889 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
891 if (device_param
->skipped
) continue;
893 int temp
= hm_get_temperature_with_device_id (device_id
);
895 fprintf (out
, "%d\t", temp
);
898 hc_thread_mutex_unlock (mux_adl
);
918 void status_display ()
920 if (data
.devices_status
== STATUS_INIT
) return;
921 if (data
.devices_status
== STATUS_STARTING
) return;
922 if (data
.devices_status
== STATUS_BYPASS
) return;
924 if (data
.machine_readable
== 1)
926 status_display_machine_readable ();
931 char tmp_buf
[1000] = { 0 };
935 log_info ("Session.Name...: %s", data
.session
);
937 char *status_type
= strstatus (data
.devices_status
);
939 uint hash_mode
= data
.hash_mode
;
941 char *hash_type
= strhashtype (hash_mode
); // not a bug
943 log_info ("Status.........: %s", status_type
);
949 if (data
.rp_files_cnt
)
953 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
955 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
958 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
960 log_info ("Rules.Type.....: %s", tmp_buf
);
967 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
969 if (data
.rp_gen_seed
)
971 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
979 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
981 if (data
.wordlist_mode
== WL_MODE_FILE
)
983 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
985 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
987 log_info ("Input.Mode.....: Pipe");
990 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
992 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
993 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
995 else if (data
.attack_mode
== ATTACK_MODE_BF
)
997 char *mask
= data
.mask
;
1001 uint mask_len
= data
.css_cnt
;
1003 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1007 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1009 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1011 mask_len
-= data
.salts_buf
[0].salt_len
;
1015 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1017 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1020 if (data
.maskcnt
> 1)
1022 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1024 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1027 log_info ("Input.Mode.....: %s", tmp_buf
);
1032 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1034 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1035 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1037 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1039 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1040 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1043 if (data
.digests_cnt
== 1)
1045 if (data
.hash_mode
== 2500)
1047 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1049 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1050 (char *) data
.salts_buf
[0].salt_buf
,
1064 else if (data
.hash_mode
== 5200)
1066 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1068 else if (data
.hash_mode
== 9000)
1070 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1072 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1074 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1076 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1078 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1082 char out_buf
[HCBUFSIZ
] = { 0 };
1084 ascii_digest (out_buf
, 0, 0);
1087 if (strlen (out_buf
) > 40)
1095 log_info ("Hash.Target....: %s", out_buf
);
1100 if (data
.hash_mode
== 3000)
1102 char out_buf1
[32] = { 0 };
1103 char out_buf2
[32] = { 0 };
1105 ascii_digest (out_buf1
, 0, 0);
1106 ascii_digest (out_buf2
, 0, 1);
1108 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1112 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1116 log_info ("Hash.Type......: %s", hash_type
);
1122 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1123 double speed_ms
[DEVICES_MAX
] = { 0 };
1125 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1127 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1129 if (device_param
->skipped
) continue;
1131 speed_cnt
[device_id
] = 0;
1132 speed_ms
[device_id
] = 0;
1134 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1136 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1137 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1140 speed_cnt
[device_id
] /= SPEED_CACHE
;
1141 speed_ms
[device_id
] /= SPEED_CACHE
;
1144 double hashes_all_ms
= 0;
1146 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1148 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1150 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1152 if (device_param
->skipped
) continue;
1154 hashes_dev_ms
[device_id
] = 0;
1156 if (speed_ms
[device_id
])
1158 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1160 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1168 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1170 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1172 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1174 if (device_param
->skipped
) continue;
1176 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1178 exec_all_ms
[device_id
] = exec_ms_avg
;
1185 double ms_running
= 0;
1187 hc_timer_get (data
.timer_running
, ms_running
);
1189 double ms_paused
= data
.ms_paused
;
1191 if (data
.devices_status
== STATUS_PAUSED
)
1193 double ms_paused_tmp
= 0;
1195 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1197 ms_paused
+= ms_paused_tmp
;
1202 __time64_t sec_run
= ms_running
/ 1000;
1206 time_t sec_run
= ms_running
/ 1000;
1212 char display_run
[32] = { 0 };
1216 struct tm
*tmp
= NULL
;
1220 tmp
= _gmtime64 (&sec_run
);
1224 tmp
= gmtime (&sec_run
);
1230 memset (&tm_run
, 0, sizeof (tm_run
));
1232 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1234 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1236 char *start
= ctime (&data
.proc_start
);
1238 size_t start_len
= strlen (start
);
1240 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1241 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1243 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1248 log_info ("Time.Started...: 0 secs");
1255 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1258 u64 all_rejected
= 0;
1259 u64 all_restored
= 0;
1261 u64 progress_noneed
= 0;
1263 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1265 all_done
+= data
.words_progress_done
[salt_pos
];
1266 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1267 all_restored
+= data
.words_progress_restored
[salt_pos
];
1269 // Important for ETA only
1271 if (data
.salts_shown
[salt_pos
] == 1)
1273 const u64 all
= data
.words_progress_done
[salt_pos
]
1274 + data
.words_progress_rejected
[salt_pos
]
1275 + data
.words_progress_restored
[salt_pos
];
1277 const u64 left
= data
.words_cnt
- all
;
1279 progress_noneed
+= left
;
1283 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1284 u64 progress_end
= progress_total
;
1286 u64 progress_skip
= 0;
1290 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1292 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1293 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1294 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1299 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1301 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1302 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1303 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1306 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1307 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1309 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1311 if (data
.devices_status
!= STATUS_CRACKED
)
1314 __time64_t sec_etc
= 0;
1321 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1323 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1325 sec_etc
= ms_left
/ 1000;
1330 //log_info ("Time.Estimated.: 0 secs");
1332 else if ((u64
) sec_etc
> ETC_MAX
)
1334 log_info ("Time.Estimated.: > 10 Years");
1338 char display_etc
[32] = { 0 };
1342 struct tm
*tmp
= NULL
;
1346 tmp
= _gmtime64 (&sec_etc
);
1350 tmp
= gmtime (&sec_etc
);
1356 memset (&tm_etc
, 0, sizeof (tm_etc
));
1358 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1360 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1368 char *etc
= ctime (&now
);
1370 size_t etc_len
= strlen (etc
);
1372 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1373 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1375 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1381 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1383 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1385 if (device_param
->skipped
) continue;
1387 char display_dev_cur
[16] = { 0 };
1389 strncpy (display_dev_cur
, "0.00", 4);
1391 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1393 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1396 char display_all_cur
[16] = { 0 };
1398 strncpy (display_all_cur
, "0.00", 4);
1400 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1402 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1404 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1405 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1407 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);
1411 if (data
.digests_cnt
> 100)
1413 time_t now
= time (NULL
);
1415 int cpt_cur_min
= 0;
1416 int cpt_cur_hour
= 0;
1417 int cpt_cur_day
= 0;
1419 for (int i
= 0; i
< CPT_BUF
; i
++)
1421 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1422 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1424 if ((timestamp
+ 60) > now
)
1426 cpt_cur_min
+= cracked
;
1429 if ((timestamp
+ 3600) > now
)
1431 cpt_cur_hour
+= cracked
;
1434 if ((timestamp
+ 86400) > now
)
1436 cpt_cur_day
+= cracked
;
1440 double ms_real
= ms_running
- ms_paused
;
1442 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1443 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1444 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1446 if ((data
.cpt_start
+ 86400) < now
)
1448 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1456 else if ((data
.cpt_start
+ 3600) < now
)
1458 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1465 else if ((data
.cpt_start
+ 60) < now
)
1467 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1475 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1484 u64 restore_point
= get_lowest_words_done ();
1486 u64 restore_total
= data
.words_base
;
1488 float percent_restore
= 0;
1490 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1492 if (progress_end_relative_skip
)
1494 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1496 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1497 float percent_rejected
= 0.0;
1501 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1504 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);
1505 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1507 if (data
.restore_disable
== 0)
1509 if (percent_finished
!= 1)
1511 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1518 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1520 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1521 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1523 if (data
.restore_disable
== 0)
1525 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1530 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1531 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1533 // --restore not allowed if stdin is used -- really? why?
1535 //if (data.restore_disable == 0)
1537 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1544 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1545 if (data
.devices_status
== STATUS_CRACKED
) return;
1546 if (data
.devices_status
== STATUS_ABORTED
) return;
1547 if (data
.devices_status
== STATUS_QUIT
) return;
1549 if (data
.gpu_temp_disable
== 0)
1551 hc_thread_mutex_lock (mux_adl
);
1553 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1555 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1557 if (device_param
->skipped
) continue;
1559 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1560 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1561 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1562 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1563 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1564 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1565 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1567 char output_buf
[256] = { 0 };
1571 if (num_temperature
>= 0)
1573 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1575 output_len
= strlen (output_buf
);
1578 if (num_fanspeed
>= 0)
1580 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1582 output_len
= strlen (output_buf
);
1585 if (num_utilization
>= 0)
1587 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1589 output_len
= strlen (output_buf
);
1592 if (num_corespeed
>= 0)
1594 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1596 output_len
= strlen (output_buf
);
1599 if (num_memoryspeed
>= 0)
1601 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1603 output_len
= strlen (output_buf
);
1606 if (num_buslanes
>= 0)
1608 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1610 output_len
= strlen (output_buf
);
1613 if (num_throttle
== 1)
1615 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1617 output_len
= strlen (output_buf
);
1620 if (output_len
== 0)
1622 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1624 output_len
= strlen (output_buf
);
1627 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1630 hc_thread_mutex_unlock (mux_adl
);
1633 #endif // HAVE_HWMON
1636 static void status_benchmark_automate ()
1638 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1639 double speed_ms
[DEVICES_MAX
] = { 0 };
1641 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1643 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1645 if (device_param
->skipped
) continue;
1647 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1648 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1651 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1653 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1655 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1657 if (device_param
->skipped
) continue;
1659 hashes_dev_ms
[device_id
] = 0;
1661 if (speed_ms
[device_id
])
1663 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1667 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1669 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1671 if (device_param
->skipped
) continue;
1673 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1677 static void status_benchmark ()
1679 if (data
.devices_status
== STATUS_INIT
) return;
1680 if (data
.devices_status
== STATUS_STARTING
) return;
1681 if (data
.devices_status
== STATUS_BYPASS
) return;
1683 if (data
.machine_readable
== 1)
1685 status_benchmark_automate ();
1690 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1691 double speed_ms
[DEVICES_MAX
] = { 0 };
1693 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1695 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1697 if (device_param
->skipped
) continue;
1699 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1700 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1703 double hashes_all_ms
= 0;
1705 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1707 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1709 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1711 if (device_param
->skipped
) continue;
1713 hashes_dev_ms
[device_id
] = 0;
1715 if (speed_ms
[device_id
])
1717 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1719 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1727 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1729 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1731 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1733 if (device_param
->skipped
) continue;
1735 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1737 exec_all_ms
[device_id
] = exec_ms_avg
;
1740 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1742 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1744 if (device_param
->skipped
) continue;
1746 char display_dev_cur
[16] = { 0 };
1748 strncpy (display_dev_cur
, "0.00", 4);
1750 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1752 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1755 char display_all_cur
[16] = { 0 };
1757 strncpy (display_all_cur
, "0.00", 4);
1759 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1761 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1765 * hashcat -only- functions
1768 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1770 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1772 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1773 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1774 else if (attack_kern
== ATTACK_KERN_COMBI
)
1775 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1776 else if (attack_kern
== ATTACK_KERN_BF
)
1777 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1780 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1783 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
)
1785 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1787 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1788 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1789 else if (attack_kern
== ATTACK_KERN_COMBI
)
1790 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1791 else if (attack_kern
== ATTACK_KERN_BF
)
1792 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1796 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1800 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1802 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1804 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1808 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1812 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
)
1814 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1816 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1820 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1824 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1826 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1829 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1831 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1834 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1836 if (line_len
& 1) return (line_len
); // not in hex
1838 if (data
.hex_wordlist
== 1)
1843 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1845 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1848 memset (line_buf
+ i
, 0, line_len
- i
);
1852 else if (line_len
>= 6) // $HEX[] = 6
1854 if (line_buf
[0] != '$') return (line_len
);
1855 if (line_buf
[1] != 'H') return (line_len
);
1856 if (line_buf
[2] != 'E') return (line_len
);
1857 if (line_buf
[3] != 'X') return (line_len
);
1858 if (line_buf
[4] != '[') return (line_len
);
1859 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1864 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1866 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1869 memset (line_buf
+ i
, 0, line_len
- i
);
1877 static void clear_prompt ()
1879 fputc ('\r', stdout
);
1881 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1883 fputc (' ', stdout
);
1886 fputc ('\r', stdout
);
1891 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1893 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
);
1896 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1898 char *outfile
= data
.outfile
;
1899 uint quiet
= data
.quiet
;
1900 FILE *pot_fp
= data
.pot_fp
;
1901 uint loopback
= data
.loopback
;
1902 uint debug_mode
= data
.debug_mode
;
1903 char *debug_file
= data
.debug_file
;
1905 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1906 int debug_rule_len
= 0; // -1 error
1907 uint debug_plain_len
= 0;
1909 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1913 char out_buf
[HCBUFSIZ
] = { 0 };
1915 const u32 salt_pos
= plain
->salt_pos
;
1916 const u32 digest_pos
= plain
->digest_pos
; // relative
1917 const u32 gidvid
= plain
->gidvid
;
1918 const u32 il_pos
= plain
->il_pos
;
1920 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1924 u64 crackpos
= device_param
->words_off
;
1926 uint plain_buf
[16] = { 0 };
1928 u8
*plain_ptr
= (u8
*) plain_buf
;
1930 unsigned int plain_len
= 0;
1932 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1936 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1938 for (int i
= 0; i
< 16; i
++)
1940 plain_buf
[i
] = pw
.i
[i
];
1943 plain_len
= pw
.pw_len
;
1945 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1952 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1954 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1956 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1960 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1962 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1964 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1966 debug_plain_len
= plain_len
;
1970 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1973 crackpos
*= data
.kernel_rules_cnt
;
1974 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1976 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1978 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1982 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1984 for (int i
= 0; i
< 16; i
++)
1986 plain_buf
[i
] = pw
.i
[i
];
1989 plain_len
= pw
.pw_len
;
1991 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1992 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1994 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1996 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2000 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2002 memcpy (plain_ptr
, comb_buf
, comb_len
);
2005 plain_len
+= comb_len
;
2008 crackpos
*= data
.combs_cnt
;
2009 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2011 if (data
.pw_max
!= PW_DICTMAX1
)
2013 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2016 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2018 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2019 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2021 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2022 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2024 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2025 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2027 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2028 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2030 plain_len
= data
.css_cnt
;
2033 crackpos
*= data
.bfs_cnt
;
2034 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2036 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2040 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2042 for (int i
= 0; i
< 16; i
++)
2044 plain_buf
[i
] = pw
.i
[i
];
2047 plain_len
= pw
.pw_len
;
2049 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2052 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2054 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2056 plain_len
+= start
+ stop
;
2059 crackpos
*= data
.combs_cnt
;
2060 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2062 if (data
.pw_max
!= PW_DICTMAX1
)
2064 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2067 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2071 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2073 for (int i
= 0; i
< 16; i
++)
2075 plain_buf
[i
] = pw
.i
[i
];
2078 plain_len
= pw
.pw_len
;
2080 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2083 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2085 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2087 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2089 plain_len
+= start
+ stop
;
2092 crackpos
*= data
.combs_cnt
;
2093 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2095 if (data
.pw_max
!= PW_DICTMAX1
)
2097 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2101 if (data
.attack_mode
== ATTACK_MODE_BF
)
2103 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2105 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2107 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2109 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2113 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2115 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2117 plain_ptr
[j
] = plain_ptr
[i
];
2120 plain_len
= plain_len
/ 2;
2125 // if enabled, update also the potfile
2131 fprintf (pot_fp
, "%s:", out_buf
);
2133 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2135 fputc ('\n', pot_fp
);
2139 unlock_file (pot_fp
);
2144 FILE *out_fp
= NULL
;
2146 if (outfile
!= NULL
)
2148 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2150 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2161 if (quiet
== 0) clear_prompt ();
2164 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2166 if (outfile
!= NULL
)
2168 if (out_fp
!= stdout
)
2175 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2177 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2179 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2180 if (quiet
== 0) fflush (stdout
);
2189 char *loopback_file
= data
.loopback_file
;
2193 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2197 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2199 fputc ('\n', fb_fp
);
2205 // (rule) debug mode
2207 // the next check implies that:
2208 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2211 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2213 if (debug_rule_len
< 0) debug_rule_len
= 0;
2215 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2217 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2219 if ((quiet
== 0) && (debug_file
== NULL
))
2221 fprintf (stdout
, "%s", PROMPT
);
2228 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2230 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2234 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2238 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2242 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2244 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
);
2246 uint cpt_cracked
= 0;
2248 for (uint i
= 0; i
< num_cracked
; i
++)
2250 const uint hash_pos
= cracked
[i
].hash_pos
;
2252 if (data
.digests_shown
[hash_pos
] == 1) continue;
2254 hc_thread_mutex_lock (mux_display
);
2256 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2258 data
.digests_shown
[hash_pos
] = 1;
2260 data
.digests_done
++;
2264 salt_buf
->digests_done
++;
2266 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2268 data
.salts_shown
[salt_pos
] = 1;
2274 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2276 hc_thread_mutex_unlock (mux_display
);
2278 check_hash (device_param
, &cracked
[i
]);
2283 if (cpt_cracked
> 0)
2285 hc_thread_mutex_lock (mux_display
);
2287 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2288 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2292 data
.cpt_total
+= cpt_cracked
;
2294 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2296 hc_thread_mutex_unlock (mux_display
);
2299 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2301 // we need to reset cracked state on the device
2302 // otherwise host thinks again and again the hash was cracked
2303 // and returns invalid password each time
2305 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2307 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
);
2312 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2316 static void save_hash ()
2318 char *hashfile
= data
.hashfile
;
2320 char new_hashfile
[256] = { 0 };
2321 char old_hashfile
[256] = { 0 };
2323 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2324 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2326 unlink (new_hashfile
);
2328 char separator
= data
.separator
;
2330 FILE *fp
= fopen (new_hashfile
, "wb");
2334 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2339 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2341 if (data
.salts_shown
[salt_pos
] == 1) continue;
2343 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2345 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2347 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2349 if (data
.digests_shown
[idx
] == 1) continue;
2351 if (data
.hash_mode
!= 2500)
2353 if (data
.username
== 1)
2355 user_t
*user
= data
.hash_info
[idx
]->user
;
2359 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2361 fputc (separator
, fp
);
2364 char out_buf
[HCBUFSIZ
]; // scratch buffer
2368 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2370 fputs (out_buf
, fp
);
2385 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2387 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2396 unlink (old_hashfile
);
2398 if (rename (hashfile
, old_hashfile
) != 0)
2400 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2407 if (rename (new_hashfile
, hashfile
) != 0)
2409 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2414 unlink (old_hashfile
);
2417 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2419 uint num_elements
= num
;
2421 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2422 device_param
->kernel_params_buf32
[31] = num
;
2424 uint kernel_threads
= device_param
->kernel_threads
;
2426 while (num_elements
% kernel_threads
) num_elements
++;
2428 cl_kernel kernel
= NULL
;
2432 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2433 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2434 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2435 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2436 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2439 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2440 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2441 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2442 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2443 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2444 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2445 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2446 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2447 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2448 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2449 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2453 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2455 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2456 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2458 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2462 if (kern_run
== KERN_RUN_2
)
2464 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2466 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2470 while (num_elements
% kernel_threads
) num_elements
++;
2472 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2473 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2475 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2478 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2480 if (data
.devices_status
== STATUS_RUNNING
)
2482 if (iteration
< EXPECTED_ITERATIONS
)
2486 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
]); break;
2487 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
]); break;
2488 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
]); break;
2493 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2495 cl_ulong time_start
;
2498 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2499 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2501 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2503 if (data
.devices_status
== STATUS_RUNNING
)
2505 if (iteration
< EXPECTED_ITERATIONS
)
2509 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2510 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2511 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2518 uint exec_pos
= device_param
->exec_pos
;
2520 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2524 if (exec_pos
== EXEC_CACHE
)
2529 device_param
->exec_pos
= exec_pos
;
2532 hc_clReleaseEvent (data
.ocl
, event
);
2534 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2537 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2539 uint num_elements
= num
;
2543 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2544 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2545 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2548 // causes problems with special threads like in bcrypt
2549 // const uint kernel_threads = device_param->kernel_threads;
2551 uint kernel_threads
= device_param
->kernel_threads
;
2553 while (num_elements
% kernel_threads
) num_elements
++;
2555 cl_kernel kernel
= NULL
;
2559 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2560 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2561 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2566 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2567 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2568 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2569 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2570 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2571 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2573 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2574 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2575 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2576 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2577 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2578 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2580 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2581 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2582 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2583 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2584 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2585 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2586 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2590 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2591 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2593 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2595 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2597 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2600 static void run_kernel_tm (hc_device_param_t
*device_param
)
2602 const uint num_elements
= 1024; // fixed
2604 uint kernel_threads
= 32;
2606 cl_kernel kernel
= device_param
->kernel_tm
;
2608 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2609 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2611 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2613 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2615 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2618 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2620 uint num_elements
= num
;
2622 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2623 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2625 // causes problems with special threads like in bcrypt
2626 // const uint kernel_threads = device_param->kernel_threads;
2628 uint kernel_threads
= device_param
->kernel_threads
;
2630 while (num_elements
% kernel_threads
) num_elements
++;
2632 cl_kernel kernel
= device_param
->kernel_amp
;
2634 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2635 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2637 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2638 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2640 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2642 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2644 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2647 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2649 const u32 num16d
= num
/ 16;
2650 const u32 num16m
= num
% 16;
2654 device_param
->kernel_params_memset_buf32
[1] = value
;
2655 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2657 uint kernel_threads
= device_param
->kernel_threads
;
2659 uint num_elements
= num16d
;
2661 while (num_elements
% kernel_threads
) num_elements
++;
2663 cl_kernel kernel
= device_param
->kernel_memset
;
2665 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2666 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2667 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2669 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2670 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2672 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2674 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2676 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2688 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2692 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2694 run_kernel_memset (device_param
, buf
, 0, size
);
2699 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2701 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2703 const cl_uchar zero = 0;
2705 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2710 // NOTE: clEnqueueFillBuffer () always fails with -59
2711 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2712 // How's that possible, OpenCL 1.2 support is advertised??
2713 // We need to workaround...
2715 #define FILLSZ 0x100000
2717 char *tmp = (char *) mymalloc (FILLSZ);
2719 for (size_t i = 0; i < size; i += FILLSZ)
2721 const size_t left = size - i;
2723 const size_t fillsz = MIN (FILLSZ, left);
2725 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2733 static void 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
)
2735 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2737 if (attack_mode
== ATTACK_MODE_BF
)
2739 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2741 const uint size_tm
= 32 * sizeof (bs_word_t
);
2743 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2745 run_kernel_tm (device_param
);
2747 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
);
2751 if (highest_pw_len
< 16)
2753 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
2755 else if (highest_pw_len
< 32)
2757 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
2761 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
2766 run_kernel_amp (device_param
, pws_cnt
);
2768 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
2770 if (opts_type
& OPTS_TYPE_HOOK12
)
2772 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
2775 uint iter
= salt_buf
->salt_iter
;
2777 uint loop_step
= device_param
->kernel_loops
;
2779 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
2781 uint loop_left
= iter
- loop_pos
;
2783 loop_left
= MIN (loop_left
, loop_step
);
2785 device_param
->kernel_params_buf32
[25] = loop_pos
;
2786 device_param
->kernel_params_buf32
[26] = loop_left
;
2788 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
2790 if (data
.devices_status
== STATUS_CRACKED
) break;
2791 if (data
.devices_status
== STATUS_ABORTED
) break;
2792 if (data
.devices_status
== STATUS_QUIT
) break;
2798 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2800 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2804 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2806 const u32 speed_pos
= device_param
->speed_pos
;
2808 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2810 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2812 if (data
.benchmark
== 1)
2814 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2818 if (opts_type
& OPTS_TYPE_HOOK23
)
2820 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
2822 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
);
2824 // do something with data
2826 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
);
2829 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
2833 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2839 else if (rule_len
== 1)
2841 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2847 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2849 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2851 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
);
2853 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2855 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2857 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2859 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2861 for (u32 i
= 0; i
< pws_cnt
; i
++)
2863 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2865 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2870 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2872 for (u32 i
= 0; i
< pws_cnt
; i
++)
2874 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2876 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2883 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2885 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2887 for (u32 i
= 0; i
< pws_cnt
; i
++)
2889 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2891 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2896 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2898 for (u32 i
= 0; i
< pws_cnt
; i
++)
2900 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2902 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2909 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
);
2911 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2913 const u64 off
= device_param
->words_off
;
2915 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2917 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2921 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2923 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2925 device_param
->kernel_params_buf32
[25] = 0;
2926 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2927 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2929 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2931 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
2935 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
2938 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2940 return exec_ms_prev
;
2943 static void autotune (hc_device_param_t
*device_param
)
2945 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2947 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2948 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2950 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2951 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2953 u32 kernel_accel
= kernel_accel_min
;
2954 u32 kernel_loops
= kernel_loops_min
;
2956 // in this case the user specified a fixed -u and -n on the commandline
2957 // no way to tune anything
2958 // but we need to run a few caching rounds
2960 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2962 try_run (device_param
, kernel_accel
, kernel_loops
);
2963 try_run (device_param
, kernel_accel
, kernel_loops
);
2964 try_run (device_param
, kernel_accel
, kernel_loops
);
2965 try_run (device_param
, kernel_accel
, kernel_loops
);
2967 device_param
->kernel_accel
= kernel_accel
;
2968 device_param
->kernel_loops
= kernel_loops
;
2970 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2972 device_param
->kernel_power
= kernel_power
;
2977 // from here it's clear we are allowed to autotune
2978 // so let's init some fake words
2980 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2982 if (data
.attack_kern
== ATTACK_KERN_BF
)
2984 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2988 for (u32 i
= 0; i
< kernel_power_max
; i
++)
2990 device_param
->pws_buf
[i
].i
[0] = i
;
2991 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
2992 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
2995 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
);
2998 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3000 if (data
.kernel_rules_cnt
> 1)
3002 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
);
3007 run_kernel_amp (device_param
, kernel_power_max
);
3010 #define VERIFIER_CNT 1
3012 // first find out highest kernel-loops that stays below target_ms
3014 if (kernel_loops_min
< kernel_loops_max
)
3016 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3018 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3020 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3022 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3024 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3027 if (exec_ms
< target_ms
) break;
3031 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3033 #define STEPS_CNT 10
3035 if (kernel_accel_min
< kernel_accel_max
)
3037 for (int i
= 0; i
< STEPS_CNT
; i
++)
3039 const u32 kernel_accel_try
= 1 << i
;
3041 if (kernel_accel_try
< kernel_accel_min
) continue;
3042 if (kernel_accel_try
> kernel_accel_max
) break;
3044 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3046 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3048 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3050 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3053 if (exec_ms
> target_ms
) break;
3055 kernel_accel
= kernel_accel_try
;
3059 // at this point we want to know the actual runtime for the following reason:
3060 // we need a reference for the balancing loop following up, and this
3061 // the balancing loop can have an effect that the creates a new opportunity, for example:
3062 // if the target is 95 ms and the current runtime is 48ms the above loop
3063 // stopped the execution because the previous exec_ms was > 95ms
3064 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3065 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3067 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3069 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3071 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3073 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3076 u32 diff
= kernel_loops
- kernel_accel
;
3078 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3080 u32 kernel_accel_orig
= kernel_accel
;
3081 u32 kernel_loops_orig
= kernel_loops
;
3083 for (u32 f
= 1; f
< 1024; f
++)
3085 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3086 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3088 if (kernel_accel_try
> kernel_accel_max
) break;
3089 if (kernel_loops_try
< kernel_loops_min
) break;
3091 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3093 if (diff_new
> diff
) break;
3097 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3099 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3101 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3103 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3106 if (exec_ms
< exec_ms_pre_final
)
3108 exec_ms_pre_final
= exec_ms
;
3110 kernel_accel
= kernel_accel_try
;
3111 kernel_loops
= kernel_loops_try
;
3116 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3118 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3120 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3122 if (exec_accel_min
>= 1.0)
3124 // this is safe to not overflow kernel_accel_max because of accel_left
3126 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3129 // reset them fake words
3132 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3134 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);
3135 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);
3138 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3140 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3142 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3147 device_param
->exec_pos
= 0;
3149 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3151 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3152 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3153 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3157 device_param
->kernel_accel
= kernel_accel
;
3158 device_param
->kernel_loops
= kernel_loops
;
3160 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3162 device_param
->kernel_power
= kernel_power
;
3166 if (data
.quiet
== 0)
3170 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3171 "Device #%u: autotuned kernel-loops to %u\n",
3172 device_param
->device_id
+ 1, kernel_accel
,
3173 device_param
->device_id
+ 1, kernel_loops
);
3175 fprintf (stdout
, "%s", PROMPT
);
3183 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3185 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3189 uint speed_pos
= device_param
->speed_pos
;
3192 if (device_param
->timer_speed
.tv_sec
== 0)
3194 hc_timer_set (&device_param
->timer_speed
);
3199 if (device_param
->timer_speed
.QuadPart
== 0)
3201 hc_timer_set (&device_param
->timer_speed
);
3205 // find higest password length, this is for optimization stuff
3207 uint highest_pw_len
= 0;
3209 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3212 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3215 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3217 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3218 + device_param
->kernel_params_mp_l_buf32
[5];
3223 uint innerloop_step
= 0;
3224 uint innerloop_cnt
= 0;
3226 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3227 else innerloop_step
= 1;
3229 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3230 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3231 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3233 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3235 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3237 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3239 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3241 if (data
.devices_status
== STATUS_CRACKED
) break;
3242 if (data
.devices_status
== STATUS_ABORTED
) break;
3243 if (data
.devices_status
== STATUS_QUIT
) break;
3244 if (data
.devices_status
== STATUS_BYPASS
) break;
3246 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3248 device_param
->kernel_params_buf32
[24] = salt_pos
;
3249 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3250 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3252 FILE *combs_fp
= device_param
->combs_fp
;
3254 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3261 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3263 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3265 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3267 if (data
.devices_status
== STATUS_CRACKED
) break;
3268 if (data
.devices_status
== STATUS_ABORTED
) break;
3269 if (data
.devices_status
== STATUS_QUIT
) break;
3270 if (data
.devices_status
== STATUS_BYPASS
) break;
3272 uint fast_iteration
= 0;
3274 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3276 if (innerloop_left
> innerloop_step
)
3278 innerloop_left
= innerloop_step
;
3283 device_param
->innerloop_pos
= innerloop_pos
;
3284 device_param
->innerloop_left
= innerloop_left
;
3286 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3288 // i think we can get rid of this
3289 if (innerloop_left
== 0)
3291 puts ("bug, how should this happen????\n");
3296 if (data
.salts_shown
[salt_pos
] == 1)
3298 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3303 // initialize amplifiers
3305 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3309 while (i
< innerloop_left
)
3311 if (feof (combs_fp
)) break;
3313 int line_len
= fgetl (combs_fp
, line_buf
);
3315 if (line_len
>= PW_MAX1
) continue;
3317 line_len
= convert_from_hex (line_buf
, line_len
);
3319 char *line_buf_new
= line_buf
;
3321 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3323 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3325 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3327 if (rule_len_out
< 0)
3329 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3334 line_len
= rule_len_out
;
3336 line_buf_new
= rule_buf_out
;
3339 line_len
= MIN (line_len
, PW_DICTMAX
);
3341 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3343 memcpy (ptr
, line_buf_new
, line_len
);
3345 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3347 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3349 uppercase (ptr
, line_len
);
3352 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3354 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3356 ptr
[line_len
] = 0x80;
3359 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3361 ptr
[line_len
] = 0x01;
3365 device_param
->combs_buf
[i
].pw_len
= line_len
;
3370 for (uint j
= i
; j
< innerloop_left
; j
++)
3372 device_param
->combs_buf
[j
].i
[0] = 0;
3373 device_param
->combs_buf
[j
].i
[1] = 0;
3374 device_param
->combs_buf
[j
].i
[2] = 0;
3375 device_param
->combs_buf
[j
].i
[3] = 0;
3376 device_param
->combs_buf
[j
].i
[4] = 0;
3377 device_param
->combs_buf
[j
].i
[5] = 0;
3378 device_param
->combs_buf
[j
].i
[6] = 0;
3379 device_param
->combs_buf
[j
].i
[7] = 0;
3381 device_param
->combs_buf
[j
].pw_len
= 0;
3386 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3388 u64 off
= innerloop_pos
;
3390 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3392 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3394 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3396 u64 off
= innerloop_pos
;
3398 device_param
->kernel_params_mp_buf64
[3] = off
;
3400 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3402 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3404 u64 off
= innerloop_pos
;
3406 device_param
->kernel_params_mp_buf64
[3] = off
;
3408 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3413 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3415 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
);
3417 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3419 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
);
3421 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3423 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
);
3425 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3427 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
);
3429 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3431 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
);
3434 if (data
.benchmark
== 1)
3436 hc_timer_set (&device_param
->timer_speed
);
3439 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
3441 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3443 if (data
.devices_status
== STATUS_CRACKED
) break;
3444 if (data
.devices_status
== STATUS_ABORTED
) break;
3445 if (data
.devices_status
== STATUS_QUIT
) break;
3451 if (data
.benchmark
== 0)
3453 check_cracked (device_param
, salt_pos
);
3460 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3462 hc_thread_mutex_lock (mux_counter
);
3464 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3466 hc_thread_mutex_unlock (mux_counter
);
3474 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3476 hc_timer_set (&device_param
->timer_speed
);
3480 //hc_thread_mutex_lock (mux_display);
3482 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3484 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3486 //hc_thread_mutex_unlock (mux_display);
3490 if (speed_pos
== SPEED_CACHE
)
3499 if (data
.benchmark
== 1) break;
3503 device_param
->speed_pos
= speed_pos
;
3508 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3510 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3514 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3516 wl_data
->buf
[wl_data
->cnt
] = 0;
3518 if (wl_data
->cnt
== 0) return;
3520 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3524 if (wl_data
->cnt
== wl_data
->avail
)
3526 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3528 wl_data
->avail
+= wl_data
->incr
;
3531 const int c
= fgetc (fd
);
3533 if (c
== EOF
) break;
3535 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3539 if (c
== '\n') break;
3542 // ensure stream ends with a newline
3544 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3548 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3554 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3558 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3560 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3570 if (*ptr
!= '\n') continue;
3574 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3585 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3589 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3591 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3593 if (*ptr
!= '\n') continue;
3597 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3608 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3612 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3614 if (*ptr
!= '\n') continue;
3618 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3629 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3631 while (wl_data
->pos
< wl_data
->cnt
)
3636 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3638 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3640 wl_data
->pos
+= off
;
3642 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3644 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3646 int rule_len_out
= -1;
3648 if (len
< BLOCK_SIZE
)
3650 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3653 if (rule_len_out
< 0)
3658 if (rule_len_out
> PW_MAX
)
3679 fprintf (stderr
, "BUG feof()!!\n");
3684 load_segment (wl_data
, fd
);
3686 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3690 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3694 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3704 fstat (fileno (fd
), &d
.stat
);
3708 _fstat64 (fileno (fd
), &d
.stat
);
3712 d
.stat
.st_nlink
= 0;
3716 d
.stat
.st_atime
= 0;
3719 d
.stat
.st_blksize
= 0;
3720 d
.stat
.st_blocks
= 0;
3723 if (d
.stat
.st_size
== 0) return 0;
3725 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3727 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3731 u64 cnt
= d_cache
->cnt
;
3735 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3737 keyspace
*= data
.kernel_rules_cnt
;
3739 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3741 keyspace
*= data
.combs_cnt
;
3744 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
);
3745 if (data
.quiet
== 0) log_info ("");
3747 hc_signal (sigHandler_default
);
3762 load_segment (wl_data
, fd
);
3764 comp
+= wl_data
->cnt
;
3768 while (i
< wl_data
->cnt
)
3773 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3775 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3777 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3779 int rule_len_out
= -1;
3781 if (len
< BLOCK_SIZE
)
3783 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3786 if (rule_len_out
< 0)
3798 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3800 cnt
+= data
.kernel_rules_cnt
;
3802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3804 cnt
+= data
.combs_cnt
;
3817 if ((now
- prev
) == 0) continue;
3819 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3821 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
);
3826 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
);
3827 if (data
.quiet
== 0) log_info ("");
3829 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3831 hc_signal (sigHandler_default
);
3836 static void *thread_monitor (void *p
)
3838 uint runtime_check
= 0;
3839 uint remove_check
= 0;
3840 uint status_check
= 0;
3841 uint restore_check
= 0;
3843 uint restore_left
= data
.restore_timer
;
3844 uint remove_left
= data
.remove_timer
;
3845 uint status_left
= data
.status_timer
;
3848 uint hwmon_check
= 0;
3850 int slowdown_warnings
= 0;
3852 // these variables are mainly used for fan control
3854 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3856 // temperature controller "loopback" values
3858 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3859 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3861 int temp_threshold
= 1; // degrees celcius
3863 int fan_speed_min
= 15; // in percentage
3864 int fan_speed_max
= 100;
3866 time_t last_temp_check_time
;
3867 #endif // HAVE_HWMON
3869 uint sleep_time
= 1;
3876 if (data
.restore_timer
)
3881 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3886 if (data
.status
== 1)
3892 if (data
.gpu_temp_disable
== 0)
3894 time (&last_temp_check_time
);
3900 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3903 if (hwmon_check
== 0)
3908 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3910 hc_sleep (sleep_time
);
3912 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3916 if (hwmon_check
== 1)
3918 hc_thread_mutex_lock (mux_adl
);
3920 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3922 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3924 if (device_param
->skipped
) continue;
3926 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
3930 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
= { 0 };
3931 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
= { 0 };
3933 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
3934 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
3936 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
3938 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
3940 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
3942 if (perfPolicies_status
.throttle
& 2)
3944 if (slowdown_warnings
< 3)
3946 if (data
.quiet
== 0) clear_prompt ();
3948 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
3950 if (slowdown_warnings
== 2)
3955 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3956 if (data
.quiet
== 0) fflush (stdout
);
3958 slowdown_warnings
++;
3963 slowdown_warnings
= 0;
3969 hc_thread_mutex_unlock (mux_adl
);
3972 if (hwmon_check
== 1)
3974 hc_thread_mutex_lock (mux_adl
);
3976 time_t temp_check_time
;
3978 time (&temp_check_time
);
3980 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3982 if (Ta
== 0) Ta
= 1;
3984 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3986 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3988 if (device_param
->skipped
) continue;
3990 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3992 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3994 if (temperature
> (int) data
.gpu_temp_abort
)
3996 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3998 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4003 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4005 if (gpu_temp_retain
)
4007 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4009 int temp_cur
= temperature
;
4011 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4013 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4015 // calculate Ta value (time difference in seconds between the last check and this check)
4017 last_temp_check_time
= temp_check_time
;
4023 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4025 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
);
4027 if (abs (fan_diff_required
) >= temp_threshold
)
4029 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4031 int fan_speed_level
= fan_speed_cur
;
4033 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4035 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4037 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4038 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4040 if (fan_speed_new
!= fan_speed_cur
)
4042 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4043 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4045 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4047 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4049 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4051 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4056 fan_speed_chgd
[device_id
] = 1;
4059 temp_diff_old
[device_id
] = temp_diff_new
;
4066 hc_thread_mutex_unlock (mux_adl
);
4068 #endif // HAVE_HWMON
4070 if (restore_check
== 1)
4074 if (restore_left
== 0)
4076 if (data
.restore_disable
== 0) cycle_restore ();
4078 restore_left
= data
.restore_timer
;
4082 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4086 time (&runtime_cur
);
4088 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4090 if (runtime_left
<= 0)
4092 if (data
.benchmark
== 0)
4094 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4097 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4101 if (remove_check
== 1)
4105 if (remove_left
== 0)
4107 if (data
.digests_saved
!= data
.digests_done
)
4109 data
.digests_saved
= data
.digests_done
;
4114 remove_left
= data
.remove_timer
;
4118 if (status_check
== 1)
4122 if (status_left
== 0)
4124 //hc_thread_mutex_lock (mux_display);
4126 if (data
.quiet
== 0) clear_prompt ();
4128 if (data
.quiet
== 0) log_info ("");
4132 if (data
.quiet
== 0) log_info ("");
4134 //hc_thread_mutex_unlock (mux_display);
4136 status_left
= data
.status_timer
;
4142 myfree (fan_speed_chgd
);
4144 myfree (temp_diff_old
);
4145 myfree (temp_diff_sum
);
4153 static void *thread_outfile_remove (void *p
)
4155 // some hash-dependent constants
4156 char *outfile_dir
= data
.outfile_check_directory
;
4157 uint dgst_size
= data
.dgst_size
;
4158 uint isSalted
= data
.isSalted
;
4159 uint esalt_size
= data
.esalt_size
;
4160 uint hash_mode
= data
.hash_mode
;
4162 uint outfile_check_timer
= data
.outfile_check_timer
;
4164 char separator
= data
.separator
;
4166 // some hash-dependent functions
4167 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4168 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4171 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4173 hash_buf
.digest
= mymalloc (dgst_size
);
4175 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4177 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4179 uint digest_buf
[64] = { 0 };
4181 outfile_data_t
*out_info
= NULL
;
4183 char **out_files
= NULL
;
4185 time_t folder_mtime
= 0;
4189 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4191 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4195 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4199 if (check_left
== 0)
4201 struct stat outfile_check_stat
;
4203 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4205 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4209 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4211 char **out_files_new
= scan_directory (outfile_dir
);
4213 int out_cnt_new
= count_dictionaries (out_files_new
);
4215 outfile_data_t
*out_info_new
= NULL
;
4217 if (out_cnt_new
> 0)
4219 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4221 for (int i
= 0; i
< out_cnt_new
; i
++)
4223 out_info_new
[i
].file_name
= out_files_new
[i
];
4225 // check if there are files that we have seen/checked before (and not changed)
4227 for (int j
= 0; j
< out_cnt
; j
++)
4229 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4231 struct stat outfile_stat
;
4233 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4235 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4237 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4238 out_info_new
[i
].seek
= out_info
[j
].seek
;
4246 local_free (out_info
);
4247 local_free (out_files
);
4249 out_files
= out_files_new
;
4250 out_cnt
= out_cnt_new
;
4251 out_info
= out_info_new
;
4253 folder_mtime
= outfile_check_stat
.st_mtime
;
4256 for (int j
= 0; j
< out_cnt
; j
++)
4258 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4262 //hc_thread_mutex_lock (mux_display);
4265 struct stat outfile_stat
;
4267 fstat (fileno (fp
), &outfile_stat
);
4271 struct stat64 outfile_stat
;
4273 _fstat64 (fileno (fp
), &outfile_stat
);
4276 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4278 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4279 out_info
[j
].seek
= 0;
4282 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4284 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4288 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4290 if (ptr
== NULL
) break;
4292 int line_len
= strlen (line_buf
);
4294 if (line_len
<= 0) continue;
4296 int iter
= MAX_CUT_TRIES
;
4298 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4300 if (line_buf
[i
] != separator
) continue;
4302 int parser_status
= PARSER_OK
;
4304 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4306 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4311 if (parser_status
== PARSER_OK
)
4313 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4315 if (data
.salts_shown
[salt_pos
] == 1) continue;
4317 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4319 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4321 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4323 if (data
.digests_shown
[idx
] == 1) continue;
4327 if (hash_mode
== 6800)
4329 if (i
== salt_buf
->salt_len
)
4331 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4334 else if (hash_mode
== 2500)
4336 // BSSID : MAC1 : MAC2 (:plain)
4337 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4339 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4341 if (!cracked
) continue;
4343 // now compare MAC1 and MAC2 too, since we have this additional info
4344 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4345 char *mac2_pos
= mac1_pos
+ 12 + 1;
4347 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4348 wpa_t
*wpa
= &wpas
[salt_pos
];
4350 // compare hex string(s) vs binary MAC address(es)
4352 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4354 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4363 if (!cracked
) continue;
4365 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4367 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4378 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4380 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4382 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4389 data
.digests_shown
[idx
] = 1;
4391 data
.digests_done
++;
4393 salt_buf
->digests_done
++;
4395 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4397 data
.salts_shown
[salt_pos
] = 1;
4401 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4406 if (data
.devices_status
== STATUS_CRACKED
) break;
4412 if (data
.devices_status
== STATUS_CRACKED
) break;
4417 if (data
.devices_status
== STATUS_CRACKED
) break;
4422 out_info
[j
].seek
= ftell (fp
);
4424 //hc_thread_mutex_unlock (mux_display);
4432 check_left
= outfile_check_timer
;
4436 if (esalt_size
) local_free (hash_buf
.esalt
);
4438 if (isSalted
) local_free (hash_buf
.salt
);
4440 local_free (hash_buf
.digest
);
4442 local_free (out_info
);
4444 local_free (out_files
);
4451 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4453 //if (device_param->pws_cnt < device_param->kernel_power)
4455 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4457 u8
*ptr
= (u8
*) pw
->i
;
4459 memcpy (ptr
, pw_buf
, pw_len
);
4461 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4463 pw
->pw_len
= pw_len
;
4465 device_param
->pws_cnt
++;
4469 // fprintf (stderr, "BUG pw_add()!!\n");
4475 static void set_kernel_power_final (const u64 kernel_power_final
)
4477 if (data
.quiet
== 0)
4483 log_info ("INFO: approaching final keyspace, workload adjusted");
4486 fprintf (stdout
, "%s", PROMPT
);
4491 data
.kernel_power_final
= kernel_power_final
;
4494 static u32
get_power (hc_device_param_t
*device_param
)
4496 const u64 kernel_power_final
= data
.kernel_power_final
;
4498 if (kernel_power_final
)
4500 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
4502 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
4504 // work should be at least the hardware power available without any accelerator
4506 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
4511 return device_param
->kernel_power
;
4514 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
4516 hc_thread_mutex_lock (mux_dispatcher
);
4518 const u64 words_cur
= data
.words_cur
;
4519 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4521 device_param
->words_off
= words_cur
;
4523 const u64 kernel_power_all
= data
.kernel_power_all
;
4525 const u64 words_left
= words_base
- words_cur
;
4527 if (words_left
< kernel_power_all
)
4529 if (data
.kernel_power_final
== 0)
4531 set_kernel_power_final (words_left
);
4535 const u32 kernel_power
= get_power (device_param
);
4537 uint work
= MIN (words_left
, kernel_power
);
4539 work
= MIN (work
, max
);
4541 data
.words_cur
+= work
;
4543 hc_thread_mutex_unlock (mux_dispatcher
);
4548 static void *thread_autotune (void *p
)
4550 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4552 if (device_param
->skipped
) return NULL
;
4554 autotune (device_param
);
4559 static void *thread_calc_stdin (void *p
)
4561 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4563 if (device_param
->skipped
) return NULL
;
4565 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4567 const uint attack_kern
= data
.attack_kern
;
4569 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4571 hc_thread_mutex_lock (mux_dispatcher
);
4573 if (feof (stdin
) != 0)
4575 hc_thread_mutex_unlock (mux_dispatcher
);
4582 while (words_cur
< device_param
->kernel_power
)
4584 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4586 if (line_buf
== NULL
) break;
4588 uint line_len
= in_superchop (line_buf
);
4590 line_len
= convert_from_hex (line_buf
, line_len
);
4592 // post-process rule engine
4594 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4596 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4598 int rule_len_out
= -1;
4600 if (line_len
< BLOCK_SIZE
)
4602 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4605 if (rule_len_out
< 0) continue;
4607 line_buf
= rule_buf_out
;
4608 line_len
= rule_len_out
;
4611 if (line_len
> PW_MAX
)
4616 // hmm that's always the case, or?
4618 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4620 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4622 hc_thread_mutex_lock (mux_counter
);
4624 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4626 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4629 hc_thread_mutex_unlock (mux_counter
);
4635 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4639 if (data
.devices_status
== STATUS_CRACKED
) break;
4640 if (data
.devices_status
== STATUS_ABORTED
) break;
4641 if (data
.devices_status
== STATUS_QUIT
) break;
4642 if (data
.devices_status
== STATUS_BYPASS
) break;
4645 hc_thread_mutex_unlock (mux_dispatcher
);
4647 if (data
.devices_status
== STATUS_CRACKED
) break;
4648 if (data
.devices_status
== STATUS_ABORTED
) break;
4649 if (data
.devices_status
== STATUS_QUIT
) break;
4650 if (data
.devices_status
== STATUS_BYPASS
) break;
4654 const uint pws_cnt
= device_param
->pws_cnt
;
4658 run_copy (device_param
, pws_cnt
);
4660 run_cracker (device_param
, pws_cnt
);
4662 device_param
->pws_cnt
= 0;
4666 if (attack_kern == ATTACK_KERN_STRAIGHT)
4668 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4670 else if (attack_kern == ATTACK_KERN_COMBI)
4672 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4678 device_param
->kernel_accel
= 0;
4679 device_param
->kernel_loops
= 0;
4686 static void *thread_calc (void *p
)
4688 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4690 if (device_param
->skipped
) return NULL
;
4692 const uint attack_mode
= data
.attack_mode
;
4693 const uint attack_kern
= data
.attack_kern
;
4695 if (attack_mode
== ATTACK_MODE_BF
)
4697 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4699 const uint work
= get_work (device_param
, -1);
4701 if (work
== 0) break;
4703 const u64 words_off
= device_param
->words_off
;
4704 const u64 words_fin
= words_off
+ work
;
4706 const uint pws_cnt
= work
;
4708 device_param
->pws_cnt
= pws_cnt
;
4712 run_copy (device_param
, pws_cnt
);
4714 run_cracker (device_param
, pws_cnt
);
4716 device_param
->pws_cnt
= 0;
4720 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4724 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4726 if (data
.devices_status
== STATUS_CRACKED
) break;
4727 if (data
.devices_status
== STATUS_ABORTED
) break;
4728 if (data
.devices_status
== STATUS_QUIT
) break;
4729 if (data
.devices_status
== STATUS_BYPASS
) break;
4731 if (data
.benchmark
== 1) break;
4733 device_param
->words_done
= words_fin
;
4738 const uint segment_size
= data
.segment_size
;
4740 char *dictfile
= data
.dictfile
;
4742 if (attack_mode
== ATTACK_MODE_COMBI
)
4744 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4746 dictfile
= data
.dictfile2
;
4750 FILE *fd
= fopen (dictfile
, "rb");
4754 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4759 if (attack_mode
== ATTACK_MODE_COMBI
)
4761 const uint combs_mode
= data
.combs_mode
;
4763 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4765 const char *dictfilec
= data
.dictfile2
;
4767 FILE *combs_fp
= fopen (dictfilec
, "rb");
4769 if (combs_fp
== NULL
)
4771 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4778 device_param
->combs_fp
= combs_fp
;
4780 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4782 const char *dictfilec
= data
.dictfile
;
4784 FILE *combs_fp
= fopen (dictfilec
, "rb");
4786 if (combs_fp
== NULL
)
4788 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4795 device_param
->combs_fp
= combs_fp
;
4799 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4801 wl_data
->buf
= (char *) mymalloc (segment_size
);
4802 wl_data
->avail
= segment_size
;
4803 wl_data
->incr
= segment_size
;
4809 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4818 const uint work
= get_work (device_param
, max
);
4820 if (work
== 0) break;
4824 words_off
= device_param
->words_off
;
4825 words_fin
= words_off
+ work
;
4830 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4832 for ( ; words_cur
< words_fin
; words_cur
++)
4834 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4836 line_len
= convert_from_hex (line_buf
, line_len
);
4838 // post-process rule engine
4840 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4842 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4844 int rule_len_out
= -1;
4846 if (line_len
< BLOCK_SIZE
)
4848 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4851 if (rule_len_out
< 0) continue;
4853 line_buf
= rule_buf_out
;
4854 line_len
= rule_len_out
;
4857 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4859 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4863 hc_thread_mutex_lock (mux_counter
);
4865 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4867 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4870 hc_thread_mutex_unlock (mux_counter
);
4875 else if (attack_kern
== ATTACK_KERN_COMBI
)
4877 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4878 // since we still need to combine the plains
4880 if (line_len
> data
.pw_max
)
4884 hc_thread_mutex_lock (mux_counter
);
4886 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4888 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4891 hc_thread_mutex_unlock (mux_counter
);
4897 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4899 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4901 if (data
.devices_status
== STATUS_CRACKED
) break;
4902 if (data
.devices_status
== STATUS_ABORTED
) break;
4903 if (data
.devices_status
== STATUS_QUIT
) break;
4904 if (data
.devices_status
== STATUS_BYPASS
) break;
4907 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4909 if (data
.devices_status
== STATUS_CRACKED
) break;
4910 if (data
.devices_status
== STATUS_ABORTED
) break;
4911 if (data
.devices_status
== STATUS_QUIT
) break;
4912 if (data
.devices_status
== STATUS_BYPASS
) break;
4915 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4917 if (data
.devices_status
== STATUS_CRACKED
) break;
4918 if (data
.devices_status
== STATUS_ABORTED
) break;
4919 if (data
.devices_status
== STATUS_QUIT
) break;
4920 if (data
.devices_status
== STATUS_BYPASS
) break;
4926 const uint pws_cnt
= device_param
->pws_cnt
;
4930 run_copy (device_param
, pws_cnt
);
4932 run_cracker (device_param
, pws_cnt
);
4934 device_param
->pws_cnt
= 0;
4938 if (attack_kern == ATTACK_KERN_STRAIGHT)
4940 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4942 else if (attack_kern == ATTACK_KERN_COMBI)
4944 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4949 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4951 if (data
.devices_status
== STATUS_CRACKED
) break;
4952 if (data
.devices_status
== STATUS_ABORTED
) break;
4953 if (data
.devices_status
== STATUS_QUIT
) break;
4954 if (data
.devices_status
== STATUS_BYPASS
) break;
4956 if (words_fin
== 0) break;
4958 device_param
->words_done
= words_fin
;
4961 if (attack_mode
== ATTACK_MODE_COMBI
)
4963 fclose (device_param
->combs_fp
);
4966 free (wl_data
->buf
);
4972 device_param
->kernel_accel
= 0;
4973 device_param
->kernel_loops
= 0;
4978 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4982 log_error ("ERROR: %s : Invalid argument", __func__
);
4987 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4989 device_param
->kernel_params_buf32
[24] = salt_pos
;
4990 device_param
->kernel_params_buf32
[27] = 1;
4991 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4992 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4993 device_param
->kernel_params_buf32
[30] = 0;
4994 device_param
->kernel_params_buf32
[31] = 1;
4996 char *dictfile_old
= data
.dictfile
;
4998 const char *weak_hash_check
= "weak-hash-check";
5000 data
.dictfile
= (char *) weak_hash_check
;
5002 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5004 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5010 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5012 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5016 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5018 uint loop_step
= 16;
5020 const uint iter
= salt_buf
->salt_iter
;
5022 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5024 uint loop_left
= iter
- loop_pos
;
5026 loop_left
= MIN (loop_left
, loop_step
);
5028 device_param
->kernel_params_buf32
[25] = loop_pos
;
5029 device_param
->kernel_params_buf32
[26] = loop_left
;
5031 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5034 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5041 check_cracked (device_param
, salt_pos
);
5047 device_param
->kernel_params_buf32
[24] = 0;
5048 device_param
->kernel_params_buf32
[25] = 0;
5049 device_param
->kernel_params_buf32
[26] = 0;
5050 device_param
->kernel_params_buf32
[27] = 0;
5051 device_param
->kernel_params_buf32
[28] = 0;
5052 device_param
->kernel_params_buf32
[29] = 0;
5053 device_param
->kernel_params_buf32
[30] = 0;
5054 device_param
->kernel_params_buf32
[31] = 0;
5056 data
.dictfile
= dictfile_old
;
5058 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5063 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5065 if (data
.username
== 0)
5067 *hashbuf_pos
= line_buf
;
5068 *hashbuf_len
= line_len
;
5072 char *pos
= line_buf
;
5075 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5077 if (line_buf
[i
] == data
.separator
)
5092 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5099 for (int i
= 0; i
< line_len
; i
++)
5101 if (line_buf
[i
] == data
.separator
)
5110 if (pos
== NULL
) pos
= line_buf
+ i
;
5122 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5129 for (int i
= 0; i
< line_len
; i
++)
5131 if (line_buf
[i
] == ':')
5138 if (sep_cnt
== 2) sep2_len
++;
5139 if (sep_cnt
== 3) sep3_len
++;
5142 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5147 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5154 for (int i
= 0; i
< line_len
; i
++)
5156 if (line_buf
[i
] == ':')
5163 if (data
.hash_mode
== 1000)
5167 if (pos
== NULL
) pos
= line_buf
+ i
;
5172 else if (data
.hash_mode
== 3000)
5176 if (pos
== NULL
) pos
= line_buf
+ i
;
5187 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5194 for (int i
= 0; i
< line_len
; i
++)
5196 if (line_buf
[i
] == ':')
5205 if (pos
== NULL
) pos
= line_buf
+ i
;
5217 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5221 char sep5_first
= 0;
5222 char sep6_first
= 0;
5224 for (int i
= 0; i
< line_len
; i
++)
5226 if (line_buf
[i
] == ':')
5233 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5234 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5237 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5242 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5249 for (int i
= 0; i
< line_len
; i
++)
5251 if (line_buf
[i
] == ':')
5260 if (pos
== NULL
) pos
= line_buf
+ i
;
5270 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5277 for (int i
= 0; i
< line_len
; i
++)
5279 if (line_buf
[i
] == ':')
5288 if (pos
== NULL
) pos
= line_buf
+ i
;
5300 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5304 for (int i
= 0; i
< line_len
; i
++)
5306 if (line_buf
[i
] == ':') sep_cnt
++;
5309 if (sep_cnt
== 8) return 1;
5314 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5316 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5319 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5321 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5326 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5328 switch (hashfile_format
)
5330 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5331 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5332 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5333 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5337 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5339 switch (hashfile_format
)
5341 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5342 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5343 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5344 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5348 char *strhlfmt (const uint hashfile_format
)
5350 switch (hashfile_format
)
5352 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5353 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5354 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5355 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5356 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5357 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5358 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5359 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5360 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5361 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5364 return ((char *) "Unknown");
5367 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5369 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5371 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5372 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5374 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5378 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5382 int line_len
= fgetl (fp
, line_buf
);
5384 if (line_len
== 0) continue;
5386 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5387 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5388 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5390 if (num_check
== max_check
) break;
5397 uint hashlist_format
= HLFMT_HASHCAT
;
5399 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5401 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5403 hashlist_format
= i
;
5408 return hashlist_format
;
5412 * some further helper function
5415 // wrapper around mymalloc for ADL
5417 #if defined(HAVE_HWMON)
5418 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
5420 return mymalloc (iSize
);
5424 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
)
5428 const uint dgst_pos0
= data
.dgst_pos0
;
5429 const uint dgst_pos1
= data
.dgst_pos1
;
5430 const uint dgst_pos2
= data
.dgst_pos2
;
5431 const uint dgst_pos3
= data
.dgst_pos3
;
5433 memset (bitmap_a
, 0, bitmap_size
);
5434 memset (bitmap_b
, 0, bitmap_size
);
5435 memset (bitmap_c
, 0, bitmap_size
);
5436 memset (bitmap_d
, 0, bitmap_size
);
5438 for (uint i
= 0; i
< digests_cnt
; i
++)
5440 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5442 digests_buf_ptr
+= dgst_size
;
5444 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5445 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5446 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5447 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5449 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5450 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5451 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5452 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5454 if (bitmap_a
[idx0
] & val0
) collisions
++;
5455 if (bitmap_b
[idx1
] & val1
) collisions
++;
5456 if (bitmap_c
[idx2
] & val2
) collisions
++;
5457 if (bitmap_d
[idx3
] & val3
) collisions
++;
5459 bitmap_a
[idx0
] |= val0
;
5460 bitmap_b
[idx1
] |= val1
;
5461 bitmap_c
[idx2
] |= val2
;
5462 bitmap_d
[idx3
] |= val3
;
5464 if (collisions
>= collisions_max
) return 0x7fffffff;
5475 void SetConsoleWindowSize (const int x
)
5477 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5479 if (h
== INVALID_HANDLE_VALUE
) return;
5481 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5483 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5485 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5487 sr
->Right
= MAX (sr
->Right
, x
- 1);
5491 co
.X
= sr
->Right
+ 1;
5494 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5496 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5500 int main (int argc
, char **argv
)
5503 SetConsoleWindowSize (132);
5507 * To help users a bit
5510 char *compute
= getenv ("COMPUTE");
5514 static char display
[100];
5516 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5522 if (getenv ("DISPLAY") == NULL
)
5523 putenv ((char *) "DISPLAY=:0");
5526 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5527 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5529 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5530 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5532 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5533 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5535 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5536 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5538 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5539 putenv ((char *) "POCL_KERNEL_CACHE=0");
5547 memset (&data
, 0, sizeof (hc_global_data_t
));
5553 data
.proc_start
= proc_start
;
5556 char **myargv
= argv
;
5558 hc_thread_mutex_init (mux_dispatcher
);
5559 hc_thread_mutex_init (mux_counter
);
5560 hc_thread_mutex_init (mux_display
);
5561 hc_thread_mutex_init (mux_adl
);
5564 * commandline parameters
5568 uint version
= VERSION
;
5570 uint benchmark
= BENCHMARK
;
5573 uint username
= USERNAME
;
5574 uint remove
= REMOVE
;
5575 uint remove_timer
= REMOVE_TIMER
;
5578 uint keyspace
= KEYSPACE
;
5579 uint potfile_disable
= POTFILE_DISABLE
;
5580 char *potfile_path
= NULL
;
5581 uint debug_mode
= DEBUG_MODE
;
5582 char *debug_file
= NULL
;
5583 char *induction_dir
= NULL
;
5584 char *outfile_check_dir
= NULL
;
5586 uint runtime
= RUNTIME
;
5587 uint hash_mode
= HASH_MODE
;
5588 uint attack_mode
= ATTACK_MODE
;
5589 uint markov_disable
= MARKOV_DISABLE
;
5590 uint markov_classic
= MARKOV_CLASSIC
;
5591 uint markov_threshold
= MARKOV_THRESHOLD
;
5592 char *markov_hcstat
= NULL
;
5593 char *outfile
= NULL
;
5594 uint outfile_format
= OUTFILE_FORMAT
;
5595 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5596 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5597 uint restore
= RESTORE
;
5598 uint restore_timer
= RESTORE_TIMER
;
5599 uint restore_disable
= RESTORE_DISABLE
;
5600 uint status
= STATUS
;
5601 uint status_timer
= STATUS_TIMER
;
5602 uint machine_readable
= MACHINE_READABLE
;
5603 uint loopback
= LOOPBACK
;
5604 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5605 char *session
= NULL
;
5606 uint hex_charset
= HEX_CHARSET
;
5607 uint hex_salt
= HEX_SALT
;
5608 uint hex_wordlist
= HEX_WORDLIST
;
5609 uint rp_gen
= RP_GEN
;
5610 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5611 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5612 uint rp_gen_seed
= RP_GEN_SEED
;
5613 char *rule_buf_l
= (char *) RULE_BUF_L
;
5614 char *rule_buf_r
= (char *) RULE_BUF_R
;
5615 uint increment
= INCREMENT
;
5616 uint increment_min
= INCREMENT_MIN
;
5617 uint increment_max
= INCREMENT_MAX
;
5618 char *cpu_affinity
= NULL
;
5619 OCL_PTR
*ocl
= NULL
;
5620 char *opencl_devices
= NULL
;
5621 char *opencl_platforms
= NULL
;
5622 char *opencl_device_types
= NULL
;
5623 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5624 char *truecrypt_keyfiles
= NULL
;
5625 char *veracrypt_keyfiles
= NULL
;
5626 uint veracrypt_pim
= 0;
5627 uint workload_profile
= WORKLOAD_PROFILE
;
5628 uint kernel_accel
= KERNEL_ACCEL
;
5629 uint kernel_loops
= KERNEL_LOOPS
;
5630 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5632 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5633 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5634 uint powertune_enable
= POWERTUNE_ENABLE
;
5636 uint logfile_disable
= LOGFILE_DISABLE
;
5637 uint segment_size
= SEGMENT_SIZE
;
5638 uint scrypt_tmto
= SCRYPT_TMTO
;
5639 char separator
= SEPARATOR
;
5640 uint bitmap_min
= BITMAP_MIN
;
5641 uint bitmap_max
= BITMAP_MAX
;
5642 char *custom_charset_1
= NULL
;
5643 char *custom_charset_2
= NULL
;
5644 char *custom_charset_3
= NULL
;
5645 char *custom_charset_4
= NULL
;
5647 #define IDX_HELP 'h'
5648 #define IDX_VERSION 'V'
5649 #define IDX_VERSION_LOWER 'v'
5650 #define IDX_QUIET 0xff02
5651 #define IDX_SHOW 0xff03
5652 #define IDX_LEFT 0xff04
5653 #define IDX_REMOVE 0xff05
5654 #define IDX_REMOVE_TIMER 0xff37
5655 #define IDX_SKIP 's'
5656 #define IDX_LIMIT 'l'
5657 #define IDX_KEYSPACE 0xff35
5658 #define IDX_POTFILE_DISABLE 0xff06
5659 #define IDX_POTFILE_PATH 0xffe0
5660 #define IDX_DEBUG_MODE 0xff43
5661 #define IDX_DEBUG_FILE 0xff44
5662 #define IDX_INDUCTION_DIR 0xff46
5663 #define IDX_OUTFILE_CHECK_DIR 0xff47
5664 #define IDX_USERNAME 0xff07
5665 #define IDX_FORCE 0xff08
5666 #define IDX_RUNTIME 0xff09
5667 #define IDX_BENCHMARK 'b'
5668 #define IDX_HASH_MODE 'm'
5669 #define IDX_ATTACK_MODE 'a'
5670 #define IDX_RP_FILE 'r'
5671 #define IDX_RP_GEN 'g'
5672 #define IDX_RP_GEN_FUNC_MIN 0xff10
5673 #define IDX_RP_GEN_FUNC_MAX 0xff11
5674 #define IDX_RP_GEN_SEED 0xff34
5675 #define IDX_RULE_BUF_L 'j'
5676 #define IDX_RULE_BUF_R 'k'
5677 #define IDX_INCREMENT 'i'
5678 #define IDX_INCREMENT_MIN 0xff12
5679 #define IDX_INCREMENT_MAX 0xff13
5680 #define IDX_OUTFILE 'o'
5681 #define IDX_OUTFILE_FORMAT 0xff14
5682 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5683 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5684 #define IDX_RESTORE 0xff15
5685 #define IDX_RESTORE_DISABLE 0xff27
5686 #define IDX_STATUS 0xff17
5687 #define IDX_STATUS_TIMER 0xff18
5688 #define IDX_MACHINE_READABLE 0xff50
5689 #define IDX_LOOPBACK 0xff38
5690 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5691 #define IDX_SESSION 0xff19
5692 #define IDX_HEX_CHARSET 0xff20
5693 #define IDX_HEX_SALT 0xff21
5694 #define IDX_HEX_WORDLIST 0xff40
5695 #define IDX_MARKOV_DISABLE 0xff22
5696 #define IDX_MARKOV_CLASSIC 0xff23
5697 #define IDX_MARKOV_THRESHOLD 't'
5698 #define IDX_MARKOV_HCSTAT 0xff24
5699 #define IDX_CPU_AFFINITY 0xff25
5700 #define IDX_OPENCL_DEVICES 'd'
5701 #define IDX_OPENCL_PLATFORMS 0xff72
5702 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5703 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5704 #define IDX_WORKLOAD_PROFILE 'w'
5705 #define IDX_KERNEL_ACCEL 'n'
5706 #define IDX_KERNEL_LOOPS 'u'
5707 #define IDX_GPU_TEMP_DISABLE 0xff29
5708 #define IDX_GPU_TEMP_ABORT 0xff30
5709 #define IDX_GPU_TEMP_RETAIN 0xff31
5710 #define IDX_POWERTUNE_ENABLE 0xff41
5711 #define IDX_LOGFILE_DISABLE 0xff51
5712 #define IDX_TRUECRYPT_KEYFILES 0xff52
5713 #define IDX_VERACRYPT_KEYFILES 0xff53
5714 #define IDX_VERACRYPT_PIM 0xff54
5715 #define IDX_SCRYPT_TMTO 0xff61
5716 #define IDX_SEGMENT_SIZE 'c'
5717 #define IDX_SEPARATOR 'p'
5718 #define IDX_BITMAP_MIN 0xff70
5719 #define IDX_BITMAP_MAX 0xff71
5720 #define IDX_CUSTOM_CHARSET_1 '1'
5721 #define IDX_CUSTOM_CHARSET_2 '2'
5722 #define IDX_CUSTOM_CHARSET_3 '3'
5723 #define IDX_CUSTOM_CHARSET_4 '4'
5725 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5727 struct option long_options
[] =
5729 {"help", no_argument
, 0, IDX_HELP
},
5730 {"version", no_argument
, 0, IDX_VERSION
},
5731 {"quiet", no_argument
, 0, IDX_QUIET
},
5732 {"show", no_argument
, 0, IDX_SHOW
},
5733 {"left", no_argument
, 0, IDX_LEFT
},
5734 {"username", no_argument
, 0, IDX_USERNAME
},
5735 {"remove", no_argument
, 0, IDX_REMOVE
},
5736 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5737 {"skip", required_argument
, 0, IDX_SKIP
},
5738 {"limit", required_argument
, 0, IDX_LIMIT
},
5739 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5740 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5741 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5742 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5743 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5744 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5745 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5746 {"force", no_argument
, 0, IDX_FORCE
},
5747 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5748 {"restore", no_argument
, 0, IDX_RESTORE
},
5749 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5750 {"status", no_argument
, 0, IDX_STATUS
},
5751 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5752 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5753 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5754 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5755 {"session", required_argument
, 0, IDX_SESSION
},
5756 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5757 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5758 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5759 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5760 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5761 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5762 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5763 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5764 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5765 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5766 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5767 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5768 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5769 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5770 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5771 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5772 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5773 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5774 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5775 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5776 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5777 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5778 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5779 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5780 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5781 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5782 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5783 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5784 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5785 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5787 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5788 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5789 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5790 #endif // HAVE_HWMON
5791 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5792 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5793 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5794 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5795 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5796 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5797 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5798 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5799 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5800 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5801 {"increment", no_argument
, 0, IDX_INCREMENT
},
5802 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5803 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5804 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5805 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5806 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5807 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5811 uint rp_files_cnt
= 0;
5813 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5815 int option_index
= 0;
5821 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5825 case IDX_HELP
: usage
= 1; break;
5827 case IDX_VERSION_LOWER
: version
= 1; break;
5828 case IDX_RESTORE
: restore
= 1; break;
5829 case IDX_SESSION
: session
= optarg
; break;
5830 case IDX_SHOW
: show
= 1; break;
5831 case IDX_LEFT
: left
= 1; break;
5832 case '?': return (-1);
5838 log_error ("ERROR: Invalid argument specified");
5849 log_info ("%s", VERSION_TAG
);
5856 usage_big_print (PROGNAME
);
5862 * session needs to be set, always!
5865 if (session
== NULL
) session
= (char *) PROGNAME
;
5868 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5871 char *exec_path
= get_exec_path ();
5875 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5876 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5878 char *install_dir
= get_install_dir (resolved_exec_path
);
5879 char *profile_dir
= NULL
;
5880 char *session_dir
= NULL
;
5881 char *shared_dir
= NULL
;
5883 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5885 struct passwd
*pw
= getpwuid (getuid ());
5887 const char *homedir
= pw
->pw_dir
;
5889 profile_dir
= get_profile_dir (homedir
);
5890 session_dir
= get_session_dir (profile_dir
);
5891 shared_dir
= strdup (SHARED_FOLDER
);
5893 mkdir (profile_dir
, 0700);
5894 mkdir (session_dir
, 0700);
5898 profile_dir
= install_dir
;
5899 session_dir
= install_dir
;
5900 shared_dir
= install_dir
;
5903 myfree (resolved_install_folder
);
5904 myfree (resolved_exec_path
);
5908 char *install_dir
= get_install_dir (exec_path
);
5909 char *profile_dir
= install_dir
;
5910 char *session_dir
= install_dir
;
5911 char *shared_dir
= install_dir
;
5915 data
.install_dir
= install_dir
;
5916 data
.profile_dir
= profile_dir
;
5917 data
.session_dir
= session_dir
;
5918 data
.shared_dir
= shared_dir
;
5923 * kernel cache, we need to make sure folder exist
5926 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5928 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5930 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5932 mkdir (kernels_folder
, 0700);
5934 myfree (kernels_folder
);
5940 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5942 data
.session
= session
;
5944 char *eff_restore_file
= (char *) mymalloc (session_size
);
5945 char *new_restore_file
= (char *) mymalloc (session_size
);
5947 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5948 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5950 data
.eff_restore_file
= eff_restore_file
;
5951 data
.new_restore_file
= new_restore_file
;
5953 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5955 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5956 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5961 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5962 if ((show
== 1) || (left
== 1))
5964 restore_disable
= 1;
5969 data
.restore_disable
= restore_disable
;
5971 restore_data_t
*rd
= init_restore (argc
, argv
);
5981 read_restore (eff_restore_file
, rd
);
5983 if (rd
->version_bin
< RESTORE_MIN
)
5985 log_error ("ERROR: Incompatible restore-file version");
5994 rd
->pid
= getpid ();
5996 rd
->pid
= GetCurrentProcessId ();
6000 uint hash_mode_chgd
= 0;
6001 uint runtime_chgd
= 0;
6002 uint kernel_loops_chgd
= 0;
6003 uint kernel_accel_chgd
= 0;
6004 uint attack_mode_chgd
= 0;
6005 uint outfile_format_chgd
= 0;
6006 uint rp_gen_seed_chgd
= 0;
6007 uint remove_timer_chgd
= 0;
6008 uint increment_min_chgd
= 0;
6009 uint increment_max_chgd
= 0;
6010 uint workload_profile_chgd
= 0;
6011 uint opencl_vector_width_chgd
= 0;
6017 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6021 //case IDX_HELP: usage = 1; break;
6022 //case IDX_VERSION: version = 1; break;
6023 //case IDX_RESTORE: restore = 1; break;
6024 case IDX_QUIET
: quiet
= 1; break;
6025 //case IDX_SHOW: show = 1; break;
6026 case IDX_SHOW
: break;
6027 //case IDX_LEFT: left = 1; break;
6028 case IDX_LEFT
: break;
6029 case IDX_USERNAME
: username
= 1; break;
6030 case IDX_REMOVE
: remove
= 1; break;
6031 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6032 remove_timer_chgd
= 1; break;
6033 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6034 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6035 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6036 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6037 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6038 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6039 case IDX_FORCE
: force
= 1; break;
6040 case IDX_SKIP
: skip
= atoll (optarg
); break;
6041 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6042 case IDX_KEYSPACE
: keyspace
= 1; break;
6043 case IDX_BENCHMARK
: benchmark
= 1; break;
6044 case IDX_RESTORE
: break;
6045 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6046 case IDX_STATUS
: status
= 1; break;
6047 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6048 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6049 case IDX_LOOPBACK
: loopback
= 1; break;
6050 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6051 //case IDX_SESSION: session = optarg; break;
6052 case IDX_SESSION
: break;
6053 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6054 hash_mode_chgd
= 1; break;
6055 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6056 runtime_chgd
= 1; break;
6057 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6058 attack_mode_chgd
= 1; break;
6059 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6060 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6061 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6062 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6063 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6064 rp_gen_seed_chgd
= 1; break;
6065 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6066 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6067 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6068 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6069 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6070 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6071 case IDX_OUTFILE
: outfile
= optarg
; break;
6072 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6073 outfile_format_chgd
= 1; break;
6074 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6075 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6076 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6077 case IDX_HEX_SALT
: hex_salt
= 1; break;
6078 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6079 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6080 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6081 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6082 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6083 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6084 opencl_vector_width_chgd
= 1; break;
6085 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6086 workload_profile_chgd
= 1; break;
6087 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6088 kernel_accel_chgd
= 1; break;
6089 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6090 kernel_loops_chgd
= 1; break;
6091 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6093 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6094 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6095 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6096 #endif // HAVE_HWMON
6097 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6098 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6099 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6100 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6101 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6102 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6103 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6104 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6105 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6106 case IDX_INCREMENT
: increment
= 1; break;
6107 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6108 increment_min_chgd
= 1; break;
6109 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6110 increment_max_chgd
= 1; break;
6111 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6112 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6113 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6114 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6117 log_error ("ERROR: Invalid argument specified");
6124 log_error ("ERROR: Invalid argument specified");
6130 * Inform user things getting started,
6131 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6132 * - we do not need to check algorithm_pos
6139 if (machine_readable
== 0)
6141 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6143 log_info ("Note: Reported benchmark cracking speed = real cracking speed");
6144 log_info ("To verify, run hashcat like this: only_one_hash.txt -a 3 -w 3 ?b?b?b?b?b?b?b");
6149 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6152 else if (restore
== 1)
6154 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6159 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6168 if (attack_mode
> 7)
6170 log_error ("ERROR: Invalid attack-mode specified");
6175 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6177 log_error ("ERROR: Invalid runtime specified");
6182 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6184 log_error ("ERROR: Invalid hash-type specified");
6189 // renamed hash modes
6203 log_error ("Old -m specified, use -m %d instead", n
);
6211 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6213 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6219 if (outfile_format
> 16)
6221 log_error ("ERROR: Invalid outfile-format specified");
6228 if (outfile_format_chgd
== 1)
6230 if (outfile_format
> 1)
6232 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6239 outfile_format
= OUTFILE_FMT_HASH
;
6245 if (outfile_format_chgd
== 1)
6247 if ((outfile_format
> 7) && (outfile_format
< 16))
6249 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6256 if (increment_min
< INCREMENT_MIN
)
6258 log_error ("ERROR: Invalid increment-min specified");
6263 if (increment_max
> INCREMENT_MAX
)
6265 log_error ("ERROR: Invalid increment-max specified");
6270 if (increment_min
> increment_max
)
6272 log_error ("ERROR: Invalid increment-min specified");
6277 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6279 log_error ("ERROR: increment is not allowed in attack-mode 0");
6284 if ((increment
== 0) && (increment_min_chgd
== 1))
6286 log_error ("ERROR: increment-min is only supported together with increment switch");
6291 if ((increment
== 0) && (increment_max_chgd
== 1))
6293 log_error ("ERROR: increment-max is only supported together with increment switch");
6298 if (rp_files_cnt
&& rp_gen
)
6300 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6305 if (rp_files_cnt
|| rp_gen
)
6307 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6309 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6315 if (rp_gen_func_min
> rp_gen_func_max
)
6317 log_error ("ERROR: Invalid rp-gen-func-min specified");
6322 if (kernel_accel_chgd
== 1)
6326 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6327 log_info ("Please consider using the option -w instead");
6328 log_info ("You can use --force to override this but do not post error reports if you do so");
6334 if (kernel_accel
< 1)
6336 log_error ("ERROR: Invalid kernel-accel specified");
6341 if (kernel_accel
> 1024)
6343 log_error ("ERROR: Invalid kernel-accel specified");
6349 if (kernel_loops_chgd
== 1)
6353 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6354 log_info ("Please consider using the option -w instead");
6355 log_info ("You can use --force to override this but do not post error reports if you do so");
6361 if (kernel_loops
< 1)
6363 log_error ("ERROR: Invalid kernel-loops specified");
6368 if (kernel_loops
> 1024)
6370 log_error ("ERROR: Invalid kernel-loops specified");
6376 if ((workload_profile
< 1) || (workload_profile
> 4))
6378 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6383 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6385 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6390 if (show
== 1 || left
== 1)
6392 attack_mode
= ATTACK_MODE_NONE
;
6396 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6401 if (potfile_disable
== 1)
6403 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6409 uint attack_kern
= ATTACK_KERN_NONE
;
6411 switch (attack_mode
)
6413 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6414 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6415 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6416 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6417 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6424 int num_additional_params
= 1;
6426 if (attack_kern
== ATTACK_KERN_COMBI
)
6428 num_additional_params
= 2;
6431 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6433 if (keyspace_wordlist_specified
== 0) optind
--;
6436 if (attack_kern
== ATTACK_KERN_NONE
)
6438 if ((optind
+ 1) != myargc
)
6440 usage_mini_print (myargv
[0]);
6445 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6447 if ((optind
+ 1) > myargc
)
6449 usage_mini_print (myargv
[0]);
6454 else if (attack_kern
== ATTACK_KERN_COMBI
)
6456 if ((optind
+ 3) != myargc
)
6458 usage_mini_print (myargv
[0]);
6463 else if (attack_kern
== ATTACK_KERN_BF
)
6465 if ((optind
+ 1) > myargc
)
6467 usage_mini_print (myargv
[0]);
6474 usage_mini_print (myargv
[0]);
6481 if (myargv
[optind
] != 0)
6483 log_error ("ERROR: Invalid argument for benchmark mode specified");
6488 if (attack_mode_chgd
== 1)
6490 if (attack_mode
!= ATTACK_MODE_BF
)
6492 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6499 if (skip
!= 0 && limit
!= 0)
6508 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6514 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6519 potfile_disable
= 1;
6521 restore_disable
= 1;
6525 weak_hash_threshold
= 0;
6530 if (remove_timer_chgd
== 1)
6534 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6539 if (remove_timer
< 1)
6541 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6549 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6551 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6553 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6560 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6568 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6570 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6575 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6577 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6585 log_error ("ERROR: Invalid debug-mode specified");
6590 if (debug_file
!= NULL
)
6594 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6600 if (induction_dir
!= NULL
)
6602 if (attack_mode
== ATTACK_MODE_BF
)
6604 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6610 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6612 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6614 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6619 weak_hash_threshold
= 0;
6623 * induction directory
6626 char *induction_directory
= NULL
;
6628 if (attack_mode
!= ATTACK_MODE_BF
)
6630 if (induction_dir
== NULL
)
6632 induction_directory
= (char *) mymalloc (session_size
);
6634 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6636 // create induction folder if it does not already exist
6640 if (rmdir (induction_directory
) == -1)
6642 if (errno
== ENOENT
)
6644 // good, we can ignore
6646 else if (errno
== ENOTEMPTY
)
6648 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6650 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6652 if (rename (induction_directory
, induction_directory_mv
) != 0)
6654 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6661 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6667 if (mkdir (induction_directory
, 0700) == -1)
6669 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6677 induction_directory
= induction_dir
;
6681 data
.induction_directory
= induction_directory
;
6687 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6689 char *loopback_file
= (char *) mymalloc (loopback_size
);
6695 char tuning_db_file
[256] = { 0 };
6697 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6699 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6702 * outfile-check directory
6705 char *outfile_check_directory
= NULL
;
6707 if (outfile_check_dir
== NULL
)
6709 outfile_check_directory
= (char *) mymalloc (session_size
);
6711 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6715 outfile_check_directory
= outfile_check_dir
;
6718 data
.outfile_check_directory
= outfile_check_directory
;
6722 struct stat outfile_check_stat
;
6724 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6726 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6730 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6735 else if (outfile_check_dir
== NULL
)
6737 if (mkdir (outfile_check_directory
, 0700) == -1)
6739 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6747 * special other stuff
6750 if (hash_mode
== 9710)
6753 outfile_format_chgd
= 1;
6756 if (hash_mode
== 9810)
6759 outfile_format_chgd
= 1;
6762 if (hash_mode
== 10410)
6765 outfile_format_chgd
= 1;
6772 data
.hash_mode
= hash_mode
;
6773 data
.restore
= restore
;
6774 data
.restore_timer
= restore_timer
;
6775 data
.restore_disable
= restore_disable
;
6776 data
.status
= status
;
6777 data
.status_timer
= status_timer
;
6778 data
.machine_readable
= machine_readable
;
6779 data
.loopback
= loopback
;
6780 data
.runtime
= runtime
;
6781 data
.remove
= remove
;
6782 data
.remove_timer
= remove_timer
;
6783 data
.debug_mode
= debug_mode
;
6784 data
.debug_file
= debug_file
;
6785 data
.username
= username
;
6787 data
.outfile
= outfile
;
6788 data
.outfile_format
= outfile_format
;
6789 data
.outfile_autohex
= outfile_autohex
;
6790 data
.hex_charset
= hex_charset
;
6791 data
.hex_salt
= hex_salt
;
6792 data
.hex_wordlist
= hex_wordlist
;
6793 data
.separator
= separator
;
6794 data
.rp_files
= rp_files
;
6795 data
.rp_files_cnt
= rp_files_cnt
;
6796 data
.rp_gen
= rp_gen
;
6797 data
.rp_gen_seed
= rp_gen_seed
;
6799 data
.benchmark
= benchmark
;
6803 data
.powertune_enable
= powertune_enable
;
6805 data
.logfile_disable
= logfile_disable
;
6806 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6807 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6808 data
.veracrypt_pim
= veracrypt_pim
;
6809 data
.scrypt_tmto
= scrypt_tmto
;
6810 data
.workload_profile
= workload_profile
;
6818 set_cpu_affinity (cpu_affinity
);
6821 if (rp_gen_seed_chgd
== 0)
6827 srand (rp_gen_seed
);
6834 if (logfile_disable
== 0)
6836 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6838 char *logfile
= (char *) mymalloc (logfile_size
);
6840 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6842 data
.logfile
= logfile
;
6844 char *topid
= logfile_generate_topid ();
6849 // logfile_append() checks for logfile_disable internally to make it easier from here
6851 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6852 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6853 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6854 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6855 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6856 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6857 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6858 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6859 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6860 #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));
6862 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6863 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6864 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6865 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6866 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6867 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6868 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6869 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6871 logfile_top_msg ("START");
6873 logfile_top_uint (attack_mode
);
6874 logfile_top_uint (attack_kern
);
6875 logfile_top_uint (benchmark
);
6876 logfile_top_uint (bitmap_min
);
6877 logfile_top_uint (bitmap_max
);
6878 logfile_top_uint (debug_mode
);
6879 logfile_top_uint (force
);
6880 logfile_top_uint (kernel_accel
);
6881 logfile_top_uint (kernel_loops
);
6882 logfile_top_uint (gpu_temp_disable
);
6884 logfile_top_uint (gpu_temp_abort
);
6885 logfile_top_uint (gpu_temp_retain
);
6887 logfile_top_uint (hash_mode
);
6888 logfile_top_uint (hex_charset
);
6889 logfile_top_uint (hex_salt
);
6890 logfile_top_uint (hex_wordlist
);
6891 logfile_top_uint (increment
);
6892 logfile_top_uint (increment_max
);
6893 logfile_top_uint (increment_min
);
6894 logfile_top_uint (keyspace
);
6895 logfile_top_uint (left
);
6896 logfile_top_uint (logfile_disable
);
6897 logfile_top_uint (loopback
);
6898 logfile_top_uint (markov_classic
);
6899 logfile_top_uint (markov_disable
);
6900 logfile_top_uint (markov_threshold
);
6901 logfile_top_uint (outfile_autohex
);
6902 logfile_top_uint (outfile_check_timer
);
6903 logfile_top_uint (outfile_format
);
6904 logfile_top_uint (potfile_disable
);
6905 logfile_top_string (potfile_path
);
6906 #if defined(HAVE_HWMON)
6907 logfile_top_uint (powertune_enable
);
6909 logfile_top_uint (scrypt_tmto
);
6910 logfile_top_uint (quiet
);
6911 logfile_top_uint (remove
);
6912 logfile_top_uint (remove_timer
);
6913 logfile_top_uint (restore
);
6914 logfile_top_uint (restore_disable
);
6915 logfile_top_uint (restore_timer
);
6916 logfile_top_uint (rp_gen
);
6917 logfile_top_uint (rp_gen_func_max
);
6918 logfile_top_uint (rp_gen_func_min
);
6919 logfile_top_uint (rp_gen_seed
);
6920 logfile_top_uint (runtime
);
6921 logfile_top_uint (segment_size
);
6922 logfile_top_uint (show
);
6923 logfile_top_uint (status
);
6924 logfile_top_uint (machine_readable
);
6925 logfile_top_uint (status_timer
);
6926 logfile_top_uint (usage
);
6927 logfile_top_uint (username
);
6928 logfile_top_uint (version
);
6929 logfile_top_uint (weak_hash_threshold
);
6930 logfile_top_uint (workload_profile
);
6931 logfile_top_uint64 (limit
);
6932 logfile_top_uint64 (skip
);
6933 logfile_top_char (separator
);
6934 logfile_top_string (cpu_affinity
);
6935 logfile_top_string (custom_charset_1
);
6936 logfile_top_string (custom_charset_2
);
6937 logfile_top_string (custom_charset_3
);
6938 logfile_top_string (custom_charset_4
);
6939 logfile_top_string (debug_file
);
6940 logfile_top_string (opencl_devices
);
6941 logfile_top_string (opencl_platforms
);
6942 logfile_top_string (opencl_device_types
);
6943 logfile_top_uint (opencl_vector_width
);
6944 logfile_top_string (induction_dir
);
6945 logfile_top_string (markov_hcstat
);
6946 logfile_top_string (outfile
);
6947 logfile_top_string (outfile_check_dir
);
6948 logfile_top_string (rule_buf_l
);
6949 logfile_top_string (rule_buf_r
);
6950 logfile_top_string (session
);
6951 logfile_top_string (truecrypt_keyfiles
);
6952 logfile_top_string (veracrypt_keyfiles
);
6953 logfile_top_uint (veracrypt_pim
);
6956 * Init OpenCL library loader
6961 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6969 * OpenCL platform selection
6972 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6975 * OpenCL device selection
6978 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6981 * OpenCL device type selection
6984 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6993 * disable useless stuff for benchmark
6998 restore_disable
= 1;
6999 potfile_disable
= 1;
7000 weak_hash_threshold
= 0;
7001 gpu_temp_disable
= 1;
7004 if (powertune_enable
== 1)
7006 gpu_temp_disable
= 0;
7010 data
.status_timer
= status_timer
;
7011 data
.restore_timer
= restore_timer
;
7012 data
.restore_disable
= restore_disable
;
7015 * force attack mode to be bruteforce
7018 attack_mode
= ATTACK_MODE_BF
;
7019 attack_kern
= ATTACK_KERN_BF
;
7021 if (workload_profile_chgd
== 0)
7023 workload_profile
= 3;
7025 data
.workload_profile
= workload_profile
;
7035 uint attack_exec
= 0;
7039 uint esalt_size
= 0;
7041 uint dgst_pos0
= -1;
7042 uint dgst_pos1
= -1;
7043 uint dgst_pos2
= -1;
7044 uint dgst_pos3
= -1;
7046 int (*parse_func
) (char *, uint
, hash_t
*);
7047 int (*sort_by_digest
) (const void *, const void *);
7049 uint algorithm_pos
= 0;
7050 uint algorithm_max
= 1;
7052 uint
*algorithms
= default_benchmark_algorithms
;
7054 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7056 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7059 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7060 * the following algos are skipped entirely
7063 if (algorithm_pos
> 0)
7067 rd
= init_restore (argc
, argv
);
7073 * update hash_mode in case of multihash benchmark
7078 if (hash_mode_chgd
== 0)
7080 hash_mode
= algorithms
[algorithm_pos
];
7082 data
.hash_mode
= hash_mode
;
7092 case 0: hash_type
= HASH_TYPE_MD5
;
7093 salt_type
= SALT_TYPE_NONE
;
7094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7095 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7096 | OPTS_TYPE_PT_ADD80
7097 | OPTS_TYPE_PT_ADDBITS14
;
7098 kern_type
= KERN_TYPE_MD5
;
7099 dgst_size
= DGST_SIZE_4_4
;
7100 parse_func
= md5_parse_hash
;
7101 sort_by_digest
= sort_by_digest_4_4
;
7102 opti_type
= OPTI_TYPE_ZERO_BYTE
7103 | OPTI_TYPE_PRECOMPUTE_INIT
7104 | OPTI_TYPE_PRECOMPUTE_MERKLE
7105 | OPTI_TYPE_MEET_IN_MIDDLE
7106 | OPTI_TYPE_EARLY_SKIP
7107 | OPTI_TYPE_NOT_ITERATED
7108 | OPTI_TYPE_NOT_SALTED
7109 | OPTI_TYPE_RAW_HASH
;
7116 case 10: hash_type
= HASH_TYPE_MD5
;
7117 salt_type
= SALT_TYPE_INTERN
;
7118 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7119 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7120 | OPTS_TYPE_ST_ADD80
7121 | OPTS_TYPE_ST_ADDBITS14
;
7122 kern_type
= KERN_TYPE_MD5_PWSLT
;
7123 dgst_size
= DGST_SIZE_4_4
;
7124 parse_func
= md5s_parse_hash
;
7125 sort_by_digest
= sort_by_digest_4_4
;
7126 opti_type
= OPTI_TYPE_ZERO_BYTE
7127 | OPTI_TYPE_PRECOMPUTE_INIT
7128 | OPTI_TYPE_PRECOMPUTE_MERKLE
7129 | OPTI_TYPE_MEET_IN_MIDDLE
7130 | OPTI_TYPE_EARLY_SKIP
7131 | OPTI_TYPE_NOT_ITERATED
7132 | OPTI_TYPE_APPENDED_SALT
7133 | OPTI_TYPE_RAW_HASH
;
7140 case 11: hash_type
= HASH_TYPE_MD5
;
7141 salt_type
= SALT_TYPE_INTERN
;
7142 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7143 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7144 | OPTS_TYPE_ST_ADD80
7145 | OPTS_TYPE_ST_ADDBITS14
;
7146 kern_type
= KERN_TYPE_MD5_PWSLT
;
7147 dgst_size
= DGST_SIZE_4_4
;
7148 parse_func
= joomla_parse_hash
;
7149 sort_by_digest
= sort_by_digest_4_4
;
7150 opti_type
= OPTI_TYPE_ZERO_BYTE
7151 | OPTI_TYPE_PRECOMPUTE_INIT
7152 | OPTI_TYPE_PRECOMPUTE_MERKLE
7153 | OPTI_TYPE_MEET_IN_MIDDLE
7154 | OPTI_TYPE_EARLY_SKIP
7155 | OPTI_TYPE_NOT_ITERATED
7156 | OPTI_TYPE_APPENDED_SALT
7157 | OPTI_TYPE_RAW_HASH
;
7164 case 12: hash_type
= HASH_TYPE_MD5
;
7165 salt_type
= SALT_TYPE_INTERN
;
7166 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7167 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7168 | OPTS_TYPE_ST_ADD80
7169 | OPTS_TYPE_ST_ADDBITS14
;
7170 kern_type
= KERN_TYPE_MD5_PWSLT
;
7171 dgst_size
= DGST_SIZE_4_4
;
7172 parse_func
= postgresql_parse_hash
;
7173 sort_by_digest
= sort_by_digest_4_4
;
7174 opti_type
= OPTI_TYPE_ZERO_BYTE
7175 | OPTI_TYPE_PRECOMPUTE_INIT
7176 | OPTI_TYPE_PRECOMPUTE_MERKLE
7177 | OPTI_TYPE_MEET_IN_MIDDLE
7178 | OPTI_TYPE_EARLY_SKIP
7179 | OPTI_TYPE_NOT_ITERATED
7180 | OPTI_TYPE_APPENDED_SALT
7181 | OPTI_TYPE_RAW_HASH
;
7188 case 20: hash_type
= HASH_TYPE_MD5
;
7189 salt_type
= SALT_TYPE_INTERN
;
7190 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7191 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7192 | OPTS_TYPE_PT_ADD80
7193 | OPTS_TYPE_PT_ADDBITS14
;
7194 kern_type
= KERN_TYPE_MD5_SLTPW
;
7195 dgst_size
= DGST_SIZE_4_4
;
7196 parse_func
= md5s_parse_hash
;
7197 sort_by_digest
= sort_by_digest_4_4
;
7198 opti_type
= OPTI_TYPE_ZERO_BYTE
7199 | OPTI_TYPE_PRECOMPUTE_INIT
7200 | OPTI_TYPE_PRECOMPUTE_MERKLE
7201 | OPTI_TYPE_EARLY_SKIP
7202 | OPTI_TYPE_NOT_ITERATED
7203 | OPTI_TYPE_PREPENDED_SALT
7204 | OPTI_TYPE_RAW_HASH
;
7211 case 21: hash_type
= HASH_TYPE_MD5
;
7212 salt_type
= SALT_TYPE_INTERN
;
7213 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7214 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7215 | OPTS_TYPE_PT_ADD80
7216 | OPTS_TYPE_PT_ADDBITS14
;
7217 kern_type
= KERN_TYPE_MD5_SLTPW
;
7218 dgst_size
= DGST_SIZE_4_4
;
7219 parse_func
= osc_parse_hash
;
7220 sort_by_digest
= sort_by_digest_4_4
;
7221 opti_type
= OPTI_TYPE_ZERO_BYTE
7222 | OPTI_TYPE_PRECOMPUTE_INIT
7223 | OPTI_TYPE_PRECOMPUTE_MERKLE
7224 | OPTI_TYPE_EARLY_SKIP
7225 | OPTI_TYPE_NOT_ITERATED
7226 | OPTI_TYPE_PREPENDED_SALT
7227 | OPTI_TYPE_RAW_HASH
;
7234 case 22: hash_type
= HASH_TYPE_MD5
;
7235 salt_type
= SALT_TYPE_EMBEDDED
;
7236 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7237 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7238 | OPTS_TYPE_PT_ADD80
7239 | OPTS_TYPE_PT_ADDBITS14
;
7240 kern_type
= KERN_TYPE_MD5_SLTPW
;
7241 dgst_size
= DGST_SIZE_4_4
;
7242 parse_func
= netscreen_parse_hash
;
7243 sort_by_digest
= sort_by_digest_4_4
;
7244 opti_type
= OPTI_TYPE_ZERO_BYTE
7245 | OPTI_TYPE_PRECOMPUTE_INIT
7246 | OPTI_TYPE_PRECOMPUTE_MERKLE
7247 | OPTI_TYPE_EARLY_SKIP
7248 | OPTI_TYPE_NOT_ITERATED
7249 | OPTI_TYPE_PREPENDED_SALT
7250 | OPTI_TYPE_RAW_HASH
;
7257 case 23: hash_type
= HASH_TYPE_MD5
;
7258 salt_type
= SALT_TYPE_EMBEDDED
;
7259 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7260 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7261 | OPTS_TYPE_PT_ADD80
7262 | OPTS_TYPE_PT_ADDBITS14
;
7263 kern_type
= KERN_TYPE_MD5_SLTPW
;
7264 dgst_size
= DGST_SIZE_4_4
;
7265 parse_func
= skype_parse_hash
;
7266 sort_by_digest
= sort_by_digest_4_4
;
7267 opti_type
= OPTI_TYPE_ZERO_BYTE
7268 | OPTI_TYPE_PRECOMPUTE_INIT
7269 | OPTI_TYPE_PRECOMPUTE_MERKLE
7270 | OPTI_TYPE_EARLY_SKIP
7271 | OPTI_TYPE_NOT_ITERATED
7272 | OPTI_TYPE_PREPENDED_SALT
7273 | OPTI_TYPE_RAW_HASH
;
7280 case 30: hash_type
= HASH_TYPE_MD5
;
7281 salt_type
= SALT_TYPE_INTERN
;
7282 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7283 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7284 | OPTS_TYPE_PT_UNICODE
7285 | OPTS_TYPE_ST_ADD80
7286 | OPTS_TYPE_ST_ADDBITS14
;
7287 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7288 dgst_size
= DGST_SIZE_4_4
;
7289 parse_func
= md5s_parse_hash
;
7290 sort_by_digest
= sort_by_digest_4_4
;
7291 opti_type
= OPTI_TYPE_ZERO_BYTE
7292 | OPTI_TYPE_PRECOMPUTE_INIT
7293 | OPTI_TYPE_PRECOMPUTE_MERKLE
7294 | OPTI_TYPE_MEET_IN_MIDDLE
7295 | OPTI_TYPE_EARLY_SKIP
7296 | OPTI_TYPE_NOT_ITERATED
7297 | OPTI_TYPE_APPENDED_SALT
7298 | OPTI_TYPE_RAW_HASH
;
7305 case 40: hash_type
= HASH_TYPE_MD5
;
7306 salt_type
= SALT_TYPE_INTERN
;
7307 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7308 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7309 | OPTS_TYPE_PT_ADD80
7310 | OPTS_TYPE_PT_ADDBITS14
7311 | OPTS_TYPE_PT_UNICODE
;
7312 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7313 dgst_size
= DGST_SIZE_4_4
;
7314 parse_func
= md5s_parse_hash
;
7315 sort_by_digest
= sort_by_digest_4_4
;
7316 opti_type
= OPTI_TYPE_ZERO_BYTE
7317 | OPTI_TYPE_PRECOMPUTE_INIT
7318 | OPTI_TYPE_PRECOMPUTE_MERKLE
7319 | OPTI_TYPE_EARLY_SKIP
7320 | OPTI_TYPE_NOT_ITERATED
7321 | OPTI_TYPE_PREPENDED_SALT
7322 | OPTI_TYPE_RAW_HASH
;
7329 case 50: hash_type
= HASH_TYPE_MD5
;
7330 salt_type
= SALT_TYPE_INTERN
;
7331 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7332 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7333 | OPTS_TYPE_ST_ADD80
7334 | OPTS_TYPE_ST_ADDBITS14
;
7335 kern_type
= KERN_TYPE_HMACMD5_PW
;
7336 dgst_size
= DGST_SIZE_4_4
;
7337 parse_func
= hmacmd5_parse_hash
;
7338 sort_by_digest
= sort_by_digest_4_4
;
7339 opti_type
= OPTI_TYPE_ZERO_BYTE
7340 | OPTI_TYPE_NOT_ITERATED
;
7347 case 60: hash_type
= HASH_TYPE_MD5
;
7348 salt_type
= SALT_TYPE_INTERN
;
7349 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7350 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7351 | OPTS_TYPE_PT_ADD80
7352 | OPTS_TYPE_PT_ADDBITS14
;
7353 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7354 dgst_size
= DGST_SIZE_4_4
;
7355 parse_func
= hmacmd5_parse_hash
;
7356 sort_by_digest
= sort_by_digest_4_4
;
7357 opti_type
= OPTI_TYPE_ZERO_BYTE
7358 | OPTI_TYPE_NOT_ITERATED
;
7365 case 100: hash_type
= HASH_TYPE_SHA1
;
7366 salt_type
= SALT_TYPE_NONE
;
7367 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7368 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7369 | OPTS_TYPE_PT_ADD80
7370 | OPTS_TYPE_PT_ADDBITS15
;
7371 kern_type
= KERN_TYPE_SHA1
;
7372 dgst_size
= DGST_SIZE_4_5
;
7373 parse_func
= sha1_parse_hash
;
7374 sort_by_digest
= sort_by_digest_4_5
;
7375 opti_type
= OPTI_TYPE_ZERO_BYTE
7376 | OPTI_TYPE_PRECOMPUTE_INIT
7377 | OPTI_TYPE_PRECOMPUTE_MERKLE
7378 | OPTI_TYPE_EARLY_SKIP
7379 | OPTI_TYPE_NOT_ITERATED
7380 | OPTI_TYPE_NOT_SALTED
7381 | OPTI_TYPE_RAW_HASH
;
7388 case 101: hash_type
= HASH_TYPE_SHA1
;
7389 salt_type
= SALT_TYPE_NONE
;
7390 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7391 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7392 | OPTS_TYPE_PT_ADD80
7393 | OPTS_TYPE_PT_ADDBITS15
;
7394 kern_type
= KERN_TYPE_SHA1
;
7395 dgst_size
= DGST_SIZE_4_5
;
7396 parse_func
= sha1b64_parse_hash
;
7397 sort_by_digest
= sort_by_digest_4_5
;
7398 opti_type
= OPTI_TYPE_ZERO_BYTE
7399 | OPTI_TYPE_PRECOMPUTE_INIT
7400 | OPTI_TYPE_PRECOMPUTE_MERKLE
7401 | OPTI_TYPE_EARLY_SKIP
7402 | OPTI_TYPE_NOT_ITERATED
7403 | OPTI_TYPE_NOT_SALTED
7404 | OPTI_TYPE_RAW_HASH
;
7411 case 110: hash_type
= HASH_TYPE_SHA1
;
7412 salt_type
= SALT_TYPE_INTERN
;
7413 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7414 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7415 | OPTS_TYPE_ST_ADD80
7416 | OPTS_TYPE_ST_ADDBITS15
;
7417 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7418 dgst_size
= DGST_SIZE_4_5
;
7419 parse_func
= sha1s_parse_hash
;
7420 sort_by_digest
= sort_by_digest_4_5
;
7421 opti_type
= OPTI_TYPE_ZERO_BYTE
7422 | OPTI_TYPE_PRECOMPUTE_INIT
7423 | OPTI_TYPE_PRECOMPUTE_MERKLE
7424 | OPTI_TYPE_EARLY_SKIP
7425 | OPTI_TYPE_NOT_ITERATED
7426 | OPTI_TYPE_APPENDED_SALT
7427 | OPTI_TYPE_RAW_HASH
;
7434 case 111: hash_type
= HASH_TYPE_SHA1
;
7435 salt_type
= SALT_TYPE_EMBEDDED
;
7436 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7437 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7438 | OPTS_TYPE_ST_ADD80
7439 | OPTS_TYPE_ST_ADDBITS15
;
7440 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7441 dgst_size
= DGST_SIZE_4_5
;
7442 parse_func
= sha1b64s_parse_hash
;
7443 sort_by_digest
= sort_by_digest_4_5
;
7444 opti_type
= OPTI_TYPE_ZERO_BYTE
7445 | OPTI_TYPE_PRECOMPUTE_INIT
7446 | OPTI_TYPE_PRECOMPUTE_MERKLE
7447 | OPTI_TYPE_EARLY_SKIP
7448 | OPTI_TYPE_NOT_ITERATED
7449 | OPTI_TYPE_APPENDED_SALT
7450 | OPTI_TYPE_RAW_HASH
;
7457 case 112: hash_type
= HASH_TYPE_SHA1
;
7458 salt_type
= SALT_TYPE_INTERN
;
7459 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7460 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7461 | OPTS_TYPE_ST_ADD80
7462 | OPTS_TYPE_ST_ADDBITS15
7464 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7465 dgst_size
= DGST_SIZE_4_5
;
7466 parse_func
= oracles_parse_hash
;
7467 sort_by_digest
= sort_by_digest_4_5
;
7468 opti_type
= OPTI_TYPE_ZERO_BYTE
7469 | OPTI_TYPE_PRECOMPUTE_INIT
7470 | OPTI_TYPE_PRECOMPUTE_MERKLE
7471 | OPTI_TYPE_EARLY_SKIP
7472 | OPTI_TYPE_NOT_ITERATED
7473 | OPTI_TYPE_APPENDED_SALT
7474 | OPTI_TYPE_RAW_HASH
;
7481 case 120: hash_type
= HASH_TYPE_SHA1
;
7482 salt_type
= SALT_TYPE_INTERN
;
7483 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7484 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7485 | OPTS_TYPE_PT_ADD80
7486 | OPTS_TYPE_PT_ADDBITS15
;
7487 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7488 dgst_size
= DGST_SIZE_4_5
;
7489 parse_func
= sha1s_parse_hash
;
7490 sort_by_digest
= sort_by_digest_4_5
;
7491 opti_type
= OPTI_TYPE_ZERO_BYTE
7492 | OPTI_TYPE_PRECOMPUTE_INIT
7493 | OPTI_TYPE_PRECOMPUTE_MERKLE
7494 | OPTI_TYPE_EARLY_SKIP
7495 | OPTI_TYPE_NOT_ITERATED
7496 | OPTI_TYPE_PREPENDED_SALT
7497 | OPTI_TYPE_RAW_HASH
;
7504 case 121: hash_type
= HASH_TYPE_SHA1
;
7505 salt_type
= SALT_TYPE_INTERN
;
7506 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7507 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7508 | OPTS_TYPE_PT_ADD80
7509 | OPTS_TYPE_PT_ADDBITS15
7510 | OPTS_TYPE_ST_LOWER
;
7511 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7512 dgst_size
= DGST_SIZE_4_5
;
7513 parse_func
= smf_parse_hash
;
7514 sort_by_digest
= sort_by_digest_4_5
;
7515 opti_type
= OPTI_TYPE_ZERO_BYTE
7516 | OPTI_TYPE_PRECOMPUTE_INIT
7517 | OPTI_TYPE_PRECOMPUTE_MERKLE
7518 | OPTI_TYPE_EARLY_SKIP
7519 | OPTI_TYPE_NOT_ITERATED
7520 | OPTI_TYPE_PREPENDED_SALT
7521 | OPTI_TYPE_RAW_HASH
;
7528 case 122: hash_type
= HASH_TYPE_SHA1
;
7529 salt_type
= SALT_TYPE_EMBEDDED
;
7530 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7531 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7532 | OPTS_TYPE_PT_ADD80
7533 | OPTS_TYPE_PT_ADDBITS15
7535 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7536 dgst_size
= DGST_SIZE_4_5
;
7537 parse_func
= osx1_parse_hash
;
7538 sort_by_digest
= sort_by_digest_4_5
;
7539 opti_type
= OPTI_TYPE_ZERO_BYTE
7540 | OPTI_TYPE_PRECOMPUTE_INIT
7541 | OPTI_TYPE_PRECOMPUTE_MERKLE
7542 | OPTI_TYPE_EARLY_SKIP
7543 | OPTI_TYPE_NOT_ITERATED
7544 | OPTI_TYPE_PREPENDED_SALT
7545 | OPTI_TYPE_RAW_HASH
;
7552 case 124: hash_type
= HASH_TYPE_SHA1
;
7553 salt_type
= SALT_TYPE_EMBEDDED
;
7554 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7555 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7556 | OPTS_TYPE_PT_ADD80
7557 | OPTS_TYPE_PT_ADDBITS15
;
7558 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7559 dgst_size
= DGST_SIZE_4_5
;
7560 parse_func
= djangosha1_parse_hash
;
7561 sort_by_digest
= sort_by_digest_4_5
;
7562 opti_type
= OPTI_TYPE_ZERO_BYTE
7563 | OPTI_TYPE_PRECOMPUTE_INIT
7564 | OPTI_TYPE_PRECOMPUTE_MERKLE
7565 | OPTI_TYPE_EARLY_SKIP
7566 | OPTI_TYPE_NOT_ITERATED
7567 | OPTI_TYPE_PREPENDED_SALT
7568 | OPTI_TYPE_RAW_HASH
;
7575 case 125: hash_type
= HASH_TYPE_SHA1
;
7576 salt_type
= SALT_TYPE_EMBEDDED
;
7577 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7578 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7579 | OPTS_TYPE_PT_ADD80
7580 | OPTS_TYPE_PT_ADDBITS15
7582 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7583 dgst_size
= DGST_SIZE_4_5
;
7584 parse_func
= arubaos_parse_hash
;
7585 sort_by_digest
= sort_by_digest_4_5
;
7586 opti_type
= OPTI_TYPE_ZERO_BYTE
7587 | OPTI_TYPE_PRECOMPUTE_INIT
7588 | OPTI_TYPE_PRECOMPUTE_MERKLE
7589 | OPTI_TYPE_EARLY_SKIP
7590 | OPTI_TYPE_NOT_ITERATED
7591 | OPTI_TYPE_PREPENDED_SALT
7592 | OPTI_TYPE_RAW_HASH
;
7599 case 130: hash_type
= HASH_TYPE_SHA1
;
7600 salt_type
= SALT_TYPE_INTERN
;
7601 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7602 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7603 | OPTS_TYPE_PT_UNICODE
7604 | OPTS_TYPE_ST_ADD80
7605 | OPTS_TYPE_ST_ADDBITS15
;
7606 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7607 dgst_size
= DGST_SIZE_4_5
;
7608 parse_func
= sha1s_parse_hash
;
7609 sort_by_digest
= sort_by_digest_4_5
;
7610 opti_type
= OPTI_TYPE_ZERO_BYTE
7611 | OPTI_TYPE_PRECOMPUTE_INIT
7612 | OPTI_TYPE_PRECOMPUTE_MERKLE
7613 | OPTI_TYPE_EARLY_SKIP
7614 | OPTI_TYPE_NOT_ITERATED
7615 | OPTI_TYPE_APPENDED_SALT
7616 | OPTI_TYPE_RAW_HASH
;
7623 case 131: hash_type
= HASH_TYPE_SHA1
;
7624 salt_type
= SALT_TYPE_EMBEDDED
;
7625 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7626 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7627 | OPTS_TYPE_PT_UNICODE
7628 | OPTS_TYPE_PT_UPPER
7629 | OPTS_TYPE_ST_ADD80
7630 | OPTS_TYPE_ST_ADDBITS15
7632 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7633 dgst_size
= DGST_SIZE_4_5
;
7634 parse_func
= mssql2000_parse_hash
;
7635 sort_by_digest
= sort_by_digest_4_5
;
7636 opti_type
= OPTI_TYPE_ZERO_BYTE
7637 | OPTI_TYPE_PRECOMPUTE_INIT
7638 | OPTI_TYPE_PRECOMPUTE_MERKLE
7639 | OPTI_TYPE_EARLY_SKIP
7640 | OPTI_TYPE_NOT_ITERATED
7641 | OPTI_TYPE_APPENDED_SALT
7642 | OPTI_TYPE_RAW_HASH
;
7649 case 132: hash_type
= HASH_TYPE_SHA1
;
7650 salt_type
= SALT_TYPE_EMBEDDED
;
7651 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7652 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7653 | OPTS_TYPE_PT_UNICODE
7654 | OPTS_TYPE_ST_ADD80
7655 | OPTS_TYPE_ST_ADDBITS15
7657 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7658 dgst_size
= DGST_SIZE_4_5
;
7659 parse_func
= mssql2005_parse_hash
;
7660 sort_by_digest
= sort_by_digest_4_5
;
7661 opti_type
= OPTI_TYPE_ZERO_BYTE
7662 | OPTI_TYPE_PRECOMPUTE_INIT
7663 | OPTI_TYPE_PRECOMPUTE_MERKLE
7664 | OPTI_TYPE_EARLY_SKIP
7665 | OPTI_TYPE_NOT_ITERATED
7666 | OPTI_TYPE_APPENDED_SALT
7667 | OPTI_TYPE_RAW_HASH
;
7674 case 133: hash_type
= HASH_TYPE_SHA1
;
7675 salt_type
= SALT_TYPE_EMBEDDED
;
7676 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7677 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7678 | OPTS_TYPE_PT_UNICODE
7679 | OPTS_TYPE_ST_ADD80
7680 | OPTS_TYPE_ST_ADDBITS15
;
7681 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7682 dgst_size
= DGST_SIZE_4_5
;
7683 parse_func
= peoplesoft_parse_hash
;
7684 sort_by_digest
= sort_by_digest_4_5
;
7685 opti_type
= OPTI_TYPE_ZERO_BYTE
7686 | OPTI_TYPE_PRECOMPUTE_INIT
7687 | OPTI_TYPE_PRECOMPUTE_MERKLE
7688 | OPTI_TYPE_EARLY_SKIP
7689 | OPTI_TYPE_NOT_ITERATED
7690 | OPTI_TYPE_APPENDED_SALT
7691 | OPTI_TYPE_RAW_HASH
;
7698 case 140: hash_type
= HASH_TYPE_SHA1
;
7699 salt_type
= SALT_TYPE_INTERN
;
7700 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7701 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7702 | OPTS_TYPE_PT_ADD80
7703 | OPTS_TYPE_PT_ADDBITS15
7704 | OPTS_TYPE_PT_UNICODE
;
7705 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7706 dgst_size
= DGST_SIZE_4_5
;
7707 parse_func
= sha1s_parse_hash
;
7708 sort_by_digest
= sort_by_digest_4_5
;
7709 opti_type
= OPTI_TYPE_ZERO_BYTE
7710 | OPTI_TYPE_PRECOMPUTE_INIT
7711 | OPTI_TYPE_PRECOMPUTE_MERKLE
7712 | OPTI_TYPE_EARLY_SKIP
7713 | OPTI_TYPE_NOT_ITERATED
7714 | OPTI_TYPE_PREPENDED_SALT
7715 | OPTI_TYPE_RAW_HASH
;
7722 case 141: hash_type
= HASH_TYPE_SHA1
;
7723 salt_type
= SALT_TYPE_EMBEDDED
;
7724 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7725 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7726 | OPTS_TYPE_PT_ADD80
7727 | OPTS_TYPE_PT_ADDBITS15
7728 | OPTS_TYPE_PT_UNICODE
7729 | OPTS_TYPE_ST_BASE64
;
7730 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7731 dgst_size
= DGST_SIZE_4_5
;
7732 parse_func
= episerver_parse_hash
;
7733 sort_by_digest
= sort_by_digest_4_5
;
7734 opti_type
= OPTI_TYPE_ZERO_BYTE
7735 | OPTI_TYPE_PRECOMPUTE_INIT
7736 | OPTI_TYPE_PRECOMPUTE_MERKLE
7737 | OPTI_TYPE_EARLY_SKIP
7738 | OPTI_TYPE_NOT_ITERATED
7739 | OPTI_TYPE_PREPENDED_SALT
7740 | OPTI_TYPE_RAW_HASH
;
7747 case 150: hash_type
= HASH_TYPE_SHA1
;
7748 salt_type
= SALT_TYPE_INTERN
;
7749 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7750 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7751 | OPTS_TYPE_ST_ADD80
7752 | OPTS_TYPE_ST_ADDBITS15
;
7753 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7754 dgst_size
= DGST_SIZE_4_5
;
7755 parse_func
= hmacsha1_parse_hash
;
7756 sort_by_digest
= sort_by_digest_4_5
;
7757 opti_type
= OPTI_TYPE_ZERO_BYTE
7758 | OPTI_TYPE_NOT_ITERATED
;
7765 case 160: hash_type
= HASH_TYPE_SHA1
;
7766 salt_type
= SALT_TYPE_INTERN
;
7767 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7768 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7769 | OPTS_TYPE_PT_ADD80
7770 | OPTS_TYPE_PT_ADDBITS15
;
7771 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7772 dgst_size
= DGST_SIZE_4_5
;
7773 parse_func
= hmacsha1_parse_hash
;
7774 sort_by_digest
= sort_by_digest_4_5
;
7775 opti_type
= OPTI_TYPE_ZERO_BYTE
7776 | OPTI_TYPE_NOT_ITERATED
;
7783 case 190: hash_type
= HASH_TYPE_SHA1
;
7784 salt_type
= SALT_TYPE_NONE
;
7785 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7786 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7787 | OPTS_TYPE_PT_ADD80
7788 | OPTS_TYPE_PT_ADDBITS15
;
7789 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7790 dgst_size
= DGST_SIZE_4_5
;
7791 parse_func
= sha1linkedin_parse_hash
;
7792 sort_by_digest
= sort_by_digest_4_5
;
7793 opti_type
= OPTI_TYPE_ZERO_BYTE
7794 | OPTI_TYPE_PRECOMPUTE_INIT
7795 | OPTI_TYPE_EARLY_SKIP
7796 | OPTI_TYPE_NOT_ITERATED
7797 | OPTI_TYPE_NOT_SALTED
;
7804 case 200: hash_type
= HASH_TYPE_MYSQL
;
7805 salt_type
= SALT_TYPE_NONE
;
7806 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7808 kern_type
= KERN_TYPE_MYSQL
;
7809 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7810 parse_func
= mysql323_parse_hash
;
7811 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7812 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7819 case 300: hash_type
= HASH_TYPE_SHA1
;
7820 salt_type
= SALT_TYPE_NONE
;
7821 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7822 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7823 | OPTS_TYPE_PT_ADD80
7824 | OPTS_TYPE_PT_ADDBITS15
;
7825 kern_type
= KERN_TYPE_MYSQL41
;
7826 dgst_size
= DGST_SIZE_4_5
;
7827 parse_func
= sha1_parse_hash
;
7828 sort_by_digest
= sort_by_digest_4_5
;
7829 opti_type
= OPTI_TYPE_ZERO_BYTE
7830 | OPTI_TYPE_PRECOMPUTE_INIT
7831 | OPTI_TYPE_PRECOMPUTE_MERKLE
7832 | OPTI_TYPE_EARLY_SKIP
7833 | OPTI_TYPE_NOT_ITERATED
7834 | OPTI_TYPE_NOT_SALTED
;
7841 case 400: hash_type
= HASH_TYPE_MD5
;
7842 salt_type
= SALT_TYPE_EMBEDDED
;
7843 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7844 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7845 kern_type
= KERN_TYPE_PHPASS
;
7846 dgst_size
= DGST_SIZE_4_4
;
7847 parse_func
= phpass_parse_hash
;
7848 sort_by_digest
= sort_by_digest_4_4
;
7849 opti_type
= OPTI_TYPE_ZERO_BYTE
7850 | OPTI_TYPE_SLOW_HASH_SIMD
;
7857 case 500: hash_type
= HASH_TYPE_MD5
;
7858 salt_type
= SALT_TYPE_EMBEDDED
;
7859 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7861 kern_type
= KERN_TYPE_MD5CRYPT
;
7862 dgst_size
= DGST_SIZE_4_4
;
7863 parse_func
= md5crypt_parse_hash
;
7864 sort_by_digest
= sort_by_digest_4_4
;
7865 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7872 case 501: hash_type
= HASH_TYPE_MD5
;
7873 salt_type
= SALT_TYPE_EMBEDDED
;
7874 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7875 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7876 | OPTS_TYPE_HASH_COPY
;
7877 kern_type
= KERN_TYPE_MD5CRYPT
;
7878 dgst_size
= DGST_SIZE_4_4
;
7879 parse_func
= juniper_parse_hash
;
7880 sort_by_digest
= sort_by_digest_4_4
;
7881 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7888 case 900: hash_type
= HASH_TYPE_MD4
;
7889 salt_type
= SALT_TYPE_NONE
;
7890 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7891 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7892 | OPTS_TYPE_PT_ADD80
7893 | OPTS_TYPE_PT_ADDBITS14
;
7894 kern_type
= KERN_TYPE_MD4
;
7895 dgst_size
= DGST_SIZE_4_4
;
7896 parse_func
= md4_parse_hash
;
7897 sort_by_digest
= sort_by_digest_4_4
;
7898 opti_type
= OPTI_TYPE_ZERO_BYTE
7899 | OPTI_TYPE_PRECOMPUTE_INIT
7900 | OPTI_TYPE_PRECOMPUTE_MERKLE
7901 | OPTI_TYPE_MEET_IN_MIDDLE
7902 | OPTI_TYPE_EARLY_SKIP
7903 | OPTI_TYPE_NOT_ITERATED
7904 | OPTI_TYPE_NOT_SALTED
7905 | OPTI_TYPE_RAW_HASH
;
7912 case 1000: hash_type
= HASH_TYPE_MD4
;
7913 salt_type
= SALT_TYPE_NONE
;
7914 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7915 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7916 | OPTS_TYPE_PT_ADD80
7917 | OPTS_TYPE_PT_ADDBITS14
7918 | OPTS_TYPE_PT_UNICODE
;
7919 kern_type
= KERN_TYPE_MD4_PWU
;
7920 dgst_size
= DGST_SIZE_4_4
;
7921 parse_func
= md4_parse_hash
;
7922 sort_by_digest
= sort_by_digest_4_4
;
7923 opti_type
= OPTI_TYPE_ZERO_BYTE
7924 | OPTI_TYPE_PRECOMPUTE_INIT
7925 | OPTI_TYPE_PRECOMPUTE_MERKLE
7926 | OPTI_TYPE_MEET_IN_MIDDLE
7927 | OPTI_TYPE_EARLY_SKIP
7928 | OPTI_TYPE_NOT_ITERATED
7929 | OPTI_TYPE_NOT_SALTED
7930 | OPTI_TYPE_RAW_HASH
;
7937 case 1100: hash_type
= HASH_TYPE_MD4
;
7938 salt_type
= SALT_TYPE_INTERN
;
7939 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7940 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7941 | OPTS_TYPE_PT_ADD80
7942 | OPTS_TYPE_PT_ADDBITS14
7943 | OPTS_TYPE_PT_UNICODE
7944 | OPTS_TYPE_ST_ADD80
7945 | OPTS_TYPE_ST_UNICODE
7946 | OPTS_TYPE_ST_LOWER
;
7947 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7948 dgst_size
= DGST_SIZE_4_4
;
7949 parse_func
= dcc_parse_hash
;
7950 sort_by_digest
= sort_by_digest_4_4
;
7951 opti_type
= OPTI_TYPE_ZERO_BYTE
7952 | OPTI_TYPE_PRECOMPUTE_INIT
7953 | OPTI_TYPE_PRECOMPUTE_MERKLE
7954 | OPTI_TYPE_EARLY_SKIP
7955 | OPTI_TYPE_NOT_ITERATED
;
7962 case 1400: hash_type
= HASH_TYPE_SHA256
;
7963 salt_type
= SALT_TYPE_NONE
;
7964 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7965 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7966 | OPTS_TYPE_PT_ADD80
7967 | OPTS_TYPE_PT_ADDBITS15
;
7968 kern_type
= KERN_TYPE_SHA256
;
7969 dgst_size
= DGST_SIZE_4_8
;
7970 parse_func
= sha256_parse_hash
;
7971 sort_by_digest
= sort_by_digest_4_8
;
7972 opti_type
= OPTI_TYPE_ZERO_BYTE
7973 | OPTI_TYPE_PRECOMPUTE_INIT
7974 | OPTI_TYPE_PRECOMPUTE_MERKLE
7975 | OPTI_TYPE_EARLY_SKIP
7976 | OPTI_TYPE_NOT_ITERATED
7977 | OPTI_TYPE_NOT_SALTED
7978 | OPTI_TYPE_RAW_HASH
;
7985 case 1410: hash_type
= HASH_TYPE_SHA256
;
7986 salt_type
= SALT_TYPE_INTERN
;
7987 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7988 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7989 | OPTS_TYPE_ST_ADD80
7990 | OPTS_TYPE_ST_ADDBITS15
;
7991 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7992 dgst_size
= DGST_SIZE_4_8
;
7993 parse_func
= sha256s_parse_hash
;
7994 sort_by_digest
= sort_by_digest_4_8
;
7995 opti_type
= OPTI_TYPE_ZERO_BYTE
7996 | OPTI_TYPE_PRECOMPUTE_INIT
7997 | OPTI_TYPE_PRECOMPUTE_MERKLE
7998 | OPTI_TYPE_EARLY_SKIP
7999 | OPTI_TYPE_NOT_ITERATED
8000 | OPTI_TYPE_APPENDED_SALT
8001 | OPTI_TYPE_RAW_HASH
;
8008 case 1420: hash_type
= HASH_TYPE_SHA256
;
8009 salt_type
= SALT_TYPE_INTERN
;
8010 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8011 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8012 | OPTS_TYPE_PT_ADD80
8013 | OPTS_TYPE_PT_ADDBITS15
;
8014 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8015 dgst_size
= DGST_SIZE_4_8
;
8016 parse_func
= sha256s_parse_hash
;
8017 sort_by_digest
= sort_by_digest_4_8
;
8018 opti_type
= OPTI_TYPE_ZERO_BYTE
8019 | OPTI_TYPE_PRECOMPUTE_INIT
8020 | OPTI_TYPE_PRECOMPUTE_MERKLE
8021 | OPTI_TYPE_EARLY_SKIP
8022 | OPTI_TYPE_NOT_ITERATED
8023 | OPTI_TYPE_PREPENDED_SALT
8024 | OPTI_TYPE_RAW_HASH
;
8031 case 1421: hash_type
= HASH_TYPE_SHA256
;
8032 salt_type
= SALT_TYPE_EMBEDDED
;
8033 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8034 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8035 | OPTS_TYPE_PT_ADD80
8036 | OPTS_TYPE_PT_ADDBITS15
;
8037 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8038 dgst_size
= DGST_SIZE_4_8
;
8039 parse_func
= hmailserver_parse_hash
;
8040 sort_by_digest
= sort_by_digest_4_8
;
8041 opti_type
= OPTI_TYPE_ZERO_BYTE
8042 | OPTI_TYPE_PRECOMPUTE_INIT
8043 | OPTI_TYPE_PRECOMPUTE_MERKLE
8044 | OPTI_TYPE_EARLY_SKIP
8045 | OPTI_TYPE_NOT_ITERATED
8046 | OPTI_TYPE_PREPENDED_SALT
8047 | OPTI_TYPE_RAW_HASH
;
8054 case 1430: hash_type
= HASH_TYPE_SHA256
;
8055 salt_type
= SALT_TYPE_INTERN
;
8056 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8057 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8058 | OPTS_TYPE_PT_UNICODE
8059 | OPTS_TYPE_ST_ADD80
8060 | OPTS_TYPE_ST_ADDBITS15
;
8061 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8062 dgst_size
= DGST_SIZE_4_8
;
8063 parse_func
= sha256s_parse_hash
;
8064 sort_by_digest
= sort_by_digest_4_8
;
8065 opti_type
= OPTI_TYPE_ZERO_BYTE
8066 | OPTI_TYPE_PRECOMPUTE_INIT
8067 | OPTI_TYPE_PRECOMPUTE_MERKLE
8068 | OPTI_TYPE_EARLY_SKIP
8069 | OPTI_TYPE_NOT_ITERATED
8070 | OPTI_TYPE_APPENDED_SALT
8071 | OPTI_TYPE_RAW_HASH
;
8078 case 1440: hash_type
= HASH_TYPE_SHA256
;
8079 salt_type
= SALT_TYPE_INTERN
;
8080 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8081 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8082 | OPTS_TYPE_PT_ADD80
8083 | OPTS_TYPE_PT_ADDBITS15
8084 | OPTS_TYPE_PT_UNICODE
;
8085 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8086 dgst_size
= DGST_SIZE_4_8
;
8087 parse_func
= sha256s_parse_hash
;
8088 sort_by_digest
= sort_by_digest_4_8
;
8089 opti_type
= OPTI_TYPE_ZERO_BYTE
8090 | OPTI_TYPE_PRECOMPUTE_INIT
8091 | OPTI_TYPE_PRECOMPUTE_MERKLE
8092 | OPTI_TYPE_EARLY_SKIP
8093 | OPTI_TYPE_NOT_ITERATED
8094 | OPTI_TYPE_PREPENDED_SALT
8095 | OPTI_TYPE_RAW_HASH
;
8102 case 1441: hash_type
= HASH_TYPE_SHA256
;
8103 salt_type
= SALT_TYPE_EMBEDDED
;
8104 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8105 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8106 | OPTS_TYPE_PT_ADD80
8107 | OPTS_TYPE_PT_ADDBITS15
8108 | OPTS_TYPE_PT_UNICODE
8109 | OPTS_TYPE_ST_BASE64
;
8110 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8111 dgst_size
= DGST_SIZE_4_8
;
8112 parse_func
= episerver4_parse_hash
;
8113 sort_by_digest
= sort_by_digest_4_8
;
8114 opti_type
= OPTI_TYPE_ZERO_BYTE
8115 | OPTI_TYPE_PRECOMPUTE_INIT
8116 | OPTI_TYPE_PRECOMPUTE_MERKLE
8117 | OPTI_TYPE_EARLY_SKIP
8118 | OPTI_TYPE_NOT_ITERATED
8119 | OPTI_TYPE_PREPENDED_SALT
8120 | OPTI_TYPE_RAW_HASH
;
8127 case 1450: hash_type
= HASH_TYPE_SHA256
;
8128 salt_type
= SALT_TYPE_INTERN
;
8129 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8130 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8131 | OPTS_TYPE_ST_ADD80
;
8132 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8133 dgst_size
= DGST_SIZE_4_8
;
8134 parse_func
= hmacsha256_parse_hash
;
8135 sort_by_digest
= sort_by_digest_4_8
;
8136 opti_type
= OPTI_TYPE_ZERO_BYTE
8137 | OPTI_TYPE_NOT_ITERATED
;
8144 case 1460: hash_type
= HASH_TYPE_SHA256
;
8145 salt_type
= SALT_TYPE_INTERN
;
8146 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8147 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8148 | OPTS_TYPE_PT_ADD80
8149 | OPTS_TYPE_PT_ADDBITS15
;
8150 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8151 dgst_size
= DGST_SIZE_4_8
;
8152 parse_func
= hmacsha256_parse_hash
;
8153 sort_by_digest
= sort_by_digest_4_8
;
8154 opti_type
= OPTI_TYPE_ZERO_BYTE
8155 | OPTI_TYPE_NOT_ITERATED
;
8162 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8163 salt_type
= SALT_TYPE_EMBEDDED
;
8164 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8166 | OPTS_TYPE_PT_BITSLICE
;
8167 kern_type
= KERN_TYPE_DESCRYPT
;
8168 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8169 parse_func
= descrypt_parse_hash
;
8170 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8171 opti_type
= OPTI_TYPE_ZERO_BYTE
8172 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8179 case 1600: hash_type
= HASH_TYPE_MD5
;
8180 salt_type
= SALT_TYPE_EMBEDDED
;
8181 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8182 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8183 kern_type
= KERN_TYPE_APR1CRYPT
;
8184 dgst_size
= DGST_SIZE_4_4
;
8185 parse_func
= md5apr1_parse_hash
;
8186 sort_by_digest
= sort_by_digest_4_4
;
8187 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8194 case 1700: hash_type
= HASH_TYPE_SHA512
;
8195 salt_type
= SALT_TYPE_NONE
;
8196 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8197 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8198 | OPTS_TYPE_PT_ADD80
8199 | OPTS_TYPE_PT_ADDBITS15
;
8200 kern_type
= KERN_TYPE_SHA512
;
8201 dgst_size
= DGST_SIZE_8_8
;
8202 parse_func
= sha512_parse_hash
;
8203 sort_by_digest
= sort_by_digest_8_8
;
8204 opti_type
= OPTI_TYPE_ZERO_BYTE
8205 | OPTI_TYPE_PRECOMPUTE_INIT
8206 | OPTI_TYPE_PRECOMPUTE_MERKLE
8207 | OPTI_TYPE_EARLY_SKIP
8208 | OPTI_TYPE_NOT_ITERATED
8209 | OPTI_TYPE_NOT_SALTED
8210 | OPTI_TYPE_USES_BITS_64
8211 | OPTI_TYPE_RAW_HASH
;
8218 case 1710: hash_type
= HASH_TYPE_SHA512
;
8219 salt_type
= SALT_TYPE_INTERN
;
8220 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8221 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8222 | OPTS_TYPE_ST_ADD80
8223 | OPTS_TYPE_ST_ADDBITS15
;
8224 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8225 dgst_size
= DGST_SIZE_8_8
;
8226 parse_func
= sha512s_parse_hash
;
8227 sort_by_digest
= sort_by_digest_8_8
;
8228 opti_type
= OPTI_TYPE_ZERO_BYTE
8229 | OPTI_TYPE_PRECOMPUTE_INIT
8230 | OPTI_TYPE_PRECOMPUTE_MERKLE
8231 | OPTI_TYPE_EARLY_SKIP
8232 | OPTI_TYPE_NOT_ITERATED
8233 | OPTI_TYPE_APPENDED_SALT
8234 | OPTI_TYPE_USES_BITS_64
8235 | OPTI_TYPE_RAW_HASH
;
8242 case 1711: hash_type
= HASH_TYPE_SHA512
;
8243 salt_type
= SALT_TYPE_EMBEDDED
;
8244 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8245 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8246 | OPTS_TYPE_ST_ADD80
8247 | OPTS_TYPE_ST_ADDBITS15
;
8248 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8249 dgst_size
= DGST_SIZE_8_8
;
8250 parse_func
= sha512b64s_parse_hash
;
8251 sort_by_digest
= sort_by_digest_8_8
;
8252 opti_type
= OPTI_TYPE_ZERO_BYTE
8253 | OPTI_TYPE_PRECOMPUTE_INIT
8254 | OPTI_TYPE_PRECOMPUTE_MERKLE
8255 | OPTI_TYPE_EARLY_SKIP
8256 | OPTI_TYPE_NOT_ITERATED
8257 | OPTI_TYPE_APPENDED_SALT
8258 | OPTI_TYPE_USES_BITS_64
8259 | OPTI_TYPE_RAW_HASH
;
8266 case 1720: hash_type
= HASH_TYPE_SHA512
;
8267 salt_type
= SALT_TYPE_INTERN
;
8268 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8269 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8270 | OPTS_TYPE_PT_ADD80
8271 | OPTS_TYPE_PT_ADDBITS15
;
8272 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8273 dgst_size
= DGST_SIZE_8_8
;
8274 parse_func
= sha512s_parse_hash
;
8275 sort_by_digest
= sort_by_digest_8_8
;
8276 opti_type
= OPTI_TYPE_ZERO_BYTE
8277 | OPTI_TYPE_PRECOMPUTE_INIT
8278 | OPTI_TYPE_PRECOMPUTE_MERKLE
8279 | OPTI_TYPE_EARLY_SKIP
8280 | OPTI_TYPE_NOT_ITERATED
8281 | OPTI_TYPE_PREPENDED_SALT
8282 | OPTI_TYPE_USES_BITS_64
8283 | OPTI_TYPE_RAW_HASH
;
8290 case 1722: hash_type
= HASH_TYPE_SHA512
;
8291 salt_type
= SALT_TYPE_EMBEDDED
;
8292 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8293 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8294 | OPTS_TYPE_PT_ADD80
8295 | OPTS_TYPE_PT_ADDBITS15
8297 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8298 dgst_size
= DGST_SIZE_8_8
;
8299 parse_func
= osx512_parse_hash
;
8300 sort_by_digest
= sort_by_digest_8_8
;
8301 opti_type
= OPTI_TYPE_ZERO_BYTE
8302 | OPTI_TYPE_PRECOMPUTE_INIT
8303 | OPTI_TYPE_PRECOMPUTE_MERKLE
8304 | OPTI_TYPE_EARLY_SKIP
8305 | OPTI_TYPE_NOT_ITERATED
8306 | OPTI_TYPE_PREPENDED_SALT
8307 | OPTI_TYPE_USES_BITS_64
8308 | OPTI_TYPE_RAW_HASH
;
8315 case 1730: hash_type
= HASH_TYPE_SHA512
;
8316 salt_type
= SALT_TYPE_INTERN
;
8317 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8318 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8319 | OPTS_TYPE_PT_UNICODE
8320 | OPTS_TYPE_ST_ADD80
8321 | OPTS_TYPE_ST_ADDBITS15
;
8322 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8323 dgst_size
= DGST_SIZE_8_8
;
8324 parse_func
= sha512s_parse_hash
;
8325 sort_by_digest
= sort_by_digest_8_8
;
8326 opti_type
= OPTI_TYPE_ZERO_BYTE
8327 | OPTI_TYPE_PRECOMPUTE_INIT
8328 | OPTI_TYPE_PRECOMPUTE_MERKLE
8329 | OPTI_TYPE_EARLY_SKIP
8330 | OPTI_TYPE_NOT_ITERATED
8331 | OPTI_TYPE_APPENDED_SALT
8332 | OPTI_TYPE_USES_BITS_64
8333 | OPTI_TYPE_RAW_HASH
;
8340 case 1731: hash_type
= HASH_TYPE_SHA512
;
8341 salt_type
= SALT_TYPE_EMBEDDED
;
8342 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8343 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8344 | OPTS_TYPE_PT_UNICODE
8345 | OPTS_TYPE_ST_ADD80
8346 | OPTS_TYPE_ST_ADDBITS15
8348 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8349 dgst_size
= DGST_SIZE_8_8
;
8350 parse_func
= mssql2012_parse_hash
;
8351 sort_by_digest
= sort_by_digest_8_8
;
8352 opti_type
= OPTI_TYPE_ZERO_BYTE
8353 | OPTI_TYPE_PRECOMPUTE_INIT
8354 | OPTI_TYPE_PRECOMPUTE_MERKLE
8355 | OPTI_TYPE_EARLY_SKIP
8356 | OPTI_TYPE_NOT_ITERATED
8357 | OPTI_TYPE_APPENDED_SALT
8358 | OPTI_TYPE_USES_BITS_64
8359 | OPTI_TYPE_RAW_HASH
;
8366 case 1740: hash_type
= HASH_TYPE_SHA512
;
8367 salt_type
= SALT_TYPE_INTERN
;
8368 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8369 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8370 | OPTS_TYPE_PT_ADD80
8371 | OPTS_TYPE_PT_ADDBITS15
8372 | OPTS_TYPE_PT_UNICODE
;
8373 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8374 dgst_size
= DGST_SIZE_8_8
;
8375 parse_func
= sha512s_parse_hash
;
8376 sort_by_digest
= sort_by_digest_8_8
;
8377 opti_type
= OPTI_TYPE_ZERO_BYTE
8378 | OPTI_TYPE_PRECOMPUTE_INIT
8379 | OPTI_TYPE_PRECOMPUTE_MERKLE
8380 | OPTI_TYPE_EARLY_SKIP
8381 | OPTI_TYPE_NOT_ITERATED
8382 | OPTI_TYPE_PREPENDED_SALT
8383 | OPTI_TYPE_USES_BITS_64
8384 | OPTI_TYPE_RAW_HASH
;
8391 case 1750: hash_type
= HASH_TYPE_SHA512
;
8392 salt_type
= SALT_TYPE_INTERN
;
8393 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8394 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8395 | OPTS_TYPE_ST_ADD80
;
8396 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8397 dgst_size
= DGST_SIZE_8_8
;
8398 parse_func
= hmacsha512_parse_hash
;
8399 sort_by_digest
= sort_by_digest_8_8
;
8400 opti_type
= OPTI_TYPE_ZERO_BYTE
8401 | OPTI_TYPE_USES_BITS_64
8402 | OPTI_TYPE_NOT_ITERATED
;
8409 case 1760: hash_type
= HASH_TYPE_SHA512
;
8410 salt_type
= SALT_TYPE_INTERN
;
8411 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8412 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8413 | OPTS_TYPE_PT_ADD80
8414 | OPTS_TYPE_PT_ADDBITS15
;
8415 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8416 dgst_size
= DGST_SIZE_8_8
;
8417 parse_func
= hmacsha512_parse_hash
;
8418 sort_by_digest
= sort_by_digest_8_8
;
8419 opti_type
= OPTI_TYPE_ZERO_BYTE
8420 | OPTI_TYPE_USES_BITS_64
8421 | OPTI_TYPE_NOT_ITERATED
;
8428 case 1800: hash_type
= HASH_TYPE_SHA512
;
8429 salt_type
= SALT_TYPE_EMBEDDED
;
8430 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8431 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8432 kern_type
= KERN_TYPE_SHA512CRYPT
;
8433 dgst_size
= DGST_SIZE_8_8
;
8434 parse_func
= sha512crypt_parse_hash
;
8435 sort_by_digest
= sort_by_digest_8_8
;
8436 opti_type
= OPTI_TYPE_ZERO_BYTE
8437 | OPTI_TYPE_USES_BITS_64
;
8444 case 2100: hash_type
= HASH_TYPE_DCC2
;
8445 salt_type
= SALT_TYPE_EMBEDDED
;
8446 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8447 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8448 | OPTS_TYPE_ST_LOWER
8449 | OPTS_TYPE_ST_UNICODE
;
8450 kern_type
= KERN_TYPE_DCC2
;
8451 dgst_size
= DGST_SIZE_4_4
;
8452 parse_func
= dcc2_parse_hash
;
8453 sort_by_digest
= sort_by_digest_4_4
;
8454 opti_type
= OPTI_TYPE_ZERO_BYTE
8455 | OPTI_TYPE_SLOW_HASH_SIMD
;
8462 case 2400: hash_type
= HASH_TYPE_MD5
;
8463 salt_type
= SALT_TYPE_NONE
;
8464 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8465 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8466 kern_type
= KERN_TYPE_MD5PIX
;
8467 dgst_size
= DGST_SIZE_4_4
;
8468 parse_func
= md5pix_parse_hash
;
8469 sort_by_digest
= sort_by_digest_4_4
;
8470 opti_type
= OPTI_TYPE_ZERO_BYTE
8471 | OPTI_TYPE_PRECOMPUTE_INIT
8472 | OPTI_TYPE_PRECOMPUTE_MERKLE
8473 | OPTI_TYPE_EARLY_SKIP
8474 | OPTI_TYPE_NOT_ITERATED
8475 | OPTI_TYPE_NOT_SALTED
;
8482 case 2410: hash_type
= HASH_TYPE_MD5
;
8483 salt_type
= SALT_TYPE_INTERN
;
8484 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8485 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8486 kern_type
= KERN_TYPE_MD5ASA
;
8487 dgst_size
= DGST_SIZE_4_4
;
8488 parse_func
= md5asa_parse_hash
;
8489 sort_by_digest
= sort_by_digest_4_4
;
8490 opti_type
= OPTI_TYPE_ZERO_BYTE
8491 | OPTI_TYPE_PRECOMPUTE_INIT
8492 | OPTI_TYPE_PRECOMPUTE_MERKLE
8493 | OPTI_TYPE_EARLY_SKIP
8494 | OPTI_TYPE_NOT_ITERATED
;
8501 case 2500: hash_type
= HASH_TYPE_WPA
;
8502 salt_type
= SALT_TYPE_EMBEDDED
;
8503 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8504 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8505 kern_type
= KERN_TYPE_WPA
;
8506 dgst_size
= DGST_SIZE_4_4
;
8507 parse_func
= wpa_parse_hash
;
8508 sort_by_digest
= sort_by_digest_4_4
;
8509 opti_type
= OPTI_TYPE_ZERO_BYTE
8510 | OPTI_TYPE_SLOW_HASH_SIMD
;
8517 case 2600: hash_type
= HASH_TYPE_MD5
;
8518 salt_type
= SALT_TYPE_VIRTUAL
;
8519 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8520 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8521 | OPTS_TYPE_PT_ADD80
8522 | OPTS_TYPE_PT_ADDBITS14
8523 | OPTS_TYPE_ST_ADD80
;
8524 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8525 dgst_size
= DGST_SIZE_4_4
;
8526 parse_func
= md5md5_parse_hash
;
8527 sort_by_digest
= sort_by_digest_4_4
;
8528 opti_type
= OPTI_TYPE_ZERO_BYTE
8529 | OPTI_TYPE_PRECOMPUTE_INIT
8530 | OPTI_TYPE_PRECOMPUTE_MERKLE
8531 | OPTI_TYPE_EARLY_SKIP
;
8538 case 2611: hash_type
= HASH_TYPE_MD5
;
8539 salt_type
= SALT_TYPE_INTERN
;
8540 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8541 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8542 | OPTS_TYPE_PT_ADD80
8543 | OPTS_TYPE_PT_ADDBITS14
8544 | OPTS_TYPE_ST_ADD80
;
8545 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8546 dgst_size
= DGST_SIZE_4_4
;
8547 parse_func
= vb3_parse_hash
;
8548 sort_by_digest
= sort_by_digest_4_4
;
8549 opti_type
= OPTI_TYPE_ZERO_BYTE
8550 | OPTI_TYPE_PRECOMPUTE_INIT
8551 | OPTI_TYPE_PRECOMPUTE_MERKLE
8552 | OPTI_TYPE_EARLY_SKIP
;
8559 case 2612: hash_type
= HASH_TYPE_MD5
;
8560 salt_type
= SALT_TYPE_EMBEDDED
;
8561 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8563 | OPTS_TYPE_PT_ADD80
8564 | OPTS_TYPE_PT_ADDBITS14
8565 | OPTS_TYPE_ST_ADD80
8567 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8568 dgst_size
= DGST_SIZE_4_4
;
8569 parse_func
= phps_parse_hash
;
8570 sort_by_digest
= sort_by_digest_4_4
;
8571 opti_type
= OPTI_TYPE_ZERO_BYTE
8572 | OPTI_TYPE_PRECOMPUTE_INIT
8573 | OPTI_TYPE_PRECOMPUTE_MERKLE
8574 | OPTI_TYPE_EARLY_SKIP
;
8581 case 2711: hash_type
= HASH_TYPE_MD5
;
8582 salt_type
= SALT_TYPE_INTERN
;
8583 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8584 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8585 | OPTS_TYPE_PT_ADD80
8586 | OPTS_TYPE_PT_ADDBITS14
8587 | OPTS_TYPE_ST_ADD80
;
8588 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8589 dgst_size
= DGST_SIZE_4_4
;
8590 parse_func
= vb30_parse_hash
;
8591 sort_by_digest
= sort_by_digest_4_4
;
8592 opti_type
= OPTI_TYPE_ZERO_BYTE
8593 | OPTI_TYPE_PRECOMPUTE_INIT
8594 | OPTI_TYPE_EARLY_SKIP
;
8601 case 2811: hash_type
= HASH_TYPE_MD5
;
8602 salt_type
= SALT_TYPE_INTERN
;
8603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8605 | OPTS_TYPE_PT_ADD80
8606 | OPTS_TYPE_PT_ADDBITS14
;
8607 kern_type
= KERN_TYPE_MD55_SLTPW
;
8608 dgst_size
= DGST_SIZE_4_4
;
8609 parse_func
= ipb2_parse_hash
;
8610 sort_by_digest
= sort_by_digest_4_4
;
8611 opti_type
= OPTI_TYPE_ZERO_BYTE
8612 | OPTI_TYPE_PRECOMPUTE_INIT
8613 | OPTI_TYPE_EARLY_SKIP
;
8620 case 3000: hash_type
= HASH_TYPE_LM
;
8621 salt_type
= SALT_TYPE_NONE
;
8622 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8623 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8624 | OPTS_TYPE_PT_UPPER
8625 | OPTS_TYPE_PT_BITSLICE
;
8626 kern_type
= KERN_TYPE_LM
;
8627 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8628 parse_func
= lm_parse_hash
;
8629 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8630 opti_type
= OPTI_TYPE_ZERO_BYTE
8631 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8638 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
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_UPPER
8643 | OPTS_TYPE_ST_UPPER
;
8644 kern_type
= KERN_TYPE_ORACLEH
;
8645 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8646 parse_func
= oracleh_parse_hash
;
8647 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8648 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8655 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8656 salt_type
= SALT_TYPE_EMBEDDED
;
8657 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8658 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8659 | OPTS_TYPE_ST_GENERATE_LE
;
8660 kern_type
= KERN_TYPE_BCRYPT
;
8661 dgst_size
= DGST_SIZE_4_6
;
8662 parse_func
= bcrypt_parse_hash
;
8663 sort_by_digest
= sort_by_digest_4_6
;
8664 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8671 case 3710: hash_type
= HASH_TYPE_MD5
;
8672 salt_type
= SALT_TYPE_INTERN
;
8673 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8674 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8675 | OPTS_TYPE_PT_ADD80
8676 | OPTS_TYPE_PT_ADDBITS14
;
8677 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8678 dgst_size
= DGST_SIZE_4_4
;
8679 parse_func
= md5s_parse_hash
;
8680 sort_by_digest
= sort_by_digest_4_4
;
8681 opti_type
= OPTI_TYPE_ZERO_BYTE
8682 | OPTI_TYPE_PRECOMPUTE_INIT
8683 | OPTI_TYPE_PRECOMPUTE_MERKLE
8684 | OPTI_TYPE_EARLY_SKIP
;
8691 case 3711: hash_type
= HASH_TYPE_MD5
;
8692 salt_type
= SALT_TYPE_EMBEDDED
;
8693 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8694 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8695 | OPTS_TYPE_PT_ADD80
8696 | OPTS_TYPE_PT_ADDBITS14
;
8697 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8698 dgst_size
= DGST_SIZE_4_4
;
8699 parse_func
= mediawiki_b_parse_hash
;
8700 sort_by_digest
= sort_by_digest_4_4
;
8701 opti_type
= OPTI_TYPE_ZERO_BYTE
8702 | OPTI_TYPE_PRECOMPUTE_INIT
8703 | OPTI_TYPE_PRECOMPUTE_MERKLE
8704 | OPTI_TYPE_EARLY_SKIP
;
8711 case 3800: hash_type
= HASH_TYPE_MD5
;
8712 salt_type
= SALT_TYPE_INTERN
;
8713 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8714 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8715 | OPTS_TYPE_ST_ADDBITS14
;
8716 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8717 dgst_size
= DGST_SIZE_4_4
;
8718 parse_func
= md5s_parse_hash
;
8719 sort_by_digest
= sort_by_digest_4_4
;
8720 opti_type
= OPTI_TYPE_ZERO_BYTE
8721 | OPTI_TYPE_PRECOMPUTE_INIT
8722 | OPTI_TYPE_PRECOMPUTE_MERKLE
8723 | OPTI_TYPE_EARLY_SKIP
8724 | OPTI_TYPE_NOT_ITERATED
8725 | OPTI_TYPE_RAW_HASH
;
8732 case 4300: hash_type
= HASH_TYPE_MD5
;
8733 salt_type
= SALT_TYPE_VIRTUAL
;
8734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8735 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8736 | OPTS_TYPE_PT_ADD80
8737 | OPTS_TYPE_PT_ADDBITS14
8738 | OPTS_TYPE_ST_ADD80
;
8739 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8740 dgst_size
= DGST_SIZE_4_4
;
8741 parse_func
= md5md5_parse_hash
;
8742 sort_by_digest
= sort_by_digest_4_4
;
8743 opti_type
= OPTI_TYPE_ZERO_BYTE
8744 | OPTI_TYPE_PRECOMPUTE_INIT
8745 | OPTI_TYPE_PRECOMPUTE_MERKLE
8746 | OPTI_TYPE_EARLY_SKIP
;
8754 case 4400: hash_type
= HASH_TYPE_MD5
;
8755 salt_type
= SALT_TYPE_NONE
;
8756 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8757 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8758 | OPTS_TYPE_PT_ADD80
8759 | OPTS_TYPE_PT_ADDBITS15
;
8760 kern_type
= KERN_TYPE_MD5_SHA1
;
8761 dgst_size
= DGST_SIZE_4_4
;
8762 parse_func
= md5_parse_hash
;
8763 sort_by_digest
= sort_by_digest_4_4
;
8764 opti_type
= OPTI_TYPE_ZERO_BYTE
8765 | OPTI_TYPE_PRECOMPUTE_INIT
8766 | OPTI_TYPE_PRECOMPUTE_MERKLE
8767 | OPTI_TYPE_EARLY_SKIP
8768 | OPTI_TYPE_NOT_ITERATED
8769 | OPTI_TYPE_NOT_SALTED
8770 | OPTI_TYPE_RAW_HASH
;
8777 case 4500: hash_type
= HASH_TYPE_SHA1
;
8778 salt_type
= SALT_TYPE_NONE
;
8779 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8780 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8781 | OPTS_TYPE_PT_ADD80
8782 | OPTS_TYPE_PT_ADDBITS15
;
8783 kern_type
= KERN_TYPE_SHA11
;
8784 dgst_size
= DGST_SIZE_4_5
;
8785 parse_func
= sha1_parse_hash
;
8786 sort_by_digest
= sort_by_digest_4_5
;
8787 opti_type
= OPTI_TYPE_ZERO_BYTE
8788 | OPTI_TYPE_PRECOMPUTE_INIT
8789 | OPTI_TYPE_PRECOMPUTE_MERKLE
8790 | OPTI_TYPE_EARLY_SKIP
8791 | OPTI_TYPE_NOT_SALTED
;
8798 case 4700: hash_type
= HASH_TYPE_SHA1
;
8799 salt_type
= SALT_TYPE_NONE
;
8800 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8801 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8802 | OPTS_TYPE_PT_ADD80
8803 | OPTS_TYPE_PT_ADDBITS14
;
8804 kern_type
= KERN_TYPE_SHA1_MD5
;
8805 dgst_size
= DGST_SIZE_4_5
;
8806 parse_func
= sha1_parse_hash
;
8807 sort_by_digest
= sort_by_digest_4_5
;
8808 opti_type
= OPTI_TYPE_ZERO_BYTE
8809 | OPTI_TYPE_PRECOMPUTE_INIT
8810 | OPTI_TYPE_PRECOMPUTE_MERKLE
8811 | OPTI_TYPE_EARLY_SKIP
8812 | OPTI_TYPE_NOT_ITERATED
8813 | OPTI_TYPE_NOT_SALTED
8814 | OPTI_TYPE_RAW_HASH
;
8821 case 4800: hash_type
= HASH_TYPE_MD5
;
8822 salt_type
= SALT_TYPE_EMBEDDED
;
8823 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8824 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8825 | OPTS_TYPE_PT_ADDBITS14
;
8826 kern_type
= KERN_TYPE_MD5_CHAP
;
8827 dgst_size
= DGST_SIZE_4_4
;
8828 parse_func
= chap_parse_hash
;
8829 sort_by_digest
= sort_by_digest_4_4
;
8830 opti_type
= OPTI_TYPE_ZERO_BYTE
8831 | OPTI_TYPE_PRECOMPUTE_INIT
8832 | OPTI_TYPE_PRECOMPUTE_MERKLE
8833 | OPTI_TYPE_MEET_IN_MIDDLE
8834 | OPTI_TYPE_EARLY_SKIP
8835 | OPTI_TYPE_NOT_ITERATED
8836 | OPTI_TYPE_RAW_HASH
;
8843 case 4900: hash_type
= HASH_TYPE_SHA1
;
8844 salt_type
= SALT_TYPE_INTERN
;
8845 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8846 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8847 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8848 dgst_size
= DGST_SIZE_4_5
;
8849 parse_func
= sha1s_parse_hash
;
8850 sort_by_digest
= sort_by_digest_4_5
;
8851 opti_type
= OPTI_TYPE_ZERO_BYTE
8852 | OPTI_TYPE_PRECOMPUTE_INIT
8853 | OPTI_TYPE_PRECOMPUTE_MERKLE
8854 | OPTI_TYPE_EARLY_SKIP
;
8861 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8862 salt_type
= SALT_TYPE_EMBEDDED
;
8863 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8864 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8865 | OPTS_TYPE_PT_ADD01
;
8866 kern_type
= KERN_TYPE_KECCAK
;
8867 dgst_size
= DGST_SIZE_8_25
;
8868 parse_func
= keccak_parse_hash
;
8869 sort_by_digest
= sort_by_digest_8_25
;
8870 opti_type
= OPTI_TYPE_ZERO_BYTE
8871 | OPTI_TYPE_USES_BITS_64
8872 | OPTI_TYPE_RAW_HASH
;
8879 case 5100: hash_type
= HASH_TYPE_MD5H
;
8880 salt_type
= SALT_TYPE_NONE
;
8881 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8882 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8883 | OPTS_TYPE_PT_ADD80
8884 | OPTS_TYPE_PT_ADDBITS14
;
8885 kern_type
= KERN_TYPE_MD5H
;
8886 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8887 parse_func
= md5half_parse_hash
;
8888 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8889 opti_type
= OPTI_TYPE_ZERO_BYTE
8890 | OPTI_TYPE_RAW_HASH
;
8897 case 5200: hash_type
= HASH_TYPE_SHA256
;
8898 salt_type
= SALT_TYPE_EMBEDDED
;
8899 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8901 kern_type
= KERN_TYPE_PSAFE3
;
8902 dgst_size
= DGST_SIZE_4_8
;
8903 parse_func
= psafe3_parse_hash
;
8904 sort_by_digest
= sort_by_digest_4_8
;
8905 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8912 case 5300: hash_type
= HASH_TYPE_MD5
;
8913 salt_type
= SALT_TYPE_EMBEDDED
;
8914 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8915 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8916 | OPTS_TYPE_ST_ADD80
;
8917 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8918 dgst_size
= DGST_SIZE_4_4
;
8919 parse_func
= ikepsk_md5_parse_hash
;
8920 sort_by_digest
= sort_by_digest_4_4
;
8921 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8928 case 5400: hash_type
= HASH_TYPE_SHA1
;
8929 salt_type
= SALT_TYPE_EMBEDDED
;
8930 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8931 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8932 | OPTS_TYPE_ST_ADD80
;
8933 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8934 dgst_size
= DGST_SIZE_4_5
;
8935 parse_func
= ikepsk_sha1_parse_hash
;
8936 sort_by_digest
= sort_by_digest_4_5
;
8937 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8944 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8945 salt_type
= SALT_TYPE_EMBEDDED
;
8946 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8947 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8948 | OPTS_TYPE_PT_ADD80
8949 | OPTS_TYPE_PT_ADDBITS14
8950 | OPTS_TYPE_PT_UNICODE
8952 kern_type
= KERN_TYPE_NETNTLMv1
;
8953 dgst_size
= DGST_SIZE_4_4
;
8954 parse_func
= netntlmv1_parse_hash
;
8955 sort_by_digest
= sort_by_digest_4_4
;
8956 opti_type
= OPTI_TYPE_ZERO_BYTE
8957 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8964 case 5600: hash_type
= HASH_TYPE_MD5
;
8965 salt_type
= SALT_TYPE_EMBEDDED
;
8966 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8967 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8968 | OPTS_TYPE_PT_ADD80
8969 | OPTS_TYPE_PT_ADDBITS14
8970 | OPTS_TYPE_PT_UNICODE
;
8971 kern_type
= KERN_TYPE_NETNTLMv2
;
8972 dgst_size
= DGST_SIZE_4_4
;
8973 parse_func
= netntlmv2_parse_hash
;
8974 sort_by_digest
= sort_by_digest_4_4
;
8975 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8982 case 5700: hash_type
= HASH_TYPE_SHA256
;
8983 salt_type
= SALT_TYPE_NONE
;
8984 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8985 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8986 | OPTS_TYPE_PT_ADD80
8987 | OPTS_TYPE_PT_ADDBITS15
;
8988 kern_type
= KERN_TYPE_SHA256
;
8989 dgst_size
= DGST_SIZE_4_8
;
8990 parse_func
= cisco4_parse_hash
;
8991 sort_by_digest
= sort_by_digest_4_8
;
8992 opti_type
= OPTI_TYPE_ZERO_BYTE
8993 | OPTI_TYPE_PRECOMPUTE_INIT
8994 | OPTI_TYPE_PRECOMPUTE_MERKLE
8995 | OPTI_TYPE_EARLY_SKIP
8996 | OPTI_TYPE_NOT_ITERATED
8997 | OPTI_TYPE_NOT_SALTED
8998 | OPTI_TYPE_RAW_HASH
;
9005 case 5800: hash_type
= HASH_TYPE_SHA1
;
9006 salt_type
= SALT_TYPE_INTERN
;
9007 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9008 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9009 | OPTS_TYPE_ST_ADD80
;
9010 kern_type
= KERN_TYPE_ANDROIDPIN
;
9011 dgst_size
= DGST_SIZE_4_5
;
9012 parse_func
= androidpin_parse_hash
;
9013 sort_by_digest
= sort_by_digest_4_5
;
9014 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9021 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9022 salt_type
= SALT_TYPE_NONE
;
9023 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9025 | OPTS_TYPE_PT_ADD80
;
9026 kern_type
= KERN_TYPE_RIPEMD160
;
9027 dgst_size
= DGST_SIZE_4_5
;
9028 parse_func
= ripemd160_parse_hash
;
9029 sort_by_digest
= sort_by_digest_4_5
;
9030 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9037 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9038 salt_type
= SALT_TYPE_NONE
;
9039 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9040 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9041 | OPTS_TYPE_PT_ADD80
;
9042 kern_type
= KERN_TYPE_WHIRLPOOL
;
9043 dgst_size
= DGST_SIZE_4_16
;
9044 parse_func
= whirlpool_parse_hash
;
9045 sort_by_digest
= sort_by_digest_4_16
;
9046 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9053 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9054 salt_type
= SALT_TYPE_EMBEDDED
;
9055 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9056 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9057 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9058 dgst_size
= DGST_SIZE_4_5
;
9059 parse_func
= truecrypt_parse_hash_2k
;
9060 sort_by_digest
= sort_by_digest_4_5
;
9061 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9068 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9069 salt_type
= SALT_TYPE_EMBEDDED
;
9070 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9071 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9072 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9073 dgst_size
= DGST_SIZE_4_5
;
9074 parse_func
= truecrypt_parse_hash_2k
;
9075 sort_by_digest
= sort_by_digest_4_5
;
9076 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9083 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9084 salt_type
= SALT_TYPE_EMBEDDED
;
9085 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9086 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9087 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9088 dgst_size
= DGST_SIZE_4_5
;
9089 parse_func
= truecrypt_parse_hash_2k
;
9090 sort_by_digest
= sort_by_digest_4_5
;
9091 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9098 case 6221: hash_type
= HASH_TYPE_SHA512
;
9099 salt_type
= SALT_TYPE_EMBEDDED
;
9100 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9101 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9102 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9103 dgst_size
= DGST_SIZE_8_8
;
9104 parse_func
= truecrypt_parse_hash_1k
;
9105 sort_by_digest
= sort_by_digest_8_8
;
9106 opti_type
= OPTI_TYPE_ZERO_BYTE
9107 | OPTI_TYPE_USES_BITS_64
;
9114 case 6222: hash_type
= HASH_TYPE_SHA512
;
9115 salt_type
= SALT_TYPE_EMBEDDED
;
9116 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9117 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9118 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9119 dgst_size
= DGST_SIZE_8_8
;
9120 parse_func
= truecrypt_parse_hash_1k
;
9121 sort_by_digest
= sort_by_digest_8_8
;
9122 opti_type
= OPTI_TYPE_ZERO_BYTE
9123 | OPTI_TYPE_USES_BITS_64
;
9130 case 6223: hash_type
= HASH_TYPE_SHA512
;
9131 salt_type
= SALT_TYPE_EMBEDDED
;
9132 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9133 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9134 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9135 dgst_size
= DGST_SIZE_8_8
;
9136 parse_func
= truecrypt_parse_hash_1k
;
9137 sort_by_digest
= sort_by_digest_8_8
;
9138 opti_type
= OPTI_TYPE_ZERO_BYTE
9139 | OPTI_TYPE_USES_BITS_64
;
9146 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9147 salt_type
= SALT_TYPE_EMBEDDED
;
9148 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9149 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9150 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9151 dgst_size
= DGST_SIZE_4_8
;
9152 parse_func
= truecrypt_parse_hash_1k
;
9153 sort_by_digest
= sort_by_digest_4_8
;
9154 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9161 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9162 salt_type
= SALT_TYPE_EMBEDDED
;
9163 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9164 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9165 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9166 dgst_size
= DGST_SIZE_4_8
;
9167 parse_func
= truecrypt_parse_hash_1k
;
9168 sort_by_digest
= sort_by_digest_4_8
;
9169 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9176 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9177 salt_type
= SALT_TYPE_EMBEDDED
;
9178 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9179 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9180 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9181 dgst_size
= DGST_SIZE_4_8
;
9182 parse_func
= truecrypt_parse_hash_1k
;
9183 sort_by_digest
= sort_by_digest_4_8
;
9184 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9191 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9192 salt_type
= SALT_TYPE_EMBEDDED
;
9193 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9194 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9195 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9196 dgst_size
= DGST_SIZE_4_5
;
9197 parse_func
= truecrypt_parse_hash_1k
;
9198 sort_by_digest
= sort_by_digest_4_5
;
9199 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9206 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9207 salt_type
= SALT_TYPE_EMBEDDED
;
9208 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9210 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9211 dgst_size
= DGST_SIZE_4_5
;
9212 parse_func
= truecrypt_parse_hash_1k
;
9213 sort_by_digest
= sort_by_digest_4_5
;
9214 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9221 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9222 salt_type
= SALT_TYPE_EMBEDDED
;
9223 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9224 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9225 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9226 dgst_size
= DGST_SIZE_4_5
;
9227 parse_func
= truecrypt_parse_hash_1k
;
9228 sort_by_digest
= sort_by_digest_4_5
;
9229 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9236 case 6300: hash_type
= HASH_TYPE_MD5
;
9237 salt_type
= SALT_TYPE_EMBEDDED
;
9238 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9239 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9240 kern_type
= KERN_TYPE_MD5AIX
;
9241 dgst_size
= DGST_SIZE_4_4
;
9242 parse_func
= md5aix_parse_hash
;
9243 sort_by_digest
= sort_by_digest_4_4
;
9244 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9251 case 6400: hash_type
= HASH_TYPE_SHA256
;
9252 salt_type
= SALT_TYPE_EMBEDDED
;
9253 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9254 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9255 kern_type
= KERN_TYPE_SHA256AIX
;
9256 dgst_size
= DGST_SIZE_4_8
;
9257 parse_func
= sha256aix_parse_hash
;
9258 sort_by_digest
= sort_by_digest_4_8
;
9259 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9266 case 6500: hash_type
= HASH_TYPE_SHA512
;
9267 salt_type
= SALT_TYPE_EMBEDDED
;
9268 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9269 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9270 kern_type
= KERN_TYPE_SHA512AIX
;
9271 dgst_size
= DGST_SIZE_8_8
;
9272 parse_func
= sha512aix_parse_hash
;
9273 sort_by_digest
= sort_by_digest_8_8
;
9274 opti_type
= OPTI_TYPE_ZERO_BYTE
9275 | OPTI_TYPE_USES_BITS_64
;
9282 case 6600: hash_type
= HASH_TYPE_AES
;
9283 salt_type
= SALT_TYPE_EMBEDDED
;
9284 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9285 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9286 kern_type
= KERN_TYPE_AGILEKEY
;
9287 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9288 parse_func
= agilekey_parse_hash
;
9289 sort_by_digest
= sort_by_digest_4_5
;
9290 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9297 case 6700: hash_type
= HASH_TYPE_SHA1
;
9298 salt_type
= SALT_TYPE_EMBEDDED
;
9299 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9301 kern_type
= KERN_TYPE_SHA1AIX
;
9302 dgst_size
= DGST_SIZE_4_5
;
9303 parse_func
= sha1aix_parse_hash
;
9304 sort_by_digest
= sort_by_digest_4_5
;
9305 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9312 case 6800: hash_type
= HASH_TYPE_AES
;
9313 salt_type
= SALT_TYPE_EMBEDDED
;
9314 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9315 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9316 kern_type
= KERN_TYPE_LASTPASS
;
9317 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9318 parse_func
= lastpass_parse_hash
;
9319 sort_by_digest
= sort_by_digest_4_8
;
9320 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9327 case 6900: hash_type
= HASH_TYPE_GOST
;
9328 salt_type
= SALT_TYPE_NONE
;
9329 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9330 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9331 kern_type
= KERN_TYPE_GOST
;
9332 dgst_size
= DGST_SIZE_4_8
;
9333 parse_func
= gost_parse_hash
;
9334 sort_by_digest
= sort_by_digest_4_8
;
9335 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9342 case 7100: hash_type
= HASH_TYPE_SHA512
;
9343 salt_type
= SALT_TYPE_EMBEDDED
;
9344 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9345 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9346 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9347 dgst_size
= DGST_SIZE_8_16
;
9348 parse_func
= sha512osx_parse_hash
;
9349 sort_by_digest
= sort_by_digest_8_16
;
9350 opti_type
= OPTI_TYPE_ZERO_BYTE
9351 | OPTI_TYPE_USES_BITS_64
9352 | OPTI_TYPE_SLOW_HASH_SIMD
;
9359 case 7200: hash_type
= HASH_TYPE_SHA512
;
9360 salt_type
= SALT_TYPE_EMBEDDED
;
9361 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9363 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9364 dgst_size
= DGST_SIZE_8_16
;
9365 parse_func
= sha512grub_parse_hash
;
9366 sort_by_digest
= sort_by_digest_8_16
;
9367 opti_type
= OPTI_TYPE_ZERO_BYTE
9368 | OPTI_TYPE_USES_BITS_64
9369 | OPTI_TYPE_SLOW_HASH_SIMD
;
9376 case 7300: hash_type
= HASH_TYPE_SHA1
;
9377 salt_type
= SALT_TYPE_EMBEDDED
;
9378 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9379 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9380 | OPTS_TYPE_ST_ADD80
9381 | OPTS_TYPE_ST_ADDBITS15
;
9382 kern_type
= KERN_TYPE_RAKP
;
9383 dgst_size
= DGST_SIZE_4_5
;
9384 parse_func
= rakp_parse_hash
;
9385 sort_by_digest
= sort_by_digest_4_5
;
9386 opti_type
= OPTI_TYPE_ZERO_BYTE
9387 | OPTI_TYPE_NOT_ITERATED
;
9394 case 7400: hash_type
= HASH_TYPE_SHA256
;
9395 salt_type
= SALT_TYPE_EMBEDDED
;
9396 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9397 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9398 kern_type
= KERN_TYPE_SHA256CRYPT
;
9399 dgst_size
= DGST_SIZE_4_8
;
9400 parse_func
= sha256crypt_parse_hash
;
9401 sort_by_digest
= sort_by_digest_4_8
;
9402 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9409 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9410 salt_type
= SALT_TYPE_EMBEDDED
;
9411 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9412 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9413 kern_type
= KERN_TYPE_KRB5PA
;
9414 dgst_size
= DGST_SIZE_4_4
;
9415 parse_func
= krb5pa_parse_hash
;
9416 sort_by_digest
= sort_by_digest_4_4
;
9417 opti_type
= OPTI_TYPE_ZERO_BYTE
9418 | OPTI_TYPE_NOT_ITERATED
;
9425 case 7600: hash_type
= HASH_TYPE_SHA1
;
9426 salt_type
= SALT_TYPE_INTERN
;
9427 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9428 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9429 | OPTS_TYPE_PT_ADD80
9430 | OPTS_TYPE_PT_ADDBITS15
;
9431 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9432 dgst_size
= DGST_SIZE_4_5
;
9433 parse_func
= redmine_parse_hash
;
9434 sort_by_digest
= sort_by_digest_4_5
;
9435 opti_type
= OPTI_TYPE_ZERO_BYTE
9436 | OPTI_TYPE_PRECOMPUTE_INIT
9437 | OPTI_TYPE_EARLY_SKIP
9438 | OPTI_TYPE_NOT_ITERATED
9439 | OPTI_TYPE_PREPENDED_SALT
;
9446 case 7700: hash_type
= HASH_TYPE_SAPB
;
9447 salt_type
= SALT_TYPE_EMBEDDED
;
9448 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9449 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9450 | OPTS_TYPE_PT_UPPER
9451 | OPTS_TYPE_ST_UPPER
;
9452 kern_type
= KERN_TYPE_SAPB
;
9453 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9454 parse_func
= sapb_parse_hash
;
9455 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9456 opti_type
= OPTI_TYPE_ZERO_BYTE
9457 | OPTI_TYPE_PRECOMPUTE_INIT
9458 | OPTI_TYPE_NOT_ITERATED
;
9465 case 7800: hash_type
= HASH_TYPE_SAPG
;
9466 salt_type
= SALT_TYPE_EMBEDDED
;
9467 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9468 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9469 | OPTS_TYPE_ST_ADD80
9470 | OPTS_TYPE_ST_UPPER
;
9471 kern_type
= KERN_TYPE_SAPG
;
9472 dgst_size
= DGST_SIZE_4_5
;
9473 parse_func
= sapg_parse_hash
;
9474 sort_by_digest
= sort_by_digest_4_5
;
9475 opti_type
= OPTI_TYPE_ZERO_BYTE
9476 | OPTI_TYPE_PRECOMPUTE_INIT
9477 | OPTI_TYPE_NOT_ITERATED
;
9484 case 7900: hash_type
= HASH_TYPE_SHA512
;
9485 salt_type
= SALT_TYPE_EMBEDDED
;
9486 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9488 kern_type
= KERN_TYPE_DRUPAL7
;
9489 dgst_size
= DGST_SIZE_8_8
;
9490 parse_func
= drupal7_parse_hash
;
9491 sort_by_digest
= sort_by_digest_8_8
;
9492 opti_type
= OPTI_TYPE_ZERO_BYTE
9493 | OPTI_TYPE_USES_BITS_64
;
9500 case 8000: hash_type
= HASH_TYPE_SHA256
;
9501 salt_type
= SALT_TYPE_EMBEDDED
;
9502 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9503 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9504 | OPTS_TYPE_PT_UNICODE
9505 | OPTS_TYPE_ST_ADD80
9507 kern_type
= KERN_TYPE_SYBASEASE
;
9508 dgst_size
= DGST_SIZE_4_8
;
9509 parse_func
= sybasease_parse_hash
;
9510 sort_by_digest
= sort_by_digest_4_8
;
9511 opti_type
= OPTI_TYPE_ZERO_BYTE
9512 | OPTI_TYPE_PRECOMPUTE_INIT
9513 | OPTI_TYPE_EARLY_SKIP
9514 | OPTI_TYPE_NOT_ITERATED
9515 | OPTI_TYPE_RAW_HASH
;
9522 case 8100: hash_type
= HASH_TYPE_SHA1
;
9523 salt_type
= SALT_TYPE_EMBEDDED
;
9524 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9525 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9526 kern_type
= KERN_TYPE_NETSCALER
;
9527 dgst_size
= DGST_SIZE_4_5
;
9528 parse_func
= netscaler_parse_hash
;
9529 sort_by_digest
= sort_by_digest_4_5
;
9530 opti_type
= OPTI_TYPE_ZERO_BYTE
9531 | OPTI_TYPE_PRECOMPUTE_INIT
9532 | OPTI_TYPE_PRECOMPUTE_MERKLE
9533 | OPTI_TYPE_EARLY_SKIP
9534 | OPTI_TYPE_NOT_ITERATED
9535 | OPTI_TYPE_PREPENDED_SALT
9536 | OPTI_TYPE_RAW_HASH
;
9543 case 8200: hash_type
= HASH_TYPE_SHA256
;
9544 salt_type
= SALT_TYPE_EMBEDDED
;
9545 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9546 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9547 kern_type
= KERN_TYPE_CLOUDKEY
;
9548 dgst_size
= DGST_SIZE_4_8
;
9549 parse_func
= cloudkey_parse_hash
;
9550 sort_by_digest
= sort_by_digest_4_8
;
9551 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9558 case 8300: hash_type
= HASH_TYPE_SHA1
;
9559 salt_type
= SALT_TYPE_EMBEDDED
;
9560 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9561 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9563 | OPTS_TYPE_ST_ADD80
;
9564 kern_type
= KERN_TYPE_NSEC3
;
9565 dgst_size
= DGST_SIZE_4_5
;
9566 parse_func
= nsec3_parse_hash
;
9567 sort_by_digest
= sort_by_digest_4_5
;
9568 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9575 case 8400: hash_type
= HASH_TYPE_SHA1
;
9576 salt_type
= SALT_TYPE_INTERN
;
9577 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9578 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9579 | OPTS_TYPE_PT_ADD80
9580 | OPTS_TYPE_PT_ADDBITS15
;
9581 kern_type
= KERN_TYPE_WBB3
;
9582 dgst_size
= DGST_SIZE_4_5
;
9583 parse_func
= wbb3_parse_hash
;
9584 sort_by_digest
= sort_by_digest_4_5
;
9585 opti_type
= OPTI_TYPE_ZERO_BYTE
9586 | OPTI_TYPE_PRECOMPUTE_INIT
9587 | OPTI_TYPE_NOT_ITERATED
;
9594 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9595 salt_type
= SALT_TYPE_EMBEDDED
;
9596 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9597 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9598 | OPTS_TYPE_ST_UPPER
;
9599 kern_type
= KERN_TYPE_RACF
;
9600 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9601 parse_func
= racf_parse_hash
;
9602 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9603 opti_type
= OPTI_TYPE_ZERO_BYTE
9604 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9611 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9612 salt_type
= SALT_TYPE_NONE
;
9613 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9614 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9615 kern_type
= KERN_TYPE_LOTUS5
;
9616 dgst_size
= DGST_SIZE_4_4
;
9617 parse_func
= lotus5_parse_hash
;
9618 sort_by_digest
= sort_by_digest_4_4
;
9619 opti_type
= OPTI_TYPE_EARLY_SKIP
9620 | OPTI_TYPE_NOT_ITERATED
9621 | OPTI_TYPE_NOT_SALTED
9622 | OPTI_TYPE_RAW_HASH
;
9629 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9630 salt_type
= SALT_TYPE_EMBEDDED
;
9631 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9632 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9633 kern_type
= KERN_TYPE_LOTUS6
;
9634 dgst_size
= DGST_SIZE_4_4
;
9635 parse_func
= lotus6_parse_hash
;
9636 sort_by_digest
= sort_by_digest_4_4
;
9637 opti_type
= OPTI_TYPE_EARLY_SKIP
9638 | OPTI_TYPE_NOT_ITERATED
9639 | OPTI_TYPE_RAW_HASH
;
9646 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9647 salt_type
= SALT_TYPE_EMBEDDED
;
9648 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9649 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9650 kern_type
= KERN_TYPE_ANDROIDFDE
;
9651 dgst_size
= DGST_SIZE_4_4
;
9652 parse_func
= androidfde_parse_hash
;
9653 sort_by_digest
= sort_by_digest_4_4
;
9654 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9661 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9662 salt_type
= SALT_TYPE_EMBEDDED
;
9663 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9664 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9665 kern_type
= KERN_TYPE_SCRYPT
;
9666 dgst_size
= DGST_SIZE_4_8
;
9667 parse_func
= scrypt_parse_hash
;
9668 sort_by_digest
= sort_by_digest_4_8
;
9669 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9676 case 9000: hash_type
= HASH_TYPE_SHA1
;
9677 salt_type
= SALT_TYPE_EMBEDDED
;
9678 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9679 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9680 | OPTS_TYPE_ST_GENERATE_LE
;
9681 kern_type
= KERN_TYPE_PSAFE2
;
9682 dgst_size
= DGST_SIZE_4_5
;
9683 parse_func
= psafe2_parse_hash
;
9684 sort_by_digest
= sort_by_digest_4_5
;
9685 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9692 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9693 salt_type
= SALT_TYPE_EMBEDDED
;
9694 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9695 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9696 kern_type
= KERN_TYPE_LOTUS8
;
9697 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9698 parse_func
= lotus8_parse_hash
;
9699 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9700 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9707 case 9200: hash_type
= HASH_TYPE_SHA256
;
9708 salt_type
= SALT_TYPE_EMBEDDED
;
9709 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9710 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9711 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9712 dgst_size
= DGST_SIZE_4_32
;
9713 parse_func
= cisco8_parse_hash
;
9714 sort_by_digest
= sort_by_digest_4_32
;
9715 opti_type
= OPTI_TYPE_ZERO_BYTE
9716 | OPTI_TYPE_SLOW_HASH_SIMD
;
9723 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9724 salt_type
= SALT_TYPE_EMBEDDED
;
9725 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9726 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9727 kern_type
= KERN_TYPE_SCRYPT
;
9728 dgst_size
= DGST_SIZE_4_8
;
9729 parse_func
= cisco9_parse_hash
;
9730 sort_by_digest
= sort_by_digest_4_8
;
9731 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9738 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9739 salt_type
= SALT_TYPE_EMBEDDED
;
9740 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9742 kern_type
= KERN_TYPE_OFFICE2007
;
9743 dgst_size
= DGST_SIZE_4_4
;
9744 parse_func
= office2007_parse_hash
;
9745 sort_by_digest
= sort_by_digest_4_4
;
9746 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9753 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9754 salt_type
= SALT_TYPE_EMBEDDED
;
9755 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9756 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9757 kern_type
= KERN_TYPE_OFFICE2010
;
9758 dgst_size
= DGST_SIZE_4_4
;
9759 parse_func
= office2010_parse_hash
;
9760 sort_by_digest
= sort_by_digest_4_4
;
9761 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9768 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9769 salt_type
= SALT_TYPE_EMBEDDED
;
9770 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9771 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9772 kern_type
= KERN_TYPE_OFFICE2013
;
9773 dgst_size
= DGST_SIZE_4_4
;
9774 parse_func
= office2013_parse_hash
;
9775 sort_by_digest
= sort_by_digest_4_4
;
9776 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9783 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9784 salt_type
= SALT_TYPE_EMBEDDED
;
9785 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9786 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9787 | OPTS_TYPE_PT_ADD80
9788 | OPTS_TYPE_PT_UNICODE
;
9789 kern_type
= KERN_TYPE_OLDOFFICE01
;
9790 dgst_size
= DGST_SIZE_4_4
;
9791 parse_func
= oldoffice01_parse_hash
;
9792 sort_by_digest
= sort_by_digest_4_4
;
9793 opti_type
= OPTI_TYPE_ZERO_BYTE
9794 | OPTI_TYPE_PRECOMPUTE_INIT
9795 | OPTI_TYPE_NOT_ITERATED
;
9802 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9803 salt_type
= SALT_TYPE_EMBEDDED
;
9804 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9805 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9806 | OPTS_TYPE_PT_ADD80
;
9807 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9808 dgst_size
= DGST_SIZE_4_4
;
9809 parse_func
= oldoffice01cm1_parse_hash
;
9810 sort_by_digest
= sort_by_digest_4_4
;
9811 opti_type
= OPTI_TYPE_ZERO_BYTE
9812 | OPTI_TYPE_PRECOMPUTE_INIT
9813 | OPTI_TYPE_NOT_ITERATED
;
9820 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9821 salt_type
= SALT_TYPE_EMBEDDED
;
9822 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9823 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9824 | OPTS_TYPE_PT_ADD80
9825 | OPTS_TYPE_PT_UNICODE
9826 | OPTS_TYPE_PT_NEVERCRACK
;
9827 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9828 dgst_size
= DGST_SIZE_4_4
;
9829 parse_func
= oldoffice01cm2_parse_hash
;
9830 sort_by_digest
= sort_by_digest_4_4
;
9831 opti_type
= OPTI_TYPE_ZERO_BYTE
9832 | OPTI_TYPE_PRECOMPUTE_INIT
9833 | OPTI_TYPE_NOT_ITERATED
;
9840 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9841 salt_type
= SALT_TYPE_EMBEDDED
;
9842 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9843 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9844 | OPTS_TYPE_PT_ADD80
9845 | OPTS_TYPE_PT_UNICODE
;
9846 kern_type
= KERN_TYPE_OLDOFFICE34
;
9847 dgst_size
= DGST_SIZE_4_4
;
9848 parse_func
= oldoffice34_parse_hash
;
9849 sort_by_digest
= sort_by_digest_4_4
;
9850 opti_type
= OPTI_TYPE_ZERO_BYTE
9851 | OPTI_TYPE_PRECOMPUTE_INIT
9852 | OPTI_TYPE_NOT_ITERATED
;
9859 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9860 salt_type
= SALT_TYPE_EMBEDDED
;
9861 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9862 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9863 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9864 dgst_size
= DGST_SIZE_4_4
;
9865 parse_func
= oldoffice34cm1_parse_hash
;
9866 sort_by_digest
= sort_by_digest_4_4
;
9867 opti_type
= OPTI_TYPE_ZERO_BYTE
9868 | OPTI_TYPE_PRECOMPUTE_INIT
9869 | OPTI_TYPE_NOT_ITERATED
;
9876 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9877 salt_type
= SALT_TYPE_EMBEDDED
;
9878 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9879 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9880 | OPTS_TYPE_PT_ADD80
9881 | OPTS_TYPE_PT_UNICODE
9882 | OPTS_TYPE_PT_NEVERCRACK
;
9883 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9884 dgst_size
= DGST_SIZE_4_4
;
9885 parse_func
= oldoffice34cm2_parse_hash
;
9886 sort_by_digest
= sort_by_digest_4_4
;
9887 opti_type
= OPTI_TYPE_ZERO_BYTE
9888 | OPTI_TYPE_PRECOMPUTE_INIT
9889 | OPTI_TYPE_NOT_ITERATED
;
9896 case 9900: hash_type
= HASH_TYPE_MD5
;
9897 salt_type
= SALT_TYPE_NONE
;
9898 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9899 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9900 kern_type
= KERN_TYPE_RADMIN2
;
9901 dgst_size
= DGST_SIZE_4_4
;
9902 parse_func
= radmin2_parse_hash
;
9903 sort_by_digest
= sort_by_digest_4_4
;
9904 opti_type
= OPTI_TYPE_ZERO_BYTE
9905 | OPTI_TYPE_PRECOMPUTE_INIT
9906 | OPTI_TYPE_EARLY_SKIP
9907 | OPTI_TYPE_NOT_ITERATED
9908 | OPTI_TYPE_NOT_SALTED
;
9915 case 10000: hash_type
= HASH_TYPE_SHA256
;
9916 salt_type
= SALT_TYPE_EMBEDDED
;
9917 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9918 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9919 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9920 dgst_size
= DGST_SIZE_4_32
;
9921 parse_func
= djangopbkdf2_parse_hash
;
9922 sort_by_digest
= sort_by_digest_4_32
;
9923 opti_type
= OPTI_TYPE_ZERO_BYTE
9924 | OPTI_TYPE_SLOW_HASH_SIMD
;
9931 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9932 salt_type
= SALT_TYPE_EMBEDDED
;
9933 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9934 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9935 kern_type
= KERN_TYPE_SIPHASH
;
9936 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9937 parse_func
= siphash_parse_hash
;
9938 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9939 opti_type
= OPTI_TYPE_ZERO_BYTE
9940 | OPTI_TYPE_NOT_ITERATED
9941 | OPTI_TYPE_RAW_HASH
;
9948 case 10200: hash_type
= HASH_TYPE_MD5
;
9949 salt_type
= SALT_TYPE_EMBEDDED
;
9950 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9951 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9952 | OPTS_TYPE_ST_ADD80
9953 | OPTS_TYPE_ST_ADDBITS14
;
9954 kern_type
= KERN_TYPE_HMACMD5_PW
;
9955 dgst_size
= DGST_SIZE_4_4
;
9956 parse_func
= crammd5_parse_hash
;
9957 sort_by_digest
= sort_by_digest_4_4
;
9958 opti_type
= OPTI_TYPE_ZERO_BYTE
9959 | OPTI_TYPE_NOT_ITERATED
;
9966 case 10300: hash_type
= HASH_TYPE_SHA1
;
9967 salt_type
= SALT_TYPE_EMBEDDED
;
9968 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9969 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9970 kern_type
= KERN_TYPE_SAPH_SHA1
;
9971 dgst_size
= DGST_SIZE_4_5
;
9972 parse_func
= saph_sha1_parse_hash
;
9973 sort_by_digest
= sort_by_digest_4_5
;
9974 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9981 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9982 salt_type
= SALT_TYPE_EMBEDDED
;
9983 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9984 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9985 kern_type
= KERN_TYPE_PDF11
;
9986 dgst_size
= DGST_SIZE_4_4
;
9987 parse_func
= pdf11_parse_hash
;
9988 sort_by_digest
= sort_by_digest_4_4
;
9989 opti_type
= OPTI_TYPE_ZERO_BYTE
9990 | OPTI_TYPE_NOT_ITERATED
;
9997 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9998 salt_type
= SALT_TYPE_EMBEDDED
;
9999 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10000 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10001 kern_type
= KERN_TYPE_PDF11CM1
;
10002 dgst_size
= DGST_SIZE_4_4
;
10003 parse_func
= pdf11cm1_parse_hash
;
10004 sort_by_digest
= sort_by_digest_4_4
;
10005 opti_type
= OPTI_TYPE_ZERO_BYTE
10006 | OPTI_TYPE_NOT_ITERATED
;
10013 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10014 salt_type
= SALT_TYPE_EMBEDDED
;
10015 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10016 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10017 kern_type
= KERN_TYPE_PDF11CM2
;
10018 dgst_size
= DGST_SIZE_4_4
;
10019 parse_func
= pdf11cm2_parse_hash
;
10020 sort_by_digest
= sort_by_digest_4_4
;
10021 opti_type
= OPTI_TYPE_ZERO_BYTE
10022 | OPTI_TYPE_NOT_ITERATED
;
10029 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10030 salt_type
= SALT_TYPE_EMBEDDED
;
10031 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10032 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10033 kern_type
= KERN_TYPE_PDF14
;
10034 dgst_size
= DGST_SIZE_4_4
;
10035 parse_func
= pdf14_parse_hash
;
10036 sort_by_digest
= sort_by_digest_4_4
;
10037 opti_type
= OPTI_TYPE_ZERO_BYTE
10038 | OPTI_TYPE_NOT_ITERATED
;
10045 case 10600: hash_type
= HASH_TYPE_SHA256
;
10046 salt_type
= SALT_TYPE_EMBEDDED
;
10047 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10048 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10049 | OPTS_TYPE_ST_ADD80
10050 | OPTS_TYPE_ST_ADDBITS15
10051 | OPTS_TYPE_HASH_COPY
;
10052 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10053 dgst_size
= DGST_SIZE_4_8
;
10054 parse_func
= pdf17l3_parse_hash
;
10055 sort_by_digest
= sort_by_digest_4_8
;
10056 opti_type
= OPTI_TYPE_ZERO_BYTE
10057 | OPTI_TYPE_PRECOMPUTE_INIT
10058 | OPTI_TYPE_PRECOMPUTE_MERKLE
10059 | OPTI_TYPE_EARLY_SKIP
10060 | OPTI_TYPE_NOT_ITERATED
10061 | OPTI_TYPE_APPENDED_SALT
10062 | OPTI_TYPE_RAW_HASH
;
10069 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10070 salt_type
= SALT_TYPE_EMBEDDED
;
10071 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10072 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10073 | OPTS_TYPE_HASH_COPY
;
10074 kern_type
= KERN_TYPE_PDF17L8
;
10075 dgst_size
= DGST_SIZE_4_8
;
10076 parse_func
= pdf17l8_parse_hash
;
10077 sort_by_digest
= sort_by_digest_4_8
;
10078 opti_type
= OPTI_TYPE_ZERO_BYTE
10079 | OPTI_TYPE_NOT_ITERATED
;
10086 case 10800: hash_type
= HASH_TYPE_SHA384
;
10087 salt_type
= SALT_TYPE_NONE
;
10088 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10089 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10090 | OPTS_TYPE_PT_ADD80
10091 | OPTS_TYPE_PT_ADDBITS15
;
10092 kern_type
= KERN_TYPE_SHA384
;
10093 dgst_size
= DGST_SIZE_8_8
;
10094 parse_func
= sha384_parse_hash
;
10095 sort_by_digest
= sort_by_digest_8_8
;
10096 opti_type
= OPTI_TYPE_ZERO_BYTE
10097 | OPTI_TYPE_PRECOMPUTE_INIT
10098 | OPTI_TYPE_PRECOMPUTE_MERKLE
10099 | OPTI_TYPE_EARLY_SKIP
10100 | OPTI_TYPE_NOT_ITERATED
10101 | OPTI_TYPE_NOT_SALTED
10102 | OPTI_TYPE_USES_BITS_64
10103 | OPTI_TYPE_RAW_HASH
;
10110 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10111 salt_type
= SALT_TYPE_EMBEDDED
;
10112 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10113 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10114 | OPTS_TYPE_ST_BASE64
10115 | OPTS_TYPE_HASH_COPY
;
10116 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10117 dgst_size
= DGST_SIZE_4_32
;
10118 parse_func
= pbkdf2_sha256_parse_hash
;
10119 sort_by_digest
= sort_by_digest_4_32
;
10120 opti_type
= OPTI_TYPE_ZERO_BYTE
10121 | OPTI_TYPE_SLOW_HASH_SIMD
;
10128 case 11000: hash_type
= HASH_TYPE_MD5
;
10129 salt_type
= SALT_TYPE_INTERN
;
10130 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10131 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10132 | OPTS_TYPE_PT_ADD80
;
10133 kern_type
= KERN_TYPE_PRESTASHOP
;
10134 dgst_size
= DGST_SIZE_4_4
;
10135 parse_func
= prestashop_parse_hash
;
10136 sort_by_digest
= sort_by_digest_4_4
;
10137 opti_type
= OPTI_TYPE_ZERO_BYTE
10138 | OPTI_TYPE_PRECOMPUTE_INIT
10139 | OPTI_TYPE_NOT_ITERATED
10140 | OPTI_TYPE_PREPENDED_SALT
;
10147 case 11100: hash_type
= HASH_TYPE_MD5
;
10148 salt_type
= SALT_TYPE_EMBEDDED
;
10149 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10150 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10151 | OPTS_TYPE_ST_ADD80
;
10152 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10153 dgst_size
= DGST_SIZE_4_4
;
10154 parse_func
= postgresql_auth_parse_hash
;
10155 sort_by_digest
= sort_by_digest_4_4
;
10156 opti_type
= OPTI_TYPE_ZERO_BYTE
10157 | OPTI_TYPE_PRECOMPUTE_INIT
10158 | OPTI_TYPE_PRECOMPUTE_MERKLE
10159 | OPTI_TYPE_EARLY_SKIP
;
10166 case 11200: hash_type
= HASH_TYPE_SHA1
;
10167 salt_type
= SALT_TYPE_EMBEDDED
;
10168 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10169 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10170 | OPTS_TYPE_PT_ADD80
10171 | OPTS_TYPE_ST_HEX
;
10172 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10173 dgst_size
= DGST_SIZE_4_5
;
10174 parse_func
= mysql_auth_parse_hash
;
10175 sort_by_digest
= sort_by_digest_4_5
;
10176 opti_type
= OPTI_TYPE_ZERO_BYTE
10177 | OPTI_TYPE_EARLY_SKIP
;
10184 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10185 salt_type
= SALT_TYPE_EMBEDDED
;
10186 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10187 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10189 | OPTS_TYPE_ST_ADD80
;
10190 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10191 dgst_size
= DGST_SIZE_4_4
;
10192 parse_func
= bitcoin_wallet_parse_hash
;
10193 sort_by_digest
= sort_by_digest_4_4
;
10194 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10201 case 11400: hash_type
= HASH_TYPE_MD5
;
10202 salt_type
= SALT_TYPE_EMBEDDED
;
10203 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10204 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10205 | OPTS_TYPE_PT_ADD80
10206 | OPTS_TYPE_HASH_COPY
;
10207 kern_type
= KERN_TYPE_SIP_AUTH
;
10208 dgst_size
= DGST_SIZE_4_4
;
10209 parse_func
= sip_auth_parse_hash
;
10210 sort_by_digest
= sort_by_digest_4_4
;
10211 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10218 case 11500: hash_type
= HASH_TYPE_CRC32
;
10219 salt_type
= SALT_TYPE_INTERN
;
10220 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10221 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10222 | OPTS_TYPE_ST_GENERATE_LE
10223 | OPTS_TYPE_ST_HEX
;
10224 kern_type
= KERN_TYPE_CRC32
;
10225 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10226 parse_func
= crc32_parse_hash
;
10227 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10228 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10235 case 11600: hash_type
= HASH_TYPE_AES
;
10236 salt_type
= SALT_TYPE_EMBEDDED
;
10237 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10238 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10239 | OPTS_TYPE_PT_NEVERCRACK
;
10240 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10241 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10242 parse_func
= seven_zip_parse_hash
;
10243 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10244 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10251 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10252 salt_type
= SALT_TYPE_NONE
;
10253 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10254 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10255 | OPTS_TYPE_PT_ADD01
;
10256 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10257 dgst_size
= DGST_SIZE_4_8
;
10258 parse_func
= gost2012sbog_256_parse_hash
;
10259 sort_by_digest
= sort_by_digest_4_8
;
10260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10267 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10268 salt_type
= SALT_TYPE_NONE
;
10269 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10270 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10271 | OPTS_TYPE_PT_ADD01
;
10272 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10273 dgst_size
= DGST_SIZE_4_16
;
10274 parse_func
= gost2012sbog_512_parse_hash
;
10275 sort_by_digest
= sort_by_digest_4_16
;
10276 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10283 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10284 salt_type
= SALT_TYPE_EMBEDDED
;
10285 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10287 | OPTS_TYPE_ST_BASE64
10288 | OPTS_TYPE_HASH_COPY
;
10289 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10290 dgst_size
= DGST_SIZE_4_32
;
10291 parse_func
= pbkdf2_md5_parse_hash
;
10292 sort_by_digest
= sort_by_digest_4_32
;
10293 opti_type
= OPTI_TYPE_ZERO_BYTE
10294 | OPTI_TYPE_SLOW_HASH_SIMD
;
10301 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10302 salt_type
= SALT_TYPE_EMBEDDED
;
10303 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10304 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10305 | OPTS_TYPE_ST_BASE64
10306 | OPTS_TYPE_HASH_COPY
;
10307 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10308 dgst_size
= DGST_SIZE_4_32
;
10309 parse_func
= pbkdf2_sha1_parse_hash
;
10310 sort_by_digest
= sort_by_digest_4_32
;
10311 opti_type
= OPTI_TYPE_ZERO_BYTE
10312 | OPTI_TYPE_SLOW_HASH_SIMD
;
10319 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10320 salt_type
= SALT_TYPE_EMBEDDED
;
10321 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10322 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10323 | OPTS_TYPE_ST_BASE64
10324 | OPTS_TYPE_HASH_COPY
;
10325 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10326 dgst_size
= DGST_SIZE_8_16
;
10327 parse_func
= pbkdf2_sha512_parse_hash
;
10328 sort_by_digest
= sort_by_digest_8_16
;
10329 opti_type
= OPTI_TYPE_ZERO_BYTE
10330 | OPTI_TYPE_USES_BITS_64
10331 | OPTI_TYPE_SLOW_HASH_SIMD
;
10338 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10339 salt_type
= SALT_TYPE_EMBEDDED
;
10340 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10341 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10342 kern_type
= KERN_TYPE_ECRYPTFS
;
10343 dgst_size
= DGST_SIZE_8_8
;
10344 parse_func
= ecryptfs_parse_hash
;
10345 sort_by_digest
= sort_by_digest_8_8
;
10346 opti_type
= OPTI_TYPE_ZERO_BYTE
10347 | OPTI_TYPE_USES_BITS_64
;
10354 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10355 salt_type
= SALT_TYPE_EMBEDDED
;
10356 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10357 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10358 kern_type
= KERN_TYPE_ORACLET
;
10359 dgst_size
= DGST_SIZE_8_16
;
10360 parse_func
= oraclet_parse_hash
;
10361 sort_by_digest
= sort_by_digest_8_16
;
10362 opti_type
= OPTI_TYPE_ZERO_BYTE
10363 | OPTI_TYPE_USES_BITS_64
;
10370 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10371 salt_type
= SALT_TYPE_EMBEDDED
;
10372 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10373 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10374 kern_type
= KERN_TYPE_BSDICRYPT
;
10375 dgst_size
= DGST_SIZE_4_4
;
10376 parse_func
= bsdicrypt_parse_hash
;
10377 sort_by_digest
= sort_by_digest_4_4
;
10378 opti_type
= OPTI_TYPE_ZERO_BYTE
10379 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10386 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10387 salt_type
= SALT_TYPE_EMBEDDED
;
10388 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10389 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10390 kern_type
= KERN_TYPE_RAR3
;
10391 dgst_size
= DGST_SIZE_4_4
;
10392 parse_func
= rar3hp_parse_hash
;
10393 sort_by_digest
= sort_by_digest_4_4
;
10394 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10401 case 12600: hash_type
= HASH_TYPE_SHA256
;
10402 salt_type
= SALT_TYPE_INTERN
;
10403 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10404 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10405 | OPTS_TYPE_PT_ADD80
;
10406 kern_type
= KERN_TYPE_CF10
;
10407 dgst_size
= DGST_SIZE_4_8
;
10408 parse_func
= cf10_parse_hash
;
10409 sort_by_digest
= sort_by_digest_4_8
;
10410 opti_type
= OPTI_TYPE_ZERO_BYTE
10411 | OPTI_TYPE_PRECOMPUTE_INIT
10412 | OPTI_TYPE_EARLY_SKIP
10413 | OPTI_TYPE_NOT_ITERATED
;
10420 case 12700: hash_type
= HASH_TYPE_AES
;
10421 salt_type
= SALT_TYPE_EMBEDDED
;
10422 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10423 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10424 | OPTS_TYPE_HASH_COPY
;
10425 kern_type
= KERN_TYPE_MYWALLET
;
10426 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10427 parse_func
= mywallet_parse_hash
;
10428 sort_by_digest
= sort_by_digest_4_5
;
10429 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10436 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10437 salt_type
= SALT_TYPE_EMBEDDED
;
10438 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10440 kern_type
= KERN_TYPE_MS_DRSR
;
10441 dgst_size
= DGST_SIZE_4_8
;
10442 parse_func
= ms_drsr_parse_hash
;
10443 sort_by_digest
= sort_by_digest_4_8
;
10444 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10451 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10452 salt_type
= SALT_TYPE_EMBEDDED
;
10453 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10454 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10455 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10456 dgst_size
= DGST_SIZE_4_8
;
10457 parse_func
= androidfde_samsung_parse_hash
;
10458 sort_by_digest
= sort_by_digest_4_8
;
10459 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10466 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10467 salt_type
= SALT_TYPE_EMBEDDED
;
10468 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10469 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10470 kern_type
= KERN_TYPE_RAR5
;
10471 dgst_size
= DGST_SIZE_4_4
;
10472 parse_func
= rar5_parse_hash
;
10473 sort_by_digest
= sort_by_digest_4_4
;
10474 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10481 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10482 salt_type
= SALT_TYPE_EMBEDDED
;
10483 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10484 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10485 kern_type
= KERN_TYPE_KRB5TGS
;
10486 dgst_size
= DGST_SIZE_4_4
;
10487 parse_func
= krb5tgs_parse_hash
;
10488 sort_by_digest
= sort_by_digest_4_4
;
10489 opti_type
= OPTI_TYPE_ZERO_BYTE
10490 | OPTI_TYPE_NOT_ITERATED
;
10497 case 13200: hash_type
= HASH_TYPE_AES
;
10498 salt_type
= SALT_TYPE_EMBEDDED
;
10499 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10501 kern_type
= KERN_TYPE_AXCRYPT
;
10502 dgst_size
= DGST_SIZE_4_4
;
10503 parse_func
= axcrypt_parse_hash
;
10504 sort_by_digest
= sort_by_digest_4_4
;
10505 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10512 case 13300: hash_type
= HASH_TYPE_SHA1
;
10513 salt_type
= SALT_TYPE_NONE
;
10514 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10515 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10516 | OPTS_TYPE_PT_ADD80
10517 | OPTS_TYPE_PT_ADDBITS15
;
10518 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10519 dgst_size
= DGST_SIZE_4_5
;
10520 parse_func
= sha1axcrypt_parse_hash
;
10521 sort_by_digest
= sort_by_digest_4_5
;
10522 opti_type
= OPTI_TYPE_ZERO_BYTE
10523 | OPTI_TYPE_PRECOMPUTE_INIT
10524 | OPTI_TYPE_EARLY_SKIP
10525 | OPTI_TYPE_NOT_ITERATED
10526 | OPTI_TYPE_NOT_SALTED
;
10533 case 13400: hash_type
= HASH_TYPE_AES
;
10534 salt_type
= SALT_TYPE_EMBEDDED
;
10535 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10537 kern_type
= KERN_TYPE_KEEPASS
;
10538 dgst_size
= DGST_SIZE_4_4
;
10539 parse_func
= keepass_parse_hash
;
10540 sort_by_digest
= sort_by_digest_4_4
;
10541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10548 case 13500: hash_type
= HASH_TYPE_SHA1
;
10549 salt_type
= SALT_TYPE_EMBEDDED
;
10550 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10551 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10552 | OPTS_TYPE_PT_UNICODE
10553 | OPTS_TYPE_PT_ADD80
;
10554 kern_type
= KERN_TYPE_PSTOKEN
;
10555 dgst_size
= DGST_SIZE_4_5
;
10556 parse_func
= pstoken_parse_hash
;
10557 sort_by_digest
= sort_by_digest_4_5
;
10558 opti_type
= OPTI_TYPE_ZERO_BYTE
10559 | OPTI_TYPE_PRECOMPUTE_INIT
10560 | OPTI_TYPE_EARLY_SKIP
10561 | OPTI_TYPE_NOT_ITERATED
10562 | OPTI_TYPE_PREPENDED_SALT
10563 | OPTI_TYPE_RAW_HASH
;
10570 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10571 salt_type
= SALT_TYPE_EMBEDDED
;
10572 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10573 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10574 kern_type
= KERN_TYPE_ZIP2
;
10575 dgst_size
= DGST_SIZE_4_4
;
10576 parse_func
= zip2_parse_hash
;
10577 sort_by_digest
= sort_by_digest_4_4
;
10578 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10585 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10586 salt_type
= SALT_TYPE_EMBEDDED
;
10587 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10588 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10589 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10590 dgst_size
= DGST_SIZE_4_5
;
10591 parse_func
= veracrypt_parse_hash_655331
;
10592 sort_by_digest
= sort_by_digest_4_5
;
10593 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10600 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10601 salt_type
= SALT_TYPE_EMBEDDED
;
10602 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10603 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10604 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10605 dgst_size
= DGST_SIZE_4_5
;
10606 parse_func
= veracrypt_parse_hash_655331
;
10607 sort_by_digest
= sort_by_digest_4_5
;
10608 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10615 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10616 salt_type
= SALT_TYPE_EMBEDDED
;
10617 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10618 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10619 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10620 dgst_size
= DGST_SIZE_4_5
;
10621 parse_func
= veracrypt_parse_hash_655331
;
10622 sort_by_digest
= sort_by_digest_4_5
;
10623 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10630 case 13721: hash_type
= HASH_TYPE_SHA512
;
10631 salt_type
= SALT_TYPE_EMBEDDED
;
10632 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10633 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10634 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10635 dgst_size
= DGST_SIZE_8_8
;
10636 parse_func
= veracrypt_parse_hash_500000
;
10637 sort_by_digest
= sort_by_digest_8_8
;
10638 opti_type
= OPTI_TYPE_ZERO_BYTE
10639 | OPTI_TYPE_USES_BITS_64
;
10646 case 13722: hash_type
= HASH_TYPE_SHA512
;
10647 salt_type
= SALT_TYPE_EMBEDDED
;
10648 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10649 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10650 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10651 dgst_size
= DGST_SIZE_8_8
;
10652 parse_func
= veracrypt_parse_hash_500000
;
10653 sort_by_digest
= sort_by_digest_8_8
;
10654 opti_type
= OPTI_TYPE_ZERO_BYTE
10655 | OPTI_TYPE_USES_BITS_64
;
10662 case 13723: hash_type
= HASH_TYPE_SHA512
;
10663 salt_type
= SALT_TYPE_EMBEDDED
;
10664 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10666 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10667 dgst_size
= DGST_SIZE_8_8
;
10668 parse_func
= veracrypt_parse_hash_500000
;
10669 sort_by_digest
= sort_by_digest_8_8
;
10670 opti_type
= OPTI_TYPE_ZERO_BYTE
10671 | OPTI_TYPE_USES_BITS_64
;
10678 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10679 salt_type
= SALT_TYPE_EMBEDDED
;
10680 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10682 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10683 dgst_size
= DGST_SIZE_4_8
;
10684 parse_func
= veracrypt_parse_hash_500000
;
10685 sort_by_digest
= sort_by_digest_4_8
;
10686 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10693 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10694 salt_type
= SALT_TYPE_EMBEDDED
;
10695 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10697 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10698 dgst_size
= DGST_SIZE_4_8
;
10699 parse_func
= veracrypt_parse_hash_500000
;
10700 sort_by_digest
= sort_by_digest_4_8
;
10701 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10708 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10709 salt_type
= SALT_TYPE_EMBEDDED
;
10710 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10711 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10712 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10713 dgst_size
= DGST_SIZE_4_8
;
10714 parse_func
= veracrypt_parse_hash_500000
;
10715 sort_by_digest
= sort_by_digest_4_8
;
10716 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10723 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10724 salt_type
= SALT_TYPE_EMBEDDED
;
10725 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10726 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10727 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10728 dgst_size
= DGST_SIZE_4_5
;
10729 parse_func
= veracrypt_parse_hash_327661
;
10730 sort_by_digest
= sort_by_digest_4_5
;
10731 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10738 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10739 salt_type
= SALT_TYPE_EMBEDDED
;
10740 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10742 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10743 dgst_size
= DGST_SIZE_4_5
;
10744 parse_func
= veracrypt_parse_hash_327661
;
10745 sort_by_digest
= sort_by_digest_4_5
;
10746 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10753 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10754 salt_type
= SALT_TYPE_EMBEDDED
;
10755 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10756 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10757 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10758 dgst_size
= DGST_SIZE_4_5
;
10759 parse_func
= veracrypt_parse_hash_327661
;
10760 sort_by_digest
= sort_by_digest_4_5
;
10761 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10768 case 13751: hash_type
= HASH_TYPE_SHA256
;
10769 salt_type
= SALT_TYPE_EMBEDDED
;
10770 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10771 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10772 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10773 dgst_size
= DGST_SIZE_4_8
;
10774 parse_func
= veracrypt_parse_hash_500000
;
10775 sort_by_digest
= sort_by_digest_4_8
;
10776 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10783 case 13752: hash_type
= HASH_TYPE_SHA256
;
10784 salt_type
= SALT_TYPE_EMBEDDED
;
10785 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10786 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10787 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10788 dgst_size
= DGST_SIZE_4_8
;
10789 parse_func
= veracrypt_parse_hash_500000
;
10790 sort_by_digest
= sort_by_digest_4_8
;
10791 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10798 case 13753: hash_type
= HASH_TYPE_SHA256
;
10799 salt_type
= SALT_TYPE_EMBEDDED
;
10800 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10801 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10802 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10803 dgst_size
= DGST_SIZE_4_8
;
10804 parse_func
= veracrypt_parse_hash_500000
;
10805 sort_by_digest
= sort_by_digest_4_8
;
10806 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10813 case 13761: hash_type
= HASH_TYPE_SHA256
;
10814 salt_type
= SALT_TYPE_EMBEDDED
;
10815 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10816 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10817 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10818 dgst_size
= DGST_SIZE_4_8
;
10819 parse_func
= veracrypt_parse_hash_200000
;
10820 sort_by_digest
= sort_by_digest_4_8
;
10821 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10828 case 13762: hash_type
= HASH_TYPE_SHA256
;
10829 salt_type
= SALT_TYPE_EMBEDDED
;
10830 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10831 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10832 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10833 dgst_size
= DGST_SIZE_4_8
;
10834 parse_func
= veracrypt_parse_hash_200000
;
10835 sort_by_digest
= sort_by_digest_4_8
;
10836 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10843 case 13763: hash_type
= HASH_TYPE_SHA256
;
10844 salt_type
= SALT_TYPE_EMBEDDED
;
10845 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10846 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10847 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10848 dgst_size
= DGST_SIZE_4_8
;
10849 parse_func
= veracrypt_parse_hash_200000
;
10850 sort_by_digest
= sort_by_digest_4_8
;
10851 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10858 case 13800: hash_type
= HASH_TYPE_SHA256
;
10859 salt_type
= SALT_TYPE_EMBEDDED
;
10860 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10861 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10862 | OPTS_TYPE_PT_UNICODE
;
10863 kern_type
= KERN_TYPE_WIN8PHONE
;
10864 dgst_size
= DGST_SIZE_4_8
;
10865 parse_func
= win8phone_parse_hash
;
10866 sort_by_digest
= sort_by_digest_4_8
;
10867 opti_type
= OPTI_TYPE_ZERO_BYTE
10868 | OPTI_TYPE_PRECOMPUTE_INIT
10869 | OPTI_TYPE_EARLY_SKIP
10870 | OPTI_TYPE_NOT_ITERATED
10871 | OPTI_TYPE_RAW_HASH
;
10879 default: usage_mini_print (PROGNAME
); return (-1);
10886 data
.parse_func
= parse_func
;
10894 if (salt_type
== SALT_TYPE_INTERN
)
10896 opts_type
|= OPTS_TYPE_ST_HEX
;
10900 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10906 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10907 | (salt_type
== SALT_TYPE_EXTERN
)
10908 | (salt_type
== SALT_TYPE_EMBEDDED
)
10909 | (salt_type
== SALT_TYPE_VIRTUAL
));
10911 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10913 data
.hash_type
= hash_type
;
10914 data
.attack_mode
= attack_mode
;
10915 data
.attack_kern
= attack_kern
;
10916 data
.attack_exec
= attack_exec
;
10917 data
.kern_type
= kern_type
;
10918 data
.opts_type
= opts_type
;
10919 data
.dgst_size
= dgst_size
;
10920 data
.salt_type
= salt_type
;
10921 data
.isSalted
= isSalted
;
10922 data
.sort_by_digest
= sort_by_digest
;
10923 data
.dgst_pos0
= dgst_pos0
;
10924 data
.dgst_pos1
= dgst_pos1
;
10925 data
.dgst_pos2
= dgst_pos2
;
10926 data
.dgst_pos3
= dgst_pos3
;
10932 case 2500: esalt_size
= sizeof (wpa_t
); break;
10933 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10934 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10935 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10936 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10937 case 6211: esalt_size
= sizeof (tc_t
); break;
10938 case 6212: esalt_size
= sizeof (tc_t
); break;
10939 case 6213: esalt_size
= sizeof (tc_t
); break;
10940 case 6221: esalt_size
= sizeof (tc_t
); break;
10941 case 6222: esalt_size
= sizeof (tc_t
); break;
10942 case 6223: esalt_size
= sizeof (tc_t
); break;
10943 case 6231: esalt_size
= sizeof (tc_t
); break;
10944 case 6232: esalt_size
= sizeof (tc_t
); break;
10945 case 6233: esalt_size
= sizeof (tc_t
); break;
10946 case 6241: esalt_size
= sizeof (tc_t
); break;
10947 case 6242: esalt_size
= sizeof (tc_t
); break;
10948 case 6243: esalt_size
= sizeof (tc_t
); break;
10949 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10950 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10951 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10952 case 7300: esalt_size
= sizeof (rakp_t
); break;
10953 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10954 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10955 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10956 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10957 case 9400: esalt_size
= sizeof (office2007_t
); break;
10958 case 9500: esalt_size
= sizeof (office2010_t
); break;
10959 case 9600: esalt_size
= sizeof (office2013_t
); break;
10960 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10961 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10962 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10963 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10964 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10965 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10966 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10967 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10968 case 10400: esalt_size
= sizeof (pdf_t
); break;
10969 case 10410: esalt_size
= sizeof (pdf_t
); break;
10970 case 10420: esalt_size
= sizeof (pdf_t
); break;
10971 case 10500: esalt_size
= sizeof (pdf_t
); break;
10972 case 10600: esalt_size
= sizeof (pdf_t
); break;
10973 case 10700: esalt_size
= sizeof (pdf_t
); break;
10974 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10975 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10976 case 11400: esalt_size
= sizeof (sip_t
); break;
10977 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10978 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10979 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10980 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10981 case 13000: esalt_size
= sizeof (rar5_t
); break;
10982 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10983 case 13400: esalt_size
= sizeof (keepass_t
); break;
10984 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10985 case 13600: esalt_size
= sizeof (zip2_t
); break;
10986 case 13711: esalt_size
= sizeof (tc_t
); break;
10987 case 13712: esalt_size
= sizeof (tc_t
); break;
10988 case 13713: esalt_size
= sizeof (tc_t
); break;
10989 case 13721: esalt_size
= sizeof (tc_t
); break;
10990 case 13722: esalt_size
= sizeof (tc_t
); break;
10991 case 13723: esalt_size
= sizeof (tc_t
); break;
10992 case 13731: esalt_size
= sizeof (tc_t
); break;
10993 case 13732: esalt_size
= sizeof (tc_t
); break;
10994 case 13733: esalt_size
= sizeof (tc_t
); break;
10995 case 13741: esalt_size
= sizeof (tc_t
); break;
10996 case 13742: esalt_size
= sizeof (tc_t
); break;
10997 case 13743: esalt_size
= sizeof (tc_t
); break;
10998 case 13751: esalt_size
= sizeof (tc_t
); break;
10999 case 13752: esalt_size
= sizeof (tc_t
); break;
11000 case 13753: esalt_size
= sizeof (tc_t
); break;
11001 case 13761: esalt_size
= sizeof (tc_t
); break;
11002 case 13762: esalt_size
= sizeof (tc_t
); break;
11003 case 13763: esalt_size
= sizeof (tc_t
); break;
11004 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11007 data
.esalt_size
= esalt_size
;
11010 * choose dictionary parser
11013 if (hash_type
== HASH_TYPE_LM
)
11015 get_next_word_func
= get_next_word_lm
;
11017 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11019 get_next_word_func
= get_next_word_uc
;
11023 get_next_word_func
= get_next_word_std
;
11030 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11033 size_t dictstat_nmemb
= 0;
11037 uint dictstat_nmemb
= 0;
11040 char dictstat
[256] = { 0 };
11042 FILE *dictstat_fp
= NULL
;
11046 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11048 dictstat_fp
= fopen (dictstat
, "rb");
11053 struct stat tmpstat
;
11055 fstat (fileno (dictstat_fp
), &tmpstat
);
11059 struct stat64 tmpstat
;
11061 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11064 if (tmpstat
.st_mtime
< COMPTIME
)
11066 /* with v0.15 the format changed so we have to ensure user is using a good version
11067 since there is no version-header in the dictstat file */
11069 fclose (dictstat_fp
);
11075 while (!feof (dictstat_fp
))
11079 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11081 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11083 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11085 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11091 fclose (dictstat_fp
);
11100 char potfile
[256] = { 0 };
11102 if (potfile_path
== NULL
)
11104 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11108 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11111 data
.pot_fp
= NULL
;
11113 FILE *out_fp
= NULL
;
11114 FILE *pot_fp
= NULL
;
11116 if (show
== 1 || left
== 1)
11118 pot_fp
= fopen (potfile
, "rb");
11120 if (pot_fp
== NULL
)
11122 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11127 if (outfile
!= NULL
)
11129 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11131 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11145 if (potfile_disable
== 0)
11147 pot_fp
= fopen (potfile
, "ab");
11149 if (pot_fp
== NULL
)
11151 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11156 data
.pot_fp
= pot_fp
;
11163 uint pot_avail
= 0;
11165 if (show
== 1 || left
== 1)
11167 SUPPRESS_OUTPUT
= 1;
11169 pot_avail
= count_lines (pot_fp
);
11173 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11175 uint pot_hashes_avail
= 0;
11179 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11181 while (!feof (pot_fp
))
11185 int line_len
= fgetl (pot_fp
, line_buf
);
11187 if (line_len
== 0) continue;
11189 char *plain_buf
= line_buf
+ line_len
;
11191 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11193 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11195 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11196 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11198 if (pot_cnt
== pot_hashes_avail
)
11202 for (pos
= 0; pos
< INCR_POT
; pos
++)
11204 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11206 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11208 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11210 tmp_hash
->digest
= mymalloc (dgst_size
);
11214 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11219 tmp_hash
->esalt
= mymalloc (esalt_size
);
11222 pot_hashes_avail
++;
11230 int iter
= MAX_CUT_TRIES
;
11234 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11236 if (line_buf
[i
] == ':')
11244 if (data
.hash_mode
!= 2500)
11246 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11250 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11252 if (line_len
> max_salt_size
)
11254 parser_status
= PARSER_GLOBAL_LENGTH
;
11258 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11260 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11262 hashes_buf
->salt
->salt_len
= line_len
;
11264 parser_status
= PARSER_OK
;
11268 // if NOT parsed without error, we add the ":" to the plain
11270 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11276 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11278 if (parser_status
< PARSER_GLOBAL_ZERO
)
11280 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11285 if (plain_len
>= 255) continue;
11287 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11289 pot_ptr
->plain_len
= plain_len
;
11298 SUPPRESS_OUTPUT
= 0;
11300 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11307 uint pw_min
= PW_MIN
;
11308 uint pw_max
= PW_MAX
;
11312 case 125: if (pw_max
> 32) pw_max
= 32;
11314 case 400: if (pw_max
> 40) pw_max
= 40;
11316 case 500: if (pw_max
> 16) pw_max
= 16;
11318 case 1500: if (pw_max
> 8) pw_max
= 8;
11320 case 1600: if (pw_max
> 16) pw_max
= 16;
11322 case 1800: if (pw_max
> 16) pw_max
= 16;
11324 case 2100: if (pw_max
> 16) pw_max
= 16;
11326 case 2500: if (pw_min
< 8) pw_min
= 8;
11328 case 3000: if (pw_max
> 7) pw_max
= 7;
11330 case 5200: if (pw_max
> 24) pw_max
= 24;
11332 case 5800: if (pw_max
> 16) pw_max
= 16;
11334 case 6300: if (pw_max
> 16) pw_max
= 16;
11336 case 7400: if (pw_max
> 16) pw_max
= 16;
11338 case 7700: if (pw_max
> 8) pw_max
= 8;
11340 case 7900: if (pw_max
> 48) pw_max
= 48;
11342 case 8500: if (pw_max
> 8) pw_max
= 8;
11344 case 8600: if (pw_max
> 16) pw_max
= 16;
11346 case 9710: pw_min
= 5;
11349 case 9810: pw_min
= 5;
11352 case 10410: pw_min
= 5;
11355 case 10300: if (pw_max
< 3) pw_min
= 3;
11356 if (pw_max
> 40) pw_max
= 40;
11358 case 10500: if (pw_max
< 3) pw_min
= 3;
11359 if (pw_max
> 40) pw_max
= 40;
11361 case 10700: if (pw_max
> 16) pw_max
= 16;
11363 case 11300: if (pw_max
> 40) pw_max
= 40;
11365 case 11600: if (pw_max
> 32) pw_max
= 32;
11367 case 12500: if (pw_max
> 20) pw_max
= 20;
11369 case 12800: if (pw_max
> 24) pw_max
= 24;
11373 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11375 switch (attack_kern
)
11377 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11379 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11385 * charsets : keep them together for more easy maintainnce
11388 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11389 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11391 mp_setup_sys (mp_sys
);
11393 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11394 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11395 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11396 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11399 * load hashes, part I: find input mode, count hashes
11402 uint hashlist_mode
= 0;
11403 uint hashlist_format
= HLFMT_HASHCAT
;
11405 uint hashes_avail
= 0;
11407 if (benchmark
== 0)
11411 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11413 if ((hash_mode
== 2500) ||
11414 (hash_mode
== 5200) ||
11415 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11416 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11417 (hash_mode
== 9000))
11419 hashlist_mode
= HL_MODE_ARG
;
11421 char *hashfile
= myargv
[optind
];
11423 data
.hashfile
= hashfile
;
11425 logfile_top_var_string ("target", hashfile
);
11428 if (hashlist_mode
== HL_MODE_ARG
)
11430 if (hash_mode
== 2500)
11434 if (stat (data
.hashfile
, &st
) == -1)
11436 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11441 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11448 else if (hashlist_mode
== HL_MODE_FILE
)
11450 char *hashfile
= myargv
[optind
];
11452 data
.hashfile
= hashfile
;
11454 logfile_top_var_string ("target", hashfile
);
11458 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11460 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11465 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11467 hashes_avail
= count_lines (fp
);
11471 if (hashes_avail
== 0)
11473 log_error ("ERROR: hashfile is empty or corrupt");
11480 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11482 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11484 log_error ("ERROR: remove not supported in native hashfile-format mode");
11496 hashlist_mode
= HL_MODE_ARG
;
11501 if (hash_mode
== 3000) hashes_avail
*= 2;
11503 data
.hashlist_mode
= hashlist_mode
;
11504 data
.hashlist_format
= hashlist_format
;
11506 logfile_top_uint (hashlist_mode
);
11507 logfile_top_uint (hashlist_format
);
11510 * load hashes, part II: allocate required memory, set pointers
11513 hash_t
*hashes_buf
= NULL
;
11514 void *digests_buf
= NULL
;
11515 salt_t
*salts_buf
= NULL
;
11516 void *esalts_buf
= NULL
;
11518 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11520 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11522 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11526 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11528 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11530 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11532 if (username
&& (remove
|| show
|| left
))
11534 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11539 hash_info
->orighash
= (char *) mymalloc (256);
11546 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11550 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11555 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11558 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11560 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11564 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11568 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11573 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11578 * load hashes, part III: parse hashes or generate them if benchmark
11581 uint hashes_cnt
= 0;
11583 if (benchmark
== 0)
11587 // useless to read hash file for keyspace, cheat a little bit w/ optind
11589 else if (hashes_avail
== 0)
11592 else if (hashlist_mode
== HL_MODE_ARG
)
11594 char *input_buf
= myargv
[optind
];
11596 uint input_len
= strlen (input_buf
);
11598 logfile_top_var_string ("target", input_buf
);
11600 char *hash_buf
= NULL
;
11603 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11605 bool hash_fmt_error
= 0;
11607 if (hash_len
< 1) hash_fmt_error
= 1;
11608 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11610 if (hash_fmt_error
)
11612 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11616 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11618 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11620 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11625 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11628 int parser_status
= PARSER_OK
;
11630 if (hash_mode
== 2500)
11634 log_error ("ERROR: hccap file not specified");
11639 hashlist_mode
= HL_MODE_FILE
;
11641 data
.hashlist_mode
= hashlist_mode
;
11643 FILE *fp
= fopen (hash_buf
, "rb");
11647 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11652 if (hashes_avail
< 1)
11654 log_error ("ERROR: hccap file is empty or corrupt");
11661 uint hccap_size
= sizeof (hccap_t
);
11663 char *in
= (char *) mymalloc (hccap_size
);
11667 int n
= fread (in
, hccap_size
, 1, fp
);
11671 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11676 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11678 if (parser_status
!= PARSER_OK
)
11680 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11685 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11687 if ((show
== 1) || (left
== 1))
11689 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11691 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11693 int cur_pos
= tmp_salt
->salt_len
;
11694 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11696 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11698 // do the appending task
11700 snprintf (salt_ptr
+ cur_pos
,
11702 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11714 wpa
->orig_mac2
[5]);
11716 // memset () the remaining part of the salt
11718 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11719 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11721 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11723 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11726 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
);
11727 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
);
11736 else if (hash_mode
== 3000)
11738 if (hash_len
== 32)
11740 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11742 hash_t
*lm_hash_left
= NULL
;
11744 if (parser_status
== PARSER_OK
)
11746 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11752 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11755 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11757 hash_t
*lm_hash_right
= NULL
;
11759 if (parser_status
== PARSER_OK
)
11761 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11767 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11772 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11774 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
);
11775 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
);
11780 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11782 if (parser_status
== PARSER_OK
)
11784 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11785 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11788 if (parser_status
== PARSER_OK
)
11794 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11800 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11802 if (parser_status
== PARSER_OK
)
11804 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11805 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11808 if (parser_status
== PARSER_OK
)
11814 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11819 else if (hashlist_mode
== HL_MODE_FILE
)
11821 char *hashfile
= data
.hashfile
;
11825 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11827 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11834 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11840 int line_len
= fgetl (fp
, line_buf
);
11842 if (line_len
== 0) continue;
11844 char *hash_buf
= NULL
;
11847 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11849 bool hash_fmt_error
= 0;
11851 if (hash_len
< 1) hash_fmt_error
= 1;
11852 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11854 if (hash_fmt_error
)
11856 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11863 char *user_buf
= NULL
;
11866 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11868 if (remove
|| show
)
11870 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11872 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11874 user_t
*user_ptr
= *user
;
11876 if (user_buf
!= NULL
)
11878 user_ptr
->user_name
= mystrdup (user_buf
);
11882 user_ptr
->user_name
= mystrdup ("");
11885 user_ptr
->user_len
= user_len
;
11889 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11891 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11893 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11898 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11901 if (hash_mode
== 3000)
11903 if (hash_len
== 32)
11905 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11907 if (parser_status
< PARSER_GLOBAL_ZERO
)
11909 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11914 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11918 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11920 if (parser_status
< PARSER_GLOBAL_ZERO
)
11922 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11927 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11929 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);
11935 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
);
11936 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
);
11940 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11942 if (parser_status
< PARSER_GLOBAL_ZERO
)
11944 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11949 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);
11951 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11952 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11959 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11961 if (parser_status
< PARSER_GLOBAL_ZERO
)
11963 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11968 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);
11970 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11971 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11981 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11983 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11990 hashes_buf
[0].salt
->salt_len
= 8;
11992 // special salt handling
11996 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11997 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11999 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12001 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12003 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12005 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12007 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12009 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12011 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12013 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12015 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12017 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12018 hashes_buf
[0].salt
->scrypt_N
= 1024;
12019 hashes_buf
[0].salt
->scrypt_r
= 1;
12020 hashes_buf
[0].salt
->scrypt_p
= 1;
12022 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12024 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12025 hashes_buf
[0].salt
->scrypt_N
= 16384;
12026 hashes_buf
[0].salt
->scrypt_r
= 1;
12027 hashes_buf
[0].salt
->scrypt_p
= 1;
12029 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12031 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12033 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12035 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12037 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12039 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12041 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12043 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12045 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12047 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12049 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12051 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12053 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12055 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12057 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12061 // special esalt handling
12065 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12067 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12068 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12070 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12071 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12073 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12074 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12075 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12076 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12078 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12079 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12080 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12081 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12083 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12085 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12086 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12087 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12089 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12090 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12091 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12093 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12094 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12095 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12097 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12098 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12099 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12101 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12102 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12103 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12105 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12106 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12107 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12109 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12110 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12111 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12113 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12115 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12117 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12118 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12119 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12128 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12130 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12132 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12134 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12136 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12138 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12140 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12142 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12144 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12146 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12148 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12150 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12152 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12154 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12156 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12158 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12160 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12162 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12164 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12166 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12168 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12170 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12172 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12174 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12176 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12178 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12180 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12182 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12184 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12186 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12188 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12190 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12192 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12194 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12196 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12198 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12202 // set default iterations
12206 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12208 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12210 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12212 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12214 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12216 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12218 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12220 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12222 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12224 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12226 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12228 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12230 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12232 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12234 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12236 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12238 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12240 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12242 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12244 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12246 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12248 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12250 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12252 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12254 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12256 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12258 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12260 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12262 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12264 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12266 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12268 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12270 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12272 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12274 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12276 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12278 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12280 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12282 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12284 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12286 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12288 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12290 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12292 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12294 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12296 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12298 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12300 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12302 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12304 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12306 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12308 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12310 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12312 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12314 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12316 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12318 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12320 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12322 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12324 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12326 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12328 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12330 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12332 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12334 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12336 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12338 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12340 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12342 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12344 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12346 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12348 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12350 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12352 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12354 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12356 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12358 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12360 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12362 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12364 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12366 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12368 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12375 if (show
== 1 || left
== 1)
12377 for (uint i
= 0; i
< pot_cnt
; i
++)
12379 pot_t
*pot_ptr
= &pot
[i
];
12381 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12383 local_free (hashes_buf
->digest
);
12387 local_free (hashes_buf
->salt
);
12393 if (data
.quiet
== 0) log_info_nn ("");
12400 if (hashes_cnt
== 0)
12402 log_error ("ERROR: No hashes loaded");
12409 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12412 if (data
.outfile
!= NULL
)
12414 if (data
.hashfile
!= NULL
)
12417 struct stat tmpstat_outfile
;
12418 struct stat tmpstat_hashfile
;
12422 struct stat64 tmpstat_outfile
;
12423 struct stat64 tmpstat_hashfile
;
12426 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12428 if (tmp_outfile_fp
)
12431 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12435 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12438 fclose (tmp_outfile_fp
);
12441 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12443 if (tmp_hashfile_fp
)
12446 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12450 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12453 fclose (tmp_hashfile_fp
);
12456 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12458 tmpstat_outfile
.st_mode
= 0;
12459 tmpstat_outfile
.st_nlink
= 0;
12460 tmpstat_outfile
.st_uid
= 0;
12461 tmpstat_outfile
.st_gid
= 0;
12462 tmpstat_outfile
.st_rdev
= 0;
12463 tmpstat_outfile
.st_atime
= 0;
12465 tmpstat_hashfile
.st_mode
= 0;
12466 tmpstat_hashfile
.st_nlink
= 0;
12467 tmpstat_hashfile
.st_uid
= 0;
12468 tmpstat_hashfile
.st_gid
= 0;
12469 tmpstat_hashfile
.st_rdev
= 0;
12470 tmpstat_hashfile
.st_atime
= 0;
12473 tmpstat_outfile
.st_blksize
= 0;
12474 tmpstat_outfile
.st_blocks
= 0;
12476 tmpstat_hashfile
.st_blksize
= 0;
12477 tmpstat_hashfile
.st_blocks
= 0;
12481 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12483 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12490 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12492 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12502 * Remove duplicates
12505 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12509 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12513 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12516 uint hashes_cnt_orig
= hashes_cnt
;
12520 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12524 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12526 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12531 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12534 if (hashes_pos
> hashes_cnt
)
12536 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12546 uint potfile_remove_cracks
= 0;
12548 if (potfile_disable
== 0)
12552 hash_buf
.digest
= mymalloc (dgst_size
);
12553 hash_buf
.salt
= NULL
;
12554 hash_buf
.esalt
= NULL
;
12555 hash_buf
.hash_info
= NULL
;
12556 hash_buf
.cracked
= 0;
12560 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12565 hash_buf
.esalt
= mymalloc (esalt_size
);
12568 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12570 // no solution for these special hash types (for instane because they use hashfile in output etc)
12571 if ((hash_mode
!= 5200) &&
12572 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12573 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12574 (hash_mode
!= 9000))
12576 FILE *fp
= fopen (potfile
, "rb");
12580 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12582 // to be safe work with a copy (because of line_len loop, i etc)
12583 // moved up here because it's easier to handle continue case
12586 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12590 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12592 if (ptr
== NULL
) break;
12594 int line_len
= strlen (line_buf
);
12596 if (line_len
== 0) continue;
12598 int iter
= MAX_CUT_TRIES
;
12600 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12602 if (line_buf
[i
] != ':') continue;
12606 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12609 hash_t
*found
= NULL
;
12611 if (hash_mode
== 6800)
12613 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12615 // manipulate salt_buf
12616 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12618 hash_buf
.salt
->salt_len
= i
;
12620 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12623 else if (hash_mode
== 2500)
12625 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12627 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12628 // manipulate salt_buf
12630 memcpy (line_buf_cpy
, line_buf
, i
);
12632 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12634 if (mac2_pos
== NULL
) continue;
12639 if (strlen (mac2_pos
) != 12) continue;
12641 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12643 if (mac1_pos
== NULL
) continue;
12648 if (strlen (mac1_pos
) != 12) continue;
12650 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12652 // here we need the ESSID
12653 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12655 hash_buf
.salt
->salt_len
= essid_length
;
12657 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12661 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12663 // compare hex string(s) vs binary MAC address(es)
12665 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12667 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12676 if (!found
) continue;
12678 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12680 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12692 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12694 if (parser_status
== PARSER_OK
)
12698 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12702 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12707 if (found
== NULL
) continue;
12709 if (!found
->cracked
) potfile_remove_cracks
++;
12711 found
->cracked
= 1;
12719 myfree (line_buf_cpy
);
12729 local_free (hash_buf
.esalt
);
12734 local_free (hash_buf
.salt
);
12737 local_free (hash_buf
.digest
);
12741 * Now generate all the buffers required for later
12744 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12746 salt_t
*salts_buf_new
= NULL
;
12747 void *esalts_buf_new
= NULL
;
12751 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12755 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12760 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12763 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12765 uint digests_cnt
= hashes_cnt
;
12766 uint digests_done
= 0;
12768 size_t size_digests
= digests_cnt
* dgst_size
;
12769 size_t size_shown
= digests_cnt
* sizeof (uint
);
12771 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12772 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12774 uint salts_cnt
= 0;
12775 uint salts_done
= 0;
12777 hashinfo_t
**hash_info
= NULL
;
12779 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12781 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12783 if (username
&& (remove
|| show
))
12787 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12789 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12791 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12796 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12801 // copied from inner loop
12803 salt_buf
= &salts_buf_new
[salts_cnt
];
12805 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12809 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12812 salt_buf
->digests_cnt
= 0;
12813 salt_buf
->digests_done
= 0;
12814 salt_buf
->digests_offset
= 0;
12819 if (hashes_buf
[0].cracked
== 1)
12821 digests_shown
[0] = 1;
12825 salt_buf
->digests_done
++;
12828 salt_buf
->digests_cnt
++;
12830 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12832 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12834 hash_info
[0] = hashes_buf
[0].hash_info
;
12837 // copy from inner loop
12839 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12843 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12845 salt_buf
= &salts_buf_new
[salts_cnt
];
12847 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12851 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12854 salt_buf
->digests_cnt
= 0;
12855 salt_buf
->digests_done
= 0;
12856 salt_buf
->digests_offset
= hashes_pos
;
12862 if (hashes_buf
[hashes_pos
].cracked
== 1)
12864 digests_shown
[hashes_pos
] = 1;
12868 salt_buf
->digests_done
++;
12871 salt_buf
->digests_cnt
++;
12873 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12875 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12877 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12881 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12883 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12885 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12887 salts_shown
[salt_pos
] = 1;
12892 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12895 local_free (digests_buf
);
12896 local_free (salts_buf
);
12897 local_free (esalts_buf
);
12899 digests_buf
= digests_buf_new
;
12900 salts_buf
= salts_buf_new
;
12901 esalts_buf
= esalts_buf_new
;
12903 local_free (hashes_buf
);
12906 * special modification not set from parser
12911 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12912 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12913 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12914 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12915 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12916 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12917 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12918 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12919 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12920 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12921 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12922 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12923 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12924 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12925 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12926 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12927 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12928 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12929 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12930 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12931 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12932 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12933 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12934 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12935 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12936 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12937 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12938 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12939 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12940 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12943 if (truecrypt_keyfiles
)
12945 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12947 char *keyfiles
= strdup (truecrypt_keyfiles
);
12949 char *keyfile
= strtok (keyfiles
, ",");
12953 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12955 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12960 if (veracrypt_keyfiles
)
12962 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12964 char *keyfiles
= strdup (veracrypt_keyfiles
);
12966 char *keyfile
= strtok (keyfiles
, ",");
12970 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12972 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12977 data
.digests_cnt
= digests_cnt
;
12978 data
.digests_done
= digests_done
;
12979 data
.digests_buf
= digests_buf
;
12980 data
.digests_shown
= digests_shown
;
12981 data
.digests_shown_tmp
= digests_shown_tmp
;
12983 data
.salts_cnt
= salts_cnt
;
12984 data
.salts_done
= salts_done
;
12985 data
.salts_buf
= salts_buf
;
12986 data
.salts_shown
= salts_shown
;
12988 data
.esalts_buf
= esalts_buf
;
12989 data
.hash_info
= hash_info
;
12992 * Automatic Optimizers
12995 if (salts_cnt
== 1)
12996 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12998 if (digests_cnt
== 1)
12999 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13001 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13002 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13004 if (attack_mode
== ATTACK_MODE_BF
)
13005 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13007 data
.opti_type
= opti_type
;
13009 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13011 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13013 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13015 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13017 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13018 opts_type
|= OPTS_TYPE_PT_ADD80
;
13021 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13023 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13024 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13027 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13029 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13030 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13037 * Some algorithm, like descrypt, can benefit from JIT compilation
13040 int force_jit_compilation
= -1;
13042 if (hash_mode
== 8900)
13044 force_jit_compilation
= 8900;
13046 else if (hash_mode
== 9300)
13048 force_jit_compilation
= 8900;
13050 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13052 force_jit_compilation
= 1500;
13056 * generate bitmap tables
13059 const uint bitmap_shift1
= 5;
13060 const uint bitmap_shift2
= 13;
13062 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13064 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13065 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13066 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13067 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13068 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13069 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13070 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13071 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13078 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13080 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13082 bitmap_nums
= 1 << bitmap_bits
;
13084 bitmap_mask
= bitmap_nums
- 1;
13086 bitmap_size
= bitmap_nums
* sizeof (uint
);
13088 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13090 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;
13091 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;
13096 bitmap_nums
= 1 << bitmap_bits
;
13098 bitmap_mask
= bitmap_nums
- 1;
13100 bitmap_size
= bitmap_nums
* sizeof (uint
);
13102 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);
13103 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);
13106 * prepare quick rule
13109 data
.rule_buf_l
= rule_buf_l
;
13110 data
.rule_buf_r
= rule_buf_r
;
13112 int rule_len_l
= (int) strlen (rule_buf_l
);
13113 int rule_len_r
= (int) strlen (rule_buf_r
);
13115 data
.rule_len_l
= rule_len_l
;
13116 data
.rule_len_r
= rule_len_r
;
13122 uint
*all_kernel_rules_cnt
= NULL
;
13124 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13128 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13130 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13133 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13137 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13139 uint kernel_rules_avail
= 0;
13141 uint kernel_rules_cnt
= 0;
13143 kernel_rule_t
*kernel_rules_buf
= NULL
;
13145 char *rp_file
= rp_files
[i
];
13147 char in
[BLOCK_SIZE
] = { 0 };
13148 char out
[BLOCK_SIZE
] = { 0 };
13152 uint rule_line
= 0;
13154 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13156 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13163 memset (rule_buf
, 0, HCBUFSIZ
);
13165 rule_len
= fgetl (fp
, rule_buf
);
13169 if (rule_len
== 0) continue;
13171 if (rule_buf
[0] == '#') continue;
13173 if (kernel_rules_avail
== kernel_rules_cnt
)
13175 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13177 kernel_rules_avail
+= INCR_RULES
;
13180 memset (in
, 0, BLOCK_SIZE
);
13181 memset (out
, 0, BLOCK_SIZE
);
13183 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13187 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13192 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13194 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13196 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13202 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13204 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13210 kernel_rules_cnt
++;
13215 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13217 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13221 * merge rules or automatic rule generator
13224 uint kernel_rules_cnt
= 0;
13226 kernel_rule_t
*kernel_rules_buf
= NULL
;
13228 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13232 kernel_rules_cnt
= 1;
13234 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13236 repeats
[0] = kernel_rules_cnt
;
13238 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13240 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13242 repeats
[i
+ 1] = kernel_rules_cnt
;
13245 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13247 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13249 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13253 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13255 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13257 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13260 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13262 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13264 if (out_pos
== RULES_MAX
- 1)
13266 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13271 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13276 local_free (repeats
);
13280 uint kernel_rules_avail
= 0;
13282 while (kernel_rules_cnt
< rp_gen
)
13284 if (kernel_rules_avail
== kernel_rules_cnt
)
13286 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13288 kernel_rules_avail
+= INCR_RULES
;
13291 memset (rule_buf
, 0, HCBUFSIZ
);
13293 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13295 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13297 kernel_rules_cnt
++;
13305 * generate NOP rules
13308 if (kernel_rules_cnt
== 0)
13310 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13312 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13314 kernel_rules_cnt
++;
13317 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13318 data
.kernel_rules_buf
= kernel_rules_buf
;
13321 * OpenCL platforms: detect
13324 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13325 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13327 cl_uint platforms_cnt
= 0;
13328 cl_uint platform_devices_cnt
= 0;
13332 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13334 if (platforms_cnt
== 0)
13337 log_info ("ATTENTION! No OpenCL compatible platform found");
13339 log_info ("You're probably missing the OpenCL runtime installation");
13340 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13341 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13342 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13348 if (opencl_platforms_filter
!= (uint
) -1)
13350 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13352 if (opencl_platforms_filter
> platform_cnt_mask
)
13354 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13362 * OpenCL device types:
13363 * 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.
13364 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13367 if (opencl_device_types
== NULL
)
13369 cl_device_type device_types_all
= 0;
13371 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13373 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13375 cl_platform_id platform
= platforms
[platform_id
];
13377 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13379 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13381 cl_device_id device
= platform_devices
[platform_devices_id
];
13383 cl_device_type device_type
;
13385 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13387 device_types_all
|= device_type
;
13391 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13393 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13398 * OpenCL devices: simply push all devices from all platforms into the same device array
13402 int need_nvapi
= 0;
13405 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13407 data
.devices_param
= devices_param
;
13409 uint devices_cnt
= 0;
13411 uint devices_active
= 0;
13413 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13415 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13417 cl_platform_id platform
= platforms
[platform_id
];
13419 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13421 char platform_vendor
[INFOSZ
] = { 0 };
13423 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13425 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13426 // this causes trouble with vendor id based macros
13427 // we'll assign generic to those without special optimization available
13429 cl_uint platform_vendor_id
= 0;
13431 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13433 platform_vendor_id
= VENDOR_ID_AMD
;
13435 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13437 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13439 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13441 platform_vendor_id
= VENDOR_ID_APPLE
;
13443 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13445 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13447 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13449 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13451 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13453 platform_vendor_id
= VENDOR_ID_MESA
;
13455 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13457 platform_vendor_id
= VENDOR_ID_NV
;
13459 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13461 platform_vendor_id
= VENDOR_ID_POCL
;
13465 platform_vendor_id
= VENDOR_ID_GENERIC
;
13468 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13470 size_t param_value_size
= 0;
13472 const uint device_id
= devices_cnt
;
13474 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13476 device_param
->platform_vendor_id
= platform_vendor_id
;
13478 device_param
->device
= platform_devices
[platform_devices_id
];
13480 device_param
->device_id
= device_id
;
13482 device_param
->platform_devices_id
= platform_devices_id
;
13486 cl_device_type device_type
;
13488 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13490 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13492 device_param
->device_type
= device_type
;
13496 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13498 char *device_name
= (char *) mymalloc (param_value_size
);
13500 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13502 device_param
->device_name
= device_name
;
13506 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13508 char *device_vendor
= (char *) mymalloc (param_value_size
);
13510 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13512 device_param
->device_vendor
= device_vendor
;
13514 cl_uint device_vendor_id
= 0;
13516 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13518 device_vendor_id
= VENDOR_ID_AMD
;
13520 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13522 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13524 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13526 device_vendor_id
= VENDOR_ID_APPLE
;
13528 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13530 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13532 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13534 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13536 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13538 device_vendor_id
= VENDOR_ID_MESA
;
13540 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13542 device_vendor_id
= VENDOR_ID_NV
;
13544 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13546 device_vendor_id
= VENDOR_ID_POCL
;
13550 device_vendor_id
= VENDOR_ID_GENERIC
;
13553 device_param
->device_vendor_id
= device_vendor_id
;
13557 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13561 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13563 char *device_version
= (char *) mymalloc (param_value_size
);
13565 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13567 device_param
->device_version
= device_version
;
13569 // device_opencl_version
13571 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13573 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13575 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13577 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13579 myfree (device_opencl_version
);
13583 cl_uint vector_width
;
13585 if (opencl_vector_width_chgd
== 0)
13587 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13589 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13591 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13595 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13600 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13605 vector_width
= opencl_vector_width
;
13608 if (vector_width
> 16) vector_width
= 16;
13610 device_param
->vector_width
= vector_width
;
13612 // max_compute_units
13614 cl_uint device_processors
;
13616 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13618 device_param
->device_processors
= device_processors
;
13620 // device_maxmem_alloc
13621 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13623 cl_ulong device_maxmem_alloc
;
13625 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13627 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13629 // device_global_mem
13631 cl_ulong device_global_mem
;
13633 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13635 device_param
->device_global_mem
= device_global_mem
;
13637 // max_work_group_size
13639 size_t device_maxworkgroup_size
;
13641 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13643 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13645 // max_clock_frequency
13647 cl_uint device_maxclock_frequency
;
13649 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13651 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13653 // device_endian_little
13655 cl_bool device_endian_little
;
13657 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13659 if (device_endian_little
== CL_FALSE
)
13661 log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13663 device_param
->skipped
= 1;
13666 // device_available
13668 cl_bool device_available
;
13670 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13672 if (device_available
== CL_FALSE
)
13674 log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13676 device_param
->skipped
= 1;
13679 // device_compiler_available
13681 cl_bool device_compiler_available
;
13683 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13685 if (device_compiler_available
== CL_FALSE
)
13687 log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13689 device_param
->skipped
= 1;
13692 // device_execution_capabilities
13694 cl_device_exec_capabilities device_execution_capabilities
;
13696 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13698 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13700 log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13702 device_param
->skipped
= 1;
13705 // device_extensions
13707 size_t device_extensions_size
;
13709 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13711 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13713 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13715 if (strstr (device_extensions
, "base_atomics") == 0)
13717 log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13719 device_param
->skipped
= 1;
13722 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13724 log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13726 device_param
->skipped
= 1;
13729 myfree (device_extensions
);
13731 // device_local_mem_size
13733 cl_ulong device_local_mem_size
;
13735 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13737 if (device_local_mem_size
< 32768)
13739 log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13741 device_param
->skipped
= 1;
13744 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13745 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13746 // This results in both utilizing it for 50%
13747 // However, Intel has much better SIMD control over their own hardware
13748 // It makes sense to give them full control over their own hardware
13750 if (device_type
& CL_DEVICE_TYPE_CPU
)
13752 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13754 if (data
.force
== 0)
13756 if (algorithm_pos
== 0)
13758 log_info ("Device #%u: WARNING: not native intel opencl runtime, expect massive speed loss", device_id
+ 1);
13759 log_info (" You can use --force to override this but do not post error reports if you do so");
13762 device_param
->skipped
= 1;
13769 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13770 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13774 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13776 char *driver_version
= (char *) mymalloc (param_value_size
);
13778 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13780 device_param
->driver_version
= driver_version
;
13782 // device_name_chksum
13784 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13787 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
);
13789 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
);
13792 uint device_name_digest
[4] = { 0 };
13794 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13796 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13798 device_param
->device_name_chksum
= device_name_chksum
;
13800 // device_processor_cores
13802 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
13804 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
13809 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
13819 // device_processor_cores
13821 if (device_type
& CL_DEVICE_TYPE_CPU
)
13823 cl_uint device_processor_cores
= 1;
13825 device_param
->device_processor_cores
= device_processor_cores
;
13828 if (device_type
& CL_DEVICE_TYPE_GPU
)
13830 if (device_vendor_id
== VENDOR_ID_AMD
)
13832 cl_uint device_processor_cores
= 0;
13834 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13836 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13838 device_param
->device_processor_cores
= device_processor_cores
;
13840 else if (device_vendor_id
== VENDOR_ID_NV
)
13842 cl_uint kernel_exec_timeout
= 0;
13844 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13846 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13848 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13850 cl_uint device_processor_cores
= 0;
13852 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13854 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13856 device_param
->device_processor_cores
= device_processor_cores
;
13858 cl_uint sm_minor
= 0;
13859 cl_uint sm_major
= 0;
13861 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13862 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13864 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13865 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13867 device_param
->sm_minor
= sm_minor
;
13868 device_param
->sm_major
= sm_major
;
13872 cl_uint device_processor_cores
= 1;
13874 device_param
->device_processor_cores
= device_processor_cores
;
13880 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13882 if (machine_readable
== 0)
13884 if (device_param
->skipped
== 0)
13886 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13889 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13890 (unsigned int) (device_global_mem
/ 1024 / 1024),
13891 (unsigned int) device_processors
);
13895 log_info ("Device #%u: %s, skipped",
13902 // common driver check
13904 if (device_param
->skipped
== 0)
13906 if (device_type
& CL_DEVICE_TYPE_GPU
)
13908 if (platform_vendor_id
== VENDOR_ID_AMD
)
13910 int catalyst_check
= (force
== 1) ? 0 : 1;
13912 int catalyst_warn
= 0;
13914 int catalyst_broken
= 0;
13916 if (catalyst_check
== 1)
13920 // v14.9 and higher
13921 if (atoi (device_param
->driver_version
) >= 1573)
13926 catalyst_check
= 0;
13929 if (catalyst_broken
== 1)
13932 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13933 log_info ("It will pass over cracked hashes and does not report them as cracked");
13934 log_info ("You are STRONGLY encouraged not to use it");
13935 log_info ("You can use --force to override this but do not post error reports if you do so");
13941 if (catalyst_warn
== 1)
13944 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13945 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13946 log_info ("See hashcat's homepage for official supported catalyst drivers");
13948 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13950 log_info ("You can use --force to override this but do not post error reports if you do so");
13956 else if (platform_vendor_id
== VENDOR_ID_NV
)
13958 if (device_param
->kernel_exec_timeout
!= 0)
13960 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);
13961 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13966 /* turns out pocl still creates segfaults (because of llvm)
13967 if (device_type & CL_DEVICE_TYPE_CPU)
13969 if (platform_vendor_id == VENDOR_ID_AMD)
13974 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13975 log_info ("You are STRONGLY encouraged not to use it");
13976 log_info ("You can use --force to override this but do not post error reports if you do so");
13977 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13987 * kernel accel and loops tuning db adjustment
13990 device_param
->kernel_accel_min
= 1;
13991 device_param
->kernel_accel_max
= 1024;
13993 device_param
->kernel_loops_min
= 1;
13994 device_param
->kernel_loops_max
= 1024;
13996 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13998 if (tuningdb_entry
)
14000 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
14001 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
14005 device_param
->kernel_accel_min
= _kernel_accel
;
14006 device_param
->kernel_accel_max
= _kernel_accel
;
14011 if (workload_profile
== 1)
14013 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
14015 else if (workload_profile
== 2)
14017 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
14020 device_param
->kernel_loops_min
= _kernel_loops
;
14021 device_param
->kernel_loops_max
= _kernel_loops
;
14025 // commandline parameters overwrite tuningdb entries
14029 device_param
->kernel_accel_min
= kernel_accel
;
14030 device_param
->kernel_accel_max
= kernel_accel
;
14035 device_param
->kernel_loops_min
= kernel_loops
;
14036 device_param
->kernel_loops_max
= kernel_loops
;
14052 if (keyspace
== 0 && devices_active
== 0)
14054 log_error ("ERROR: No devices found/left");
14059 // 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)
14061 if (devices_filter
!= (uint
) -1)
14063 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
14065 if (devices_filter
> devices_cnt_mask
)
14067 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
14073 data
.devices_cnt
= devices_cnt
;
14075 data
.devices_active
= devices_active
;
14077 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14079 if (machine_readable
== 0)
14090 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
] = { { 0 } };
14091 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
] = { { 0 } };
14092 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
] = { { 0 } };
14094 if (gpu_temp_disable
== 0)
14096 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14097 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14098 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14100 data
.hm_adl
= NULL
;
14101 data
.hm_nvapi
= NULL
;
14102 data
.hm_nvml
= NULL
;
14104 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
14106 data
.hm_nvml
= nvml
;
14111 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
14113 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
14115 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
14119 for (int i
= 0; i
< tmp_in
; i
++)
14121 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
14124 for (int i
= 0; i
< tmp_out
; i
++)
14126 unsigned int speed
;
14128 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
14130 hm_NVML_nvmlDeviceSetComputeMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].nvml
, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS
);
14132 hm_NVML_nvmlDeviceSetGpuOperationMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].nvml
, NVML_GOM_ALL_ON
);
14137 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
14139 data
.hm_nvapi
= nvapi
;
14144 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
14146 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
14148 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
14152 for (int i
= 0; i
< tmp_in
; i
++)
14154 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
14159 if ((need_adl
== 1) && (adl_init (adl
) == 0))
14166 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14168 // total number of adapters
14170 int hm_adapters_num
;
14172 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return (-1);
14176 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
14178 if (lpAdapterInfo
== NULL
) return (-1);
14180 // get a list (of ids of) valid/usable adapters
14182 int num_adl_adapters
= 0;
14184 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14186 if (num_adl_adapters
> 0)
14188 hc_thread_mutex_lock (mux_adl
);
14190 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
14192 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14194 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14195 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14197 hc_thread_mutex_unlock (mux_adl
);
14200 myfree (valid_adl_device_list
);
14201 myfree (lpAdapterInfo
);
14205 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14207 gpu_temp_disable
= 1;
14212 * OpenCL devices: allocate buffer for device specific information
14215 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14216 int *temp_retain_fanpolicy_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14218 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14220 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14222 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
14225 * User-defined GPU temp handling
14228 if (gpu_temp_disable
== 1)
14230 gpu_temp_abort
= 0;
14231 gpu_temp_retain
= 0;
14234 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14236 if (gpu_temp_abort
< gpu_temp_retain
)
14238 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14244 data
.gpu_temp_disable
= gpu_temp_disable
;
14245 data
.gpu_temp_abort
= gpu_temp_abort
;
14246 data
.gpu_temp_retain
= gpu_temp_retain
;
14250 * enable custom signal handler(s)
14253 if (benchmark
== 0)
14255 hc_signal (sigHandler_default
);
14259 hc_signal (sigHandler_benchmark
);
14266 if (data
.quiet
== 0)
14268 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14270 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
);
14272 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14274 log_info ("Rules: %u", kernel_rules_cnt
);
14279 log_info ("Applicable Optimizers:");
14281 for (uint i
= 0; i
< 32; i
++)
14283 const uint opti_bit
= 1u << i
;
14285 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14290 * Watchdog and Temperature balance
14294 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14296 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14299 if (gpu_temp_abort
== 0)
14301 log_info ("Watchdog: Temperature abort trigger disabled");
14305 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14308 if (gpu_temp_retain
== 0)
14310 log_info ("Watchdog: Temperature retain trigger disabled");
14314 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14317 if (data
.quiet
== 0) log_info ("");
14327 if (gpu_temp_disable
== 0)
14329 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14331 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14333 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14335 if (device_param
->skipped
) continue;
14337 const uint platform_devices_id
= device_param
->platform_devices_id
;
14339 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14341 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
14342 data
.hm_device
[device_id
].nvapi
= 0;
14343 data
.hm_device
[device_id
].nvml
= 0;
14344 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
14345 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
14346 data
.hm_device
[device_id
].fan_set_supported
= hm_adapters_adl
[platform_devices_id
].fan_set_supported
;
14349 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14351 data
.hm_device
[device_id
].adl
= 0;
14352 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
14353 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
14354 data
.hm_device
[device_id
].od_version
= 0;
14355 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
14356 data
.hm_device
[device_id
].fan_set_supported
= 0;
14362 * powertune on user request
14365 if (powertune_enable
== 1)
14367 hc_thread_mutex_lock (mux_adl
);
14369 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14371 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14373 if (device_param
->skipped
) continue;
14375 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
14379 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14380 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14381 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14382 * Driver / ADL bug?
14385 if (data
.hm_device
[device_id
].od_version
== 6)
14389 // check powertune capabilities first, if not available then skip device
14391 int powertune_supported
= 0;
14393 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
14395 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14400 // first backup current value, we will restore it later
14402 if (powertune_supported
!= 0)
14404 // powercontrol settings
14406 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14408 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
14410 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
14413 if (ADL_rc
!= ADL_OK
)
14415 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14420 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14422 log_error ("ERROR: Failed to set new ADL PowerControl values");
14429 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
14431 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
14433 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
)
14435 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
14440 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
14442 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
14444 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
14446 log_error ("ERROR: Failed to get ADL device capabilities");
14451 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
14452 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
14454 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
14455 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
14457 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
14458 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
14460 // warning if profile has too low max values
14462 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
14464 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
14467 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
14469 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
14472 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
14474 performance_state
->iNumberOfPerformanceLevels
= 2;
14476 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
14477 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
14478 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
14479 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
14481 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
)
14483 log_info ("ERROR: Failed to set ADL performance state");
14488 local_free (performance_state
);
14491 // set powertune value only
14493 if (powertune_supported
!= 0)
14496 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14498 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
14500 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14505 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14507 log_error ("ERROR: Failed to set new ADL PowerControl values");
14515 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
14517 // first backup current value, we will restore it later
14519 unsigned int limit
;
14521 int powertune_supported
= 0;
14523 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
14525 powertune_supported
= 1;
14528 // if backup worked, activate the maximum allowed
14530 if (powertune_supported
!= 0)
14532 unsigned int minLimit
;
14533 unsigned int maxLimit
;
14535 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
14539 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
14541 // now we can be sure we need to reset later
14543 nvml_power_limit
[device_id
] = limit
;
14551 hc_thread_mutex_unlock (mux_adl
);
14554 #endif // HAVE_HWMON
14557 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14560 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14562 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14568 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14570 if (device_param
->skipped
) continue;
14573 * device properties
14576 const char *device_name_chksum
= device_param
->device_name_chksum
;
14577 const u32 device_processors
= device_param
->device_processors
;
14578 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14581 * create context for each device
14584 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14587 * create command-queue
14590 // not supported with NV
14591 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14593 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14596 * kernel threads: some algorithms need a fixed kernel-threads count
14597 * because of shared memory usage or bitslice
14598 * there needs to be some upper limit, otherwise there's too much overhead
14601 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14603 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14605 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14608 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14609 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14610 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14611 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14612 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14613 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14614 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14615 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14616 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14617 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14618 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14619 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14620 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14622 device_param
->kernel_threads
= kernel_threads
;
14624 device_param
->hardware_power
= device_processors
* kernel_threads
;
14627 * create input buffers on device : calculate size of fixed memory buffers
14630 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14631 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14633 device_param
->size_root_css
= size_root_css
;
14634 device_param
->size_markov_css
= size_markov_css
;
14636 size_t size_results
= sizeof (uint
);
14638 device_param
->size_results
= size_results
;
14640 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14641 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14643 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14644 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14645 size_t size_esalts
= salts_cnt
* esalt_size
;
14647 device_param
->size_plains
= size_plains
;
14648 device_param
->size_digests
= size_digests
;
14649 device_param
->size_shown
= size_shown
;
14650 device_param
->size_salts
= size_salts
;
14652 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14653 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14654 size_t size_tm
= 32 * sizeof (bs_word_t
);
14658 size_t size_scryptV
= 1;
14660 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14662 uint tmto_start
= 0;
14663 uint tmto_stop
= 10;
14667 tmto_start
= scrypt_tmto
;
14671 // in case the user did not specify the tmto manually
14672 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14673 // but set the lower end only in case the user has a device with too less memory
14675 if (hash_mode
== 8900)
14677 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14681 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14686 else if (hash_mode
== 9300)
14688 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14692 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14699 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14701 // TODO: in theory the following calculation needs to be done per salt, not global
14702 // we assume all hashes have the same scrypt settings
14704 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14706 size_scryptV
/= 1 << tmto
;
14708 size_scryptV
*= device_processors
* device_processor_cores
;
14710 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14712 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14717 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14719 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14720 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14726 if (data
.salts_buf
[0].scrypt_phy
== 0)
14728 log_error ("ERROR: can't allocate enough device memory");
14733 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14737 * some algorithms need a fixed kernel-loops count
14740 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
14742 const u32 kernel_loops_fixed
= 1024;
14744 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14745 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14748 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
14750 const u32 kernel_loops_fixed
= 1024;
14752 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14753 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14756 if (hash_mode
== 8900)
14758 const u32 kernel_loops_fixed
= 1;
14760 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14761 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14764 if (hash_mode
== 9300)
14766 const u32 kernel_loops_fixed
= 1;
14768 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14769 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14772 if (hash_mode
== 12500)
14774 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14776 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14777 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14781 * some algorithms have a maximum kernel-loops count
14784 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14786 u32 innerloop_cnt
= 0;
14788 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14790 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14791 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14792 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14796 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14799 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14800 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14802 device_param
->kernel_loops_max
= innerloop_cnt
;
14806 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14807 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14809 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14811 size_t size_pws
= 4;
14812 size_t size_tmps
= 4;
14813 size_t size_hooks
= 4;
14815 while (kernel_accel_max
>= kernel_accel_min
)
14817 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14821 size_pws
= kernel_power_max
* sizeof (pw_t
);
14827 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14828 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14829 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14830 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14831 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14832 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14833 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14834 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14835 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14836 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14837 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14838 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14839 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14840 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14841 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14842 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14843 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14844 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14845 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14846 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14847 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14848 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14849 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14850 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14851 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14852 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14853 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14854 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14855 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14856 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14857 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14858 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14859 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14860 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14861 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14862 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14863 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14864 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14865 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14866 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14867 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14868 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14869 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14870 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14871 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14872 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14873 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14874 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14875 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14876 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14877 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14878 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14879 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14880 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14881 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14882 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14883 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14884 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14885 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14886 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14887 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14888 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14889 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14890 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14891 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14892 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14893 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14894 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14895 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14896 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14897 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14898 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14899 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14900 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14901 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14902 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14903 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14904 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14905 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14906 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14907 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14908 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14913 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14918 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14919 // if not, decrease amplifier and try again
14923 const u64 size_total
14940 + size_pws
// not a bug
14951 // Don't ask me, ask AMD!
14953 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14954 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14958 kernel_accel_max
--;
14967 if (kernel_accel_max == 0)
14969 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14975 device_param
->kernel_accel_min
= kernel_accel_min
;
14976 device_param
->kernel_accel_max
= kernel_accel_max
;
14979 if (kernel_accel_max < kernel_accel)
14981 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14983 device_param->kernel_accel = kernel_accel_max;
14987 device_param
->size_bfs
= size_bfs
;
14988 device_param
->size_combs
= size_combs
;
14989 device_param
->size_rules
= size_rules
;
14990 device_param
->size_rules_c
= size_rules_c
;
14991 device_param
->size_pws
= size_pws
;
14992 device_param
->size_tmps
= size_tmps
;
14993 device_param
->size_hooks
= size_hooks
;
14996 * default building options
14999 char build_opts
[1024] = { 0 };
15001 // we don't have sm_* on vendors not NV but it doesn't matter
15004 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\\OpenCL\\\" -I '%s\\OpenCL\\' -I %s\\OpenCL\\ -I\"%s\\OpenCL\\\" -I'%s\\OpenCL\\' -I%s\\OpenCL\\", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
15006 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s/OpenCL/\" -I '%s/OpenCL/' -I %s/OpenCL/ -I\"%s/OpenCL/\" -I'%s/OpenCL/' -I%s/OpenCL/", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
15009 char build_opts_new
[1024] = { 0 };
15011 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -DVENDOR_ID=%u -DCUDA_ARCH=%d -DVECT_SIZE=%u -DDEVICE_TYPE=%u -DKERN_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
, kern_type
);
15013 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
15016 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
15018 // we do vectorizing much better than the auto-vectorizer
15020 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
15022 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
15027 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
15036 * kernel source filename
15039 char source_file
[256] = { 0 };
15041 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
15045 if (stat (source_file
, &sst
) == -1)
15047 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15053 * kernel cached filename
15056 char cached_file
[256] = { 0 };
15058 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
15064 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
15070 * kernel compile or load
15073 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15075 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15077 if (force_jit_compilation
== -1)
15081 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15083 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15085 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15087 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15090 size_t build_log_size
= 0;
15092 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15094 if (build_log_size
> 1)
15096 char *build_log
= (char *) malloc (build_log_size
+ 1);
15098 memset (build_log
, 0, build_log_size
+ 1);
15100 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15110 device_param
->skipped
= true;
15112 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15117 size_t binary_size
;
15119 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15121 u8
*binary
= (u8
*) mymalloc (binary_size
);
15123 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15125 writeProgramBin (cached_file
, binary
, binary_size
);
15127 local_free (binary
);
15132 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15135 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15137 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15139 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15145 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
15148 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15150 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15152 char build_opts_update
[1024] = { 0 };
15154 if (force_jit_compilation
== 1500)
15156 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
15158 else if (force_jit_compilation
== 8900)
15160 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.salts_buf
[0].scrypt_tmto
);
15164 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
15167 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
15170 size_t build_log_size
= 0;
15172 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15174 if (build_log_size
> 1)
15176 char *build_log
= (char *) malloc (build_log_size
+ 1);
15178 memset (build_log
, 0, build_log_size
+ 1);
15180 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15190 device_param
->skipped
= true;
15192 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15196 local_free (kernel_lengths
);
15197 local_free (kernel_sources
[0]);
15198 local_free (kernel_sources
);
15202 * word generator kernel
15205 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
15208 * kernel mp source filename
15211 char source_file
[256] = { 0 };
15213 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
15217 if (stat (source_file
, &sst
) == -1)
15219 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15225 * kernel mp cached filename
15228 char cached_file
[256] = { 0 };
15230 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15236 if (stat (cached_file
, &cst
) == -1)
15242 * kernel compile or load
15245 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15247 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15251 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15252 if (quiet
== 0) log_info ("");
15254 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15256 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15258 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15262 device_param
->skipped
= true;
15264 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15269 size_t binary_size
;
15271 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15273 u8
*binary
= (u8
*) mymalloc (binary_size
);
15275 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15277 writeProgramBin (cached_file
, binary
, binary_size
);
15279 local_free (binary
);
15284 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15287 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15289 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15291 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15294 local_free (kernel_lengths
);
15295 local_free (kernel_sources
[0]);
15296 local_free (kernel_sources
);
15303 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15310 * kernel amp source filename
15313 char source_file
[256] = { 0 };
15315 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15319 if (stat (source_file
, &sst
) == -1)
15321 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15327 * kernel amp cached filename
15330 char cached_file
[256] = { 0 };
15332 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15338 if (stat (cached_file
, &cst
) == -1)
15344 * kernel compile or load
15347 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15349 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15353 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15354 if (quiet
== 0) log_info ("");
15356 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15358 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15360 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15364 device_param
->skipped
= true;
15366 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15371 size_t binary_size
;
15373 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15375 u8
*binary
= (u8
*) mymalloc (binary_size
);
15377 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15379 writeProgramBin (cached_file
, binary
, binary_size
);
15381 local_free (binary
);
15386 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15389 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15391 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15393 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15396 local_free (kernel_lengths
);
15397 local_free (kernel_sources
[0]);
15398 local_free (kernel_sources
);
15401 // some algorithm collide too fast, make that impossible
15403 if (benchmark
== 1)
15405 ((uint
*) digests_buf
)[0] = -1;
15406 ((uint
*) digests_buf
)[1] = -1;
15407 ((uint
*) digests_buf
)[2] = -1;
15408 ((uint
*) digests_buf
)[3] = -1;
15415 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15416 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15417 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15418 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15419 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15420 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15421 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15422 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15423 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15424 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15425 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15426 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15427 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15428 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15429 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15430 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15431 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15432 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15434 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
);
15435 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
);
15436 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
);
15437 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
);
15438 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
);
15439 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
);
15440 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
);
15441 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
);
15442 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15443 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15444 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15450 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15452 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15453 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15455 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15457 else if (attack_kern
== ATTACK_KERN_COMBI
)
15459 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15460 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15461 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15462 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15464 else if (attack_kern
== ATTACK_KERN_BF
)
15466 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15467 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15468 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15469 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15470 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15475 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15477 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15484 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15486 device_param
->pws_buf
= pws_buf
;
15488 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15490 device_param
->combs_buf
= combs_buf
;
15492 void *hooks_buf
= mymalloc (size_hooks
);
15494 device_param
->hooks_buf
= hooks_buf
;
15500 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15501 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15502 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15503 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15504 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15505 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15506 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15507 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15508 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15509 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15510 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15512 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15513 ? &device_param
->d_pws_buf
15514 : &device_param
->d_pws_amp_buf
;
15515 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15516 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15517 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15518 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15519 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15520 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15521 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15522 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15523 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15524 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15525 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15526 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15527 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15528 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15529 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15530 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15531 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15532 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15533 device_param
->kernel_params
[19] = &device_param
->d_result
;
15534 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15535 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15536 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15537 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15538 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15539 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15540 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15541 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15542 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15543 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15544 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15545 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15547 device_param
->kernel_params_mp_buf64
[3] = 0;
15548 device_param
->kernel_params_mp_buf32
[4] = 0;
15549 device_param
->kernel_params_mp_buf32
[5] = 0;
15550 device_param
->kernel_params_mp_buf32
[6] = 0;
15551 device_param
->kernel_params_mp_buf32
[7] = 0;
15552 device_param
->kernel_params_mp_buf32
[8] = 0;
15554 device_param
->kernel_params_mp
[0] = NULL
;
15555 device_param
->kernel_params_mp
[1] = NULL
;
15556 device_param
->kernel_params_mp
[2] = NULL
;
15557 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15558 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15559 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15560 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15561 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15562 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15564 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15565 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15566 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15567 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15568 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15569 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15570 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15572 device_param
->kernel_params_mp_l
[0] = NULL
;
15573 device_param
->kernel_params_mp_l
[1] = NULL
;
15574 device_param
->kernel_params_mp_l
[2] = NULL
;
15575 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15576 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15577 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15578 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15579 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15580 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15581 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15583 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15584 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15585 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15586 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15587 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15588 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15590 device_param
->kernel_params_mp_r
[0] = NULL
;
15591 device_param
->kernel_params_mp_r
[1] = NULL
;
15592 device_param
->kernel_params_mp_r
[2] = NULL
;
15593 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15594 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15595 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15596 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15597 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15598 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15600 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15601 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15603 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15604 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15605 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15606 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15607 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15608 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15609 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15611 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15612 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15614 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15615 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15617 device_param
->kernel_params_memset
[0] = NULL
;
15618 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15619 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15625 size_t kernel_wgs_tmp
;
15627 char kernel_name
[64] = { 0 };
15629 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15631 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15633 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15635 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15637 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15639 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15641 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15643 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15647 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15649 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15651 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15653 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15655 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15657 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15660 if (data
.attack_mode
== ATTACK_MODE_BF
)
15662 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15664 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15666 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15668 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
);
15674 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15676 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15678 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15680 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15682 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15684 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15686 if (opts_type
& OPTS_TYPE_HOOK12
)
15688 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15690 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15692 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
);
15695 if (opts_type
& OPTS_TYPE_HOOK23
)
15697 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15699 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15701 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
);
15705 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
);
15706 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
);
15707 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
);
15709 for (uint i
= 0; i
<= 20; i
++)
15711 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15712 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15713 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15715 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15716 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15719 for (uint i
= 21; i
<= 31; i
++)
15721 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15722 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15723 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15725 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15726 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15731 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15733 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
);
15735 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15736 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15737 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15741 if (attack_mode
== ATTACK_MODE_BF
)
15743 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15744 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15746 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
);
15747 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
);
15749 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15751 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15752 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15755 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15757 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15759 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
);
15761 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15763 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15765 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
);
15768 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15774 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15776 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
);
15779 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15785 for (uint i
= 0; i
< 5; i
++)
15787 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15790 for (uint i
= 5; i
< 7; i
++)
15792 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15796 // maybe this has been updated by clGetKernelWorkGroupInfo()
15797 // value can only be decreased, so we don't need to reallocate buffers
15799 device_param
->kernel_threads
= kernel_threads
;
15801 // zero some data buffers
15803 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15804 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15805 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15806 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15807 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15808 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15814 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15816 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15818 else if (attack_kern
== ATTACK_KERN_COMBI
)
15820 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15821 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15822 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15823 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15825 else if (attack_kern
== ATTACK_KERN_BF
)
15827 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15828 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15829 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15830 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15831 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15834 #if defined(HAVE_HWMON)
15837 * Store initial fanspeed if gpu_temp_retain is enabled
15840 if (gpu_temp_disable
== 0)
15842 if (gpu_temp_retain
!= 0)
15844 hc_thread_mutex_lock (mux_adl
);
15846 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
15848 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
15849 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
15851 temp_retain_fanspeed_value
[device_id
] = fanspeed
;
15852 temp_retain_fanpolicy_value
[device_id
] = fanpolicy
;
15854 // we also set it to tell the OS we take control over the fan and it's automatic controller
15855 // if it was set to automatic. we do not control user-defined fanspeeds.
15857 if (fanpolicy
== 1)
15859 data
.hm_device
[device_id
].fan_set_supported
= 1;
15863 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15865 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
15867 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15874 data
.hm_device
[device_id
].fan_set_supported
= 1;
15878 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
15880 data
.hm_device
[device_id
].fan_set_supported
= 0;
15885 data
.hm_device
[device_id
].fan_set_supported
= 0;
15889 hc_thread_mutex_unlock (mux_adl
);
15893 #endif // HAVE_HWMON
15896 if (data
.quiet
== 0) log_info_nn ("");
15899 * In benchmark-mode, inform user which algorithm is checked
15902 if (benchmark
== 1)
15904 if (machine_readable
== 0)
15908 data
.quiet
= quiet
;
15910 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15912 log_info ("Hashtype: %s", hash_type
);
15918 * keep track of the progress
15921 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15922 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15923 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15930 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15932 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15937 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15939 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15944 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15946 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15956 segment_size
*= (1024 * 1024);
15958 data
.segment_size
= segment_size
;
15960 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15962 wl_data
->buf
= (char *) mymalloc (segment_size
);
15963 wl_data
->avail
= segment_size
;
15964 wl_data
->incr
= segment_size
;
15968 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15970 data
.wordlist_mode
= wordlist_mode
;
15972 cs_t
*css_buf
= NULL
;
15976 char **masks
= NULL
;
15977 char **dictfiles
= NULL
;
15979 uint mask_from_file
= 0;
15981 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15983 if (wordlist_mode
== WL_MODE_FILE
)
15985 int wls_left
= myargc
- (optind
+ 1);
15987 for (int i
= 0; i
< wls_left
; i
++)
15989 char *l0_filename
= myargv
[optind
+ 1 + i
];
15991 struct stat l0_stat
;
15993 if (stat (l0_filename
, &l0_stat
) == -1)
15995 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
16000 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
16004 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16008 dictfiles
[dictcnt
- 1] = l0_filename
;
16012 // do not allow --keyspace w/ a directory
16016 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16021 char **dictionary_files
= NULL
;
16023 dictionary_files
= scan_directory (l0_filename
);
16025 if (dictionary_files
!= NULL
)
16027 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16029 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16031 char *l1_filename
= dictionary_files
[d
];
16033 struct stat l1_stat
;
16035 if (stat (l1_filename
, &l1_stat
) == -1)
16037 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16042 if (S_ISREG (l1_stat
.st_mode
))
16044 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16048 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16053 local_free (dictionary_files
);
16059 log_error ("ERROR: No usable dictionary file found.");
16064 else if (wordlist_mode
== WL_MODE_STDIN
)
16069 else if (attack_mode
== ATTACK_MODE_COMBI
)
16073 char *dictfile1
= myargv
[optind
+ 1 + 0];
16074 char *dictfile2
= myargv
[optind
+ 1 + 1];
16076 // find the bigger dictionary and use as base
16081 struct stat tmp_stat
;
16083 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
16085 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16090 if (stat (dictfile1
, &tmp_stat
) == -1)
16092 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16099 if (S_ISDIR (tmp_stat
.st_mode
))
16101 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16108 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16110 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16117 if (stat (dictfile2
, &tmp_stat
) == -1)
16119 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16127 if (S_ISDIR (tmp_stat
.st_mode
))
16129 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16137 data
.combs_cnt
= 1;
16141 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16143 data
.quiet
= quiet
;
16145 if (words1_cnt
== 0)
16147 log_error ("ERROR: %s: empty file", dictfile1
);
16155 data
.combs_cnt
= 1;
16159 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16161 data
.quiet
= quiet
;
16163 if (words2_cnt
== 0)
16165 log_error ("ERROR: %s: empty file", dictfile2
);
16176 data
.dictfile
= dictfile1
;
16177 data
.dictfile2
= dictfile2
;
16179 if (words1_cnt
>= words2_cnt
)
16181 data
.combs_cnt
= words2_cnt
;
16182 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16184 dictfiles
= &data
.dictfile
;
16190 data
.combs_cnt
= words1_cnt
;
16191 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16193 dictfiles
= &data
.dictfile2
;
16197 // we also have to switch wordlist related rules!
16199 char *tmpc
= data
.rule_buf_l
;
16201 data
.rule_buf_l
= data
.rule_buf_r
;
16202 data
.rule_buf_r
= tmpc
;
16204 int tmpi
= data
.rule_len_l
;
16206 data
.rule_len_l
= data
.rule_len_r
;
16207 data
.rule_len_r
= tmpi
;
16210 else if (attack_mode
== ATTACK_MODE_BF
)
16216 if (benchmark
== 0)
16218 mask
= myargv
[optind
+ 1];
16220 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16222 if ((optind
+ 2) <= myargc
)
16224 struct stat file_stat
;
16226 if (stat (mask
, &file_stat
) == -1)
16230 masks
[maskcnt
- 1] = mystrdup (mask
);
16234 int wls_left
= myargc
- (optind
+ 1);
16236 uint masks_avail
= INCR_MASKS
;
16238 for (int i
= 0; i
< wls_left
; i
++)
16242 mask
= myargv
[optind
+ 1 + i
];
16244 if (stat (mask
, &file_stat
) == -1)
16246 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16252 uint is_file
= S_ISREG (file_stat
.st_mode
);
16258 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16260 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16265 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16267 while (!feof (mask_fp
))
16269 memset (line_buf
, 0, HCBUFSIZ
);
16271 int line_len
= fgetl (mask_fp
, line_buf
);
16273 if (line_len
== 0) continue;
16275 if (line_buf
[0] == '#') continue;
16277 if (masks_avail
== maskcnt
)
16279 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16281 masks_avail
+= INCR_MASKS
;
16284 masks
[maskcnt
] = mystrdup (line_buf
);
16295 log_error ("ERROR: %s: unsupported file-type", mask
);
16301 mask_from_file
= 1;
16306 custom_charset_1
= (char *) "?l?d?u";
16307 custom_charset_2
= (char *) "?l?d";
16308 custom_charset_3
= (char *) "?l?d*!$@_";
16310 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16311 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16312 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16314 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16316 wordlist_mode
= WL_MODE_MASK
;
16318 data
.wordlist_mode
= wordlist_mode
;
16328 * generate full masks and charsets
16331 masks
= (char **) mymalloc (sizeof (char *));
16335 case 1731: pw_min
= 5;
16337 mask
= mystrdup ("?b?b?b?b?b");
16339 case 12500: pw_min
= 5;
16341 mask
= mystrdup ("?b?b?b?b?b");
16343 default: pw_min
= 7;
16345 mask
= mystrdup ("?b?b?b?b?b?b?b");
16351 masks
[maskcnt
- 1] = mystrdup (mask
);
16353 wordlist_mode
= WL_MODE_MASK
;
16355 data
.wordlist_mode
= wordlist_mode
;
16360 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16364 if (increment_min
> pw_min
) pw_min
= increment_min
;
16366 if (increment_max
< pw_max
) pw_max
= increment_max
;
16369 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16371 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16375 char *mask
= myargv
[myargc
- 1];
16379 masks
= (char **) mymalloc (1 * sizeof (char *));
16383 struct stat file_stat
;
16385 if (stat (mask
, &file_stat
) == -1)
16389 masks
[maskcnt
- 1] = mystrdup (mask
);
16393 uint is_file
= S_ISREG (file_stat
.st_mode
);
16399 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16401 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16406 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16408 uint masks_avail
= 1;
16410 while (!feof (mask_fp
))
16412 memset (line_buf
, 0, HCBUFSIZ
);
16414 int line_len
= fgetl (mask_fp
, line_buf
);
16416 if (line_len
== 0) continue;
16418 if (line_buf
[0] == '#') continue;
16420 if (masks_avail
== maskcnt
)
16422 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16424 masks_avail
+= INCR_MASKS
;
16427 masks
[maskcnt
] = mystrdup (line_buf
);
16436 mask_from_file
= 1;
16442 masks
[maskcnt
- 1] = mystrdup (mask
);
16448 int wls_left
= myargc
- (optind
+ 2);
16450 for (int i
= 0; i
< wls_left
; i
++)
16452 char *filename
= myargv
[optind
+ 1 + i
];
16454 struct stat file_stat
;
16456 if (stat (filename
, &file_stat
) == -1)
16458 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16463 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16467 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16471 dictfiles
[dictcnt
- 1] = filename
;
16475 // do not allow --keyspace w/ a directory
16479 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16484 char **dictionary_files
= NULL
;
16486 dictionary_files
= scan_directory (filename
);
16488 if (dictionary_files
!= NULL
)
16490 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16492 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16494 char *l1_filename
= dictionary_files
[d
];
16496 struct stat l1_stat
;
16498 if (stat (l1_filename
, &l1_stat
) == -1)
16500 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16505 if (S_ISREG (l1_stat
.st_mode
))
16507 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16511 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16516 local_free (dictionary_files
);
16522 log_error ("ERROR: No usable dictionary file found.");
16531 uint mask_min
= increment_min
; // we can't reject smaller masks here
16532 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16534 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16536 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16538 if (cur_mask
== NULL
) break;
16540 masks
[maskcnt
] = cur_mask
;
16544 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16548 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16550 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16554 char *mask
= myargv
[optind
+ 1 + 0];
16558 masks
= (char **) mymalloc (1 * sizeof (char *));
16562 struct stat file_stat
;
16564 if (stat (mask
, &file_stat
) == -1)
16568 masks
[maskcnt
- 1] = mystrdup (mask
);
16572 uint is_file
= S_ISREG (file_stat
.st_mode
);
16578 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16580 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16585 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16587 uint masks_avail
= 1;
16589 while (!feof (mask_fp
))
16591 memset (line_buf
, 0, HCBUFSIZ
);
16593 int line_len
= fgetl (mask_fp
, line_buf
);
16595 if (line_len
== 0) continue;
16597 if (line_buf
[0] == '#') continue;
16599 if (masks_avail
== maskcnt
)
16601 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16603 masks_avail
+= INCR_MASKS
;
16606 masks
[maskcnt
] = mystrdup (line_buf
);
16615 mask_from_file
= 1;
16621 masks
[maskcnt
- 1] = mystrdup (mask
);
16627 int wls_left
= myargc
- (optind
+ 2);
16629 for (int i
= 0; i
< wls_left
; i
++)
16631 char *filename
= myargv
[optind
+ 2 + i
];
16633 struct stat file_stat
;
16635 if (stat (filename
, &file_stat
) == -1)
16637 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16642 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16646 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16650 dictfiles
[dictcnt
- 1] = filename
;
16654 // do not allow --keyspace w/ a directory
16658 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16663 char **dictionary_files
= NULL
;
16665 dictionary_files
= scan_directory (filename
);
16667 if (dictionary_files
!= NULL
)
16669 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16671 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16673 char *l1_filename
= dictionary_files
[d
];
16675 struct stat l1_stat
;
16677 if (stat (l1_filename
, &l1_stat
) == -1)
16679 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16684 if (S_ISREG (l1_stat
.st_mode
))
16686 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16690 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16695 local_free (dictionary_files
);
16701 log_error ("ERROR: No usable dictionary file found.");
16710 uint mask_min
= increment_min
; // we can't reject smaller masks here
16711 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16713 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16715 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16717 if (cur_mask
== NULL
) break;
16719 masks
[maskcnt
] = cur_mask
;
16723 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16728 data
.pw_min
= pw_min
;
16729 data
.pw_max
= pw_max
;
16735 if (weak_hash_threshold
>= salts_cnt
)
16737 hc_device_param_t
*device_param
= NULL
;
16739 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16741 device_param
= &data
.devices_param
[device_id
];
16743 if (device_param
->skipped
) continue;
16748 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16750 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16752 weak_hash_check (device_param
, salt_pos
);
16755 // Display hack, guarantee that there is at least one \r before real start
16757 //if (data.quiet == 0) log_info ("");
16761 * status and monitor threads
16764 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16766 hc_thread_t i_thread
= 0;
16768 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16770 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16773 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16775 uint ni_threads_cnt
= 0;
16777 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16779 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16789 if (outfile_check_timer
!= 0)
16791 if (data
.outfile_check_directory
!= NULL
)
16793 if ((hash_mode
!= 5200) &&
16794 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16795 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16796 (hash_mode
!= 9000))
16798 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16804 outfile_check_timer
= 0;
16809 outfile_check_timer
= 0;
16815 * Inform the user if we got some hashes remove because of the pot file remove feature
16818 if (data
.quiet
== 0)
16820 if (potfile_remove_cracks
> 0)
16822 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16823 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16827 data
.outfile_check_timer
= outfile_check_timer
;
16833 char **induction_dictionaries
= NULL
;
16835 int induction_dictionaries_cnt
= 0;
16837 hcstat_table_t
*root_table_buf
= NULL
;
16838 hcstat_table_t
*markov_table_buf
= NULL
;
16840 uint initial_restore_done
= 0;
16842 data
.maskcnt
= maskcnt
;
16844 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16846 if (data
.devices_status
== STATUS_CRACKED
) break;
16848 data
.devices_status
= STATUS_INIT
;
16850 if (maskpos
> rd
->maskpos
)
16855 rd
->maskpos
= maskpos
;
16856 data
.maskpos
= maskpos
;
16858 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16860 char *mask
= masks
[maskpos
];
16862 if (mask_from_file
== 1)
16864 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16869 uint mask_offset
= 0;
16871 uint separator_cnt
;
16873 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16875 str_ptr
= strstr (mask
+ mask_offset
, ",");
16877 if (str_ptr
== NULL
) break;
16879 str_pos
= str_ptr
- mask
;
16881 // escaped separator, i.e. "\,"
16885 if (mask
[str_pos
- 1] == '\\')
16889 mask_offset
= str_pos
+ 1;
16895 // reset the offset
16899 mask
[str_pos
] = '\0';
16901 switch (separator_cnt
)
16904 mp_reset_usr (mp_usr
, 0);
16906 custom_charset_1
= mask
;
16907 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16911 mp_reset_usr (mp_usr
, 1);
16913 custom_charset_2
= mask
;
16914 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16918 mp_reset_usr (mp_usr
, 2);
16920 custom_charset_3
= mask
;
16921 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16925 mp_reset_usr (mp_usr
, 3);
16927 custom_charset_4
= mask
;
16928 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16932 mask
= mask
+ str_pos
+ 1;
16936 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16940 local_free (css_buf
);
16941 local_free (data
.root_css_buf
);
16942 local_free (data
.markov_css_buf
);
16944 local_free (masks
[maskpos
- 1]);
16947 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16950 data
.css_cnt
= css_cnt
;
16951 data
.css_buf
= css_buf
;
16953 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16955 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16957 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16958 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16960 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16962 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16964 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16965 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16967 data
.root_css_buf
= root_css_buf
;
16968 data
.markov_css_buf
= markov_css_buf
;
16970 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16972 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16974 local_free (root_table_buf
);
16975 local_free (markov_table_buf
);
16979 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16981 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16983 if (device_param
->skipped
) continue;
16985 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16986 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16987 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16989 device_param
->kernel_params_mp_buf64
[3] = 0;
16990 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16991 device_param
->kernel_params_mp_buf32
[5] = 0;
16992 device_param
->kernel_params_mp_buf32
[6] = 0;
16993 device_param
->kernel_params_mp_buf32
[7] = 0;
16995 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16997 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16998 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16999 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
17000 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
17002 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17004 device_param
->kernel_params_mp_buf32
[5] = 0;
17005 device_param
->kernel_params_mp_buf32
[6] = 0;
17006 device_param
->kernel_params_mp_buf32
[7] = 0;
17009 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
17010 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
17011 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
17013 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
);
17014 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
);
17017 else if (attack_mode
== ATTACK_MODE_BF
)
17019 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
17023 for (uint i
= 0; i
< dictcnt
; i
++)
17025 local_free (dictfiles
[i
]);
17028 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
17030 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
17032 if (l1_filename
== NULL
) break;
17036 dictfiles
[dictcnt
- 1] = l1_filename
;
17043 dictfiles
[dictcnt
- 1] = mask
;
17048 log_error ("ERROR: Mask is too small");
17055 free (induction_dictionaries
);
17057 // induction_dictionaries_cnt = 0; // implied
17059 if (attack_mode
!= ATTACK_MODE_BF
)
17063 induction_dictionaries
= scan_directory (induction_directory
);
17065 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17069 if (induction_dictionaries_cnt
)
17071 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17075 * prevent the user from using --keyspace together w/ maskfile and or dictfile
17079 if ((maskcnt
> 1) || (dictcnt
> 1))
17081 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
17087 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
17089 char *subid
= logfile_generate_subid ();
17091 data
.subid
= subid
;
17093 logfile_sub_msg ("START");
17095 data
.devices_status
= STATUS_INIT
;
17097 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17098 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17099 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17101 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17105 data
.cpt_start
= time (NULL
);
17107 data
.cpt_total
= 0;
17109 if (data
.restore
== 0)
17111 rd
->words_cur
= skip
;
17118 data
.ms_paused
= 0;
17120 data
.kernel_power_final
= 0;
17122 data
.words_cur
= rd
->words_cur
;
17124 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17126 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17128 if (device_param
->skipped
) continue;
17130 device_param
->speed_pos
= 0;
17132 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17133 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17135 device_param
->exec_pos
= 0;
17137 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17139 device_param
->outerloop_pos
= 0;
17140 device_param
->outerloop_left
= 0;
17141 device_param
->innerloop_pos
= 0;
17142 device_param
->innerloop_left
= 0;
17144 // some more resets:
17146 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17148 device_param
->pws_cnt
= 0;
17150 device_param
->words_off
= 0;
17151 device_param
->words_done
= 0;
17154 // figure out some workload
17156 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17158 if (data
.wordlist_mode
== WL_MODE_FILE
)
17160 char *dictfile
= NULL
;
17162 if (induction_dictionaries_cnt
)
17164 dictfile
= induction_dictionaries
[0];
17168 dictfile
= dictfiles
[dictpos
];
17171 data
.dictfile
= dictfile
;
17173 logfile_sub_string (dictfile
);
17175 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17177 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17180 FILE *fd2
= fopen (dictfile
, "rb");
17184 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17189 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17193 if (data
.words_cnt
== 0)
17195 if (data
.devices_status
== STATUS_CRACKED
) break;
17196 if (data
.devices_status
== STATUS_ABORTED
) break;
17204 else if (attack_mode
== ATTACK_MODE_COMBI
)
17206 char *dictfile
= data
.dictfile
;
17207 char *dictfile2
= data
.dictfile2
;
17209 logfile_sub_string (dictfile
);
17210 logfile_sub_string (dictfile2
);
17212 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17214 FILE *fd2
= fopen (dictfile
, "rb");
17218 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17223 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17227 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17229 FILE *fd2
= fopen (dictfile2
, "rb");
17233 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17238 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17243 if (data
.words_cnt
== 0)
17245 if (data
.devices_status
== STATUS_CRACKED
) break;
17246 if (data
.devices_status
== STATUS_ABORTED
) break;
17253 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17255 char *dictfile
= NULL
;
17257 if (induction_dictionaries_cnt
)
17259 dictfile
= induction_dictionaries
[0];
17263 dictfile
= dictfiles
[dictpos
];
17266 data
.dictfile
= dictfile
;
17268 char *mask
= data
.mask
;
17270 logfile_sub_string (dictfile
);
17271 logfile_sub_string (mask
);
17273 FILE *fd2
= fopen (dictfile
, "rb");
17277 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17282 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17286 if (data
.words_cnt
== 0)
17288 if (data
.devices_status
== STATUS_CRACKED
) break;
17289 if (data
.devices_status
== STATUS_ABORTED
) break;
17296 else if (attack_mode
== ATTACK_MODE_BF
)
17298 local_free (css_buf
);
17299 local_free (data
.root_css_buf
);
17300 local_free (data
.markov_css_buf
);
17302 char *mask
= dictfiles
[dictpos
];
17304 logfile_sub_string (mask
);
17308 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17310 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17312 uint css_cnt_unicode
= css_cnt
* 2;
17314 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17316 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17318 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17320 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17321 css_buf_unicode
[j
+ 1].cs_len
= 1;
17326 css_buf
= css_buf_unicode
;
17327 css_cnt
= css_cnt_unicode
;
17330 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17332 uint mask_min
= pw_min
;
17333 uint mask_max
= pw_max
;
17335 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17341 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17343 if (css_cnt
< mask_min
)
17345 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17348 if (css_cnt
> mask_max
)
17350 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17353 // skip to next mask
17357 rd
->dictpos
= dictpos
;
17359 logfile_sub_msg ("STOP");
17364 uint save_css_cnt
= css_cnt
;
17366 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17368 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17370 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17371 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17373 uint css_cnt_salt
= css_cnt
+ salt_len
;
17375 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17377 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17379 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17381 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17382 css_buf_salt
[j
].cs_len
= 1;
17387 css_buf
= css_buf_salt
;
17388 css_cnt
= css_cnt_salt
;
17393 data
.css_cnt
= css_cnt
;
17394 data
.css_buf
= css_buf
;
17396 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17398 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17400 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17402 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17403 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17405 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17407 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17409 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17410 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17412 data
.root_css_buf
= root_css_buf
;
17413 data
.markov_css_buf
= markov_css_buf
;
17415 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17417 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17419 local_free (root_table_buf
);
17420 local_free (markov_table_buf
);
17424 uint css_cnt_l
= css_cnt
;
17427 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17429 if (save_css_cnt
< 6)
17433 else if (save_css_cnt
== 6)
17439 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17441 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17452 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17467 /* unfinished code?
17468 int sum = css_buf[css_cnt_r - 1].cs_len;
17470 for (uint i = 1; i < 4 && i < css_cnt; i++)
17472 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17476 sum *= css_buf[css_cnt_r - 1].cs_len;
17481 css_cnt_l
-= css_cnt_r
;
17483 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17485 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17487 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17489 if (device_param
->skipped
) continue;
17491 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17492 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17493 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17495 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17496 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17497 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17498 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17499 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17500 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17502 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17503 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17504 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17505 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17507 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17508 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17509 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17511 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17512 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17513 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17514 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17515 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17517 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
17518 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
17519 for (uint i
= 4; i
< 9; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
17521 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
17522 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
17523 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
17525 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
);
17526 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
);
17530 u64 words_base
= data
.words_cnt
;
17532 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17534 if (data
.kernel_rules_cnt
)
17536 words_base
/= data
.kernel_rules_cnt
;
17539 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17541 if (data
.combs_cnt
)
17543 words_base
/= data
.combs_cnt
;
17546 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17550 words_base
/= data
.bfs_cnt
;
17554 data
.words_base
= words_base
;
17558 log_info ("%llu", (unsigned long long int) words_base
);
17563 if (data
.words_cur
> data
.words_base
)
17565 log_error ("ERROR: restore value greater keyspace");
17570 if (data
.words_cur
)
17572 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17574 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17576 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17579 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17581 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17583 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17586 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17588 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17590 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17596 * Update loopback file
17605 uint random_num
= get_random_num (0, 9999);
17607 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17609 data
.loopback_file
= loopback_file
;
17613 * Update dictionary statistic
17618 dictstat_fp
= fopen (dictstat
, "wb");
17622 lock_file (dictstat_fp
);
17624 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17626 fclose (dictstat_fp
);
17631 * create autotune threads
17634 data
.devices_status
= STATUS_AUTOTUNE
;
17636 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17638 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17640 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17642 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
17645 hc_thread_wait (data
.devices_cnt
, c_threads
);
17648 * Inform user about possible slow speeds
17651 uint hardware_power_all
= 0;
17653 uint kernel_power_all
= 0;
17655 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17657 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17659 hardware_power_all
+= device_param
->hardware_power
;
17661 kernel_power_all
+= device_param
->kernel_power
;
17664 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
17666 data
.kernel_power_all
= kernel_power_all
;
17668 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17670 if (data
.words_base
< kernel_power_all
)
17674 log_info ("ATTENTION!");
17675 log_info (" The wordlist or mask you are using is too small.");
17676 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17677 log_info (" The cracking speed will drop.");
17678 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17685 * create cracker threads
17688 data
.devices_status
= STATUS_RUNNING
;
17690 if (initial_restore_done
== 0)
17692 if (data
.restore_disable
== 0) cycle_restore ();
17694 initial_restore_done
= 1;
17697 hc_timer_set (&data
.timer_running
);
17699 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17701 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17703 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17704 if (quiet
== 0) fflush (stdout
);
17707 else if (wordlist_mode
== WL_MODE_STDIN
)
17709 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17710 if (data
.quiet
== 0) log_info ("");
17713 time_t runtime_start
;
17715 time (&runtime_start
);
17717 data
.runtime_start
= runtime_start
;
17719 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17721 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17723 if (wordlist_mode
== WL_MODE_STDIN
)
17725 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17729 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17733 hc_thread_wait (data
.devices_cnt
, c_threads
);
17735 local_free (c_threads
);
17741 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17743 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17745 if (data
.devices_status
== STATUS_CRACKED
) break;
17746 if (data
.devices_status
== STATUS_ABORTED
) break;
17748 if (data
.devices_status
== STATUS_BYPASS
)
17750 data
.devices_status
= STATUS_RUNNING
;
17753 if (induction_dictionaries_cnt
)
17755 unlink (induction_dictionaries
[0]);
17758 free (induction_dictionaries
);
17760 if (attack_mode
!= ATTACK_MODE_BF
)
17762 induction_dictionaries
= scan_directory (induction_directory
);
17764 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17767 if (benchmark
== 0)
17769 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17771 if (quiet
== 0) clear_prompt ();
17773 if (quiet
== 0) log_info ("");
17781 if (quiet
== 0) status_display ();
17784 if (quiet
== 0) log_info ("");
17788 if (attack_mode
== ATTACK_MODE_BF
)
17792 rd
->dictpos
= dictpos
;
17796 if (induction_dictionaries_cnt
)
17798 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17804 rd
->dictpos
= dictpos
;
17808 time_t runtime_stop
;
17810 time (&runtime_stop
);
17812 data
.runtime_stop
= runtime_stop
;
17814 logfile_sub_uint (runtime_start
);
17815 logfile_sub_uint (runtime_stop
);
17817 logfile_sub_msg ("STOP");
17819 global_free (subid
);
17822 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17824 if (data
.devices_status
== STATUS_CRACKED
) break;
17825 if (data
.devices_status
== STATUS_ABORTED
) break;
17826 if (data
.devices_status
== STATUS_QUIT
) break;
17828 if (data
.devices_status
== STATUS_BYPASS
)
17830 data
.devices_status
= STATUS_RUNNING
;
17834 // 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
17836 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17838 if (data
.wordlist_mode
== WL_MODE_FILE
)
17840 if (data
.dictfile
== NULL
)
17842 if (dictfiles
!= NULL
)
17844 data
.dictfile
= dictfiles
[0];
17846 hc_timer_set (&data
.timer_running
);
17851 // NOTE: combi is okay because it is already set beforehand
17852 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17854 if (data
.dictfile
== NULL
)
17856 if (dictfiles
!= NULL
)
17858 hc_timer_set (&data
.timer_running
);
17860 data
.dictfile
= dictfiles
[0];
17864 else if (attack_mode
== ATTACK_MODE_BF
)
17866 if (data
.mask
== NULL
)
17868 hc_timer_set (&data
.timer_running
);
17870 data
.mask
= masks
[0];
17874 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17876 data
.devices_status
= STATUS_EXHAUSTED
;
17879 // if cracked / aborted remove last induction dictionary
17881 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17883 struct stat induct_stat
;
17885 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17887 unlink (induction_dictionaries
[file_pos
]);
17891 // wait for non-interactive threads
17893 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17895 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17898 local_free (ni_threads
);
17900 // wait for interactive threads
17902 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17904 hc_thread_wait (1, &i_thread
);
17907 // we dont need restore file anymore
17908 if (data
.restore_disable
== 0)
17910 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17912 unlink (eff_restore_file
);
17913 unlink (new_restore_file
);
17921 // finally save left hashes
17923 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17932 if (benchmark
== 1)
17934 status_benchmark ();
17936 if (machine_readable
== 0)
17943 if (quiet
== 0) clear_prompt ();
17945 if (quiet
== 0) log_info ("");
17953 if (quiet
== 0) status_display ();
17956 if (quiet
== 0) log_info ("");
17959 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17961 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17963 if (device_param
->skipped
) continue;
17965 local_free (device_param
->combs_buf
);
17967 local_free (device_param
->hooks_buf
);
17969 local_free (device_param
->device_name
);
17971 local_free (device_param
->device_name_chksum
);
17973 local_free (device_param
->device_version
);
17975 local_free (device_param
->driver_version
);
17977 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17978 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17979 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17980 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17981 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17982 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17983 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17984 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17985 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17986 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17987 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17988 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17989 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17990 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17991 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17992 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17993 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17994 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17995 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17996 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17997 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17998 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17999 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
18000 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
18001 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
18002 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
18003 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
18004 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
18005 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
18007 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
18008 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
18009 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
18010 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
18011 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
18012 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
18013 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
18014 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
18015 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
18016 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
18017 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
18019 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
18020 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
18021 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
18023 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
18024 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
18027 // reset default fan speed
18030 if (gpu_temp_disable
== 0)
18032 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
18034 hc_thread_mutex_lock (mux_adl
);
18036 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18038 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18040 if (device_param
->skipped
) continue;
18042 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
18044 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
18045 int fanpolicy
= temp_retain_fanpolicy_value
[device_id
];
18047 if (fanpolicy
== 1)
18051 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
18053 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 0);
18055 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
18060 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
18065 hc_thread_mutex_unlock (mux_adl
);
18069 // reset power tuning
18071 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
18073 hc_thread_mutex_lock (mux_adl
);
18075 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18077 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18079 if (device_param
->skipped
) continue;
18081 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
18083 if (data
.hm_device
[device_id
].od_version
== 6)
18085 // check powertune capabilities first, if not available then skip device
18087 int powertune_supported
= 0;
18089 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
18091 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
18096 if (powertune_supported
!= 0)
18098 // powercontrol settings
18100 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
18102 log_info ("ERROR: Failed to restore the ADL PowerControl values");
18109 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
18111 performance_state
->iNumberOfPerformanceLevels
= 2;
18113 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
18114 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
18115 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
18116 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
18118 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
18120 log_info ("ERROR: Failed to restore ADL performance state");
18125 local_free (performance_state
);
18130 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
18132 unsigned int limit
= nvml_power_limit
[device_id
];
18136 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
18141 hc_thread_mutex_unlock (mux_adl
);
18144 if (gpu_temp_disable
== 0)
18148 hm_NVML_nvmlShutdown (data
.hm_nvml
);
18150 nvml_close (data
.hm_nvml
);
18152 data
.hm_nvml
= NULL
;
18157 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
18159 adl_close (data
.hm_adl
);
18161 data
.hm_adl
= NULL
;
18164 #endif // HAVE_HWMON
18168 local_free (masks
);
18170 local_free (dictstat_base
);
18172 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18174 pot_t
*pot_ptr
= &pot
[pot_pos
];
18176 hash_t
*hash
= &pot_ptr
->hash
;
18178 local_free (hash
->digest
);
18182 local_free (hash
->salt
);
18188 local_free (all_kernel_rules_cnt
);
18189 local_free (all_kernel_rules_buf
);
18191 local_free (wl_data
->buf
);
18192 local_free (wl_data
);
18194 local_free (bitmap_s1_a
);
18195 local_free (bitmap_s1_b
);
18196 local_free (bitmap_s1_c
);
18197 local_free (bitmap_s1_d
);
18198 local_free (bitmap_s2_a
);
18199 local_free (bitmap_s2_b
);
18200 local_free (bitmap_s2_c
);
18201 local_free (bitmap_s2_d
);
18204 local_free (temp_retain_fanspeed_value
);
18205 local_free (od_clock_mem_status
);
18206 local_free (od_power_control_status
);
18207 local_free (nvml_power_limit
);
18210 global_free (devices_param
);
18212 global_free (kernel_rules_buf
);
18214 global_free (root_css_buf
);
18215 global_free (markov_css_buf
);
18217 global_free (digests_buf
);
18218 global_free (digests_shown
);
18219 global_free (digests_shown_tmp
);
18221 global_free (salts_buf
);
18222 global_free (salts_shown
);
18224 global_free (esalts_buf
);
18226 global_free (words_progress_done
);
18227 global_free (words_progress_rejected
);
18228 global_free (words_progress_restored
);
18230 if (pot_fp
) fclose (pot_fp
);
18232 if (data
.devices_status
== STATUS_QUIT
) break;
18235 // destroy others mutex
18237 hc_thread_mutex_delete (mux_dispatcher
);
18238 hc_thread_mutex_delete (mux_counter
);
18239 hc_thread_mutex_delete (mux_display
);
18240 hc_thread_mutex_delete (mux_adl
);
18244 local_free (eff_restore_file
);
18245 local_free (new_restore_file
);
18251 tuning_db_destroy (tuning_db
);
18255 local_free (loopback_file
);
18257 if (loopback
== 1) unlink (loopback_file
);
18259 // induction directory
18261 if (induction_dir
== NULL
)
18263 if (attack_mode
!= ATTACK_MODE_BF
)
18265 if (rmdir (induction_directory
) == -1)
18267 if (errno
== ENOENT
)
18269 // good, we can ignore
18271 else if (errno
== ENOTEMPTY
)
18273 // good, we can ignore
18277 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18283 local_free (induction_directory
);
18287 // outfile-check directory
18289 if (outfile_check_dir
== NULL
)
18291 if (rmdir (outfile_check_directory
) == -1)
18293 if (errno
== ENOENT
)
18295 // good, we can ignore
18297 else if (errno
== ENOTEMPTY
)
18299 // good, we can ignore
18303 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18309 local_free (outfile_check_directory
);
18316 logfile_top_uint (proc_start
);
18317 logfile_top_uint (proc_stop
);
18319 logfile_top_msg ("STOP");
18321 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18322 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18324 if (data
.ocl
) ocl_close (data
.ocl
);
18326 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18327 if (data
.devices_status
== STATUS_QUIT
) return 2;
18328 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18329 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18330 if (data
.devices_status
== STATUS_CRACKED
) return 0;