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 global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
168 #define HC_API_CALL __stdcall
173 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
324 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
330 static unsigned int full01
= 0x01010101;
331 static unsigned int full80
= 0x80808080;
333 int SUPPRESS_OUTPUT
= 0;
335 hc_thread_mutex_t mux_adl
;
336 hc_thread_mutex_t mux_counter
;
337 hc_thread_mutex_t mux_dispatcher
;
338 hc_thread_mutex_t mux_display
;
340 hc_global_data_t data
;
342 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
344 const char *USAGE_MINI
[] =
346 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
348 "Try --help for more help.",
352 const char *USAGE_BIG
[] =
354 "%s, advanced password recovery",
356 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
360 " Options Short / Long | Type | Description | Example",
361 "===============================|======|======================================================|=======================",
362 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
363 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
364 " -V, --version | | Print version |",
365 " -h, --help | | Print help |",
366 " --quiet | | Suppress output |",
367 " --hex-charset | | Assume charset is given in hex |",
368 " --hex-salt | | Assume salt is given in hex |",
369 " --hex-wordlist | | Assume words in wordlist is given in hex |",
370 " --force | | Ignore warnings |",
371 " --status | | Enable automatic update of the status-screen |",
372 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
373 " --machine-readable | | Display the status view in a machine readable format |",
374 " --loopback | | Add new plains to induct directory |",
375 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
376 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
377 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
378 " --markov-classic | | Enables classic markov-chains, no per-position |",
379 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
380 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
381 " --session | Str | Define specific session name | --session=mysession",
382 " --restore | | Restore session from --session |",
383 " --restore-disable | | Do not write restore file |",
384 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
385 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
386 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
387 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
388 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
389 " --show | | Show cracked passwords only |",
390 " --left | | Show un-cracked passwords only |",
391 " --username | | Enable ignoring of usernames in hashfile |",
392 " --remove | | Enable remove of hash once it is cracked |",
393 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
394 " --potfile-disable | | Do not write potfile |",
395 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
396 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
397 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
398 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
399 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
400 " --logfile-disable | | Disable the logfile |",
401 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
402 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
403 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
404 " -b, --benchmark | | Run benchmark |",
405 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
406 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
407 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
408 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
409 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
410 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
411 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
412 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
413 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
414 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
415 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
416 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
418 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
419 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
420 " --powertune-enable | | Enable power tuning, restores settings when finished |",
422 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
423 " -s, --skip | Num | Skip X words from the start | -s 1000000",
424 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
425 " --keyspace | | Show keyspace base:mod values and quit |",
426 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
427 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
428 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
429 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
430 " --generate-rules-func-min | Num | Force min X funcs per rule |",
431 " --generate-rules-func-max | Num | Force max X funcs per rule |",
432 " --generate-rules-seed | Num | Force RNG seed set to X |",
433 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
434 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
435 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
436 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
437 " -i, --increment | | Enable mask increment mode |",
438 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
439 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
441 "- [ Hash modes ] -",
443 " # | Name | Category",
444 " ======+==================================================+======================================",
445 " 900 | MD4 | Raw Hash",
446 " 0 | MD5 | Raw Hash",
447 " 5100 | Half MD5 | Raw Hash",
448 " 100 | SHA1 | Raw Hash",
449 " 10800 | SHA-384 | Raw Hash",
450 " 1400 | SHA-256 | Raw Hash",
451 " 1700 | SHA-512 | Raw Hash",
452 " 5000 | SHA-3(Keccak) | Raw Hash",
453 " 10100 | SipHash | Raw Hash",
454 " 6000 | RipeMD160 | Raw Hash",
455 " 6100 | Whirlpool | Raw Hash",
456 " 6900 | GOST R 34.11-94 | Raw Hash",
457 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
458 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
459 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
461 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
462 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
463 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
464 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
465 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
466 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
467 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
468 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
469 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
470 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
471 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
472 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
473 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
474 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
475 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
480 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
481 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
482 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
483 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
484 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
485 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
486 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
487 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
488 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
489 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
490 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
491 " 400 | phpass | Generic KDF",
492 " 8900 | scrypt | Generic KDF",
493 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
494 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
495 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
496 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
497 " 23 | Skype | Network protocols",
498 " 2500 | WPA/WPA2 | Network protocols",
499 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
500 " 5300 | IKE-PSK MD5 | Network protocols",
501 " 5400 | IKE-PSK SHA1 | Network protocols",
502 " 5500 | NetNTLMv1 | Network protocols",
503 " 5500 | NetNTLMv1 + ESS | Network protocols",
504 " 5600 | NetNTLMv2 | Network protocols",
505 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
506 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
507 " 8300 | DNSSEC (NSEC3) | Network protocols",
508 " 10200 | Cram MD5 | Network protocols",
509 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
510 " 11200 | MySQL CRAM (SHA1) | Network protocols",
511 " 11400 | SIP digest authentication (MD5) | Network protocols",
512 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
513 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
514 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
515 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
516 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
517 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
518 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
519 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
520 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
521 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
522 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
523 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
524 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
525 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
526 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
527 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
528 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
529 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
530 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
531 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
532 " 12 | PostgreSQL | Database Server",
533 " 131 | MSSQL(2000) | Database Server",
534 " 132 | MSSQL(2005) | Database Server",
535 " 1731 | MSSQL(2012) | Database Server",
536 " 1731 | MSSQL(2014) | Database Server",
537 " 200 | MySQL323 | Database Server",
538 " 300 | MySQL4.1/MySQL5 | Database Server",
539 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
540 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
541 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
542 " 8000 | Sybase ASE | Database Server",
543 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
544 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
545 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
546 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
547 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
548 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
549 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
550 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
551 " 11500 | CRC32 | Checksums",
552 " 3000 | LM | Operating-Systems",
553 " 1000 | NTLM | Operating-Systems",
554 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
555 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
556 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
557 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
558 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
559 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
560 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
561 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
562 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
563 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
564 " 1722 | OSX v10.7 | Operating-Systems",
565 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
566 " 6300 | AIX {smd5} | Operating-Systems",
567 " 6700 | AIX {ssha1} | Operating-Systems",
568 " 6400 | AIX {ssha256} | Operating-Systems",
569 " 6500 | AIX {ssha512} | Operating-Systems",
570 " 2400 | Cisco-PIX | Operating-Systems",
571 " 2410 | Cisco-ASA | Operating-Systems",
572 " 500 | Cisco-IOS $1$ | Operating-Systems",
573 " 5700 | Cisco-IOS $4$ | Operating-Systems",
574 " 9200 | Cisco-IOS $8$ | Operating-Systems",
575 " 9300 | Cisco-IOS $9$ | Operating-Systems",
576 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
577 " 501 | Juniper IVE | Operating-Systems",
578 " 5800 | Android PIN | Operating-Systems",
579 " 8100 | Citrix Netscaler | Operating-Systems",
580 " 8500 | RACF | Operating-Systems",
581 " 7200 | GRUB 2 | Operating-Systems",
582 " 9900 | Radmin2 | Operating-Systems",
583 " 125 | ArubaOS | Operating-Systems",
584 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
585 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
586 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
587 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
588 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
589 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
590 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
591 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
592 " 11600 | 7-Zip | Archives",
593 " 12500 | RAR3-hp | Archives",
594 " 13000 | RAR5 | Archives",
595 " 13200 | AxCrypt | Archives",
596 " 13300 | AxCrypt in memory SHA1 | Archives",
597 " 13600 | WinZip | Archives",
598 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
599 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
600 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
601 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
602 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
603 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
604 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
605 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
608 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
609 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
610 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
611 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
612 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
613 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
614 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
615 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
616 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
617 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
618 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
619 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
620 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
621 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
622 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
623 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
624 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
625 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
628 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
629 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
630 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
631 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
632 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
633 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
634 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
635 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
636 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
637 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
638 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
639 " 9400 | MS Office 2007 | Documents",
640 " 9500 | MS Office 2010 | Documents",
641 " 9600 | MS Office 2013 | Documents",
642 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
643 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
644 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
645 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
646 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
647 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
648 " 9000 | Password Safe v2 | Password Managers",
649 " 5200 | Password Safe v3 | Password Managers",
650 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
651 " 6600 | 1Password, agilekeychain | Password Managers",
652 " 8200 | 1Password, cloudkeychain | Password Managers",
653 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
654 " 12700 | Blockchain, My Wallet | Password Managers",
655 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
657 "- [ Outfile Formats ] -",
663 " 3 | hash[:salt]:plain",
665 " 5 | hash[:salt]:hex_plain",
666 " 6 | plain:hex_plain",
667 " 7 | hash[:salt]:plain:hex_plain",
669 " 9 | hash[:salt]:crack_pos",
670 " 10 | plain:crack_pos",
671 " 11 | hash[:salt]:plain:crack_pos",
672 " 12 | hex_plain:crack_pos",
673 " 13 | hash[:salt]:hex_plain:crack_pos",
674 " 14 | plain:hex_plain:crack_pos",
675 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
677 "- [ Rule Debugging Modes ] -",
682 " 2 | Original-Word",
683 " 3 | Original-Word:Finding-Rule",
684 " 4 | Original-Word:Finding-Rule:Processed-Word",
686 "- [ Attack Modes ] -",
693 " 6 | Hybrid Wordlist + Mask",
694 " 7 | Hybrid Mask + Wordlist",
696 "- [ Built-in Charsets ] -",
700 " l | abcdefghijklmnopqrstuvwxyz",
701 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
703 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
707 "- [ OpenCL Device Types ] -",
710 " ===+=============",
713 " 3 | FPGA, DSP, Co-Processor",
715 "- [ Workload Profiles ] -",
717 " # | Performance | Runtime | Power Consumption | Desktop Impact",
718 " ===+=============+=========+===================+=================",
719 " 1 | Low | 2 ms | Low | Minimal",
720 " 2 | Default | 12 ms | Economic | Noticeable",
721 " 3 | High | 96 ms | High | Unresponsive",
722 " 4 | Nightmare | 480 ms | Insane | Headless",
724 "If you have no idea what just happened then visit the following pages:",
726 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
727 "* https://hashcat.net/wiki/#frequently_asked_questions",
733 * hashcat specific functions
736 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
738 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
740 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
742 double exec_ms_sum
= 0;
746 for (int i
= 0; i
< last_num_entries
; i
++)
748 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
752 exec_ms_sum
+= exec_ms
;
758 if (exec_ms_cnt
== 0) return 0;
760 return exec_ms_sum
/ exec_ms_cnt
;
763 void status_display_machine_readable ()
767 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
773 fprintf (out
, "SPEED\t");
775 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
777 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
779 if (device_param
->skipped
) continue;
784 for (int i
= 0; i
< SPEED_CACHE
; i
++)
786 speed_cnt
+= device_param
->speed_cnt
[i
];
787 speed_ms
+= device_param
->speed_ms
[i
];
790 speed_cnt
/= SPEED_CACHE
;
791 speed_ms
/= SPEED_CACHE
;
793 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
800 fprintf (out
, "EXEC_RUNTIME\t");
802 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
804 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
806 if (device_param
->skipped
) continue;
808 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
810 fprintf (out
, "%f\t", exec_ms_avg
);
817 u64 words_cur
= get_lowest_words_done ();
819 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
825 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
828 u64 all_rejected
= 0;
829 u64 all_restored
= 0;
831 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
833 all_done
+= data
.words_progress_done
[salt_pos
];
834 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
835 all_restored
+= data
.words_progress_restored
[salt_pos
];
838 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
839 u64 progress_end
= progress_total
;
841 u64 progress_skip
= 0;
845 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
847 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
848 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
849 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
854 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
856 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
857 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
858 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
861 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
862 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
864 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
870 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
871 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
878 if (data
.gpu_temp_disable
== 0)
880 fprintf (out
, "TEMP\t");
882 hc_thread_mutex_lock (mux_adl
);
884 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
886 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
888 if (device_param
->skipped
) continue;
890 int temp
= hm_get_temperature_with_device_id (device_id
);
892 fprintf (out
, "%d\t", temp
);
895 hc_thread_mutex_unlock (mux_adl
);
915 void status_display ()
917 if (data
.devices_status
== STATUS_INIT
) return;
918 if (data
.devices_status
== STATUS_STARTING
) return;
919 if (data
.devices_status
== STATUS_BYPASS
) return;
921 if (data
.machine_readable
== 1)
923 status_display_machine_readable ();
928 char tmp_buf
[1000] = { 0 };
932 log_info ("Session.Name...: %s", data
.session
);
934 char *status_type
= strstatus (data
.devices_status
);
936 uint hash_mode
= data
.hash_mode
;
938 char *hash_type
= strhashtype (hash_mode
); // not a bug
940 log_info ("Status.........: %s", status_type
);
946 if (data
.rp_files_cnt
)
950 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
952 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
955 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
957 log_info ("Rules.Type.....: %s", tmp_buf
);
964 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
966 if (data
.rp_gen_seed
)
968 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
976 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
978 if (data
.wordlist_mode
== WL_MODE_FILE
)
980 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
982 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
984 log_info ("Input.Mode.....: Pipe");
987 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
989 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
990 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
992 else if (data
.attack_mode
== ATTACK_MODE_BF
)
994 char *mask
= data
.mask
;
998 uint mask_len
= data
.css_cnt
;
1000 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1004 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1006 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1008 mask_len
-= data
.salts_buf
[0].salt_len
;
1012 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1014 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1017 if (data
.maskcnt
> 1)
1019 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1021 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1024 log_info ("Input.Mode.....: %s", tmp_buf
);
1029 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1031 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1032 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1034 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1036 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1037 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1040 if (data
.digests_cnt
== 1)
1042 if (data
.hash_mode
== 2500)
1044 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1046 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1047 (char *) data
.salts_buf
[0].salt_buf
,
1061 else if (data
.hash_mode
== 5200)
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1065 else if (data
.hash_mode
== 9000)
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1069 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1071 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1073 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1075 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1079 char out_buf
[HCBUFSIZ
] = { 0 };
1081 ascii_digest (out_buf
, 0, 0);
1084 if (strlen (out_buf
) > 40)
1092 log_info ("Hash.Target....: %s", out_buf
);
1097 if (data
.hash_mode
== 3000)
1099 char out_buf1
[32] = { 0 };
1100 char out_buf2
[32] = { 0 };
1102 ascii_digest (out_buf1
, 0, 0);
1103 ascii_digest (out_buf2
, 0, 1);
1105 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1109 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1113 log_info ("Hash.Type......: %s", hash_type
);
1119 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1120 double speed_ms
[DEVICES_MAX
] = { 0 };
1122 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1124 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1126 if (device_param
->skipped
) continue;
1128 speed_cnt
[device_id
] = 0;
1129 speed_ms
[device_id
] = 0;
1131 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1133 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1134 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1137 speed_cnt
[device_id
] /= SPEED_CACHE
;
1138 speed_ms
[device_id
] /= SPEED_CACHE
;
1141 double hashes_all_ms
= 0;
1143 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1145 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1147 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1149 if (device_param
->skipped
) continue;
1151 hashes_dev_ms
[device_id
] = 0;
1153 if (speed_ms
[device_id
])
1155 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1157 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1165 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1167 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1169 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1171 if (device_param
->skipped
) continue;
1173 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1175 exec_all_ms
[device_id
] = exec_ms_avg
;
1182 double ms_running
= 0;
1184 hc_timer_get (data
.timer_running
, ms_running
);
1186 double ms_paused
= data
.ms_paused
;
1188 if (data
.devices_status
== STATUS_PAUSED
)
1190 double ms_paused_tmp
= 0;
1192 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1194 ms_paused
+= ms_paused_tmp
;
1199 __time64_t sec_run
= ms_running
/ 1000;
1203 time_t sec_run
= ms_running
/ 1000;
1209 char display_run
[32] = { 0 };
1213 struct tm
*tmp
= NULL
;
1217 tmp
= _gmtime64 (&sec_run
);
1221 tmp
= gmtime (&sec_run
);
1227 memset (&tm_run
, 0, sizeof (tm_run
));
1229 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1231 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1233 char *start
= ctime (&data
.proc_start
);
1235 size_t start_len
= strlen (start
);
1237 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1238 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1240 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1245 log_info ("Time.Started...: 0 secs");
1252 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1255 u64 all_rejected
= 0;
1256 u64 all_restored
= 0;
1258 u64 progress_noneed
= 0;
1260 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1262 all_done
+= data
.words_progress_done
[salt_pos
];
1263 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1264 all_restored
+= data
.words_progress_restored
[salt_pos
];
1266 // Important for ETA only
1268 if (data
.salts_shown
[salt_pos
] == 1)
1270 const u64 all
= data
.words_progress_done
[salt_pos
]
1271 + data
.words_progress_rejected
[salt_pos
]
1272 + data
.words_progress_restored
[salt_pos
];
1274 const u64 left
= data
.words_cnt
- all
;
1276 progress_noneed
+= left
;
1280 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1281 u64 progress_end
= progress_total
;
1283 u64 progress_skip
= 0;
1287 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1289 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1290 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1291 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1296 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1298 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1299 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1300 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1303 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1304 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1306 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1308 if (data
.devices_status
!= STATUS_CRACKED
)
1311 __time64_t sec_etc
= 0;
1318 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1320 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1322 sec_etc
= ms_left
/ 1000;
1327 //log_info ("Time.Estimated.: 0 secs");
1329 else if ((u64
) sec_etc
> ETC_MAX
)
1331 log_info ("Time.Estimated.: > 10 Years");
1335 char display_etc
[32] = { 0 };
1339 struct tm
*tmp
= NULL
;
1343 tmp
= _gmtime64 (&sec_etc
);
1347 tmp
= gmtime (&sec_etc
);
1353 memset (&tm_etc
, 0, sizeof (tm_etc
));
1355 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1357 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1365 char *etc
= ctime (&now
);
1367 size_t etc_len
= strlen (etc
);
1369 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1370 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1372 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1378 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1380 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1382 if (device_param
->skipped
) continue;
1384 char display_dev_cur
[16] = { 0 };
1386 strncpy (display_dev_cur
, "0.00", 4);
1388 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1390 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1393 char display_all_cur
[16] = { 0 };
1395 strncpy (display_all_cur
, "0.00", 4);
1397 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1399 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1401 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1402 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1404 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);
1408 if (data
.digests_cnt
> 100)
1410 time_t now
= time (NULL
);
1412 int cpt_cur_min
= 0;
1413 int cpt_cur_hour
= 0;
1414 int cpt_cur_day
= 0;
1416 for (int i
= 0; i
< CPT_BUF
; i
++)
1418 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1419 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1421 if ((timestamp
+ 60) > now
)
1423 cpt_cur_min
+= cracked
;
1426 if ((timestamp
+ 3600) > now
)
1428 cpt_cur_hour
+= cracked
;
1431 if ((timestamp
+ 86400) > now
)
1433 cpt_cur_day
+= cracked
;
1437 double ms_real
= ms_running
- ms_paused
;
1439 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1440 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1441 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1443 if ((data
.cpt_start
+ 86400) < now
)
1445 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1453 else if ((data
.cpt_start
+ 3600) < now
)
1455 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1462 else if ((data
.cpt_start
+ 60) < now
)
1464 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1472 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1481 u64 restore_point
= get_lowest_words_done ();
1483 u64 restore_total
= data
.words_base
;
1485 float percent_restore
= 0;
1487 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1489 if (progress_end_relative_skip
)
1491 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1493 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1494 float percent_rejected
= 0.0;
1498 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1501 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);
1502 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1504 if (data
.restore_disable
== 0)
1506 if (percent_finished
!= 1)
1508 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1515 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1517 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1518 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1520 if (data
.restore_disable
== 0)
1522 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1527 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1528 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1530 // --restore not allowed if stdin is used -- really? why?
1532 //if (data.restore_disable == 0)
1534 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1541 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1542 if (data
.devices_status
== STATUS_CRACKED
) return;
1543 if (data
.devices_status
== STATUS_ABORTED
) return;
1544 if (data
.devices_status
== STATUS_QUIT
) return;
1546 if (data
.gpu_temp_disable
== 0)
1548 hc_thread_mutex_lock (mux_adl
);
1550 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1552 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1554 if (device_param
->skipped
) continue;
1556 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1557 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1558 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1559 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1560 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1561 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1562 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1564 char output_buf
[256] = { 0 };
1568 if (num_temperature
>= 0)
1570 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1572 output_len
= strlen (output_buf
);
1575 if (num_fanspeed
>= 0)
1577 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1579 output_len
= strlen (output_buf
);
1582 if (num_utilization
>= 0)
1584 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1586 output_len
= strlen (output_buf
);
1589 if (num_corespeed
>= 0)
1591 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1593 output_len
= strlen (output_buf
);
1596 if (num_memoryspeed
>= 0)
1598 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1600 output_len
= strlen (output_buf
);
1603 if (num_buslanes
>= 0)
1605 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1607 output_len
= strlen (output_buf
);
1610 if (num_throttle
== 1)
1612 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1614 output_len
= strlen (output_buf
);
1617 if (output_len
== 0)
1619 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1621 output_len
= strlen (output_buf
);
1624 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1627 hc_thread_mutex_unlock (mux_adl
);
1630 #endif // HAVE_HWMON
1633 static void status_benchmark_automate ()
1635 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1636 double speed_ms
[DEVICES_MAX
] = { 0 };
1638 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1640 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1642 if (device_param
->skipped
) continue;
1644 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1645 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1648 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1650 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1652 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1654 if (device_param
->skipped
) continue;
1656 hashes_dev_ms
[device_id
] = 0;
1658 if (speed_ms
[device_id
])
1660 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1664 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1666 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1668 if (device_param
->skipped
) continue;
1670 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1674 static void status_benchmark ()
1676 if (data
.devices_status
== STATUS_INIT
) return;
1677 if (data
.devices_status
== STATUS_STARTING
) return;
1678 if (data
.devices_status
== STATUS_BYPASS
) return;
1680 if (data
.machine_readable
== 1)
1682 status_benchmark_automate ();
1687 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1688 double speed_ms
[DEVICES_MAX
] = { 0 };
1690 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1692 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1694 if (device_param
->skipped
) continue;
1696 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1697 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1700 double hashes_all_ms
= 0;
1702 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1704 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1706 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1708 if (device_param
->skipped
) continue;
1710 hashes_dev_ms
[device_id
] = 0;
1712 if (speed_ms
[device_id
])
1714 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1716 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1724 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1726 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1728 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1730 if (device_param
->skipped
) continue;
1732 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1734 exec_all_ms
[device_id
] = exec_ms_avg
;
1737 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1739 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1741 if (device_param
->skipped
) continue;
1743 char display_dev_cur
[16] = { 0 };
1745 strncpy (display_dev_cur
, "0.00", 4);
1747 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1749 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1752 char display_all_cur
[16] = { 0 };
1754 strncpy (display_all_cur
, "0.00", 4);
1756 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1758 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1762 * hashcat -only- functions
1765 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1767 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1769 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1770 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1771 else if (attack_kern
== ATTACK_KERN_COMBI
)
1772 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1773 else if (attack_kern
== ATTACK_KERN_BF
)
1774 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1777 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1780 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
)
1782 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1784 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1785 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1786 else if (attack_kern
== ATTACK_KERN_COMBI
)
1787 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1788 else if (attack_kern
== ATTACK_KERN_BF
)
1789 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1793 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1797 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1799 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1801 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1805 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1809 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
)
1811 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1813 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1817 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1821 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1823 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1826 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1828 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1831 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1833 if (line_len
& 1) return (line_len
); // not in hex
1835 if (data
.hex_wordlist
== 1)
1840 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1842 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1845 memset (line_buf
+ i
, 0, line_len
- i
);
1849 else if (line_len
>= 6) // $HEX[] = 6
1851 if (line_buf
[0] != '$') return (line_len
);
1852 if (line_buf
[1] != 'H') return (line_len
);
1853 if (line_buf
[2] != 'E') return (line_len
);
1854 if (line_buf
[3] != 'X') return (line_len
);
1855 if (line_buf
[4] != '[') return (line_len
);
1856 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1861 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1863 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1866 memset (line_buf
+ i
, 0, line_len
- i
);
1874 static void clear_prompt ()
1876 fputc ('\r', stdout
);
1878 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1880 fputc (' ', stdout
);
1883 fputc ('\r', stdout
);
1888 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1890 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
);
1893 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1895 char *outfile
= data
.outfile
;
1896 uint quiet
= data
.quiet
;
1897 FILE *pot_fp
= data
.pot_fp
;
1898 uint loopback
= data
.loopback
;
1899 uint debug_mode
= data
.debug_mode
;
1900 char *debug_file
= data
.debug_file
;
1902 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1903 int debug_rule_len
= 0; // -1 error
1904 uint debug_plain_len
= 0;
1906 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1910 char out_buf
[HCBUFSIZ
] = { 0 };
1912 const u32 salt_pos
= plain
->salt_pos
;
1913 const u32 digest_pos
= plain
->digest_pos
; // relative
1914 const u32 gidvid
= plain
->gidvid
;
1915 const u32 il_pos
= plain
->il_pos
;
1917 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1921 u64 crackpos
= device_param
->words_off
;
1923 uint plain_buf
[16] = { 0 };
1925 u8
*plain_ptr
= (u8
*) plain_buf
;
1927 unsigned int plain_len
= 0;
1929 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1933 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1935 for (int i
= 0; i
< 16; i
++)
1937 plain_buf
[i
] = pw
.i
[i
];
1940 plain_len
= pw
.pw_len
;
1942 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1949 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1951 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1953 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1957 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1959 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1961 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1963 debug_plain_len
= plain_len
;
1967 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1970 crackpos
*= data
.kernel_rules_cnt
;
1971 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1973 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1975 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1979 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1981 for (int i
= 0; i
< 16; i
++)
1983 plain_buf
[i
] = pw
.i
[i
];
1986 plain_len
= pw
.pw_len
;
1988 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1989 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1991 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1993 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1997 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1999 memcpy (plain_ptr
, comb_buf
, comb_len
);
2002 plain_len
+= comb_len
;
2005 crackpos
*= data
.combs_cnt
;
2006 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2008 if (data
.pw_max
!= PW_DICTMAX1
)
2010 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2013 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2015 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2016 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2018 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2019 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2021 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2022 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2024 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2025 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2027 plain_len
= data
.css_cnt
;
2030 crackpos
*= data
.bfs_cnt
;
2031 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2033 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2037 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2039 for (int i
= 0; i
< 16; i
++)
2041 plain_buf
[i
] = pw
.i
[i
];
2044 plain_len
= pw
.pw_len
;
2046 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2049 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2051 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2053 plain_len
+= start
+ stop
;
2056 crackpos
*= data
.combs_cnt
;
2057 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2059 if (data
.pw_max
!= PW_DICTMAX1
)
2061 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2064 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2068 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2070 for (int i
= 0; i
< 16; i
++)
2072 plain_buf
[i
] = pw
.i
[i
];
2075 plain_len
= pw
.pw_len
;
2077 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2080 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2082 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2084 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2086 plain_len
+= start
+ stop
;
2089 crackpos
*= data
.combs_cnt
;
2090 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2092 if (data
.pw_max
!= PW_DICTMAX1
)
2094 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2098 if (data
.attack_mode
== ATTACK_MODE_BF
)
2100 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2102 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2104 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2106 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2110 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2112 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2114 plain_ptr
[j
] = plain_ptr
[i
];
2117 plain_len
= plain_len
/ 2;
2122 // if enabled, update also the potfile
2128 fprintf (pot_fp
, "%s:", out_buf
);
2130 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2132 fputc ('\n', pot_fp
);
2136 unlock_file (pot_fp
);
2141 FILE *out_fp
= NULL
;
2143 if (outfile
!= NULL
)
2145 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2147 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2158 if (quiet
== 0) clear_prompt ();
2161 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2163 if (outfile
!= NULL
)
2165 if (out_fp
!= stdout
)
2172 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2174 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2176 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2177 if (quiet
== 0) fflush (stdout
);
2186 char *loopback_file
= data
.loopback_file
;
2190 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2194 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2196 fputc ('\n', fb_fp
);
2202 // (rule) debug mode
2204 // the next check implies that:
2205 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2208 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2210 if (debug_rule_len
< 0) debug_rule_len
= 0;
2212 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2214 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2216 if ((quiet
== 0) && (debug_file
== NULL
))
2218 fprintf (stdout
, "%s", PROMPT
);
2225 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2227 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2231 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2235 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2239 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2241 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
);
2243 uint cpt_cracked
= 0;
2245 for (uint i
= 0; i
< num_cracked
; i
++)
2247 const uint hash_pos
= cracked
[i
].hash_pos
;
2249 if (data
.digests_shown
[hash_pos
] == 1) continue;
2251 hc_thread_mutex_lock (mux_display
);
2253 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2255 data
.digests_shown
[hash_pos
] = 1;
2257 data
.digests_done
++;
2261 salt_buf
->digests_done
++;
2263 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2265 data
.salts_shown
[salt_pos
] = 1;
2271 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2273 hc_thread_mutex_unlock (mux_display
);
2275 check_hash (device_param
, &cracked
[i
]);
2280 if (cpt_cracked
> 0)
2282 hc_thread_mutex_lock (mux_display
);
2284 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2285 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2289 data
.cpt_total
+= cpt_cracked
;
2291 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2293 hc_thread_mutex_unlock (mux_display
);
2296 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2298 // we need to reset cracked state on the device
2299 // otherwise host thinks again and again the hash was cracked
2300 // and returns invalid password each time
2302 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2304 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
);
2309 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2313 static void save_hash ()
2315 char *hashfile
= data
.hashfile
;
2317 char new_hashfile
[256] = { 0 };
2318 char old_hashfile
[256] = { 0 };
2320 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2321 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2323 unlink (new_hashfile
);
2325 char separator
= data
.separator
;
2327 FILE *fp
= fopen (new_hashfile
, "wb");
2331 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2336 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2338 if (data
.salts_shown
[salt_pos
] == 1) continue;
2340 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2342 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2344 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2346 if (data
.digests_shown
[idx
] == 1) continue;
2348 if (data
.hash_mode
!= 2500)
2350 char out_buf
[HCBUFSIZ
] = { 0 };
2352 if (data
.username
== 1)
2354 user_t
*user
= data
.hash_info
[idx
]->user
;
2358 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2360 fputc (separator
, fp
);
2363 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2365 fputs (out_buf
, fp
);
2373 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2375 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2384 unlink (old_hashfile
);
2386 if (rename (hashfile
, old_hashfile
) != 0)
2388 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2395 if (rename (new_hashfile
, hashfile
) != 0)
2397 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2402 unlink (old_hashfile
);
2405 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2407 uint num_elements
= num
;
2409 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2410 device_param
->kernel_params_buf32
[31] = num
;
2412 uint kernel_threads
= device_param
->kernel_threads
;
2414 while (num_elements
% kernel_threads
) num_elements
++;
2416 cl_kernel kernel
= NULL
;
2420 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2421 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2422 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2423 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2424 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2427 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2428 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2429 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2430 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2431 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2432 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2433 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2434 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2435 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2436 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2437 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2441 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2443 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2444 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2446 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2450 if (kern_run
== KERN_RUN_2
)
2452 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2454 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2458 while (num_elements
% kernel_threads
) num_elements
++;
2460 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2461 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2463 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2466 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2468 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2472 cl_ulong time_start
;
2475 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2476 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2478 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2480 uint exec_pos
= device_param
->exec_pos
;
2482 device_param
->exec_ms
[exec_pos
] = exec_time
;
2486 if (exec_pos
== EXEC_CACHE
)
2491 device_param
->exec_pos
= exec_pos
;
2494 hc_clReleaseEvent (data
.ocl
, event
);
2496 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2499 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2501 uint num_elements
= num
;
2505 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2506 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2507 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2510 // causes problems with special threads like in bcrypt
2511 // const uint kernel_threads = device_param->kernel_threads;
2513 uint kernel_threads
= device_param
->kernel_threads
;
2515 while (num_elements
% kernel_threads
) num_elements
++;
2517 cl_kernel kernel
= NULL
;
2521 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2522 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2523 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2528 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2529 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2530 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2531 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2532 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2533 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2535 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2536 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2537 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2538 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2539 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2540 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2542 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2543 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2544 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2545 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2546 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2547 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2548 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2552 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2553 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2555 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2557 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2559 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2562 static void run_kernel_tm (hc_device_param_t
*device_param
)
2564 const uint num_elements
= 1024; // fixed
2566 uint kernel_threads
= 32;
2568 cl_kernel kernel
= device_param
->kernel_tm
;
2570 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2571 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2573 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2575 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2577 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2580 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2582 uint num_elements
= num
;
2584 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2585 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2587 // causes problems with special threads like in bcrypt
2588 // const uint kernel_threads = device_param->kernel_threads;
2590 uint kernel_threads
= device_param
->kernel_threads
;
2592 while (num_elements
% kernel_threads
) num_elements
++;
2594 cl_kernel kernel
= device_param
->kernel_amp
;
2596 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2597 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2599 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2600 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2602 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2604 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2606 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2609 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2611 const u32 num16d
= num
/ 16;
2612 const u32 num16m
= num
% 16;
2616 device_param
->kernel_params_memset_buf32
[1] = value
;
2617 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2619 uint kernel_threads
= device_param
->kernel_threads
;
2621 uint num_elements
= num16d
;
2623 while (num_elements
% kernel_threads
) num_elements
++;
2625 cl_kernel kernel
= device_param
->kernel_memset
;
2627 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2628 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2629 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2631 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2632 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2634 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2636 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2638 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2650 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2654 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2656 run_kernel_memset (device_param
, buf
, 0, size
);
2661 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2663 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2665 const cl_uchar zero = 0;
2667 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2672 // NOTE: clEnqueueFillBuffer () always fails with -59
2673 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2674 // How's that possible, OpenCL 1.2 support is advertised??
2675 // We need to workaround...
2677 #define FILLSZ 0x100000
2679 char *tmp = (char *) mymalloc (FILLSZ);
2681 for (size_t i = 0; i < size; i += FILLSZ)
2683 const size_t left = size - i;
2685 const size_t fillsz = MIN (FILLSZ, left);
2687 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2695 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
)
2697 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2699 if (attack_mode
== ATTACK_MODE_BF
)
2701 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2703 const uint size_tm
= 32 * sizeof (bs_word_t
);
2705 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2707 run_kernel_tm (device_param
);
2709 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
);
2713 if (highest_pw_len
< 16)
2715 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2717 else if (highest_pw_len
< 32)
2719 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2723 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2728 run_kernel_amp (device_param
, pws_cnt
);
2730 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2732 if (opts_type
& OPTS_TYPE_HOOK12
)
2734 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2737 uint iter
= salt_buf
->salt_iter
;
2739 uint loop_step
= device_param
->kernel_loops
;
2741 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2743 uint loop_left
= iter
- loop_pos
;
2745 loop_left
= MIN (loop_left
, loop_step
);
2747 device_param
->kernel_params_buf32
[25] = loop_pos
;
2748 device_param
->kernel_params_buf32
[26] = loop_left
;
2750 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2752 if (data
.devices_status
== STATUS_CRACKED
) break;
2753 if (data
.devices_status
== STATUS_ABORTED
) break;
2754 if (data
.devices_status
== STATUS_QUIT
) break;
2760 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2762 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2766 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2768 const u32 speed_pos
= device_param
->speed_pos
;
2770 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2772 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2774 if (data
.benchmark
== 1)
2776 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2780 if (opts_type
& OPTS_TYPE_HOOK23
)
2782 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2784 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
);
2786 // do something with data
2788 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
);
2791 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2795 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2801 else if (rule_len
== 1)
2803 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2809 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2811 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2813 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
);
2815 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2817 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2819 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2821 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2823 for (u32 i
= 0; i
< pws_cnt
; i
++)
2825 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2827 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2832 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2834 for (u32 i
= 0; i
< pws_cnt
; i
++)
2836 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2838 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2845 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2847 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2849 for (u32 i
= 0; i
< pws_cnt
; i
++)
2851 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2853 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2858 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2860 for (u32 i
= 0; i
< pws_cnt
; i
++)
2862 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2864 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2871 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
);
2873 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2875 const u64 off
= device_param
->words_off
;
2877 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2879 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2883 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2885 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2887 device_param
->kernel_params_buf32
[25] = 0;
2888 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2889 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2891 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2893 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true);
2897 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true);
2900 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2902 return exec_ms_prev
;
2905 static void autotune (hc_device_param_t
*device_param
)
2907 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2909 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2910 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2912 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2913 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2915 u32 kernel_accel
= kernel_accel_min
;
2916 u32 kernel_loops
= kernel_loops_min
;
2918 // in this case the user specified a fixed -u and -n on the commandline
2919 // no way to tune anything
2920 // but we need to run a few caching rounds
2922 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2924 try_run (device_param
, kernel_accel
, kernel_loops
);
2925 try_run (device_param
, kernel_accel
, kernel_loops
);
2926 try_run (device_param
, kernel_accel
, kernel_loops
);
2927 try_run (device_param
, kernel_accel
, kernel_loops
);
2929 device_param
->kernel_accel
= kernel_accel
;
2930 device_param
->kernel_loops
= kernel_loops
;
2932 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2934 device_param
->kernel_power
= kernel_power
;
2939 // from here it's clear we are allowed to autotune
2940 // so let's init some fake words
2942 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2944 if (data
.attack_kern
== ATTACK_KERN_BF
)
2946 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2950 for (u32 i
= 0; i
< kernel_power_max
; i
++)
2952 device_param
->pws_buf
[i
].i
[0] = i
;
2953 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
2954 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
2957 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
);
2960 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2962 if (data
.kernel_rules_cnt
> 1)
2964 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
);
2969 run_kernel_amp (device_param
, kernel_power_max
);
2972 #define VERIFIER_CNT 1
2974 // first find out highest kernel-loops that stays below target_ms
2976 if (kernel_loops_min
< kernel_loops_max
)
2978 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2980 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2982 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2984 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2986 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2989 if (exec_ms
< target_ms
) break;
2993 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2995 #define STEPS_CNT 10
2997 if (kernel_accel_min
< kernel_accel_max
)
2999 for (int i
= 0; i
< STEPS_CNT
; i
++)
3001 const u32 kernel_accel_try
= 1 << i
;
3003 if (kernel_accel_try
< kernel_accel_min
) continue;
3004 if (kernel_accel_try
> kernel_accel_max
) break;
3006 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3008 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3010 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3012 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3015 if (exec_ms
> target_ms
) break;
3017 kernel_accel
= kernel_accel_try
;
3021 // at this point we want to know the actual runtime for the following reason:
3022 // we need a reference for the balancing loop following up, and this
3023 // the balancing loop can have an effect that the creates a new opportunity, for example:
3024 // if the target is 95 ms and the current runtime is 48ms the above loop
3025 // stopped the execution because the previous exec_ms was > 95ms
3026 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3027 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3029 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3031 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3033 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3035 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3038 u32 diff
= kernel_loops
- kernel_accel
;
3040 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3042 u32 kernel_accel_orig
= kernel_accel
;
3043 u32 kernel_loops_orig
= kernel_loops
;
3045 for (u32 f
= 1; f
< 1024; f
++)
3047 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3048 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3050 if (kernel_accel_try
> kernel_accel_max
) break;
3051 if (kernel_loops_try
< kernel_loops_min
) break;
3053 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3055 if (diff_new
> diff
) break;
3059 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3061 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3063 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3065 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3068 if (exec_ms
< exec_ms_pre_final
)
3070 exec_ms_pre_final
= exec_ms
;
3072 kernel_accel
= kernel_accel_try
;
3073 kernel_loops
= kernel_loops_try
;
3078 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3080 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3082 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3084 if (exec_accel_min
>= 1.0)
3086 // this is safe to not overflow kernel_accel_max because of accel_left
3088 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3091 // reset them fake words
3094 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3096 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);
3097 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);
3100 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3102 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3104 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3109 device_param
->exec_pos
= 0;
3111 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3115 device_param
->kernel_accel
= kernel_accel
;
3116 device_param
->kernel_loops
= kernel_loops
;
3118 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3120 device_param
->kernel_power
= kernel_power
;
3124 if (data
.quiet
== 0)
3128 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3129 "Device #%u: autotuned kernel-loops to %u\n",
3130 device_param
->device_id
+ 1, kernel_accel
,
3131 device_param
->device_id
+ 1, kernel_loops
);
3133 fprintf (stdout
, "%s", PROMPT
);
3141 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3143 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3147 uint speed_pos
= device_param
->speed_pos
;
3150 if (device_param
->timer_speed
.tv_sec
== 0)
3152 hc_timer_set (&device_param
->timer_speed
);
3157 if (device_param
->timer_speed
.QuadPart
== 0)
3159 hc_timer_set (&device_param
->timer_speed
);
3163 // find higest password length, this is for optimization stuff
3165 uint highest_pw_len
= 0;
3167 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3170 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3173 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3175 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3176 + device_param
->kernel_params_mp_l_buf32
[5];
3181 uint innerloop_step
= 0;
3182 uint innerloop_cnt
= 0;
3184 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3185 else innerloop_step
= 1;
3187 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3188 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3189 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3191 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3193 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3195 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3197 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3199 if (data
.devices_status
== STATUS_CRACKED
) break;
3200 if (data
.devices_status
== STATUS_ABORTED
) break;
3201 if (data
.devices_status
== STATUS_QUIT
) break;
3202 if (data
.devices_status
== STATUS_BYPASS
) break;
3204 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3206 device_param
->kernel_params_buf32
[24] = salt_pos
;
3207 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3208 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3210 FILE *combs_fp
= device_param
->combs_fp
;
3212 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3219 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3221 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3223 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3225 if (data
.devices_status
== STATUS_CRACKED
) break;
3226 if (data
.devices_status
== STATUS_ABORTED
) break;
3227 if (data
.devices_status
== STATUS_QUIT
) break;
3228 if (data
.devices_status
== STATUS_BYPASS
) break;
3230 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3232 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3234 device_param
->innerloop_pos
= innerloop_pos
;
3235 device_param
->innerloop_left
= innerloop_left
;
3237 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3239 // i think we can get rid of this
3240 if (innerloop_left
== 0)
3242 puts ("bug, how should this happen????\n");
3247 if (data
.salts_shown
[salt_pos
] == 1)
3249 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3254 // initialize amplifiers
3256 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3260 while (i
< innerloop_left
)
3262 if (feof (combs_fp
)) break;
3264 int line_len
= fgetl (combs_fp
, line_buf
);
3266 if (line_len
>= PW_MAX1
) continue;
3268 line_len
= convert_from_hex (line_buf
, line_len
);
3270 char *line_buf_new
= line_buf
;
3272 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3274 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3276 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3278 if (rule_len_out
< 0)
3280 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3285 line_len
= rule_len_out
;
3287 line_buf_new
= rule_buf_out
;
3290 line_len
= MIN (line_len
, PW_DICTMAX
);
3292 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3294 memcpy (ptr
, line_buf_new
, line_len
);
3296 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3298 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3300 uppercase (ptr
, line_len
);
3303 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3305 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3307 ptr
[line_len
] = 0x80;
3310 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3312 ptr
[line_len
] = 0x01;
3316 device_param
->combs_buf
[i
].pw_len
= line_len
;
3321 for (uint j
= i
; j
< innerloop_left
; j
++)
3323 device_param
->combs_buf
[j
].i
[0] = 0;
3324 device_param
->combs_buf
[j
].i
[1] = 0;
3325 device_param
->combs_buf
[j
].i
[2] = 0;
3326 device_param
->combs_buf
[j
].i
[3] = 0;
3327 device_param
->combs_buf
[j
].i
[4] = 0;
3328 device_param
->combs_buf
[j
].i
[5] = 0;
3329 device_param
->combs_buf
[j
].i
[6] = 0;
3330 device_param
->combs_buf
[j
].i
[7] = 0;
3332 device_param
->combs_buf
[j
].pw_len
= 0;
3337 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3339 u64 off
= innerloop_pos
;
3341 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3343 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3345 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3347 u64 off
= innerloop_pos
;
3349 device_param
->kernel_params_mp_buf64
[3] = off
;
3351 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3353 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3355 u64 off
= innerloop_pos
;
3357 device_param
->kernel_params_mp_buf64
[3] = off
;
3359 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3364 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3366 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
);
3368 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3370 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
);
3372 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3374 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
);
3376 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3378 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
);
3380 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3382 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
);
3385 if (data
.benchmark
== 1)
3387 hc_timer_set (&device_param
->timer_speed
);
3390 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3392 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3394 if (data
.devices_status
== STATUS_CRACKED
) break;
3395 if (data
.devices_status
== STATUS_ABORTED
) break;
3396 if (data
.devices_status
== STATUS_QUIT
) break;
3402 check_cracked (device_param
, salt_pos
);
3408 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3410 hc_thread_mutex_lock (mux_counter
);
3412 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3414 hc_thread_mutex_unlock (mux_counter
);
3422 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3424 hc_timer_set (&device_param
->timer_speed
);
3428 //hc_thread_mutex_lock (mux_display);
3430 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3432 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3434 //hc_thread_mutex_unlock (mux_display);
3438 if (speed_pos
== SPEED_CACHE
)
3447 if (data
.benchmark
== 1) break;
3451 device_param
->speed_pos
= speed_pos
;
3456 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3458 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3462 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3464 wl_data
->buf
[wl_data
->cnt
] = 0;
3466 if (wl_data
->cnt
== 0) return;
3468 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3472 if (wl_data
->cnt
== wl_data
->avail
)
3474 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3476 wl_data
->avail
+= wl_data
->incr
;
3479 const int c
= fgetc (fd
);
3481 if (c
== EOF
) break;
3483 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3487 if (c
== '\n') break;
3490 // ensure stream ends with a newline
3492 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3496 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3502 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3506 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3508 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3518 if (*ptr
!= '\n') continue;
3522 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3533 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3537 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3539 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3541 if (*ptr
!= '\n') continue;
3545 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3556 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3560 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3562 if (*ptr
!= '\n') continue;
3566 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3577 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3579 while (wl_data
->pos
< wl_data
->cnt
)
3584 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3586 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3588 wl_data
->pos
+= off
;
3590 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3592 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3594 int rule_len_out
= -1;
3596 if (len
< BLOCK_SIZE
)
3598 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3601 if (rule_len_out
< 0)
3606 if (rule_len_out
> PW_MAX
)
3627 fprintf (stderr
, "BUG feof()!!\n");
3632 load_segment (wl_data
, fd
);
3634 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3638 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3642 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3652 fstat (fileno (fd
), &d
.stat
);
3656 _fstat64 (fileno (fd
), &d
.stat
);
3660 d
.stat
.st_nlink
= 0;
3664 d
.stat
.st_atime
= 0;
3667 d
.stat
.st_blksize
= 0;
3668 d
.stat
.st_blocks
= 0;
3671 if (d
.stat
.st_size
== 0) return 0;
3673 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3675 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3679 u64 cnt
= d_cache
->cnt
;
3683 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3685 keyspace
*= data
.kernel_rules_cnt
;
3687 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3689 keyspace
*= data
.combs_cnt
;
3692 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
);
3693 if (data
.quiet
== 0) log_info ("");
3695 hc_signal (sigHandler_default
);
3710 load_segment (wl_data
, fd
);
3712 comp
+= wl_data
->cnt
;
3716 while (i
< wl_data
->cnt
)
3721 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3723 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3725 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3727 int rule_len_out
= -1;
3729 if (len
< BLOCK_SIZE
)
3731 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3734 if (rule_len_out
< 0)
3746 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3748 cnt
+= data
.kernel_rules_cnt
;
3750 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3752 cnt
+= data
.combs_cnt
;
3765 if ((now
- prev
) == 0) continue;
3767 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3769 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
);
3774 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
);
3775 if (data
.quiet
== 0) log_info ("");
3777 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3779 hc_signal (sigHandler_default
);
3784 static void *thread_monitor (void *p
)
3786 uint runtime_check
= 0;
3787 uint remove_check
= 0;
3788 uint status_check
= 0;
3789 uint restore_check
= 0;
3791 uint restore_left
= data
.restore_timer
;
3792 uint remove_left
= data
.remove_timer
;
3793 uint status_left
= data
.status_timer
;
3796 uint hwmon_check
= 0;
3798 int slowdown_warnings
= 0;
3800 // these variables are mainly used for fan control
3802 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3804 // temperature controller "loopback" values
3806 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3807 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3809 int temp_threshold
= 1; // degrees celcius
3811 int fan_speed_min
= 15; // in percentage
3812 int fan_speed_max
= 100;
3814 time_t last_temp_check_time
;
3815 #endif // HAVE_HWMON
3817 uint sleep_time
= 1;
3824 if (data
.restore_timer
)
3829 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3834 if (data
.status
== 1)
3840 if (data
.gpu_temp_disable
== 0)
3842 time (&last_temp_check_time
);
3848 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3851 if (hwmon_check
== 0)
3856 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3858 hc_sleep (sleep_time
);
3860 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3864 if (hwmon_check
== 1)
3866 hc_thread_mutex_lock (mux_adl
);
3868 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3870 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3872 if (device_param
->skipped
) continue;
3874 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
3878 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
= { 0 };
3879 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
= { 0 };
3881 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
3882 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
3884 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
3886 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
3888 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
3890 if (perfPolicies_status
.throttle
& 2)
3892 if (slowdown_warnings
< 3)
3894 if (data
.quiet
== 0) clear_prompt ();
3896 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
3898 if (slowdown_warnings
== 2)
3903 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3904 if (data
.quiet
== 0) fflush (stdout
);
3906 slowdown_warnings
++;
3911 slowdown_warnings
= 0;
3917 hc_thread_mutex_unlock (mux_adl
);
3920 if (hwmon_check
== 1)
3922 hc_thread_mutex_lock (mux_adl
);
3924 time_t temp_check_time
;
3926 time (&temp_check_time
);
3928 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3930 if (Ta
== 0) Ta
= 1;
3932 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3934 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3936 if (device_param
->skipped
) continue;
3938 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3940 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3942 if (temperature
> (int) data
.gpu_temp_abort
)
3944 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3946 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3951 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3953 if (gpu_temp_retain
)
3955 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
3957 int temp_cur
= temperature
;
3959 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3961 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3963 // calculate Ta value (time difference in seconds between the last check and this check)
3965 last_temp_check_time
= temp_check_time
;
3971 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3973 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
);
3975 if (abs (fan_diff_required
) >= temp_threshold
)
3977 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3979 int fan_speed_level
= fan_speed_cur
;
3981 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3983 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3985 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3986 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3988 if (fan_speed_new
!= fan_speed_cur
)
3990 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3991 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3993 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3995 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
3997 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
3999 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4004 fan_speed_chgd
[device_id
] = 1;
4007 temp_diff_old
[device_id
] = temp_diff_new
;
4014 hc_thread_mutex_unlock (mux_adl
);
4016 #endif // HAVE_HWMON
4018 if (restore_check
== 1)
4022 if (restore_left
== 0)
4024 if (data
.restore_disable
== 0) cycle_restore ();
4026 restore_left
= data
.restore_timer
;
4030 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4034 time (&runtime_cur
);
4036 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4038 if (runtime_left
<= 0)
4040 if (data
.benchmark
== 0)
4042 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4045 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4049 if (remove_check
== 1)
4053 if (remove_left
== 0)
4055 if (data
.digests_saved
!= data
.digests_done
)
4057 data
.digests_saved
= data
.digests_done
;
4062 remove_left
= data
.remove_timer
;
4066 if (status_check
== 1)
4070 if (status_left
== 0)
4072 //hc_thread_mutex_lock (mux_display);
4074 if (data
.quiet
== 0) clear_prompt ();
4076 if (data
.quiet
== 0) log_info ("");
4080 if (data
.quiet
== 0) log_info ("");
4082 //hc_thread_mutex_unlock (mux_display);
4084 status_left
= data
.status_timer
;
4090 myfree (fan_speed_chgd
);
4092 myfree (temp_diff_old
);
4093 myfree (temp_diff_sum
);
4101 static void *thread_outfile_remove (void *p
)
4103 // some hash-dependent constants
4104 char *outfile_dir
= data
.outfile_check_directory
;
4105 uint dgst_size
= data
.dgst_size
;
4106 uint isSalted
= data
.isSalted
;
4107 uint esalt_size
= data
.esalt_size
;
4108 uint hash_mode
= data
.hash_mode
;
4110 uint outfile_check_timer
= data
.outfile_check_timer
;
4112 char separator
= data
.separator
;
4114 // some hash-dependent functions
4115 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4116 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4119 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4121 hash_buf
.digest
= mymalloc (dgst_size
);
4123 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4125 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4127 uint digest_buf
[64] = { 0 };
4129 outfile_data_t
*out_info
= NULL
;
4131 char **out_files
= NULL
;
4133 time_t folder_mtime
= 0;
4137 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4139 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4143 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4147 if (check_left
== 0)
4149 struct stat outfile_check_stat
;
4151 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4153 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4157 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4159 char **out_files_new
= scan_directory (outfile_dir
);
4161 int out_cnt_new
= count_dictionaries (out_files_new
);
4163 outfile_data_t
*out_info_new
= NULL
;
4165 if (out_cnt_new
> 0)
4167 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4169 for (int i
= 0; i
< out_cnt_new
; i
++)
4171 out_info_new
[i
].file_name
= out_files_new
[i
];
4173 // check if there are files that we have seen/checked before (and not changed)
4175 for (int j
= 0; j
< out_cnt
; j
++)
4177 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4179 struct stat outfile_stat
;
4181 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4183 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4185 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4186 out_info_new
[i
].seek
= out_info
[j
].seek
;
4194 local_free (out_info
);
4195 local_free (out_files
);
4197 out_files
= out_files_new
;
4198 out_cnt
= out_cnt_new
;
4199 out_info
= out_info_new
;
4201 folder_mtime
= outfile_check_stat
.st_mtime
;
4204 for (int j
= 0; j
< out_cnt
; j
++)
4206 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4210 //hc_thread_mutex_lock (mux_display);
4213 struct stat outfile_stat
;
4215 fstat (fileno (fp
), &outfile_stat
);
4219 struct stat64 outfile_stat
;
4221 _fstat64 (fileno (fp
), &outfile_stat
);
4224 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4226 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4227 out_info
[j
].seek
= 0;
4230 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4232 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4236 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4238 if (ptr
== NULL
) break;
4240 int line_len
= strlen (line_buf
);
4242 if (line_len
<= 0) continue;
4244 int iter
= MAX_CUT_TRIES
;
4246 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4248 if (line_buf
[i
] != separator
) continue;
4250 int parser_status
= PARSER_OK
;
4252 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4254 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4259 if (parser_status
== PARSER_OK
)
4261 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4263 if (data
.salts_shown
[salt_pos
] == 1) continue;
4265 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4267 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4269 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4271 if (data
.digests_shown
[idx
] == 1) continue;
4275 if (hash_mode
== 6800)
4277 if (i
== salt_buf
->salt_len
)
4279 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4282 else if (hash_mode
== 2500)
4284 // BSSID : MAC1 : MAC2 (:plain)
4285 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4287 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4289 if (!cracked
) continue;
4291 // now compare MAC1 and MAC2 too, since we have this additional info
4292 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4293 char *mac2_pos
= mac1_pos
+ 12 + 1;
4295 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4296 wpa_t
*wpa
= &wpas
[salt_pos
];
4298 // compare hex string(s) vs binary MAC address(es)
4300 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4302 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4311 if (!cracked
) continue;
4313 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4315 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4326 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4328 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4330 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4337 data
.digests_shown
[idx
] = 1;
4339 data
.digests_done
++;
4341 salt_buf
->digests_done
++;
4343 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4345 data
.salts_shown
[salt_pos
] = 1;
4349 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4354 if (data
.devices_status
== STATUS_CRACKED
) break;
4360 if (data
.devices_status
== STATUS_CRACKED
) break;
4365 if (data
.devices_status
== STATUS_CRACKED
) break;
4370 out_info
[j
].seek
= ftell (fp
);
4372 //hc_thread_mutex_unlock (mux_display);
4380 check_left
= outfile_check_timer
;
4384 if (esalt_size
) local_free (hash_buf
.esalt
);
4386 if (isSalted
) local_free (hash_buf
.salt
);
4388 local_free (hash_buf
.digest
);
4390 local_free (out_info
);
4392 local_free (out_files
);
4399 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4401 //if (device_param->pws_cnt < device_param->kernel_power)
4403 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4405 u8
*ptr
= (u8
*) pw
->i
;
4407 memcpy (ptr
, pw_buf
, pw_len
);
4409 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4411 pw
->pw_len
= pw_len
;
4413 device_param
->pws_cnt
++;
4417 // fprintf (stderr, "BUG pw_add()!!\n");
4423 static void set_kernel_power_final (const u64 kernel_power_final
)
4425 if (data
.quiet
== 0)
4431 log_info ("INFO: approaching final keyspace, workload adjusted");
4434 fprintf (stdout
, "%s", PROMPT
);
4439 data
.kernel_power_final
= kernel_power_final
;
4442 static u32
get_power (hc_device_param_t
*device_param
)
4444 const u64 kernel_power_final
= data
.kernel_power_final
;
4446 if (kernel_power_final
)
4448 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
4450 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
4452 // work should be at least the hardware power available without any accelerator
4454 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
4459 return device_param
->kernel_power
;
4462 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
4464 hc_thread_mutex_lock (mux_dispatcher
);
4466 const u64 words_cur
= data
.words_cur
;
4467 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4469 device_param
->words_off
= words_cur
;
4471 const u64 kernel_power_all
= data
.kernel_power_all
;
4473 const u64 words_left
= words_base
- words_cur
;
4475 if (words_left
< kernel_power_all
)
4477 if (data
.kernel_power_final
== 0)
4479 set_kernel_power_final (words_left
);
4483 const u32 kernel_power
= get_power (device_param
);
4485 uint work
= MIN (words_left
, kernel_power
);
4487 work
= MIN (work
, max
);
4489 data
.words_cur
+= work
;
4491 hc_thread_mutex_unlock (mux_dispatcher
);
4496 static void *thread_autotune (void *p
)
4498 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4500 if (device_param
->skipped
) return NULL
;
4502 autotune (device_param
);
4507 static void *thread_calc_stdin (void *p
)
4509 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4511 if (device_param
->skipped
) return NULL
;
4513 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4515 const uint attack_kern
= data
.attack_kern
;
4517 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4519 hc_thread_mutex_lock (mux_dispatcher
);
4521 if (feof (stdin
) != 0)
4523 hc_thread_mutex_unlock (mux_dispatcher
);
4530 while (words_cur
< device_param
->kernel_power
)
4532 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4534 if (line_buf
== NULL
) break;
4536 uint line_len
= in_superchop (line_buf
);
4538 line_len
= convert_from_hex (line_buf
, line_len
);
4540 // post-process rule engine
4542 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4544 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4546 int rule_len_out
= -1;
4548 if (line_len
< BLOCK_SIZE
)
4550 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4553 if (rule_len_out
< 0) continue;
4555 line_buf
= rule_buf_out
;
4556 line_len
= rule_len_out
;
4559 if (line_len
> PW_MAX
)
4564 // hmm that's always the case, or?
4566 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4568 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4570 hc_thread_mutex_lock (mux_counter
);
4572 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4574 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4577 hc_thread_mutex_unlock (mux_counter
);
4583 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4587 if (data
.devices_status
== STATUS_CRACKED
) break;
4588 if (data
.devices_status
== STATUS_ABORTED
) break;
4589 if (data
.devices_status
== STATUS_QUIT
) break;
4590 if (data
.devices_status
== STATUS_BYPASS
) break;
4593 hc_thread_mutex_unlock (mux_dispatcher
);
4595 if (data
.devices_status
== STATUS_CRACKED
) break;
4596 if (data
.devices_status
== STATUS_ABORTED
) break;
4597 if (data
.devices_status
== STATUS_QUIT
) break;
4598 if (data
.devices_status
== STATUS_BYPASS
) break;
4602 const uint pws_cnt
= device_param
->pws_cnt
;
4606 run_copy (device_param
, pws_cnt
);
4608 run_cracker (device_param
, pws_cnt
);
4610 device_param
->pws_cnt
= 0;
4614 if (attack_kern == ATTACK_KERN_STRAIGHT)
4616 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4618 else if (attack_kern == ATTACK_KERN_COMBI)
4620 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4626 device_param
->kernel_accel
= 0;
4627 device_param
->kernel_loops
= 0;
4634 static void *thread_calc (void *p
)
4636 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4638 if (device_param
->skipped
) return NULL
;
4640 const uint attack_mode
= data
.attack_mode
;
4641 const uint attack_kern
= data
.attack_kern
;
4643 if (attack_mode
== ATTACK_MODE_BF
)
4645 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4647 const uint work
= get_work (device_param
, -1);
4649 if (work
== 0) break;
4651 const u64 words_off
= device_param
->words_off
;
4652 const u64 words_fin
= words_off
+ work
;
4654 const uint pws_cnt
= work
;
4656 device_param
->pws_cnt
= pws_cnt
;
4660 run_copy (device_param
, pws_cnt
);
4662 run_cracker (device_param
, pws_cnt
);
4664 device_param
->pws_cnt
= 0;
4668 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4672 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4674 if (data
.devices_status
== STATUS_CRACKED
) break;
4675 if (data
.devices_status
== STATUS_ABORTED
) break;
4676 if (data
.devices_status
== STATUS_QUIT
) break;
4677 if (data
.devices_status
== STATUS_BYPASS
) break;
4679 if (data
.benchmark
== 1) break;
4681 device_param
->words_done
= words_fin
;
4686 const uint segment_size
= data
.segment_size
;
4688 char *dictfile
= data
.dictfile
;
4690 if (attack_mode
== ATTACK_MODE_COMBI
)
4692 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4694 dictfile
= data
.dictfile2
;
4698 FILE *fd
= fopen (dictfile
, "rb");
4702 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4707 if (attack_mode
== ATTACK_MODE_COMBI
)
4709 const uint combs_mode
= data
.combs_mode
;
4711 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4713 const char *dictfilec
= data
.dictfile2
;
4715 FILE *combs_fp
= fopen (dictfilec
, "rb");
4717 if (combs_fp
== NULL
)
4719 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4726 device_param
->combs_fp
= combs_fp
;
4728 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4730 const char *dictfilec
= data
.dictfile
;
4732 FILE *combs_fp
= fopen (dictfilec
, "rb");
4734 if (combs_fp
== NULL
)
4736 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4743 device_param
->combs_fp
= combs_fp
;
4747 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4749 wl_data
->buf
= (char *) mymalloc (segment_size
);
4750 wl_data
->avail
= segment_size
;
4751 wl_data
->incr
= segment_size
;
4757 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4766 const uint work
= get_work (device_param
, max
);
4768 if (work
== 0) break;
4772 words_off
= device_param
->words_off
;
4773 words_fin
= words_off
+ work
;
4778 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4780 for ( ; words_cur
< words_fin
; words_cur
++)
4782 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4784 line_len
= convert_from_hex (line_buf
, line_len
);
4786 // post-process rule engine
4788 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4790 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4792 int rule_len_out
= -1;
4794 if (line_len
< BLOCK_SIZE
)
4796 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4799 if (rule_len_out
< 0) continue;
4801 line_buf
= rule_buf_out
;
4802 line_len
= rule_len_out
;
4805 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4807 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4811 hc_thread_mutex_lock (mux_counter
);
4813 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4815 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4818 hc_thread_mutex_unlock (mux_counter
);
4823 else if (attack_kern
== ATTACK_KERN_COMBI
)
4825 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4826 // since we still need to combine the plains
4828 if (line_len
> data
.pw_max
)
4832 hc_thread_mutex_lock (mux_counter
);
4834 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4836 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4839 hc_thread_mutex_unlock (mux_counter
);
4845 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4847 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4849 if (data
.devices_status
== STATUS_CRACKED
) break;
4850 if (data
.devices_status
== STATUS_ABORTED
) break;
4851 if (data
.devices_status
== STATUS_QUIT
) break;
4852 if (data
.devices_status
== STATUS_BYPASS
) break;
4855 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4857 if (data
.devices_status
== STATUS_CRACKED
) break;
4858 if (data
.devices_status
== STATUS_ABORTED
) break;
4859 if (data
.devices_status
== STATUS_QUIT
) break;
4860 if (data
.devices_status
== STATUS_BYPASS
) break;
4863 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4865 if (data
.devices_status
== STATUS_CRACKED
) break;
4866 if (data
.devices_status
== STATUS_ABORTED
) break;
4867 if (data
.devices_status
== STATUS_QUIT
) break;
4868 if (data
.devices_status
== STATUS_BYPASS
) break;
4874 const uint pws_cnt
= device_param
->pws_cnt
;
4878 run_copy (device_param
, pws_cnt
);
4880 run_cracker (device_param
, pws_cnt
);
4882 device_param
->pws_cnt
= 0;
4886 if (attack_kern == ATTACK_KERN_STRAIGHT)
4888 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4890 else if (attack_kern == ATTACK_KERN_COMBI)
4892 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4897 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4899 if (data
.devices_status
== STATUS_CRACKED
) break;
4900 if (data
.devices_status
== STATUS_ABORTED
) break;
4901 if (data
.devices_status
== STATUS_QUIT
) break;
4902 if (data
.devices_status
== STATUS_BYPASS
) break;
4904 if (words_fin
== 0) break;
4906 device_param
->words_done
= words_fin
;
4909 if (attack_mode
== ATTACK_MODE_COMBI
)
4911 fclose (device_param
->combs_fp
);
4914 free (wl_data
->buf
);
4920 device_param
->kernel_accel
= 0;
4921 device_param
->kernel_loops
= 0;
4926 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4930 log_error ("ERROR: %s : Invalid argument", __func__
);
4935 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4937 device_param
->kernel_params_buf32
[24] = salt_pos
;
4938 device_param
->kernel_params_buf32
[27] = 1;
4939 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4940 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4941 device_param
->kernel_params_buf32
[30] = 0;
4942 device_param
->kernel_params_buf32
[31] = 1;
4944 char *dictfile_old
= data
.dictfile
;
4946 const char *weak_hash_check
= "weak-hash-check";
4948 data
.dictfile
= (char *) weak_hash_check
;
4950 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4952 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4958 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4960 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4964 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4966 uint loop_step
= 16;
4968 const uint iter
= salt_buf
->salt_iter
;
4970 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4972 uint loop_left
= iter
- loop_pos
;
4974 loop_left
= MIN (loop_left
, loop_step
);
4976 device_param
->kernel_params_buf32
[25] = loop_pos
;
4977 device_param
->kernel_params_buf32
[26] = loop_left
;
4979 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4982 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4989 check_cracked (device_param
, salt_pos
);
4995 device_param
->kernel_params_buf32
[24] = 0;
4996 device_param
->kernel_params_buf32
[25] = 0;
4997 device_param
->kernel_params_buf32
[26] = 0;
4998 device_param
->kernel_params_buf32
[27] = 0;
4999 device_param
->kernel_params_buf32
[28] = 0;
5000 device_param
->kernel_params_buf32
[29] = 0;
5001 device_param
->kernel_params_buf32
[30] = 0;
5002 device_param
->kernel_params_buf32
[31] = 0;
5004 data
.dictfile
= dictfile_old
;
5006 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5011 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5013 if (data
.username
== 0)
5015 *hashbuf_pos
= line_buf
;
5016 *hashbuf_len
= line_len
;
5020 char *pos
= line_buf
;
5023 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5025 if (line_buf
[i
] == data
.separator
)
5040 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5047 for (int i
= 0; i
< line_len
; i
++)
5049 if (line_buf
[i
] == data
.separator
)
5058 if (pos
== NULL
) pos
= line_buf
+ i
;
5070 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5077 for (int i
= 0; i
< line_len
; i
++)
5079 if (line_buf
[i
] == ':')
5086 if (sep_cnt
== 2) sep2_len
++;
5087 if (sep_cnt
== 3) sep3_len
++;
5090 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5095 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5102 for (int i
= 0; i
< line_len
; i
++)
5104 if (line_buf
[i
] == ':')
5111 if (data
.hash_mode
== 1000)
5115 if (pos
== NULL
) pos
= line_buf
+ i
;
5120 else if (data
.hash_mode
== 3000)
5124 if (pos
== NULL
) pos
= line_buf
+ i
;
5135 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5142 for (int i
= 0; i
< line_len
; i
++)
5144 if (line_buf
[i
] == ':')
5153 if (pos
== NULL
) pos
= line_buf
+ i
;
5165 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5169 char sep5_first
= 0;
5170 char sep6_first
= 0;
5172 for (int i
= 0; i
< line_len
; i
++)
5174 if (line_buf
[i
] == ':')
5181 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5182 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5185 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5190 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5197 for (int i
= 0; i
< line_len
; i
++)
5199 if (line_buf
[i
] == ':')
5208 if (pos
== NULL
) pos
= line_buf
+ i
;
5218 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5225 for (int i
= 0; i
< line_len
; i
++)
5227 if (line_buf
[i
] == ':')
5236 if (pos
== NULL
) pos
= line_buf
+ i
;
5248 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5252 for (int i
= 0; i
< line_len
; i
++)
5254 if (line_buf
[i
] == ':') sep_cnt
++;
5257 if (sep_cnt
== 8) return 1;
5262 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5264 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5267 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5269 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5274 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5276 switch (hashfile_format
)
5278 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5279 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5280 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5281 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5285 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5287 switch (hashfile_format
)
5289 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5290 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5291 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5292 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5296 char *strhlfmt (const uint hashfile_format
)
5298 switch (hashfile_format
)
5300 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5301 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5302 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5303 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5304 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5305 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5306 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5307 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5308 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5309 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5312 return ((char *) "Unknown");
5315 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5317 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5319 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5320 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5322 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5326 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5330 int line_len
= fgetl (fp
, line_buf
);
5332 if (line_len
== 0) continue;
5334 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5335 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5336 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5338 if (num_check
== max_check
) break;
5345 uint hashlist_format
= HLFMT_HASHCAT
;
5347 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5349 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5351 hashlist_format
= i
;
5356 return hashlist_format
;
5360 * some further helper function
5363 // wrapper around mymalloc for ADL
5365 #if defined(HAVE_HWMON)
5366 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
5368 return mymalloc (iSize
);
5372 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
)
5376 const uint dgst_pos0
= data
.dgst_pos0
;
5377 const uint dgst_pos1
= data
.dgst_pos1
;
5378 const uint dgst_pos2
= data
.dgst_pos2
;
5379 const uint dgst_pos3
= data
.dgst_pos3
;
5381 memset (bitmap_a
, 0, bitmap_size
);
5382 memset (bitmap_b
, 0, bitmap_size
);
5383 memset (bitmap_c
, 0, bitmap_size
);
5384 memset (bitmap_d
, 0, bitmap_size
);
5386 for (uint i
= 0; i
< digests_cnt
; i
++)
5388 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5390 digests_buf_ptr
+= dgst_size
;
5392 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5393 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5394 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5395 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5397 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5398 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5399 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5400 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5402 if (bitmap_a
[idx0
] & val0
) collisions
++;
5403 if (bitmap_b
[idx1
] & val1
) collisions
++;
5404 if (bitmap_c
[idx2
] & val2
) collisions
++;
5405 if (bitmap_d
[idx3
] & val3
) collisions
++;
5407 bitmap_a
[idx0
] |= val0
;
5408 bitmap_b
[idx1
] |= val1
;
5409 bitmap_c
[idx2
] |= val2
;
5410 bitmap_d
[idx3
] |= val3
;
5412 if (collisions
>= collisions_max
) return 0x7fffffff;
5423 void SetConsoleWindowSize (const int x
)
5425 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5427 if (h
== INVALID_HANDLE_VALUE
) return;
5429 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5431 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5433 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5435 sr
->Right
= MAX (sr
->Right
, x
- 1);
5439 co
.X
= sr
->Right
+ 1;
5442 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5444 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5448 int main (int argc
, char **argv
)
5451 SetConsoleWindowSize (132);
5455 * To help users a bit
5458 char *compute
= getenv ("COMPUTE");
5462 static char display
[100];
5464 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5470 if (getenv ("DISPLAY") == NULL
)
5471 putenv ((char *) "DISPLAY=:0");
5474 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5475 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5477 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5478 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5480 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5481 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5483 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5484 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5486 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5487 putenv ((char *) "POCL_KERNEL_CACHE=0");
5495 memset (&data
, 0, sizeof (hc_global_data_t
));
5501 data
.proc_start
= proc_start
;
5504 char **myargv
= argv
;
5506 hc_thread_mutex_init (mux_dispatcher
);
5507 hc_thread_mutex_init (mux_counter
);
5508 hc_thread_mutex_init (mux_display
);
5509 hc_thread_mutex_init (mux_adl
);
5512 * commandline parameters
5516 uint version
= VERSION
;
5518 uint benchmark
= BENCHMARK
;
5521 uint username
= USERNAME
;
5522 uint remove
= REMOVE
;
5523 uint remove_timer
= REMOVE_TIMER
;
5526 uint keyspace
= KEYSPACE
;
5527 uint potfile_disable
= POTFILE_DISABLE
;
5528 char *potfile_path
= NULL
;
5529 uint debug_mode
= DEBUG_MODE
;
5530 char *debug_file
= NULL
;
5531 char *induction_dir
= NULL
;
5532 char *outfile_check_dir
= NULL
;
5534 uint runtime
= RUNTIME
;
5535 uint hash_mode
= HASH_MODE
;
5536 uint attack_mode
= ATTACK_MODE
;
5537 uint markov_disable
= MARKOV_DISABLE
;
5538 uint markov_classic
= MARKOV_CLASSIC
;
5539 uint markov_threshold
= MARKOV_THRESHOLD
;
5540 char *markov_hcstat
= NULL
;
5541 char *outfile
= NULL
;
5542 uint outfile_format
= OUTFILE_FORMAT
;
5543 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5544 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5545 uint restore
= RESTORE
;
5546 uint restore_timer
= RESTORE_TIMER
;
5547 uint restore_disable
= RESTORE_DISABLE
;
5548 uint status
= STATUS
;
5549 uint status_timer
= STATUS_TIMER
;
5550 uint machine_readable
= MACHINE_READABLE
;
5551 uint loopback
= LOOPBACK
;
5552 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5553 char *session
= NULL
;
5554 uint hex_charset
= HEX_CHARSET
;
5555 uint hex_salt
= HEX_SALT
;
5556 uint hex_wordlist
= HEX_WORDLIST
;
5557 uint rp_gen
= RP_GEN
;
5558 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5559 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5560 uint rp_gen_seed
= RP_GEN_SEED
;
5561 char *rule_buf_l
= (char *) RULE_BUF_L
;
5562 char *rule_buf_r
= (char *) RULE_BUF_R
;
5563 uint increment
= INCREMENT
;
5564 uint increment_min
= INCREMENT_MIN
;
5565 uint increment_max
= INCREMENT_MAX
;
5566 char *cpu_affinity
= NULL
;
5567 OCL_PTR
*ocl
= NULL
;
5568 char *opencl_devices
= NULL
;
5569 char *opencl_platforms
= NULL
;
5570 char *opencl_device_types
= NULL
;
5571 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5572 char *truecrypt_keyfiles
= NULL
;
5573 char *veracrypt_keyfiles
= NULL
;
5574 uint veracrypt_pim
= 0;
5575 uint workload_profile
= WORKLOAD_PROFILE
;
5576 uint kernel_accel
= KERNEL_ACCEL
;
5577 uint kernel_loops
= KERNEL_LOOPS
;
5578 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5580 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5581 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5582 uint powertune_enable
= POWERTUNE_ENABLE
;
5584 uint logfile_disable
= LOGFILE_DISABLE
;
5585 uint segment_size
= SEGMENT_SIZE
;
5586 uint scrypt_tmto
= SCRYPT_TMTO
;
5587 char separator
= SEPARATOR
;
5588 uint bitmap_min
= BITMAP_MIN
;
5589 uint bitmap_max
= BITMAP_MAX
;
5590 char *custom_charset_1
= NULL
;
5591 char *custom_charset_2
= NULL
;
5592 char *custom_charset_3
= NULL
;
5593 char *custom_charset_4
= NULL
;
5595 #define IDX_HELP 'h'
5596 #define IDX_VERSION 'V'
5597 #define IDX_VERSION_LOWER 'v'
5598 #define IDX_QUIET 0xff02
5599 #define IDX_SHOW 0xff03
5600 #define IDX_LEFT 0xff04
5601 #define IDX_REMOVE 0xff05
5602 #define IDX_REMOVE_TIMER 0xff37
5603 #define IDX_SKIP 's'
5604 #define IDX_LIMIT 'l'
5605 #define IDX_KEYSPACE 0xff35
5606 #define IDX_POTFILE_DISABLE 0xff06
5607 #define IDX_POTFILE_PATH 0xffe0
5608 #define IDX_DEBUG_MODE 0xff43
5609 #define IDX_DEBUG_FILE 0xff44
5610 #define IDX_INDUCTION_DIR 0xff46
5611 #define IDX_OUTFILE_CHECK_DIR 0xff47
5612 #define IDX_USERNAME 0xff07
5613 #define IDX_FORCE 0xff08
5614 #define IDX_RUNTIME 0xff09
5615 #define IDX_BENCHMARK 'b'
5616 #define IDX_HASH_MODE 'm'
5617 #define IDX_ATTACK_MODE 'a'
5618 #define IDX_RP_FILE 'r'
5619 #define IDX_RP_GEN 'g'
5620 #define IDX_RP_GEN_FUNC_MIN 0xff10
5621 #define IDX_RP_GEN_FUNC_MAX 0xff11
5622 #define IDX_RP_GEN_SEED 0xff34
5623 #define IDX_RULE_BUF_L 'j'
5624 #define IDX_RULE_BUF_R 'k'
5625 #define IDX_INCREMENT 'i'
5626 #define IDX_INCREMENT_MIN 0xff12
5627 #define IDX_INCREMENT_MAX 0xff13
5628 #define IDX_OUTFILE 'o'
5629 #define IDX_OUTFILE_FORMAT 0xff14
5630 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5631 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5632 #define IDX_RESTORE 0xff15
5633 #define IDX_RESTORE_DISABLE 0xff27
5634 #define IDX_STATUS 0xff17
5635 #define IDX_STATUS_TIMER 0xff18
5636 #define IDX_MACHINE_READABLE 0xff50
5637 #define IDX_LOOPBACK 0xff38
5638 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5639 #define IDX_SESSION 0xff19
5640 #define IDX_HEX_CHARSET 0xff20
5641 #define IDX_HEX_SALT 0xff21
5642 #define IDX_HEX_WORDLIST 0xff40
5643 #define IDX_MARKOV_DISABLE 0xff22
5644 #define IDX_MARKOV_CLASSIC 0xff23
5645 #define IDX_MARKOV_THRESHOLD 't'
5646 #define IDX_MARKOV_HCSTAT 0xff24
5647 #define IDX_CPU_AFFINITY 0xff25
5648 #define IDX_OPENCL_DEVICES 'd'
5649 #define IDX_OPENCL_PLATFORMS 0xff72
5650 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5651 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5652 #define IDX_WORKLOAD_PROFILE 'w'
5653 #define IDX_KERNEL_ACCEL 'n'
5654 #define IDX_KERNEL_LOOPS 'u'
5655 #define IDX_GPU_TEMP_DISABLE 0xff29
5656 #define IDX_GPU_TEMP_ABORT 0xff30
5657 #define IDX_GPU_TEMP_RETAIN 0xff31
5658 #define IDX_POWERTUNE_ENABLE 0xff41
5659 #define IDX_LOGFILE_DISABLE 0xff51
5660 #define IDX_TRUECRYPT_KEYFILES 0xff52
5661 #define IDX_VERACRYPT_KEYFILES 0xff53
5662 #define IDX_VERACRYPT_PIM 0xff54
5663 #define IDX_SCRYPT_TMTO 0xff61
5664 #define IDX_SEGMENT_SIZE 'c'
5665 #define IDX_SEPARATOR 'p'
5666 #define IDX_BITMAP_MIN 0xff70
5667 #define IDX_BITMAP_MAX 0xff71
5668 #define IDX_CUSTOM_CHARSET_1 '1'
5669 #define IDX_CUSTOM_CHARSET_2 '2'
5670 #define IDX_CUSTOM_CHARSET_3 '3'
5671 #define IDX_CUSTOM_CHARSET_4 '4'
5673 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5675 struct option long_options
[] =
5677 {"help", no_argument
, 0, IDX_HELP
},
5678 {"version", no_argument
, 0, IDX_VERSION
},
5679 {"quiet", no_argument
, 0, IDX_QUIET
},
5680 {"show", no_argument
, 0, IDX_SHOW
},
5681 {"left", no_argument
, 0, IDX_LEFT
},
5682 {"username", no_argument
, 0, IDX_USERNAME
},
5683 {"remove", no_argument
, 0, IDX_REMOVE
},
5684 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5685 {"skip", required_argument
, 0, IDX_SKIP
},
5686 {"limit", required_argument
, 0, IDX_LIMIT
},
5687 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5688 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5689 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5690 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5691 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5692 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5693 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5694 {"force", no_argument
, 0, IDX_FORCE
},
5695 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5696 {"restore", no_argument
, 0, IDX_RESTORE
},
5697 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5698 {"status", no_argument
, 0, IDX_STATUS
},
5699 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5700 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5701 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5702 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5703 {"session", required_argument
, 0, IDX_SESSION
},
5704 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5705 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5706 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5707 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5708 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5709 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5710 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5711 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5712 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5713 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5714 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5715 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5716 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5717 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5718 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5719 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5720 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5721 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5722 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5723 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5724 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5725 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5726 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5727 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5728 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5729 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5730 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5731 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5732 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5733 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5735 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5736 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5737 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5738 #endif // HAVE_HWMON
5739 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5740 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5741 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5742 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5743 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5744 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5745 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5746 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5747 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5748 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5749 {"increment", no_argument
, 0, IDX_INCREMENT
},
5750 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5751 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5752 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5753 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5754 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5755 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5759 uint rp_files_cnt
= 0;
5761 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5763 int option_index
= 0;
5769 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5773 case IDX_HELP
: usage
= 1; break;
5775 case IDX_VERSION_LOWER
: version
= 1; break;
5776 case IDX_RESTORE
: restore
= 1; break;
5777 case IDX_SESSION
: session
= optarg
; break;
5778 case IDX_SHOW
: show
= 1; break;
5779 case IDX_LEFT
: left
= 1; break;
5780 case '?': return (-1);
5786 log_error ("ERROR: Invalid argument specified");
5797 log_info ("%s", VERSION_TAG
);
5804 usage_big_print (PROGNAME
);
5810 * session needs to be set, always!
5813 if (session
== NULL
) session
= (char *) PROGNAME
;
5816 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5819 char *exec_path
= get_exec_path ();
5823 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5824 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5826 char *install_dir
= get_install_dir (resolved_exec_path
);
5827 char *profile_dir
= NULL
;
5828 char *session_dir
= NULL
;
5829 char *shared_dir
= NULL
;
5831 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5833 struct passwd
*pw
= getpwuid (getuid ());
5835 const char *homedir
= pw
->pw_dir
;
5837 profile_dir
= get_profile_dir (homedir
);
5838 session_dir
= get_session_dir (profile_dir
);
5839 shared_dir
= strdup (SHARED_FOLDER
);
5841 mkdir (profile_dir
, 0700);
5842 mkdir (session_dir
, 0700);
5846 profile_dir
= install_dir
;
5847 session_dir
= install_dir
;
5848 shared_dir
= install_dir
;
5851 myfree (resolved_install_folder
);
5852 myfree (resolved_exec_path
);
5856 char *install_dir
= get_install_dir (exec_path
);
5857 char *profile_dir
= install_dir
;
5858 char *session_dir
= install_dir
;
5859 char *shared_dir
= install_dir
;
5863 data
.install_dir
= install_dir
;
5864 data
.profile_dir
= profile_dir
;
5865 data
.session_dir
= session_dir
;
5866 data
.shared_dir
= shared_dir
;
5871 * kernel cache, we need to make sure folder exist
5874 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5876 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5878 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5880 mkdir (kernels_folder
, 0700);
5882 myfree (kernels_folder
);
5888 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5890 data
.session
= session
;
5892 char *eff_restore_file
= (char *) mymalloc (session_size
);
5893 char *new_restore_file
= (char *) mymalloc (session_size
);
5895 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5896 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5898 data
.eff_restore_file
= eff_restore_file
;
5899 data
.new_restore_file
= new_restore_file
;
5901 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5903 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5904 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5909 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5910 if ((show
== 1) || (left
== 1))
5912 restore_disable
= 1;
5917 data
.restore_disable
= restore_disable
;
5919 restore_data_t
*rd
= init_restore (argc
, argv
);
5929 read_restore (eff_restore_file
, rd
);
5931 if (rd
->version_bin
< RESTORE_MIN
)
5933 log_error ("ERROR: Incompatible restore-file version");
5942 rd
->pid
= getpid ();
5944 rd
->pid
= GetCurrentProcessId ();
5948 uint hash_mode_chgd
= 0;
5949 uint runtime_chgd
= 0;
5950 uint kernel_loops_chgd
= 0;
5951 uint kernel_accel_chgd
= 0;
5952 uint attack_mode_chgd
= 0;
5953 uint outfile_format_chgd
= 0;
5954 uint rp_gen_seed_chgd
= 0;
5955 uint remove_timer_chgd
= 0;
5956 uint increment_min_chgd
= 0;
5957 uint increment_max_chgd
= 0;
5958 uint workload_profile_chgd
= 0;
5959 uint opencl_vector_width_chgd
= 0;
5965 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5969 //case IDX_HELP: usage = 1; break;
5970 //case IDX_VERSION: version = 1; break;
5971 //case IDX_RESTORE: restore = 1; break;
5972 case IDX_QUIET
: quiet
= 1; break;
5973 //case IDX_SHOW: show = 1; break;
5974 case IDX_SHOW
: break;
5975 //case IDX_LEFT: left = 1; break;
5976 case IDX_LEFT
: break;
5977 case IDX_USERNAME
: username
= 1; break;
5978 case IDX_REMOVE
: remove
= 1; break;
5979 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5980 remove_timer_chgd
= 1; break;
5981 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5982 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5983 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5984 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5985 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5986 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5987 case IDX_FORCE
: force
= 1; break;
5988 case IDX_SKIP
: skip
= atoll (optarg
); break;
5989 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5990 case IDX_KEYSPACE
: keyspace
= 1; break;
5991 case IDX_BENCHMARK
: benchmark
= 1; break;
5992 case IDX_RESTORE
: break;
5993 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5994 case IDX_STATUS
: status
= 1; break;
5995 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5996 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5997 case IDX_LOOPBACK
: loopback
= 1; break;
5998 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5999 //case IDX_SESSION: session = optarg; break;
6000 case IDX_SESSION
: break;
6001 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6002 hash_mode_chgd
= 1; break;
6003 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6004 runtime_chgd
= 1; break;
6005 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6006 attack_mode_chgd
= 1; break;
6007 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6008 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6009 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6010 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6011 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6012 rp_gen_seed_chgd
= 1; break;
6013 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6014 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6015 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6016 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6017 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6018 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6019 case IDX_OUTFILE
: outfile
= optarg
; break;
6020 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6021 outfile_format_chgd
= 1; break;
6022 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6023 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6024 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6025 case IDX_HEX_SALT
: hex_salt
= 1; break;
6026 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6027 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6028 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6029 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6030 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6031 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6032 opencl_vector_width_chgd
= 1; break;
6033 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6034 workload_profile_chgd
= 1; break;
6035 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6036 kernel_accel_chgd
= 1; break;
6037 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6038 kernel_loops_chgd
= 1; break;
6039 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6041 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6042 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6043 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6044 #endif // HAVE_HWMON
6045 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6046 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6047 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6048 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6049 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6050 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6051 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6052 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6053 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6054 case IDX_INCREMENT
: increment
= 1; break;
6055 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6056 increment_min_chgd
= 1; break;
6057 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6058 increment_max_chgd
= 1; break;
6059 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6060 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6061 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6062 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6065 log_error ("ERROR: Invalid argument specified");
6072 log_error ("ERROR: Invalid argument specified");
6078 * Inform user things getting started,
6079 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6080 * - we do not need to check algorithm_pos
6087 if (machine_readable
== 0)
6089 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6094 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6097 else if (restore
== 1)
6099 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6104 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6113 if (attack_mode
> 7)
6115 log_error ("ERROR: Invalid attack-mode specified");
6120 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6122 log_error ("ERROR: Invalid runtime specified");
6127 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6129 log_error ("ERROR: Invalid hash-type specified");
6134 // renamed hash modes
6148 log_error ("Old -m specified, use -m %d instead", n
);
6156 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6158 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6164 if (outfile_format
> 16)
6166 log_error ("ERROR: Invalid outfile-format specified");
6173 if (outfile_format_chgd
== 1)
6175 if (outfile_format
> 1)
6177 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6184 outfile_format
= OUTFILE_FMT_HASH
;
6190 if (outfile_format_chgd
== 1)
6192 if ((outfile_format
> 7) && (outfile_format
< 16))
6194 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6201 if (increment_min
< INCREMENT_MIN
)
6203 log_error ("ERROR: Invalid increment-min specified");
6208 if (increment_max
> INCREMENT_MAX
)
6210 log_error ("ERROR: Invalid increment-max specified");
6215 if (increment_min
> increment_max
)
6217 log_error ("ERROR: Invalid increment-min specified");
6222 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6224 log_error ("ERROR: increment is not allowed in attack-mode 0");
6229 if ((increment
== 0) && (increment_min_chgd
== 1))
6231 log_error ("ERROR: increment-min is only supported together with increment switch");
6236 if ((increment
== 0) && (increment_max_chgd
== 1))
6238 log_error ("ERROR: increment-max is only supported together with increment switch");
6243 if (rp_files_cnt
&& rp_gen
)
6245 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6250 if (rp_files_cnt
|| rp_gen
)
6252 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6254 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6260 if (rp_gen_func_min
> rp_gen_func_max
)
6262 log_error ("ERROR: Invalid rp-gen-func-min specified");
6267 if (kernel_accel_chgd
== 1)
6271 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6272 log_info ("Please consider using the option -w instead");
6273 log_info ("You can use --force to override this but do not post error reports if you do so");
6279 if (kernel_accel
< 1)
6281 log_error ("ERROR: Invalid kernel-accel specified");
6286 if (kernel_accel
> 1024)
6288 log_error ("ERROR: Invalid kernel-accel specified");
6294 if (kernel_loops_chgd
== 1)
6298 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6299 log_info ("Please consider using the option -w instead");
6300 log_info ("You can use --force to override this but do not post error reports if you do so");
6306 if (kernel_loops
< 1)
6308 log_error ("ERROR: Invalid kernel-loops specified");
6313 if (kernel_loops
> 1024)
6315 log_error ("ERROR: Invalid kernel-loops specified");
6321 if ((workload_profile
< 1) || (workload_profile
> 4))
6323 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6328 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6330 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6335 if (show
== 1 || left
== 1)
6337 attack_mode
= ATTACK_MODE_NONE
;
6341 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6346 if (potfile_disable
== 1)
6348 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6354 uint attack_kern
= ATTACK_KERN_NONE
;
6356 switch (attack_mode
)
6358 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6359 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6360 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6361 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6362 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6369 int num_additional_params
= 1;
6371 if (attack_kern
== ATTACK_KERN_COMBI
)
6373 num_additional_params
= 2;
6376 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6378 if (keyspace_wordlist_specified
== 0) optind
--;
6381 if (attack_kern
== ATTACK_KERN_NONE
)
6383 if ((optind
+ 1) != myargc
)
6385 usage_mini_print (myargv
[0]);
6390 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6392 if ((optind
+ 1) > myargc
)
6394 usage_mini_print (myargv
[0]);
6399 else if (attack_kern
== ATTACK_KERN_COMBI
)
6401 if ((optind
+ 3) != myargc
)
6403 usage_mini_print (myargv
[0]);
6408 else if (attack_kern
== ATTACK_KERN_BF
)
6410 if ((optind
+ 1) > myargc
)
6412 usage_mini_print (myargv
[0]);
6419 usage_mini_print (myargv
[0]);
6426 if (myargv
[optind
] != 0)
6428 log_error ("ERROR: Invalid argument for benchmark mode specified");
6433 if (attack_mode_chgd
== 1)
6435 if (attack_mode
!= ATTACK_MODE_BF
)
6437 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6444 if (skip
!= 0 && limit
!= 0)
6453 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6459 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6464 potfile_disable
= 1;
6466 restore_disable
= 1;
6470 weak_hash_threshold
= 0;
6475 if (remove_timer_chgd
== 1)
6479 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6484 if (remove_timer
< 1)
6486 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6494 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6496 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6498 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6505 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6513 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6515 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6520 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6522 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6530 log_error ("ERROR: Invalid debug-mode specified");
6535 if (debug_file
!= NULL
)
6539 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6545 if (induction_dir
!= NULL
)
6547 if (attack_mode
== ATTACK_MODE_BF
)
6549 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6555 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6557 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6559 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6564 weak_hash_threshold
= 0;
6568 * induction directory
6571 char *induction_directory
= NULL
;
6573 if (attack_mode
!= ATTACK_MODE_BF
)
6575 if (induction_dir
== NULL
)
6577 induction_directory
= (char *) mymalloc (session_size
);
6579 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6581 // create induction folder if it does not already exist
6585 if (rmdir (induction_directory
) == -1)
6587 if (errno
== ENOENT
)
6589 // good, we can ignore
6591 else if (errno
== ENOTEMPTY
)
6593 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6595 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6597 if (rename (induction_directory
, induction_directory_mv
) != 0)
6599 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6606 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6612 if (mkdir (induction_directory
, 0700) == -1)
6614 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6622 induction_directory
= induction_dir
;
6626 data
.induction_directory
= induction_directory
;
6632 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6634 char *loopback_file
= (char *) mymalloc (loopback_size
);
6640 char tuning_db_file
[256] = { 0 };
6642 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6644 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6647 * outfile-check directory
6650 char *outfile_check_directory
= NULL
;
6652 if (outfile_check_dir
== NULL
)
6654 outfile_check_directory
= (char *) mymalloc (session_size
);
6656 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6660 outfile_check_directory
= outfile_check_dir
;
6663 data
.outfile_check_directory
= outfile_check_directory
;
6667 struct stat outfile_check_stat
;
6669 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6671 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6675 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6680 else if (outfile_check_dir
== NULL
)
6682 if (mkdir (outfile_check_directory
, 0700) == -1)
6684 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6692 * special other stuff
6695 if (hash_mode
== 9710)
6698 outfile_format_chgd
= 1;
6701 if (hash_mode
== 9810)
6704 outfile_format_chgd
= 1;
6707 if (hash_mode
== 10410)
6710 outfile_format_chgd
= 1;
6717 data
.hash_mode
= hash_mode
;
6718 data
.restore
= restore
;
6719 data
.restore_timer
= restore_timer
;
6720 data
.restore_disable
= restore_disable
;
6721 data
.status
= status
;
6722 data
.status_timer
= status_timer
;
6723 data
.machine_readable
= machine_readable
;
6724 data
.loopback
= loopback
;
6725 data
.runtime
= runtime
;
6726 data
.remove
= remove
;
6727 data
.remove_timer
= remove_timer
;
6728 data
.debug_mode
= debug_mode
;
6729 data
.debug_file
= debug_file
;
6730 data
.username
= username
;
6732 data
.outfile
= outfile
;
6733 data
.outfile_format
= outfile_format
;
6734 data
.outfile_autohex
= outfile_autohex
;
6735 data
.hex_charset
= hex_charset
;
6736 data
.hex_salt
= hex_salt
;
6737 data
.hex_wordlist
= hex_wordlist
;
6738 data
.separator
= separator
;
6739 data
.rp_files
= rp_files
;
6740 data
.rp_files_cnt
= rp_files_cnt
;
6741 data
.rp_gen
= rp_gen
;
6742 data
.rp_gen_seed
= rp_gen_seed
;
6744 data
.benchmark
= benchmark
;
6748 data
.powertune_enable
= powertune_enable
;
6750 data
.logfile_disable
= logfile_disable
;
6751 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6752 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6753 data
.veracrypt_pim
= veracrypt_pim
;
6754 data
.scrypt_tmto
= scrypt_tmto
;
6755 data
.workload_profile
= workload_profile
;
6763 set_cpu_affinity (cpu_affinity
);
6766 if (rp_gen_seed_chgd
== 0)
6772 srand (rp_gen_seed
);
6779 if (logfile_disable
== 0)
6781 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6783 char *logfile
= (char *) mymalloc (logfile_size
);
6785 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6787 data
.logfile
= logfile
;
6789 char *topid
= logfile_generate_topid ();
6794 // logfile_append() checks for logfile_disable internally to make it easier from here
6796 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6797 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6798 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6799 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6800 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6801 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6802 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6803 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6804 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6805 #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));
6807 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6808 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6809 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6810 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6811 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6812 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6813 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6814 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6816 logfile_top_msg ("START");
6818 logfile_top_uint (attack_mode
);
6819 logfile_top_uint (attack_kern
);
6820 logfile_top_uint (benchmark
);
6821 logfile_top_uint (bitmap_min
);
6822 logfile_top_uint (bitmap_max
);
6823 logfile_top_uint (debug_mode
);
6824 logfile_top_uint (force
);
6825 logfile_top_uint (kernel_accel
);
6826 logfile_top_uint (kernel_loops
);
6827 logfile_top_uint (gpu_temp_disable
);
6829 logfile_top_uint (gpu_temp_abort
);
6830 logfile_top_uint (gpu_temp_retain
);
6832 logfile_top_uint (hash_mode
);
6833 logfile_top_uint (hex_charset
);
6834 logfile_top_uint (hex_salt
);
6835 logfile_top_uint (hex_wordlist
);
6836 logfile_top_uint (increment
);
6837 logfile_top_uint (increment_max
);
6838 logfile_top_uint (increment_min
);
6839 logfile_top_uint (keyspace
);
6840 logfile_top_uint (left
);
6841 logfile_top_uint (logfile_disable
);
6842 logfile_top_uint (loopback
);
6843 logfile_top_uint (markov_classic
);
6844 logfile_top_uint (markov_disable
);
6845 logfile_top_uint (markov_threshold
);
6846 logfile_top_uint (outfile_autohex
);
6847 logfile_top_uint (outfile_check_timer
);
6848 logfile_top_uint (outfile_format
);
6849 logfile_top_uint (potfile_disable
);
6850 logfile_top_string (potfile_path
);
6851 #if defined(HAVE_HWMON)
6852 logfile_top_uint (powertune_enable
);
6854 logfile_top_uint (scrypt_tmto
);
6855 logfile_top_uint (quiet
);
6856 logfile_top_uint (remove
);
6857 logfile_top_uint (remove_timer
);
6858 logfile_top_uint (restore
);
6859 logfile_top_uint (restore_disable
);
6860 logfile_top_uint (restore_timer
);
6861 logfile_top_uint (rp_gen
);
6862 logfile_top_uint (rp_gen_func_max
);
6863 logfile_top_uint (rp_gen_func_min
);
6864 logfile_top_uint (rp_gen_seed
);
6865 logfile_top_uint (runtime
);
6866 logfile_top_uint (segment_size
);
6867 logfile_top_uint (show
);
6868 logfile_top_uint (status
);
6869 logfile_top_uint (machine_readable
);
6870 logfile_top_uint (status_timer
);
6871 logfile_top_uint (usage
);
6872 logfile_top_uint (username
);
6873 logfile_top_uint (version
);
6874 logfile_top_uint (weak_hash_threshold
);
6875 logfile_top_uint (workload_profile
);
6876 logfile_top_uint64 (limit
);
6877 logfile_top_uint64 (skip
);
6878 logfile_top_char (separator
);
6879 logfile_top_string (cpu_affinity
);
6880 logfile_top_string (custom_charset_1
);
6881 logfile_top_string (custom_charset_2
);
6882 logfile_top_string (custom_charset_3
);
6883 logfile_top_string (custom_charset_4
);
6884 logfile_top_string (debug_file
);
6885 logfile_top_string (opencl_devices
);
6886 logfile_top_string (opencl_platforms
);
6887 logfile_top_string (opencl_device_types
);
6888 logfile_top_uint (opencl_vector_width
);
6889 logfile_top_string (induction_dir
);
6890 logfile_top_string (markov_hcstat
);
6891 logfile_top_string (outfile
);
6892 logfile_top_string (outfile_check_dir
);
6893 logfile_top_string (rule_buf_l
);
6894 logfile_top_string (rule_buf_r
);
6895 logfile_top_string (session
);
6896 logfile_top_string (truecrypt_keyfiles
);
6897 logfile_top_string (veracrypt_keyfiles
);
6898 logfile_top_uint (veracrypt_pim
);
6901 * Init OpenCL library loader
6906 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6914 * OpenCL platform selection
6917 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6920 * OpenCL device selection
6923 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6926 * OpenCL device type selection
6929 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6938 * disable useless stuff for benchmark
6943 restore_disable
= 1;
6944 potfile_disable
= 1;
6945 weak_hash_threshold
= 0;
6946 gpu_temp_disable
= 1;
6949 powertune_enable
= 1;
6952 data
.status_timer
= status_timer
;
6953 data
.restore_timer
= restore_timer
;
6954 data
.restore_disable
= restore_disable
;
6957 * force attack mode to be bruteforce
6960 attack_mode
= ATTACK_MODE_BF
;
6961 attack_kern
= ATTACK_KERN_BF
;
6963 if (workload_profile_chgd
== 0)
6965 workload_profile
= 3;
6967 data
.workload_profile
= workload_profile
;
6977 uint attack_exec
= 0;
6981 uint esalt_size
= 0;
6983 uint dgst_pos0
= -1;
6984 uint dgst_pos1
= -1;
6985 uint dgst_pos2
= -1;
6986 uint dgst_pos3
= -1;
6988 int (*parse_func
) (char *, uint
, hash_t
*);
6989 int (*sort_by_digest
) (const void *, const void *);
6991 uint algorithm_pos
= 0;
6992 uint algorithm_max
= 1;
6994 uint
*algorithms
= default_benchmark_algorithms
;
6996 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6998 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7001 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7002 * the following algos are skipped entirely
7005 if (algorithm_pos
> 0)
7009 rd
= init_restore (argc
, argv
);
7015 * update hash_mode in case of multihash benchmark
7020 if (hash_mode_chgd
== 0)
7022 hash_mode
= algorithms
[algorithm_pos
];
7024 data
.hash_mode
= hash_mode
;
7034 case 0: hash_type
= HASH_TYPE_MD5
;
7035 salt_type
= SALT_TYPE_NONE
;
7036 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7037 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7038 | OPTS_TYPE_PT_ADD80
7039 | OPTS_TYPE_PT_ADDBITS14
;
7040 kern_type
= KERN_TYPE_MD5
;
7041 dgst_size
= DGST_SIZE_4_4
;
7042 parse_func
= md5_parse_hash
;
7043 sort_by_digest
= sort_by_digest_4_4
;
7044 opti_type
= OPTI_TYPE_ZERO_BYTE
7045 | OPTI_TYPE_PRECOMPUTE_INIT
7046 | OPTI_TYPE_PRECOMPUTE_MERKLE
7047 | OPTI_TYPE_MEET_IN_MIDDLE
7048 | OPTI_TYPE_EARLY_SKIP
7049 | OPTI_TYPE_NOT_ITERATED
7050 | OPTI_TYPE_NOT_SALTED
7051 | OPTI_TYPE_RAW_HASH
;
7058 case 10: hash_type
= HASH_TYPE_MD5
;
7059 salt_type
= SALT_TYPE_INTERN
;
7060 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7062 | OPTS_TYPE_ST_ADD80
7063 | OPTS_TYPE_ST_ADDBITS14
;
7064 kern_type
= KERN_TYPE_MD5_PWSLT
;
7065 dgst_size
= DGST_SIZE_4_4
;
7066 parse_func
= md5s_parse_hash
;
7067 sort_by_digest
= sort_by_digest_4_4
;
7068 opti_type
= OPTI_TYPE_ZERO_BYTE
7069 | OPTI_TYPE_PRECOMPUTE_INIT
7070 | OPTI_TYPE_PRECOMPUTE_MERKLE
7071 | OPTI_TYPE_MEET_IN_MIDDLE
7072 | OPTI_TYPE_EARLY_SKIP
7073 | OPTI_TYPE_NOT_ITERATED
7074 | OPTI_TYPE_APPENDED_SALT
7075 | OPTI_TYPE_RAW_HASH
;
7082 case 11: hash_type
= HASH_TYPE_MD5
;
7083 salt_type
= SALT_TYPE_INTERN
;
7084 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7085 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7086 | OPTS_TYPE_ST_ADD80
7087 | OPTS_TYPE_ST_ADDBITS14
;
7088 kern_type
= KERN_TYPE_MD5_PWSLT
;
7089 dgst_size
= DGST_SIZE_4_4
;
7090 parse_func
= joomla_parse_hash
;
7091 sort_by_digest
= sort_by_digest_4_4
;
7092 opti_type
= OPTI_TYPE_ZERO_BYTE
7093 | OPTI_TYPE_PRECOMPUTE_INIT
7094 | OPTI_TYPE_PRECOMPUTE_MERKLE
7095 | OPTI_TYPE_MEET_IN_MIDDLE
7096 | OPTI_TYPE_EARLY_SKIP
7097 | OPTI_TYPE_NOT_ITERATED
7098 | OPTI_TYPE_APPENDED_SALT
7099 | OPTI_TYPE_RAW_HASH
;
7106 case 12: hash_type
= HASH_TYPE_MD5
;
7107 salt_type
= SALT_TYPE_INTERN
;
7108 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7109 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7110 | OPTS_TYPE_ST_ADD80
7111 | OPTS_TYPE_ST_ADDBITS14
;
7112 kern_type
= KERN_TYPE_MD5_PWSLT
;
7113 dgst_size
= DGST_SIZE_4_4
;
7114 parse_func
= postgresql_parse_hash
;
7115 sort_by_digest
= sort_by_digest_4_4
;
7116 opti_type
= OPTI_TYPE_ZERO_BYTE
7117 | OPTI_TYPE_PRECOMPUTE_INIT
7118 | OPTI_TYPE_PRECOMPUTE_MERKLE
7119 | OPTI_TYPE_MEET_IN_MIDDLE
7120 | OPTI_TYPE_EARLY_SKIP
7121 | OPTI_TYPE_NOT_ITERATED
7122 | OPTI_TYPE_APPENDED_SALT
7123 | OPTI_TYPE_RAW_HASH
;
7130 case 20: hash_type
= HASH_TYPE_MD5
;
7131 salt_type
= SALT_TYPE_INTERN
;
7132 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7133 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7134 | OPTS_TYPE_PT_ADD80
7135 | OPTS_TYPE_PT_ADDBITS14
;
7136 kern_type
= KERN_TYPE_MD5_SLTPW
;
7137 dgst_size
= DGST_SIZE_4_4
;
7138 parse_func
= md5s_parse_hash
;
7139 sort_by_digest
= sort_by_digest_4_4
;
7140 opti_type
= OPTI_TYPE_ZERO_BYTE
7141 | OPTI_TYPE_PRECOMPUTE_INIT
7142 | OPTI_TYPE_PRECOMPUTE_MERKLE
7143 | OPTI_TYPE_EARLY_SKIP
7144 | OPTI_TYPE_NOT_ITERATED
7145 | OPTI_TYPE_PREPENDED_SALT
7146 | OPTI_TYPE_RAW_HASH
;
7153 case 21: hash_type
= HASH_TYPE_MD5
;
7154 salt_type
= SALT_TYPE_INTERN
;
7155 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7156 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7157 | OPTS_TYPE_PT_ADD80
7158 | OPTS_TYPE_PT_ADDBITS14
;
7159 kern_type
= KERN_TYPE_MD5_SLTPW
;
7160 dgst_size
= DGST_SIZE_4_4
;
7161 parse_func
= osc_parse_hash
;
7162 sort_by_digest
= sort_by_digest_4_4
;
7163 opti_type
= OPTI_TYPE_ZERO_BYTE
7164 | OPTI_TYPE_PRECOMPUTE_INIT
7165 | OPTI_TYPE_PRECOMPUTE_MERKLE
7166 | OPTI_TYPE_EARLY_SKIP
7167 | OPTI_TYPE_NOT_ITERATED
7168 | OPTI_TYPE_PREPENDED_SALT
7169 | OPTI_TYPE_RAW_HASH
;
7176 case 22: hash_type
= HASH_TYPE_MD5
;
7177 salt_type
= SALT_TYPE_EMBEDDED
;
7178 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7179 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7180 | OPTS_TYPE_PT_ADD80
7181 | OPTS_TYPE_PT_ADDBITS14
;
7182 kern_type
= KERN_TYPE_MD5_SLTPW
;
7183 dgst_size
= DGST_SIZE_4_4
;
7184 parse_func
= netscreen_parse_hash
;
7185 sort_by_digest
= sort_by_digest_4_4
;
7186 opti_type
= OPTI_TYPE_ZERO_BYTE
7187 | OPTI_TYPE_PRECOMPUTE_INIT
7188 | OPTI_TYPE_PRECOMPUTE_MERKLE
7189 | OPTI_TYPE_EARLY_SKIP
7190 | OPTI_TYPE_NOT_ITERATED
7191 | OPTI_TYPE_PREPENDED_SALT
7192 | OPTI_TYPE_RAW_HASH
;
7199 case 23: hash_type
= HASH_TYPE_MD5
;
7200 salt_type
= SALT_TYPE_EMBEDDED
;
7201 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7202 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7203 | OPTS_TYPE_PT_ADD80
7204 | OPTS_TYPE_PT_ADDBITS14
;
7205 kern_type
= KERN_TYPE_MD5_SLTPW
;
7206 dgst_size
= DGST_SIZE_4_4
;
7207 parse_func
= skype_parse_hash
;
7208 sort_by_digest
= sort_by_digest_4_4
;
7209 opti_type
= OPTI_TYPE_ZERO_BYTE
7210 | OPTI_TYPE_PRECOMPUTE_INIT
7211 | OPTI_TYPE_PRECOMPUTE_MERKLE
7212 | OPTI_TYPE_EARLY_SKIP
7213 | OPTI_TYPE_NOT_ITERATED
7214 | OPTI_TYPE_PREPENDED_SALT
7215 | OPTI_TYPE_RAW_HASH
;
7222 case 30: hash_type
= HASH_TYPE_MD5
;
7223 salt_type
= SALT_TYPE_INTERN
;
7224 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7225 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7226 | OPTS_TYPE_PT_UNICODE
7227 | OPTS_TYPE_ST_ADD80
7228 | OPTS_TYPE_ST_ADDBITS14
;
7229 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7230 dgst_size
= DGST_SIZE_4_4
;
7231 parse_func
= md5s_parse_hash
;
7232 sort_by_digest
= sort_by_digest_4_4
;
7233 opti_type
= OPTI_TYPE_ZERO_BYTE
7234 | OPTI_TYPE_PRECOMPUTE_INIT
7235 | OPTI_TYPE_PRECOMPUTE_MERKLE
7236 | OPTI_TYPE_MEET_IN_MIDDLE
7237 | OPTI_TYPE_EARLY_SKIP
7238 | OPTI_TYPE_NOT_ITERATED
7239 | OPTI_TYPE_APPENDED_SALT
7240 | OPTI_TYPE_RAW_HASH
;
7247 case 40: hash_type
= HASH_TYPE_MD5
;
7248 salt_type
= SALT_TYPE_INTERN
;
7249 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7250 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7251 | OPTS_TYPE_PT_ADD80
7252 | OPTS_TYPE_PT_ADDBITS14
7253 | OPTS_TYPE_PT_UNICODE
;
7254 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7255 dgst_size
= DGST_SIZE_4_4
;
7256 parse_func
= md5s_parse_hash
;
7257 sort_by_digest
= sort_by_digest_4_4
;
7258 opti_type
= OPTI_TYPE_ZERO_BYTE
7259 | OPTI_TYPE_PRECOMPUTE_INIT
7260 | OPTI_TYPE_PRECOMPUTE_MERKLE
7261 | OPTI_TYPE_EARLY_SKIP
7262 | OPTI_TYPE_NOT_ITERATED
7263 | OPTI_TYPE_PREPENDED_SALT
7264 | OPTI_TYPE_RAW_HASH
;
7271 case 50: hash_type
= HASH_TYPE_MD5
;
7272 salt_type
= SALT_TYPE_INTERN
;
7273 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7274 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7275 | OPTS_TYPE_ST_ADD80
7276 | OPTS_TYPE_ST_ADDBITS14
;
7277 kern_type
= KERN_TYPE_HMACMD5_PW
;
7278 dgst_size
= DGST_SIZE_4_4
;
7279 parse_func
= hmacmd5_parse_hash
;
7280 sort_by_digest
= sort_by_digest_4_4
;
7281 opti_type
= OPTI_TYPE_ZERO_BYTE
7282 | OPTI_TYPE_NOT_ITERATED
;
7289 case 60: hash_type
= HASH_TYPE_MD5
;
7290 salt_type
= SALT_TYPE_INTERN
;
7291 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7292 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7293 | OPTS_TYPE_PT_ADD80
7294 | OPTS_TYPE_PT_ADDBITS14
;
7295 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7296 dgst_size
= DGST_SIZE_4_4
;
7297 parse_func
= hmacmd5_parse_hash
;
7298 sort_by_digest
= sort_by_digest_4_4
;
7299 opti_type
= OPTI_TYPE_ZERO_BYTE
7300 | OPTI_TYPE_NOT_ITERATED
;
7307 case 100: hash_type
= HASH_TYPE_SHA1
;
7308 salt_type
= SALT_TYPE_NONE
;
7309 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7310 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7311 | OPTS_TYPE_PT_ADD80
7312 | OPTS_TYPE_PT_ADDBITS15
;
7313 kern_type
= KERN_TYPE_SHA1
;
7314 dgst_size
= DGST_SIZE_4_5
;
7315 parse_func
= sha1_parse_hash
;
7316 sort_by_digest
= sort_by_digest_4_5
;
7317 opti_type
= OPTI_TYPE_ZERO_BYTE
7318 | OPTI_TYPE_PRECOMPUTE_INIT
7319 | OPTI_TYPE_PRECOMPUTE_MERKLE
7320 | OPTI_TYPE_EARLY_SKIP
7321 | OPTI_TYPE_NOT_ITERATED
7322 | OPTI_TYPE_NOT_SALTED
7323 | OPTI_TYPE_RAW_HASH
;
7330 case 101: hash_type
= HASH_TYPE_SHA1
;
7331 salt_type
= SALT_TYPE_NONE
;
7332 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7333 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7334 | OPTS_TYPE_PT_ADD80
7335 | OPTS_TYPE_PT_ADDBITS15
;
7336 kern_type
= KERN_TYPE_SHA1
;
7337 dgst_size
= DGST_SIZE_4_5
;
7338 parse_func
= sha1b64_parse_hash
;
7339 sort_by_digest
= sort_by_digest_4_5
;
7340 opti_type
= OPTI_TYPE_ZERO_BYTE
7341 | OPTI_TYPE_PRECOMPUTE_INIT
7342 | OPTI_TYPE_PRECOMPUTE_MERKLE
7343 | OPTI_TYPE_EARLY_SKIP
7344 | OPTI_TYPE_NOT_ITERATED
7345 | OPTI_TYPE_NOT_SALTED
7346 | OPTI_TYPE_RAW_HASH
;
7353 case 110: hash_type
= HASH_TYPE_SHA1
;
7354 salt_type
= SALT_TYPE_INTERN
;
7355 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7356 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7357 | OPTS_TYPE_ST_ADD80
7358 | OPTS_TYPE_ST_ADDBITS15
;
7359 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7360 dgst_size
= DGST_SIZE_4_5
;
7361 parse_func
= sha1s_parse_hash
;
7362 sort_by_digest
= sort_by_digest_4_5
;
7363 opti_type
= OPTI_TYPE_ZERO_BYTE
7364 | OPTI_TYPE_PRECOMPUTE_INIT
7365 | OPTI_TYPE_PRECOMPUTE_MERKLE
7366 | OPTI_TYPE_EARLY_SKIP
7367 | OPTI_TYPE_NOT_ITERATED
7368 | OPTI_TYPE_APPENDED_SALT
7369 | OPTI_TYPE_RAW_HASH
;
7376 case 111: hash_type
= HASH_TYPE_SHA1
;
7377 salt_type
= SALT_TYPE_EMBEDDED
;
7378 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7379 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7380 | OPTS_TYPE_ST_ADD80
7381 | OPTS_TYPE_ST_ADDBITS15
;
7382 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7383 dgst_size
= DGST_SIZE_4_5
;
7384 parse_func
= sha1b64s_parse_hash
;
7385 sort_by_digest
= sort_by_digest_4_5
;
7386 opti_type
= OPTI_TYPE_ZERO_BYTE
7387 | OPTI_TYPE_PRECOMPUTE_INIT
7388 | OPTI_TYPE_PRECOMPUTE_MERKLE
7389 | OPTI_TYPE_EARLY_SKIP
7390 | OPTI_TYPE_NOT_ITERATED
7391 | OPTI_TYPE_APPENDED_SALT
7392 | OPTI_TYPE_RAW_HASH
;
7399 case 112: hash_type
= HASH_TYPE_SHA1
;
7400 salt_type
= SALT_TYPE_INTERN
;
7401 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7402 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7403 | OPTS_TYPE_ST_ADD80
7404 | OPTS_TYPE_ST_ADDBITS15
7406 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7407 dgst_size
= DGST_SIZE_4_5
;
7408 parse_func
= oracles_parse_hash
;
7409 sort_by_digest
= sort_by_digest_4_5
;
7410 opti_type
= OPTI_TYPE_ZERO_BYTE
7411 | OPTI_TYPE_PRECOMPUTE_INIT
7412 | OPTI_TYPE_PRECOMPUTE_MERKLE
7413 | OPTI_TYPE_EARLY_SKIP
7414 | OPTI_TYPE_NOT_ITERATED
7415 | OPTI_TYPE_APPENDED_SALT
7416 | OPTI_TYPE_RAW_HASH
;
7423 case 120: hash_type
= HASH_TYPE_SHA1
;
7424 salt_type
= SALT_TYPE_INTERN
;
7425 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7426 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7427 | OPTS_TYPE_PT_ADD80
7428 | OPTS_TYPE_PT_ADDBITS15
;
7429 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7430 dgst_size
= DGST_SIZE_4_5
;
7431 parse_func
= sha1s_parse_hash
;
7432 sort_by_digest
= sort_by_digest_4_5
;
7433 opti_type
= OPTI_TYPE_ZERO_BYTE
7434 | OPTI_TYPE_PRECOMPUTE_INIT
7435 | OPTI_TYPE_PRECOMPUTE_MERKLE
7436 | OPTI_TYPE_EARLY_SKIP
7437 | OPTI_TYPE_NOT_ITERATED
7438 | OPTI_TYPE_PREPENDED_SALT
7439 | OPTI_TYPE_RAW_HASH
;
7446 case 121: hash_type
= HASH_TYPE_SHA1
;
7447 salt_type
= SALT_TYPE_INTERN
;
7448 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7449 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7450 | OPTS_TYPE_PT_ADD80
7451 | OPTS_TYPE_PT_ADDBITS15
7452 | OPTS_TYPE_ST_LOWER
;
7453 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7454 dgst_size
= DGST_SIZE_4_5
;
7455 parse_func
= smf_parse_hash
;
7456 sort_by_digest
= sort_by_digest_4_5
;
7457 opti_type
= OPTI_TYPE_ZERO_BYTE
7458 | OPTI_TYPE_PRECOMPUTE_INIT
7459 | OPTI_TYPE_PRECOMPUTE_MERKLE
7460 | OPTI_TYPE_EARLY_SKIP
7461 | OPTI_TYPE_NOT_ITERATED
7462 | OPTI_TYPE_PREPENDED_SALT
7463 | OPTI_TYPE_RAW_HASH
;
7470 case 122: hash_type
= HASH_TYPE_SHA1
;
7471 salt_type
= SALT_TYPE_EMBEDDED
;
7472 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7473 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7474 | OPTS_TYPE_PT_ADD80
7475 | OPTS_TYPE_PT_ADDBITS15
7477 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7478 dgst_size
= DGST_SIZE_4_5
;
7479 parse_func
= osx1_parse_hash
;
7480 sort_by_digest
= sort_by_digest_4_5
;
7481 opti_type
= OPTI_TYPE_ZERO_BYTE
7482 | OPTI_TYPE_PRECOMPUTE_INIT
7483 | OPTI_TYPE_PRECOMPUTE_MERKLE
7484 | OPTI_TYPE_EARLY_SKIP
7485 | OPTI_TYPE_NOT_ITERATED
7486 | OPTI_TYPE_PREPENDED_SALT
7487 | OPTI_TYPE_RAW_HASH
;
7494 case 124: hash_type
= HASH_TYPE_SHA1
;
7495 salt_type
= SALT_TYPE_EMBEDDED
;
7496 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7497 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7498 | OPTS_TYPE_PT_ADD80
7499 | OPTS_TYPE_PT_ADDBITS15
;
7500 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7501 dgst_size
= DGST_SIZE_4_5
;
7502 parse_func
= djangosha1_parse_hash
;
7503 sort_by_digest
= sort_by_digest_4_5
;
7504 opti_type
= OPTI_TYPE_ZERO_BYTE
7505 | OPTI_TYPE_PRECOMPUTE_INIT
7506 | OPTI_TYPE_PRECOMPUTE_MERKLE
7507 | OPTI_TYPE_EARLY_SKIP
7508 | OPTI_TYPE_NOT_ITERATED
7509 | OPTI_TYPE_PREPENDED_SALT
7510 | OPTI_TYPE_RAW_HASH
;
7517 case 125: hash_type
= HASH_TYPE_SHA1
;
7518 salt_type
= SALT_TYPE_EMBEDDED
;
7519 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7520 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7521 | OPTS_TYPE_PT_ADD80
7522 | OPTS_TYPE_PT_ADDBITS15
7524 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7525 dgst_size
= DGST_SIZE_4_5
;
7526 parse_func
= arubaos_parse_hash
;
7527 sort_by_digest
= sort_by_digest_4_5
;
7528 opti_type
= OPTI_TYPE_ZERO_BYTE
7529 | OPTI_TYPE_PRECOMPUTE_INIT
7530 | OPTI_TYPE_PRECOMPUTE_MERKLE
7531 | OPTI_TYPE_EARLY_SKIP
7532 | OPTI_TYPE_NOT_ITERATED
7533 | OPTI_TYPE_PREPENDED_SALT
7534 | OPTI_TYPE_RAW_HASH
;
7541 case 130: hash_type
= HASH_TYPE_SHA1
;
7542 salt_type
= SALT_TYPE_INTERN
;
7543 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7544 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7545 | OPTS_TYPE_PT_UNICODE
7546 | OPTS_TYPE_ST_ADD80
7547 | OPTS_TYPE_ST_ADDBITS15
;
7548 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7549 dgst_size
= DGST_SIZE_4_5
;
7550 parse_func
= sha1s_parse_hash
;
7551 sort_by_digest
= sort_by_digest_4_5
;
7552 opti_type
= OPTI_TYPE_ZERO_BYTE
7553 | OPTI_TYPE_PRECOMPUTE_INIT
7554 | OPTI_TYPE_PRECOMPUTE_MERKLE
7555 | OPTI_TYPE_EARLY_SKIP
7556 | OPTI_TYPE_NOT_ITERATED
7557 | OPTI_TYPE_APPENDED_SALT
7558 | OPTI_TYPE_RAW_HASH
;
7565 case 131: hash_type
= HASH_TYPE_SHA1
;
7566 salt_type
= SALT_TYPE_EMBEDDED
;
7567 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7568 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7569 | OPTS_TYPE_PT_UNICODE
7570 | OPTS_TYPE_PT_UPPER
7571 | OPTS_TYPE_ST_ADD80
7572 | OPTS_TYPE_ST_ADDBITS15
7574 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7575 dgst_size
= DGST_SIZE_4_5
;
7576 parse_func
= mssql2000_parse_hash
;
7577 sort_by_digest
= sort_by_digest_4_5
;
7578 opti_type
= OPTI_TYPE_ZERO_BYTE
7579 | OPTI_TYPE_PRECOMPUTE_INIT
7580 | OPTI_TYPE_PRECOMPUTE_MERKLE
7581 | OPTI_TYPE_EARLY_SKIP
7582 | OPTI_TYPE_NOT_ITERATED
7583 | OPTI_TYPE_APPENDED_SALT
7584 | OPTI_TYPE_RAW_HASH
;
7591 case 132: hash_type
= HASH_TYPE_SHA1
;
7592 salt_type
= SALT_TYPE_EMBEDDED
;
7593 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7594 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7595 | OPTS_TYPE_PT_UNICODE
7596 | OPTS_TYPE_ST_ADD80
7597 | OPTS_TYPE_ST_ADDBITS15
7599 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7600 dgst_size
= DGST_SIZE_4_5
;
7601 parse_func
= mssql2005_parse_hash
;
7602 sort_by_digest
= sort_by_digest_4_5
;
7603 opti_type
= OPTI_TYPE_ZERO_BYTE
7604 | OPTI_TYPE_PRECOMPUTE_INIT
7605 | OPTI_TYPE_PRECOMPUTE_MERKLE
7606 | OPTI_TYPE_EARLY_SKIP
7607 | OPTI_TYPE_NOT_ITERATED
7608 | OPTI_TYPE_APPENDED_SALT
7609 | OPTI_TYPE_RAW_HASH
;
7616 case 133: hash_type
= HASH_TYPE_SHA1
;
7617 salt_type
= SALT_TYPE_EMBEDDED
;
7618 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7619 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7620 | OPTS_TYPE_PT_UNICODE
7621 | OPTS_TYPE_ST_ADD80
7622 | OPTS_TYPE_ST_ADDBITS15
;
7623 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7624 dgst_size
= DGST_SIZE_4_5
;
7625 parse_func
= peoplesoft_parse_hash
;
7626 sort_by_digest
= sort_by_digest_4_5
;
7627 opti_type
= OPTI_TYPE_ZERO_BYTE
7628 | OPTI_TYPE_PRECOMPUTE_INIT
7629 | OPTI_TYPE_PRECOMPUTE_MERKLE
7630 | OPTI_TYPE_EARLY_SKIP
7631 | OPTI_TYPE_NOT_ITERATED
7632 | OPTI_TYPE_APPENDED_SALT
7633 | OPTI_TYPE_RAW_HASH
;
7640 case 140: hash_type
= HASH_TYPE_SHA1
;
7641 salt_type
= SALT_TYPE_INTERN
;
7642 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7643 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7644 | OPTS_TYPE_PT_ADD80
7645 | OPTS_TYPE_PT_ADDBITS15
7646 | OPTS_TYPE_PT_UNICODE
;
7647 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7648 dgst_size
= DGST_SIZE_4_5
;
7649 parse_func
= sha1s_parse_hash
;
7650 sort_by_digest
= sort_by_digest_4_5
;
7651 opti_type
= OPTI_TYPE_ZERO_BYTE
7652 | OPTI_TYPE_PRECOMPUTE_INIT
7653 | OPTI_TYPE_PRECOMPUTE_MERKLE
7654 | OPTI_TYPE_EARLY_SKIP
7655 | OPTI_TYPE_NOT_ITERATED
7656 | OPTI_TYPE_PREPENDED_SALT
7657 | OPTI_TYPE_RAW_HASH
;
7664 case 141: hash_type
= HASH_TYPE_SHA1
;
7665 salt_type
= SALT_TYPE_EMBEDDED
;
7666 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7667 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7668 | OPTS_TYPE_PT_ADD80
7669 | OPTS_TYPE_PT_ADDBITS15
7670 | OPTS_TYPE_PT_UNICODE
7671 | OPTS_TYPE_ST_BASE64
;
7672 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7673 dgst_size
= DGST_SIZE_4_5
;
7674 parse_func
= episerver_parse_hash
;
7675 sort_by_digest
= sort_by_digest_4_5
;
7676 opti_type
= OPTI_TYPE_ZERO_BYTE
7677 | OPTI_TYPE_PRECOMPUTE_INIT
7678 | OPTI_TYPE_PRECOMPUTE_MERKLE
7679 | OPTI_TYPE_EARLY_SKIP
7680 | OPTI_TYPE_NOT_ITERATED
7681 | OPTI_TYPE_PREPENDED_SALT
7682 | OPTI_TYPE_RAW_HASH
;
7689 case 150: hash_type
= HASH_TYPE_SHA1
;
7690 salt_type
= SALT_TYPE_INTERN
;
7691 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7692 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7693 | OPTS_TYPE_ST_ADD80
7694 | OPTS_TYPE_ST_ADDBITS15
;
7695 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7696 dgst_size
= DGST_SIZE_4_5
;
7697 parse_func
= hmacsha1_parse_hash
;
7698 sort_by_digest
= sort_by_digest_4_5
;
7699 opti_type
= OPTI_TYPE_ZERO_BYTE
7700 | OPTI_TYPE_NOT_ITERATED
;
7707 case 160: hash_type
= HASH_TYPE_SHA1
;
7708 salt_type
= SALT_TYPE_INTERN
;
7709 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7710 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7711 | OPTS_TYPE_PT_ADD80
7712 | OPTS_TYPE_PT_ADDBITS15
;
7713 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7714 dgst_size
= DGST_SIZE_4_5
;
7715 parse_func
= hmacsha1_parse_hash
;
7716 sort_by_digest
= sort_by_digest_4_5
;
7717 opti_type
= OPTI_TYPE_ZERO_BYTE
7718 | OPTI_TYPE_NOT_ITERATED
;
7725 case 190: hash_type
= HASH_TYPE_SHA1
;
7726 salt_type
= SALT_TYPE_NONE
;
7727 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7728 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7729 | OPTS_TYPE_PT_ADD80
7730 | OPTS_TYPE_PT_ADDBITS15
;
7731 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7732 dgst_size
= DGST_SIZE_4_5
;
7733 parse_func
= sha1linkedin_parse_hash
;
7734 sort_by_digest
= sort_by_digest_4_5
;
7735 opti_type
= OPTI_TYPE_ZERO_BYTE
7736 | OPTI_TYPE_PRECOMPUTE_INIT
7737 | OPTI_TYPE_EARLY_SKIP
7738 | OPTI_TYPE_NOT_ITERATED
7739 | OPTI_TYPE_NOT_SALTED
;
7746 case 200: hash_type
= HASH_TYPE_MYSQL
;
7747 salt_type
= SALT_TYPE_NONE
;
7748 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7750 kern_type
= KERN_TYPE_MYSQL
;
7751 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7752 parse_func
= mysql323_parse_hash
;
7753 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7754 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7761 case 300: hash_type
= HASH_TYPE_SHA1
;
7762 salt_type
= SALT_TYPE_NONE
;
7763 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7764 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7765 | OPTS_TYPE_PT_ADD80
7766 | OPTS_TYPE_PT_ADDBITS15
;
7767 kern_type
= KERN_TYPE_MYSQL41
;
7768 dgst_size
= DGST_SIZE_4_5
;
7769 parse_func
= sha1_parse_hash
;
7770 sort_by_digest
= sort_by_digest_4_5
;
7771 opti_type
= OPTI_TYPE_ZERO_BYTE
7772 | OPTI_TYPE_PRECOMPUTE_INIT
7773 | OPTI_TYPE_PRECOMPUTE_MERKLE
7774 | OPTI_TYPE_EARLY_SKIP
7775 | OPTI_TYPE_NOT_ITERATED
7776 | OPTI_TYPE_NOT_SALTED
;
7783 case 400: hash_type
= HASH_TYPE_MD5
;
7784 salt_type
= SALT_TYPE_EMBEDDED
;
7785 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7786 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7787 kern_type
= KERN_TYPE_PHPASS
;
7788 dgst_size
= DGST_SIZE_4_4
;
7789 parse_func
= phpass_parse_hash
;
7790 sort_by_digest
= sort_by_digest_4_4
;
7791 opti_type
= OPTI_TYPE_ZERO_BYTE
7792 | OPTI_TYPE_SLOW_HASH_SIMD
;
7799 case 500: hash_type
= HASH_TYPE_MD5
;
7800 salt_type
= SALT_TYPE_EMBEDDED
;
7801 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7802 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7803 kern_type
= KERN_TYPE_MD5CRYPT
;
7804 dgst_size
= DGST_SIZE_4_4
;
7805 parse_func
= md5crypt_parse_hash
;
7806 sort_by_digest
= sort_by_digest_4_4
;
7807 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7814 case 501: hash_type
= HASH_TYPE_MD5
;
7815 salt_type
= SALT_TYPE_EMBEDDED
;
7816 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7817 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7818 | OPTS_TYPE_HASH_COPY
;
7819 kern_type
= KERN_TYPE_MD5CRYPT
;
7820 dgst_size
= DGST_SIZE_4_4
;
7821 parse_func
= juniper_parse_hash
;
7822 sort_by_digest
= sort_by_digest_4_4
;
7823 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7830 case 900: hash_type
= HASH_TYPE_MD4
;
7831 salt_type
= SALT_TYPE_NONE
;
7832 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7833 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7834 | OPTS_TYPE_PT_ADD80
7835 | OPTS_TYPE_PT_ADDBITS14
;
7836 kern_type
= KERN_TYPE_MD4
;
7837 dgst_size
= DGST_SIZE_4_4
;
7838 parse_func
= md4_parse_hash
;
7839 sort_by_digest
= sort_by_digest_4_4
;
7840 opti_type
= OPTI_TYPE_ZERO_BYTE
7841 | OPTI_TYPE_PRECOMPUTE_INIT
7842 | OPTI_TYPE_PRECOMPUTE_MERKLE
7843 | OPTI_TYPE_MEET_IN_MIDDLE
7844 | OPTI_TYPE_EARLY_SKIP
7845 | OPTI_TYPE_NOT_ITERATED
7846 | OPTI_TYPE_NOT_SALTED
7847 | OPTI_TYPE_RAW_HASH
;
7854 case 1000: hash_type
= HASH_TYPE_MD4
;
7855 salt_type
= SALT_TYPE_NONE
;
7856 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7857 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7858 | OPTS_TYPE_PT_ADD80
7859 | OPTS_TYPE_PT_ADDBITS14
7860 | OPTS_TYPE_PT_UNICODE
;
7861 kern_type
= KERN_TYPE_MD4_PWU
;
7862 dgst_size
= DGST_SIZE_4_4
;
7863 parse_func
= md4_parse_hash
;
7864 sort_by_digest
= sort_by_digest_4_4
;
7865 opti_type
= OPTI_TYPE_ZERO_BYTE
7866 | OPTI_TYPE_PRECOMPUTE_INIT
7867 | OPTI_TYPE_PRECOMPUTE_MERKLE
7868 | OPTI_TYPE_MEET_IN_MIDDLE
7869 | OPTI_TYPE_EARLY_SKIP
7870 | OPTI_TYPE_NOT_ITERATED
7871 | OPTI_TYPE_NOT_SALTED
7872 | OPTI_TYPE_RAW_HASH
;
7879 case 1100: hash_type
= HASH_TYPE_MD4
;
7880 salt_type
= SALT_TYPE_INTERN
;
7881 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7882 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7883 | OPTS_TYPE_PT_ADD80
7884 | OPTS_TYPE_PT_ADDBITS14
7885 | OPTS_TYPE_PT_UNICODE
7886 | OPTS_TYPE_ST_ADD80
7887 | OPTS_TYPE_ST_UNICODE
7888 | OPTS_TYPE_ST_LOWER
;
7889 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7890 dgst_size
= DGST_SIZE_4_4
;
7891 parse_func
= dcc_parse_hash
;
7892 sort_by_digest
= sort_by_digest_4_4
;
7893 opti_type
= OPTI_TYPE_ZERO_BYTE
7894 | OPTI_TYPE_PRECOMPUTE_INIT
7895 | OPTI_TYPE_PRECOMPUTE_MERKLE
7896 | OPTI_TYPE_EARLY_SKIP
7897 | OPTI_TYPE_NOT_ITERATED
;
7904 case 1400: hash_type
= HASH_TYPE_SHA256
;
7905 salt_type
= SALT_TYPE_NONE
;
7906 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7907 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7908 | OPTS_TYPE_PT_ADD80
7909 | OPTS_TYPE_PT_ADDBITS15
;
7910 kern_type
= KERN_TYPE_SHA256
;
7911 dgst_size
= DGST_SIZE_4_8
;
7912 parse_func
= sha256_parse_hash
;
7913 sort_by_digest
= sort_by_digest_4_8
;
7914 opti_type
= OPTI_TYPE_ZERO_BYTE
7915 | OPTI_TYPE_PRECOMPUTE_INIT
7916 | OPTI_TYPE_PRECOMPUTE_MERKLE
7917 | OPTI_TYPE_EARLY_SKIP
7918 | OPTI_TYPE_NOT_ITERATED
7919 | OPTI_TYPE_NOT_SALTED
7920 | OPTI_TYPE_RAW_HASH
;
7927 case 1410: hash_type
= HASH_TYPE_SHA256
;
7928 salt_type
= SALT_TYPE_INTERN
;
7929 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7930 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7931 | OPTS_TYPE_ST_ADD80
7932 | OPTS_TYPE_ST_ADDBITS15
;
7933 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7934 dgst_size
= DGST_SIZE_4_8
;
7935 parse_func
= sha256s_parse_hash
;
7936 sort_by_digest
= sort_by_digest_4_8
;
7937 opti_type
= OPTI_TYPE_ZERO_BYTE
7938 | OPTI_TYPE_PRECOMPUTE_INIT
7939 | OPTI_TYPE_PRECOMPUTE_MERKLE
7940 | OPTI_TYPE_EARLY_SKIP
7941 | OPTI_TYPE_NOT_ITERATED
7942 | OPTI_TYPE_APPENDED_SALT
7943 | OPTI_TYPE_RAW_HASH
;
7950 case 1420: hash_type
= HASH_TYPE_SHA256
;
7951 salt_type
= SALT_TYPE_INTERN
;
7952 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7953 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7954 | OPTS_TYPE_PT_ADD80
7955 | OPTS_TYPE_PT_ADDBITS15
;
7956 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7957 dgst_size
= DGST_SIZE_4_8
;
7958 parse_func
= sha256s_parse_hash
;
7959 sort_by_digest
= sort_by_digest_4_8
;
7960 opti_type
= OPTI_TYPE_ZERO_BYTE
7961 | OPTI_TYPE_PRECOMPUTE_INIT
7962 | OPTI_TYPE_PRECOMPUTE_MERKLE
7963 | OPTI_TYPE_EARLY_SKIP
7964 | OPTI_TYPE_NOT_ITERATED
7965 | OPTI_TYPE_PREPENDED_SALT
7966 | OPTI_TYPE_RAW_HASH
;
7973 case 1421: hash_type
= HASH_TYPE_SHA256
;
7974 salt_type
= SALT_TYPE_EMBEDDED
;
7975 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7976 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7977 | OPTS_TYPE_PT_ADD80
7978 | OPTS_TYPE_PT_ADDBITS15
;
7979 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7980 dgst_size
= DGST_SIZE_4_8
;
7981 parse_func
= hmailserver_parse_hash
;
7982 sort_by_digest
= sort_by_digest_4_8
;
7983 opti_type
= OPTI_TYPE_ZERO_BYTE
7984 | OPTI_TYPE_PRECOMPUTE_INIT
7985 | OPTI_TYPE_PRECOMPUTE_MERKLE
7986 | OPTI_TYPE_EARLY_SKIP
7987 | OPTI_TYPE_NOT_ITERATED
7988 | OPTI_TYPE_PREPENDED_SALT
7989 | OPTI_TYPE_RAW_HASH
;
7996 case 1430: hash_type
= HASH_TYPE_SHA256
;
7997 salt_type
= SALT_TYPE_INTERN
;
7998 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7999 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8000 | OPTS_TYPE_PT_UNICODE
8001 | OPTS_TYPE_ST_ADD80
8002 | OPTS_TYPE_ST_ADDBITS15
;
8003 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8004 dgst_size
= DGST_SIZE_4_8
;
8005 parse_func
= sha256s_parse_hash
;
8006 sort_by_digest
= sort_by_digest_4_8
;
8007 opti_type
= OPTI_TYPE_ZERO_BYTE
8008 | OPTI_TYPE_PRECOMPUTE_INIT
8009 | OPTI_TYPE_PRECOMPUTE_MERKLE
8010 | OPTI_TYPE_EARLY_SKIP
8011 | OPTI_TYPE_NOT_ITERATED
8012 | OPTI_TYPE_APPENDED_SALT
8013 | OPTI_TYPE_RAW_HASH
;
8020 case 1440: hash_type
= HASH_TYPE_SHA256
;
8021 salt_type
= SALT_TYPE_INTERN
;
8022 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8023 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8024 | OPTS_TYPE_PT_ADD80
8025 | OPTS_TYPE_PT_ADDBITS15
8026 | OPTS_TYPE_PT_UNICODE
;
8027 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8028 dgst_size
= DGST_SIZE_4_8
;
8029 parse_func
= sha256s_parse_hash
;
8030 sort_by_digest
= sort_by_digest_4_8
;
8031 opti_type
= OPTI_TYPE_ZERO_BYTE
8032 | OPTI_TYPE_PRECOMPUTE_INIT
8033 | OPTI_TYPE_PRECOMPUTE_MERKLE
8034 | OPTI_TYPE_EARLY_SKIP
8035 | OPTI_TYPE_NOT_ITERATED
8036 | OPTI_TYPE_PREPENDED_SALT
8037 | OPTI_TYPE_RAW_HASH
;
8044 case 1441: hash_type
= HASH_TYPE_SHA256
;
8045 salt_type
= SALT_TYPE_EMBEDDED
;
8046 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8047 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8048 | OPTS_TYPE_PT_ADD80
8049 | OPTS_TYPE_PT_ADDBITS15
8050 | OPTS_TYPE_PT_UNICODE
8051 | OPTS_TYPE_ST_BASE64
;
8052 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8053 dgst_size
= DGST_SIZE_4_8
;
8054 parse_func
= episerver4_parse_hash
;
8055 sort_by_digest
= sort_by_digest_4_8
;
8056 opti_type
= OPTI_TYPE_ZERO_BYTE
8057 | OPTI_TYPE_PRECOMPUTE_INIT
8058 | OPTI_TYPE_PRECOMPUTE_MERKLE
8059 | OPTI_TYPE_EARLY_SKIP
8060 | OPTI_TYPE_NOT_ITERATED
8061 | OPTI_TYPE_PREPENDED_SALT
8062 | OPTI_TYPE_RAW_HASH
;
8069 case 1450: hash_type
= HASH_TYPE_SHA256
;
8070 salt_type
= SALT_TYPE_INTERN
;
8071 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8072 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8073 | OPTS_TYPE_ST_ADD80
;
8074 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8075 dgst_size
= DGST_SIZE_4_8
;
8076 parse_func
= hmacsha256_parse_hash
;
8077 sort_by_digest
= sort_by_digest_4_8
;
8078 opti_type
= OPTI_TYPE_ZERO_BYTE
8079 | OPTI_TYPE_NOT_ITERATED
;
8086 case 1460: hash_type
= HASH_TYPE_SHA256
;
8087 salt_type
= SALT_TYPE_INTERN
;
8088 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8089 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8090 | OPTS_TYPE_PT_ADD80
8091 | OPTS_TYPE_PT_ADDBITS15
;
8092 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8093 dgst_size
= DGST_SIZE_4_8
;
8094 parse_func
= hmacsha256_parse_hash
;
8095 sort_by_digest
= sort_by_digest_4_8
;
8096 opti_type
= OPTI_TYPE_ZERO_BYTE
8097 | OPTI_TYPE_NOT_ITERATED
;
8104 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8105 salt_type
= SALT_TYPE_EMBEDDED
;
8106 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8107 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8108 | OPTS_TYPE_PT_BITSLICE
;
8109 kern_type
= KERN_TYPE_DESCRYPT
;
8110 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8111 parse_func
= descrypt_parse_hash
;
8112 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8113 opti_type
= OPTI_TYPE_ZERO_BYTE
8114 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8121 case 1600: hash_type
= HASH_TYPE_MD5
;
8122 salt_type
= SALT_TYPE_EMBEDDED
;
8123 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8124 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8125 kern_type
= KERN_TYPE_APR1CRYPT
;
8126 dgst_size
= DGST_SIZE_4_4
;
8127 parse_func
= md5apr1_parse_hash
;
8128 sort_by_digest
= sort_by_digest_4_4
;
8129 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8136 case 1700: hash_type
= HASH_TYPE_SHA512
;
8137 salt_type
= SALT_TYPE_NONE
;
8138 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8139 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8140 | OPTS_TYPE_PT_ADD80
8141 | OPTS_TYPE_PT_ADDBITS15
;
8142 kern_type
= KERN_TYPE_SHA512
;
8143 dgst_size
= DGST_SIZE_8_8
;
8144 parse_func
= sha512_parse_hash
;
8145 sort_by_digest
= sort_by_digest_8_8
;
8146 opti_type
= OPTI_TYPE_ZERO_BYTE
8147 | OPTI_TYPE_PRECOMPUTE_INIT
8148 | OPTI_TYPE_PRECOMPUTE_MERKLE
8149 | OPTI_TYPE_EARLY_SKIP
8150 | OPTI_TYPE_NOT_ITERATED
8151 | OPTI_TYPE_NOT_SALTED
8152 | OPTI_TYPE_USES_BITS_64
8153 | OPTI_TYPE_RAW_HASH
;
8160 case 1710: hash_type
= HASH_TYPE_SHA512
;
8161 salt_type
= SALT_TYPE_INTERN
;
8162 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8163 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8164 | OPTS_TYPE_ST_ADD80
8165 | OPTS_TYPE_ST_ADDBITS15
;
8166 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8167 dgst_size
= DGST_SIZE_8_8
;
8168 parse_func
= sha512s_parse_hash
;
8169 sort_by_digest
= sort_by_digest_8_8
;
8170 opti_type
= OPTI_TYPE_ZERO_BYTE
8171 | OPTI_TYPE_PRECOMPUTE_INIT
8172 | OPTI_TYPE_PRECOMPUTE_MERKLE
8173 | OPTI_TYPE_EARLY_SKIP
8174 | OPTI_TYPE_NOT_ITERATED
8175 | OPTI_TYPE_APPENDED_SALT
8176 | OPTI_TYPE_USES_BITS_64
8177 | OPTI_TYPE_RAW_HASH
;
8184 case 1711: hash_type
= HASH_TYPE_SHA512
;
8185 salt_type
= SALT_TYPE_EMBEDDED
;
8186 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8187 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8188 | OPTS_TYPE_ST_ADD80
8189 | OPTS_TYPE_ST_ADDBITS15
;
8190 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8191 dgst_size
= DGST_SIZE_8_8
;
8192 parse_func
= sha512b64s_parse_hash
;
8193 sort_by_digest
= sort_by_digest_8_8
;
8194 opti_type
= OPTI_TYPE_ZERO_BYTE
8195 | OPTI_TYPE_PRECOMPUTE_INIT
8196 | OPTI_TYPE_PRECOMPUTE_MERKLE
8197 | OPTI_TYPE_EARLY_SKIP
8198 | OPTI_TYPE_NOT_ITERATED
8199 | OPTI_TYPE_APPENDED_SALT
8200 | OPTI_TYPE_USES_BITS_64
8201 | OPTI_TYPE_RAW_HASH
;
8208 case 1720: hash_type
= HASH_TYPE_SHA512
;
8209 salt_type
= SALT_TYPE_INTERN
;
8210 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8211 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8212 | OPTS_TYPE_PT_ADD80
8213 | OPTS_TYPE_PT_ADDBITS15
;
8214 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8215 dgst_size
= DGST_SIZE_8_8
;
8216 parse_func
= sha512s_parse_hash
;
8217 sort_by_digest
= sort_by_digest_8_8
;
8218 opti_type
= OPTI_TYPE_ZERO_BYTE
8219 | OPTI_TYPE_PRECOMPUTE_INIT
8220 | OPTI_TYPE_PRECOMPUTE_MERKLE
8221 | OPTI_TYPE_EARLY_SKIP
8222 | OPTI_TYPE_NOT_ITERATED
8223 | OPTI_TYPE_PREPENDED_SALT
8224 | OPTI_TYPE_USES_BITS_64
8225 | OPTI_TYPE_RAW_HASH
;
8232 case 1722: hash_type
= HASH_TYPE_SHA512
;
8233 salt_type
= SALT_TYPE_EMBEDDED
;
8234 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8235 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8236 | OPTS_TYPE_PT_ADD80
8237 | OPTS_TYPE_PT_ADDBITS15
8239 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8240 dgst_size
= DGST_SIZE_8_8
;
8241 parse_func
= osx512_parse_hash
;
8242 sort_by_digest
= sort_by_digest_8_8
;
8243 opti_type
= OPTI_TYPE_ZERO_BYTE
8244 | OPTI_TYPE_PRECOMPUTE_INIT
8245 | OPTI_TYPE_PRECOMPUTE_MERKLE
8246 | OPTI_TYPE_EARLY_SKIP
8247 | OPTI_TYPE_NOT_ITERATED
8248 | OPTI_TYPE_PREPENDED_SALT
8249 | OPTI_TYPE_USES_BITS_64
8250 | OPTI_TYPE_RAW_HASH
;
8257 case 1730: hash_type
= HASH_TYPE_SHA512
;
8258 salt_type
= SALT_TYPE_INTERN
;
8259 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8260 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8261 | OPTS_TYPE_PT_UNICODE
8262 | OPTS_TYPE_ST_ADD80
8263 | OPTS_TYPE_ST_ADDBITS15
;
8264 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8265 dgst_size
= DGST_SIZE_8_8
;
8266 parse_func
= sha512s_parse_hash
;
8267 sort_by_digest
= sort_by_digest_8_8
;
8268 opti_type
= OPTI_TYPE_ZERO_BYTE
8269 | OPTI_TYPE_PRECOMPUTE_INIT
8270 | OPTI_TYPE_PRECOMPUTE_MERKLE
8271 | OPTI_TYPE_EARLY_SKIP
8272 | OPTI_TYPE_NOT_ITERATED
8273 | OPTI_TYPE_APPENDED_SALT
8274 | OPTI_TYPE_USES_BITS_64
8275 | OPTI_TYPE_RAW_HASH
;
8282 case 1731: hash_type
= HASH_TYPE_SHA512
;
8283 salt_type
= SALT_TYPE_EMBEDDED
;
8284 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8285 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8286 | OPTS_TYPE_PT_UNICODE
8287 | OPTS_TYPE_ST_ADD80
8288 | OPTS_TYPE_ST_ADDBITS15
8290 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8291 dgst_size
= DGST_SIZE_8_8
;
8292 parse_func
= mssql2012_parse_hash
;
8293 sort_by_digest
= sort_by_digest_8_8
;
8294 opti_type
= OPTI_TYPE_ZERO_BYTE
8295 | OPTI_TYPE_PRECOMPUTE_INIT
8296 | OPTI_TYPE_PRECOMPUTE_MERKLE
8297 | OPTI_TYPE_EARLY_SKIP
8298 | OPTI_TYPE_NOT_ITERATED
8299 | OPTI_TYPE_APPENDED_SALT
8300 | OPTI_TYPE_USES_BITS_64
8301 | OPTI_TYPE_RAW_HASH
;
8308 case 1740: hash_type
= HASH_TYPE_SHA512
;
8309 salt_type
= SALT_TYPE_INTERN
;
8310 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8311 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8312 | OPTS_TYPE_PT_ADD80
8313 | OPTS_TYPE_PT_ADDBITS15
8314 | OPTS_TYPE_PT_UNICODE
;
8315 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8316 dgst_size
= DGST_SIZE_8_8
;
8317 parse_func
= sha512s_parse_hash
;
8318 sort_by_digest
= sort_by_digest_8_8
;
8319 opti_type
= OPTI_TYPE_ZERO_BYTE
8320 | OPTI_TYPE_PRECOMPUTE_INIT
8321 | OPTI_TYPE_PRECOMPUTE_MERKLE
8322 | OPTI_TYPE_EARLY_SKIP
8323 | OPTI_TYPE_NOT_ITERATED
8324 | OPTI_TYPE_PREPENDED_SALT
8325 | OPTI_TYPE_USES_BITS_64
8326 | OPTI_TYPE_RAW_HASH
;
8333 case 1750: hash_type
= HASH_TYPE_SHA512
;
8334 salt_type
= SALT_TYPE_INTERN
;
8335 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8336 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8337 | OPTS_TYPE_ST_ADD80
;
8338 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8339 dgst_size
= DGST_SIZE_8_8
;
8340 parse_func
= hmacsha512_parse_hash
;
8341 sort_by_digest
= sort_by_digest_8_8
;
8342 opti_type
= OPTI_TYPE_ZERO_BYTE
8343 | OPTI_TYPE_USES_BITS_64
8344 | OPTI_TYPE_NOT_ITERATED
;
8351 case 1760: hash_type
= HASH_TYPE_SHA512
;
8352 salt_type
= SALT_TYPE_INTERN
;
8353 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8354 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8355 | OPTS_TYPE_PT_ADD80
8356 | OPTS_TYPE_PT_ADDBITS15
;
8357 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8358 dgst_size
= DGST_SIZE_8_8
;
8359 parse_func
= hmacsha512_parse_hash
;
8360 sort_by_digest
= sort_by_digest_8_8
;
8361 opti_type
= OPTI_TYPE_ZERO_BYTE
8362 | OPTI_TYPE_USES_BITS_64
8363 | OPTI_TYPE_NOT_ITERATED
;
8370 case 1800: hash_type
= HASH_TYPE_SHA512
;
8371 salt_type
= SALT_TYPE_EMBEDDED
;
8372 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8373 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8374 kern_type
= KERN_TYPE_SHA512CRYPT
;
8375 dgst_size
= DGST_SIZE_8_8
;
8376 parse_func
= sha512crypt_parse_hash
;
8377 sort_by_digest
= sort_by_digest_8_8
;
8378 opti_type
= OPTI_TYPE_ZERO_BYTE
8379 | OPTI_TYPE_USES_BITS_64
;
8386 case 2100: hash_type
= HASH_TYPE_DCC2
;
8387 salt_type
= SALT_TYPE_EMBEDDED
;
8388 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8389 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8390 | OPTS_TYPE_ST_LOWER
8391 | OPTS_TYPE_ST_UNICODE
;
8392 kern_type
= KERN_TYPE_DCC2
;
8393 dgst_size
= DGST_SIZE_4_4
;
8394 parse_func
= dcc2_parse_hash
;
8395 sort_by_digest
= sort_by_digest_4_4
;
8396 opti_type
= OPTI_TYPE_ZERO_BYTE
8397 | OPTI_TYPE_SLOW_HASH_SIMD
;
8404 case 2400: hash_type
= HASH_TYPE_MD5
;
8405 salt_type
= SALT_TYPE_NONE
;
8406 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8407 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8408 kern_type
= KERN_TYPE_MD5PIX
;
8409 dgst_size
= DGST_SIZE_4_4
;
8410 parse_func
= md5pix_parse_hash
;
8411 sort_by_digest
= sort_by_digest_4_4
;
8412 opti_type
= OPTI_TYPE_ZERO_BYTE
8413 | OPTI_TYPE_PRECOMPUTE_INIT
8414 | OPTI_TYPE_PRECOMPUTE_MERKLE
8415 | OPTI_TYPE_EARLY_SKIP
8416 | OPTI_TYPE_NOT_ITERATED
8417 | OPTI_TYPE_NOT_SALTED
;
8424 case 2410: hash_type
= HASH_TYPE_MD5
;
8425 salt_type
= SALT_TYPE_INTERN
;
8426 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8427 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8428 kern_type
= KERN_TYPE_MD5ASA
;
8429 dgst_size
= DGST_SIZE_4_4
;
8430 parse_func
= md5asa_parse_hash
;
8431 sort_by_digest
= sort_by_digest_4_4
;
8432 opti_type
= OPTI_TYPE_ZERO_BYTE
8433 | OPTI_TYPE_PRECOMPUTE_INIT
8434 | OPTI_TYPE_PRECOMPUTE_MERKLE
8435 | OPTI_TYPE_EARLY_SKIP
8436 | OPTI_TYPE_NOT_ITERATED
;
8443 case 2500: hash_type
= HASH_TYPE_WPA
;
8444 salt_type
= SALT_TYPE_EMBEDDED
;
8445 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8446 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8447 kern_type
= KERN_TYPE_WPA
;
8448 dgst_size
= DGST_SIZE_4_4
;
8449 parse_func
= wpa_parse_hash
;
8450 sort_by_digest
= sort_by_digest_4_4
;
8451 opti_type
= OPTI_TYPE_ZERO_BYTE
8452 | OPTI_TYPE_SLOW_HASH_SIMD
;
8459 case 2600: hash_type
= HASH_TYPE_MD5
;
8460 salt_type
= SALT_TYPE_VIRTUAL
;
8461 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8462 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8463 | OPTS_TYPE_PT_ADD80
8464 | OPTS_TYPE_PT_ADDBITS14
8465 | OPTS_TYPE_ST_ADD80
;
8466 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8467 dgst_size
= DGST_SIZE_4_4
;
8468 parse_func
= md5md5_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
;
8480 case 2611: hash_type
= HASH_TYPE_MD5
;
8481 salt_type
= SALT_TYPE_INTERN
;
8482 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8483 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8484 | OPTS_TYPE_PT_ADD80
8485 | OPTS_TYPE_PT_ADDBITS14
8486 | OPTS_TYPE_ST_ADD80
;
8487 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8488 dgst_size
= DGST_SIZE_4_4
;
8489 parse_func
= vb3_parse_hash
;
8490 sort_by_digest
= sort_by_digest_4_4
;
8491 opti_type
= OPTI_TYPE_ZERO_BYTE
8492 | OPTI_TYPE_PRECOMPUTE_INIT
8493 | OPTI_TYPE_PRECOMPUTE_MERKLE
8494 | OPTI_TYPE_EARLY_SKIP
;
8501 case 2612: hash_type
= HASH_TYPE_MD5
;
8502 salt_type
= SALT_TYPE_EMBEDDED
;
8503 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8504 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8505 | OPTS_TYPE_PT_ADD80
8506 | OPTS_TYPE_PT_ADDBITS14
8507 | OPTS_TYPE_ST_ADD80
8509 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8510 dgst_size
= DGST_SIZE_4_4
;
8511 parse_func
= phps_parse_hash
;
8512 sort_by_digest
= sort_by_digest_4_4
;
8513 opti_type
= OPTI_TYPE_ZERO_BYTE
8514 | OPTI_TYPE_PRECOMPUTE_INIT
8515 | OPTI_TYPE_PRECOMPUTE_MERKLE
8516 | OPTI_TYPE_EARLY_SKIP
;
8523 case 2711: hash_type
= HASH_TYPE_MD5
;
8524 salt_type
= SALT_TYPE_INTERN
;
8525 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8526 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8527 | OPTS_TYPE_PT_ADD80
8528 | OPTS_TYPE_PT_ADDBITS14
8529 | OPTS_TYPE_ST_ADD80
;
8530 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8531 dgst_size
= DGST_SIZE_4_4
;
8532 parse_func
= vb30_parse_hash
;
8533 sort_by_digest
= sort_by_digest_4_4
;
8534 opti_type
= OPTI_TYPE_ZERO_BYTE
8535 | OPTI_TYPE_PRECOMPUTE_INIT
8536 | OPTI_TYPE_EARLY_SKIP
;
8543 case 2811: hash_type
= HASH_TYPE_MD5
;
8544 salt_type
= SALT_TYPE_INTERN
;
8545 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8546 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8547 | OPTS_TYPE_PT_ADD80
8548 | OPTS_TYPE_PT_ADDBITS14
;
8549 kern_type
= KERN_TYPE_MD55_SLTPW
;
8550 dgst_size
= DGST_SIZE_4_4
;
8551 parse_func
= ipb2_parse_hash
;
8552 sort_by_digest
= sort_by_digest_4_4
;
8553 opti_type
= OPTI_TYPE_ZERO_BYTE
8554 | OPTI_TYPE_PRECOMPUTE_INIT
8555 | OPTI_TYPE_EARLY_SKIP
;
8562 case 3000: hash_type
= HASH_TYPE_LM
;
8563 salt_type
= SALT_TYPE_NONE
;
8564 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8565 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8566 | OPTS_TYPE_PT_UPPER
8567 | OPTS_TYPE_PT_BITSLICE
;
8568 kern_type
= KERN_TYPE_LM
;
8569 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8570 parse_func
= lm_parse_hash
;
8571 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8572 opti_type
= OPTI_TYPE_ZERO_BYTE
8573 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8580 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8581 salt_type
= SALT_TYPE_INTERN
;
8582 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8583 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8584 | OPTS_TYPE_PT_UPPER
8585 | OPTS_TYPE_ST_UPPER
;
8586 kern_type
= KERN_TYPE_ORACLEH
;
8587 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8588 parse_func
= oracleh_parse_hash
;
8589 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8590 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8597 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8598 salt_type
= SALT_TYPE_EMBEDDED
;
8599 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8601 | OPTS_TYPE_ST_GENERATE_LE
;
8602 kern_type
= KERN_TYPE_BCRYPT
;
8603 dgst_size
= DGST_SIZE_4_6
;
8604 parse_func
= bcrypt_parse_hash
;
8605 sort_by_digest
= sort_by_digest_4_6
;
8606 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8613 case 3710: hash_type
= HASH_TYPE_MD5
;
8614 salt_type
= SALT_TYPE_INTERN
;
8615 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8616 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8617 | OPTS_TYPE_PT_ADD80
8618 | OPTS_TYPE_PT_ADDBITS14
;
8619 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8620 dgst_size
= DGST_SIZE_4_4
;
8621 parse_func
= md5s_parse_hash
;
8622 sort_by_digest
= sort_by_digest_4_4
;
8623 opti_type
= OPTI_TYPE_ZERO_BYTE
8624 | OPTI_TYPE_PRECOMPUTE_INIT
8625 | OPTI_TYPE_PRECOMPUTE_MERKLE
8626 | OPTI_TYPE_EARLY_SKIP
;
8633 case 3711: hash_type
= HASH_TYPE_MD5
;
8634 salt_type
= SALT_TYPE_EMBEDDED
;
8635 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8637 | OPTS_TYPE_PT_ADD80
8638 | OPTS_TYPE_PT_ADDBITS14
;
8639 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8640 dgst_size
= DGST_SIZE_4_4
;
8641 parse_func
= mediawiki_b_parse_hash
;
8642 sort_by_digest
= sort_by_digest_4_4
;
8643 opti_type
= OPTI_TYPE_ZERO_BYTE
8644 | OPTI_TYPE_PRECOMPUTE_INIT
8645 | OPTI_TYPE_PRECOMPUTE_MERKLE
8646 | OPTI_TYPE_EARLY_SKIP
;
8653 case 3800: hash_type
= HASH_TYPE_MD5
;
8654 salt_type
= SALT_TYPE_INTERN
;
8655 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8656 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8657 | OPTS_TYPE_ST_ADDBITS14
;
8658 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8659 dgst_size
= DGST_SIZE_4_4
;
8660 parse_func
= md5s_parse_hash
;
8661 sort_by_digest
= sort_by_digest_4_4
;
8662 opti_type
= OPTI_TYPE_ZERO_BYTE
8663 | OPTI_TYPE_PRECOMPUTE_INIT
8664 | OPTI_TYPE_PRECOMPUTE_MERKLE
8665 | OPTI_TYPE_EARLY_SKIP
8666 | OPTI_TYPE_NOT_ITERATED
8667 | OPTI_TYPE_RAW_HASH
;
8674 case 4300: hash_type
= HASH_TYPE_MD5
;
8675 salt_type
= SALT_TYPE_VIRTUAL
;
8676 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8677 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8678 | OPTS_TYPE_PT_ADD80
8679 | OPTS_TYPE_PT_ADDBITS14
8680 | OPTS_TYPE_ST_ADD80
;
8681 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8682 dgst_size
= DGST_SIZE_4_4
;
8683 parse_func
= md5md5_parse_hash
;
8684 sort_by_digest
= sort_by_digest_4_4
;
8685 opti_type
= OPTI_TYPE_ZERO_BYTE
8686 | OPTI_TYPE_PRECOMPUTE_INIT
8687 | OPTI_TYPE_PRECOMPUTE_MERKLE
8688 | OPTI_TYPE_EARLY_SKIP
;
8696 case 4400: hash_type
= HASH_TYPE_MD5
;
8697 salt_type
= SALT_TYPE_NONE
;
8698 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8699 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8700 | OPTS_TYPE_PT_ADD80
8701 | OPTS_TYPE_PT_ADDBITS15
;
8702 kern_type
= KERN_TYPE_MD5_SHA1
;
8703 dgst_size
= DGST_SIZE_4_4
;
8704 parse_func
= md5_parse_hash
;
8705 sort_by_digest
= sort_by_digest_4_4
;
8706 opti_type
= OPTI_TYPE_ZERO_BYTE
8707 | OPTI_TYPE_PRECOMPUTE_INIT
8708 | OPTI_TYPE_PRECOMPUTE_MERKLE
8709 | OPTI_TYPE_EARLY_SKIP
8710 | OPTI_TYPE_NOT_ITERATED
8711 | OPTI_TYPE_NOT_SALTED
8712 | OPTI_TYPE_RAW_HASH
;
8719 case 4500: hash_type
= HASH_TYPE_SHA1
;
8720 salt_type
= SALT_TYPE_NONE
;
8721 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8722 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8723 | OPTS_TYPE_PT_ADD80
8724 | OPTS_TYPE_PT_ADDBITS15
;
8725 kern_type
= KERN_TYPE_SHA11
;
8726 dgst_size
= DGST_SIZE_4_5
;
8727 parse_func
= sha1_parse_hash
;
8728 sort_by_digest
= sort_by_digest_4_5
;
8729 opti_type
= OPTI_TYPE_ZERO_BYTE
8730 | OPTI_TYPE_PRECOMPUTE_INIT
8731 | OPTI_TYPE_PRECOMPUTE_MERKLE
8732 | OPTI_TYPE_EARLY_SKIP
8733 | OPTI_TYPE_NOT_SALTED
;
8740 case 4700: hash_type
= HASH_TYPE_SHA1
;
8741 salt_type
= SALT_TYPE_NONE
;
8742 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8744 | OPTS_TYPE_PT_ADD80
8745 | OPTS_TYPE_PT_ADDBITS14
;
8746 kern_type
= KERN_TYPE_SHA1_MD5
;
8747 dgst_size
= DGST_SIZE_4_5
;
8748 parse_func
= sha1_parse_hash
;
8749 sort_by_digest
= sort_by_digest_4_5
;
8750 opti_type
= OPTI_TYPE_ZERO_BYTE
8751 | OPTI_TYPE_PRECOMPUTE_INIT
8752 | OPTI_TYPE_PRECOMPUTE_MERKLE
8753 | OPTI_TYPE_EARLY_SKIP
8754 | OPTI_TYPE_NOT_ITERATED
8755 | OPTI_TYPE_NOT_SALTED
8756 | OPTI_TYPE_RAW_HASH
;
8763 case 4800: hash_type
= HASH_TYPE_MD5
;
8764 salt_type
= SALT_TYPE_EMBEDDED
;
8765 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8766 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8767 | OPTS_TYPE_PT_ADDBITS14
;
8768 kern_type
= KERN_TYPE_MD5_CHAP
;
8769 dgst_size
= DGST_SIZE_4_4
;
8770 parse_func
= chap_parse_hash
;
8771 sort_by_digest
= sort_by_digest_4_4
;
8772 opti_type
= OPTI_TYPE_ZERO_BYTE
8773 | OPTI_TYPE_PRECOMPUTE_INIT
8774 | OPTI_TYPE_PRECOMPUTE_MERKLE
8775 | OPTI_TYPE_MEET_IN_MIDDLE
8776 | OPTI_TYPE_EARLY_SKIP
8777 | OPTI_TYPE_NOT_ITERATED
8778 | OPTI_TYPE_RAW_HASH
;
8785 case 4900: hash_type
= HASH_TYPE_SHA1
;
8786 salt_type
= SALT_TYPE_INTERN
;
8787 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8788 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8789 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8790 dgst_size
= DGST_SIZE_4_5
;
8791 parse_func
= sha1s_parse_hash
;
8792 sort_by_digest
= sort_by_digest_4_5
;
8793 opti_type
= OPTI_TYPE_ZERO_BYTE
8794 | OPTI_TYPE_PRECOMPUTE_INIT
8795 | OPTI_TYPE_PRECOMPUTE_MERKLE
8796 | OPTI_TYPE_EARLY_SKIP
;
8803 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8804 salt_type
= SALT_TYPE_EMBEDDED
;
8805 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8806 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8807 | OPTS_TYPE_PT_ADD01
;
8808 kern_type
= KERN_TYPE_KECCAK
;
8809 dgst_size
= DGST_SIZE_8_25
;
8810 parse_func
= keccak_parse_hash
;
8811 sort_by_digest
= sort_by_digest_8_25
;
8812 opti_type
= OPTI_TYPE_ZERO_BYTE
8813 | OPTI_TYPE_USES_BITS_64
8814 | OPTI_TYPE_RAW_HASH
;
8821 case 5100: hash_type
= HASH_TYPE_MD5H
;
8822 salt_type
= SALT_TYPE_NONE
;
8823 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8824 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8825 | OPTS_TYPE_PT_ADD80
8826 | OPTS_TYPE_PT_ADDBITS14
;
8827 kern_type
= KERN_TYPE_MD5H
;
8828 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8829 parse_func
= md5half_parse_hash
;
8830 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8831 opti_type
= OPTI_TYPE_ZERO_BYTE
8832 | OPTI_TYPE_RAW_HASH
;
8839 case 5200: hash_type
= HASH_TYPE_SHA256
;
8840 salt_type
= SALT_TYPE_EMBEDDED
;
8841 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8842 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8843 kern_type
= KERN_TYPE_PSAFE3
;
8844 dgst_size
= DGST_SIZE_4_8
;
8845 parse_func
= psafe3_parse_hash
;
8846 sort_by_digest
= sort_by_digest_4_8
;
8847 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8854 case 5300: hash_type
= HASH_TYPE_MD5
;
8855 salt_type
= SALT_TYPE_EMBEDDED
;
8856 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8857 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8858 | OPTS_TYPE_ST_ADD80
;
8859 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8860 dgst_size
= DGST_SIZE_4_4
;
8861 parse_func
= ikepsk_md5_parse_hash
;
8862 sort_by_digest
= sort_by_digest_4_4
;
8863 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8870 case 5400: hash_type
= HASH_TYPE_SHA1
;
8871 salt_type
= SALT_TYPE_EMBEDDED
;
8872 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8873 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8874 | OPTS_TYPE_ST_ADD80
;
8875 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8876 dgst_size
= DGST_SIZE_4_5
;
8877 parse_func
= ikepsk_sha1_parse_hash
;
8878 sort_by_digest
= sort_by_digest_4_5
;
8879 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8886 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8887 salt_type
= SALT_TYPE_EMBEDDED
;
8888 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8889 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8890 | OPTS_TYPE_PT_ADD80
8891 | OPTS_TYPE_PT_ADDBITS14
8892 | OPTS_TYPE_PT_UNICODE
8894 kern_type
= KERN_TYPE_NETNTLMv1
;
8895 dgst_size
= DGST_SIZE_4_4
;
8896 parse_func
= netntlmv1_parse_hash
;
8897 sort_by_digest
= sort_by_digest_4_4
;
8898 opti_type
= OPTI_TYPE_ZERO_BYTE
8899 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8906 case 5600: hash_type
= HASH_TYPE_MD5
;
8907 salt_type
= SALT_TYPE_EMBEDDED
;
8908 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8909 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8910 | OPTS_TYPE_PT_ADD80
8911 | OPTS_TYPE_PT_ADDBITS14
8912 | OPTS_TYPE_PT_UNICODE
;
8913 kern_type
= KERN_TYPE_NETNTLMv2
;
8914 dgst_size
= DGST_SIZE_4_4
;
8915 parse_func
= netntlmv2_parse_hash
;
8916 sort_by_digest
= sort_by_digest_4_4
;
8917 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8924 case 5700: hash_type
= HASH_TYPE_SHA256
;
8925 salt_type
= SALT_TYPE_NONE
;
8926 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8927 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8928 | OPTS_TYPE_PT_ADD80
8929 | OPTS_TYPE_PT_ADDBITS15
;
8930 kern_type
= KERN_TYPE_SHA256
;
8931 dgst_size
= DGST_SIZE_4_8
;
8932 parse_func
= cisco4_parse_hash
;
8933 sort_by_digest
= sort_by_digest_4_8
;
8934 opti_type
= OPTI_TYPE_ZERO_BYTE
8935 | OPTI_TYPE_PRECOMPUTE_INIT
8936 | OPTI_TYPE_PRECOMPUTE_MERKLE
8937 | OPTI_TYPE_EARLY_SKIP
8938 | OPTI_TYPE_NOT_ITERATED
8939 | OPTI_TYPE_NOT_SALTED
8940 | OPTI_TYPE_RAW_HASH
;
8947 case 5800: hash_type
= HASH_TYPE_SHA1
;
8948 salt_type
= SALT_TYPE_INTERN
;
8949 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8950 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8951 | OPTS_TYPE_ST_ADD80
;
8952 kern_type
= KERN_TYPE_ANDROIDPIN
;
8953 dgst_size
= DGST_SIZE_4_5
;
8954 parse_func
= androidpin_parse_hash
;
8955 sort_by_digest
= sort_by_digest_4_5
;
8956 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8963 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8964 salt_type
= SALT_TYPE_NONE
;
8965 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8966 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8967 | OPTS_TYPE_PT_ADD80
;
8968 kern_type
= KERN_TYPE_RIPEMD160
;
8969 dgst_size
= DGST_SIZE_4_5
;
8970 parse_func
= ripemd160_parse_hash
;
8971 sort_by_digest
= sort_by_digest_4_5
;
8972 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8979 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8980 salt_type
= SALT_TYPE_NONE
;
8981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8982 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8983 | OPTS_TYPE_PT_ADD80
;
8984 kern_type
= KERN_TYPE_WHIRLPOOL
;
8985 dgst_size
= DGST_SIZE_4_16
;
8986 parse_func
= whirlpool_parse_hash
;
8987 sort_by_digest
= sort_by_digest_4_16
;
8988 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8995 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8996 salt_type
= SALT_TYPE_EMBEDDED
;
8997 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8998 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8999 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9000 dgst_size
= DGST_SIZE_4_5
;
9001 parse_func
= truecrypt_parse_hash_2k
;
9002 sort_by_digest
= sort_by_digest_4_5
;
9003 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9010 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9011 salt_type
= SALT_TYPE_EMBEDDED
;
9012 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9013 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9014 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9015 dgst_size
= DGST_SIZE_4_5
;
9016 parse_func
= truecrypt_parse_hash_2k
;
9017 sort_by_digest
= sort_by_digest_4_5
;
9018 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9025 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9026 salt_type
= SALT_TYPE_EMBEDDED
;
9027 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9028 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9029 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9030 dgst_size
= DGST_SIZE_4_5
;
9031 parse_func
= truecrypt_parse_hash_2k
;
9032 sort_by_digest
= sort_by_digest_4_5
;
9033 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9040 case 6221: hash_type
= HASH_TYPE_SHA512
;
9041 salt_type
= SALT_TYPE_EMBEDDED
;
9042 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9043 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9044 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9045 dgst_size
= DGST_SIZE_8_8
;
9046 parse_func
= truecrypt_parse_hash_1k
;
9047 sort_by_digest
= sort_by_digest_8_8
;
9048 opti_type
= OPTI_TYPE_ZERO_BYTE
9049 | OPTI_TYPE_USES_BITS_64
;
9056 case 6222: hash_type
= HASH_TYPE_SHA512
;
9057 salt_type
= SALT_TYPE_EMBEDDED
;
9058 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9059 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9060 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9061 dgst_size
= DGST_SIZE_8_8
;
9062 parse_func
= truecrypt_parse_hash_1k
;
9063 sort_by_digest
= sort_by_digest_8_8
;
9064 opti_type
= OPTI_TYPE_ZERO_BYTE
9065 | OPTI_TYPE_USES_BITS_64
;
9072 case 6223: hash_type
= HASH_TYPE_SHA512
;
9073 salt_type
= SALT_TYPE_EMBEDDED
;
9074 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9075 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9076 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9077 dgst_size
= DGST_SIZE_8_8
;
9078 parse_func
= truecrypt_parse_hash_1k
;
9079 sort_by_digest
= sort_by_digest_8_8
;
9080 opti_type
= OPTI_TYPE_ZERO_BYTE
9081 | OPTI_TYPE_USES_BITS_64
;
9088 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9089 salt_type
= SALT_TYPE_EMBEDDED
;
9090 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9092 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9093 dgst_size
= DGST_SIZE_4_8
;
9094 parse_func
= truecrypt_parse_hash_1k
;
9095 sort_by_digest
= sort_by_digest_4_8
;
9096 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9103 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9104 salt_type
= SALT_TYPE_EMBEDDED
;
9105 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9106 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9107 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9108 dgst_size
= DGST_SIZE_4_8
;
9109 parse_func
= truecrypt_parse_hash_1k
;
9110 sort_by_digest
= sort_by_digest_4_8
;
9111 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9118 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9119 salt_type
= SALT_TYPE_EMBEDDED
;
9120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9122 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9123 dgst_size
= DGST_SIZE_4_8
;
9124 parse_func
= truecrypt_parse_hash_1k
;
9125 sort_by_digest
= sort_by_digest_4_8
;
9126 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9133 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9134 salt_type
= SALT_TYPE_EMBEDDED
;
9135 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9137 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9138 dgst_size
= DGST_SIZE_4_5
;
9139 parse_func
= truecrypt_parse_hash_1k
;
9140 sort_by_digest
= sort_by_digest_4_5
;
9141 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9148 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9149 salt_type
= SALT_TYPE_EMBEDDED
;
9150 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9151 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9152 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9153 dgst_size
= DGST_SIZE_4_5
;
9154 parse_func
= truecrypt_parse_hash_1k
;
9155 sort_by_digest
= sort_by_digest_4_5
;
9156 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9163 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9164 salt_type
= SALT_TYPE_EMBEDDED
;
9165 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9166 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9167 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9168 dgst_size
= DGST_SIZE_4_5
;
9169 parse_func
= truecrypt_parse_hash_1k
;
9170 sort_by_digest
= sort_by_digest_4_5
;
9171 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9178 case 6300: hash_type
= HASH_TYPE_MD5
;
9179 salt_type
= SALT_TYPE_EMBEDDED
;
9180 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9182 kern_type
= KERN_TYPE_MD5AIX
;
9183 dgst_size
= DGST_SIZE_4_4
;
9184 parse_func
= md5aix_parse_hash
;
9185 sort_by_digest
= sort_by_digest_4_4
;
9186 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9193 case 6400: hash_type
= HASH_TYPE_SHA256
;
9194 salt_type
= SALT_TYPE_EMBEDDED
;
9195 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9197 kern_type
= KERN_TYPE_SHA256AIX
;
9198 dgst_size
= DGST_SIZE_4_8
;
9199 parse_func
= sha256aix_parse_hash
;
9200 sort_by_digest
= sort_by_digest_4_8
;
9201 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9208 case 6500: hash_type
= HASH_TYPE_SHA512
;
9209 salt_type
= SALT_TYPE_EMBEDDED
;
9210 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9211 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9212 kern_type
= KERN_TYPE_SHA512AIX
;
9213 dgst_size
= DGST_SIZE_8_8
;
9214 parse_func
= sha512aix_parse_hash
;
9215 sort_by_digest
= sort_by_digest_8_8
;
9216 opti_type
= OPTI_TYPE_ZERO_BYTE
9217 | OPTI_TYPE_USES_BITS_64
;
9224 case 6600: hash_type
= HASH_TYPE_AES
;
9225 salt_type
= SALT_TYPE_EMBEDDED
;
9226 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9227 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9228 kern_type
= KERN_TYPE_AGILEKEY
;
9229 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9230 parse_func
= agilekey_parse_hash
;
9231 sort_by_digest
= sort_by_digest_4_5
;
9232 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9239 case 6700: hash_type
= HASH_TYPE_SHA1
;
9240 salt_type
= SALT_TYPE_EMBEDDED
;
9241 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9242 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9243 kern_type
= KERN_TYPE_SHA1AIX
;
9244 dgst_size
= DGST_SIZE_4_5
;
9245 parse_func
= sha1aix_parse_hash
;
9246 sort_by_digest
= sort_by_digest_4_5
;
9247 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9254 case 6800: hash_type
= HASH_TYPE_AES
;
9255 salt_type
= SALT_TYPE_EMBEDDED
;
9256 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9257 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9258 kern_type
= KERN_TYPE_LASTPASS
;
9259 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9260 parse_func
= lastpass_parse_hash
;
9261 sort_by_digest
= sort_by_digest_4_8
;
9262 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9269 case 6900: hash_type
= HASH_TYPE_GOST
;
9270 salt_type
= SALT_TYPE_NONE
;
9271 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9272 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9273 kern_type
= KERN_TYPE_GOST
;
9274 dgst_size
= DGST_SIZE_4_8
;
9275 parse_func
= gost_parse_hash
;
9276 sort_by_digest
= sort_by_digest_4_8
;
9277 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9284 case 7100: hash_type
= HASH_TYPE_SHA512
;
9285 salt_type
= SALT_TYPE_EMBEDDED
;
9286 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9287 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9288 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9289 dgst_size
= DGST_SIZE_8_16
;
9290 parse_func
= sha512osx_parse_hash
;
9291 sort_by_digest
= sort_by_digest_8_16
;
9292 opti_type
= OPTI_TYPE_ZERO_BYTE
9293 | OPTI_TYPE_USES_BITS_64
9294 | OPTI_TYPE_SLOW_HASH_SIMD
;
9301 case 7200: hash_type
= HASH_TYPE_SHA512
;
9302 salt_type
= SALT_TYPE_EMBEDDED
;
9303 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9304 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9305 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9306 dgst_size
= DGST_SIZE_8_16
;
9307 parse_func
= sha512grub_parse_hash
;
9308 sort_by_digest
= sort_by_digest_8_16
;
9309 opti_type
= OPTI_TYPE_ZERO_BYTE
9310 | OPTI_TYPE_USES_BITS_64
9311 | OPTI_TYPE_SLOW_HASH_SIMD
;
9318 case 7300: hash_type
= HASH_TYPE_SHA1
;
9319 salt_type
= SALT_TYPE_EMBEDDED
;
9320 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9321 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9322 | OPTS_TYPE_ST_ADD80
9323 | OPTS_TYPE_ST_ADDBITS15
;
9324 kern_type
= KERN_TYPE_RAKP
;
9325 dgst_size
= DGST_SIZE_4_5
;
9326 parse_func
= rakp_parse_hash
;
9327 sort_by_digest
= sort_by_digest_4_5
;
9328 opti_type
= OPTI_TYPE_ZERO_BYTE
9329 | OPTI_TYPE_NOT_ITERATED
;
9336 case 7400: hash_type
= HASH_TYPE_SHA256
;
9337 salt_type
= SALT_TYPE_EMBEDDED
;
9338 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9339 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9340 kern_type
= KERN_TYPE_SHA256CRYPT
;
9341 dgst_size
= DGST_SIZE_4_8
;
9342 parse_func
= sha256crypt_parse_hash
;
9343 sort_by_digest
= sort_by_digest_4_8
;
9344 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9351 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9352 salt_type
= SALT_TYPE_EMBEDDED
;
9353 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9354 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9355 kern_type
= KERN_TYPE_KRB5PA
;
9356 dgst_size
= DGST_SIZE_4_4
;
9357 parse_func
= krb5pa_parse_hash
;
9358 sort_by_digest
= sort_by_digest_4_4
;
9359 opti_type
= OPTI_TYPE_ZERO_BYTE
9360 | OPTI_TYPE_NOT_ITERATED
;
9367 case 7600: hash_type
= HASH_TYPE_SHA1
;
9368 salt_type
= SALT_TYPE_INTERN
;
9369 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9370 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9371 | OPTS_TYPE_PT_ADD80
9372 | OPTS_TYPE_PT_ADDBITS15
;
9373 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9374 dgst_size
= DGST_SIZE_4_5
;
9375 parse_func
= redmine_parse_hash
;
9376 sort_by_digest
= sort_by_digest_4_5
;
9377 opti_type
= OPTI_TYPE_ZERO_BYTE
9378 | OPTI_TYPE_PRECOMPUTE_INIT
9379 | OPTI_TYPE_EARLY_SKIP
9380 | OPTI_TYPE_NOT_ITERATED
9381 | OPTI_TYPE_PREPENDED_SALT
;
9388 case 7700: hash_type
= HASH_TYPE_SAPB
;
9389 salt_type
= SALT_TYPE_EMBEDDED
;
9390 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9391 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9392 | OPTS_TYPE_PT_UPPER
9393 | OPTS_TYPE_ST_UPPER
;
9394 kern_type
= KERN_TYPE_SAPB
;
9395 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9396 parse_func
= sapb_parse_hash
;
9397 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9398 opti_type
= OPTI_TYPE_ZERO_BYTE
9399 | OPTI_TYPE_PRECOMPUTE_INIT
9400 | OPTI_TYPE_NOT_ITERATED
;
9407 case 7800: hash_type
= HASH_TYPE_SAPG
;
9408 salt_type
= SALT_TYPE_EMBEDDED
;
9409 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9410 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9411 | OPTS_TYPE_ST_ADD80
9412 | OPTS_TYPE_ST_UPPER
;
9413 kern_type
= KERN_TYPE_SAPG
;
9414 dgst_size
= DGST_SIZE_4_5
;
9415 parse_func
= sapg_parse_hash
;
9416 sort_by_digest
= sort_by_digest_4_5
;
9417 opti_type
= OPTI_TYPE_ZERO_BYTE
9418 | OPTI_TYPE_PRECOMPUTE_INIT
9419 | OPTI_TYPE_NOT_ITERATED
;
9426 case 7900: hash_type
= HASH_TYPE_SHA512
;
9427 salt_type
= SALT_TYPE_EMBEDDED
;
9428 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9429 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9430 kern_type
= KERN_TYPE_DRUPAL7
;
9431 dgst_size
= DGST_SIZE_8_8
;
9432 parse_func
= drupal7_parse_hash
;
9433 sort_by_digest
= sort_by_digest_8_8
;
9434 opti_type
= OPTI_TYPE_ZERO_BYTE
9435 | OPTI_TYPE_USES_BITS_64
;
9442 case 8000: hash_type
= HASH_TYPE_SHA256
;
9443 salt_type
= SALT_TYPE_EMBEDDED
;
9444 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9445 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9446 | OPTS_TYPE_PT_UNICODE
9447 | OPTS_TYPE_ST_ADD80
9449 kern_type
= KERN_TYPE_SYBASEASE
;
9450 dgst_size
= DGST_SIZE_4_8
;
9451 parse_func
= sybasease_parse_hash
;
9452 sort_by_digest
= sort_by_digest_4_8
;
9453 opti_type
= OPTI_TYPE_ZERO_BYTE
9454 | OPTI_TYPE_PRECOMPUTE_INIT
9455 | OPTI_TYPE_EARLY_SKIP
9456 | OPTI_TYPE_NOT_ITERATED
9457 | OPTI_TYPE_RAW_HASH
;
9464 case 8100: hash_type
= HASH_TYPE_SHA1
;
9465 salt_type
= SALT_TYPE_EMBEDDED
;
9466 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9467 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9468 kern_type
= KERN_TYPE_NETSCALER
;
9469 dgst_size
= DGST_SIZE_4_5
;
9470 parse_func
= netscaler_parse_hash
;
9471 sort_by_digest
= sort_by_digest_4_5
;
9472 opti_type
= OPTI_TYPE_ZERO_BYTE
9473 | OPTI_TYPE_PRECOMPUTE_INIT
9474 | OPTI_TYPE_PRECOMPUTE_MERKLE
9475 | OPTI_TYPE_EARLY_SKIP
9476 | OPTI_TYPE_NOT_ITERATED
9477 | OPTI_TYPE_PREPENDED_SALT
9478 | OPTI_TYPE_RAW_HASH
;
9485 case 8200: hash_type
= HASH_TYPE_SHA256
;
9486 salt_type
= SALT_TYPE_EMBEDDED
;
9487 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9488 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9489 kern_type
= KERN_TYPE_CLOUDKEY
;
9490 dgst_size
= DGST_SIZE_4_8
;
9491 parse_func
= cloudkey_parse_hash
;
9492 sort_by_digest
= sort_by_digest_4_8
;
9493 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9500 case 8300: hash_type
= HASH_TYPE_SHA1
;
9501 salt_type
= SALT_TYPE_EMBEDDED
;
9502 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9503 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9505 | OPTS_TYPE_ST_ADD80
;
9506 kern_type
= KERN_TYPE_NSEC3
;
9507 dgst_size
= DGST_SIZE_4_5
;
9508 parse_func
= nsec3_parse_hash
;
9509 sort_by_digest
= sort_by_digest_4_5
;
9510 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9517 case 8400: hash_type
= HASH_TYPE_SHA1
;
9518 salt_type
= SALT_TYPE_INTERN
;
9519 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9520 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9521 | OPTS_TYPE_PT_ADD80
9522 | OPTS_TYPE_PT_ADDBITS15
;
9523 kern_type
= KERN_TYPE_WBB3
;
9524 dgst_size
= DGST_SIZE_4_5
;
9525 parse_func
= wbb3_parse_hash
;
9526 sort_by_digest
= sort_by_digest_4_5
;
9527 opti_type
= OPTI_TYPE_ZERO_BYTE
9528 | OPTI_TYPE_PRECOMPUTE_INIT
9529 | OPTI_TYPE_NOT_ITERATED
;
9536 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9537 salt_type
= SALT_TYPE_EMBEDDED
;
9538 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9540 | OPTS_TYPE_ST_UPPER
;
9541 kern_type
= KERN_TYPE_RACF
;
9542 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9543 parse_func
= racf_parse_hash
;
9544 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9545 opti_type
= OPTI_TYPE_ZERO_BYTE
9546 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9553 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9554 salt_type
= SALT_TYPE_NONE
;
9555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9556 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9557 kern_type
= KERN_TYPE_LOTUS5
;
9558 dgst_size
= DGST_SIZE_4_4
;
9559 parse_func
= lotus5_parse_hash
;
9560 sort_by_digest
= sort_by_digest_4_4
;
9561 opti_type
= OPTI_TYPE_EARLY_SKIP
9562 | OPTI_TYPE_NOT_ITERATED
9563 | OPTI_TYPE_NOT_SALTED
9564 | OPTI_TYPE_RAW_HASH
;
9571 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9572 salt_type
= SALT_TYPE_EMBEDDED
;
9573 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9575 kern_type
= KERN_TYPE_LOTUS6
;
9576 dgst_size
= DGST_SIZE_4_4
;
9577 parse_func
= lotus6_parse_hash
;
9578 sort_by_digest
= sort_by_digest_4_4
;
9579 opti_type
= OPTI_TYPE_EARLY_SKIP
9580 | OPTI_TYPE_NOT_ITERATED
9581 | OPTI_TYPE_RAW_HASH
;
9588 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9589 salt_type
= SALT_TYPE_EMBEDDED
;
9590 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9591 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9592 kern_type
= KERN_TYPE_ANDROIDFDE
;
9593 dgst_size
= DGST_SIZE_4_4
;
9594 parse_func
= androidfde_parse_hash
;
9595 sort_by_digest
= sort_by_digest_4_4
;
9596 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9603 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9604 salt_type
= SALT_TYPE_EMBEDDED
;
9605 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9606 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9607 kern_type
= KERN_TYPE_SCRYPT
;
9608 dgst_size
= DGST_SIZE_4_8
;
9609 parse_func
= scrypt_parse_hash
;
9610 sort_by_digest
= sort_by_digest_4_8
;
9611 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9618 case 9000: hash_type
= HASH_TYPE_SHA1
;
9619 salt_type
= SALT_TYPE_EMBEDDED
;
9620 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9621 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9622 | OPTS_TYPE_ST_GENERATE_LE
;
9623 kern_type
= KERN_TYPE_PSAFE2
;
9624 dgst_size
= DGST_SIZE_4_5
;
9625 parse_func
= psafe2_parse_hash
;
9626 sort_by_digest
= sort_by_digest_4_5
;
9627 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9634 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9635 salt_type
= SALT_TYPE_EMBEDDED
;
9636 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9637 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9638 kern_type
= KERN_TYPE_LOTUS8
;
9639 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9640 parse_func
= lotus8_parse_hash
;
9641 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9649 case 9200: hash_type
= HASH_TYPE_SHA256
;
9650 salt_type
= SALT_TYPE_EMBEDDED
;
9651 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9653 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9654 dgst_size
= DGST_SIZE_4_32
;
9655 parse_func
= cisco8_parse_hash
;
9656 sort_by_digest
= sort_by_digest_4_32
;
9657 opti_type
= OPTI_TYPE_ZERO_BYTE
9658 | OPTI_TYPE_SLOW_HASH_SIMD
;
9665 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9666 salt_type
= SALT_TYPE_EMBEDDED
;
9667 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9668 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9669 kern_type
= KERN_TYPE_SCRYPT
;
9670 dgst_size
= DGST_SIZE_4_8
;
9671 parse_func
= cisco9_parse_hash
;
9672 sort_by_digest
= sort_by_digest_4_8
;
9673 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9680 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9681 salt_type
= SALT_TYPE_EMBEDDED
;
9682 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9683 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9684 kern_type
= KERN_TYPE_OFFICE2007
;
9685 dgst_size
= DGST_SIZE_4_4
;
9686 parse_func
= office2007_parse_hash
;
9687 sort_by_digest
= sort_by_digest_4_4
;
9688 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9695 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9696 salt_type
= SALT_TYPE_EMBEDDED
;
9697 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9698 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9699 kern_type
= KERN_TYPE_OFFICE2010
;
9700 dgst_size
= DGST_SIZE_4_4
;
9701 parse_func
= office2010_parse_hash
;
9702 sort_by_digest
= sort_by_digest_4_4
;
9703 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9710 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9711 salt_type
= SALT_TYPE_EMBEDDED
;
9712 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9713 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9714 kern_type
= KERN_TYPE_OFFICE2013
;
9715 dgst_size
= DGST_SIZE_4_4
;
9716 parse_func
= office2013_parse_hash
;
9717 sort_by_digest
= sort_by_digest_4_4
;
9718 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9725 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9726 salt_type
= SALT_TYPE_EMBEDDED
;
9727 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9728 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9729 | OPTS_TYPE_PT_ADD80
9730 | OPTS_TYPE_PT_UNICODE
;
9731 kern_type
= KERN_TYPE_OLDOFFICE01
;
9732 dgst_size
= DGST_SIZE_4_4
;
9733 parse_func
= oldoffice01_parse_hash
;
9734 sort_by_digest
= sort_by_digest_4_4
;
9735 opti_type
= OPTI_TYPE_ZERO_BYTE
9736 | OPTI_TYPE_PRECOMPUTE_INIT
9737 | OPTI_TYPE_NOT_ITERATED
;
9744 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9745 salt_type
= SALT_TYPE_EMBEDDED
;
9746 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9747 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9748 | OPTS_TYPE_PT_ADD80
;
9749 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9750 dgst_size
= DGST_SIZE_4_4
;
9751 parse_func
= oldoffice01cm1_parse_hash
;
9752 sort_by_digest
= sort_by_digest_4_4
;
9753 opti_type
= OPTI_TYPE_ZERO_BYTE
9754 | OPTI_TYPE_PRECOMPUTE_INIT
9755 | OPTI_TYPE_NOT_ITERATED
;
9762 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9763 salt_type
= SALT_TYPE_EMBEDDED
;
9764 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9765 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9766 | OPTS_TYPE_PT_ADD80
9767 | OPTS_TYPE_PT_UNICODE
9768 | OPTS_TYPE_PT_NEVERCRACK
;
9769 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9770 dgst_size
= DGST_SIZE_4_4
;
9771 parse_func
= oldoffice01cm2_parse_hash
;
9772 sort_by_digest
= sort_by_digest_4_4
;
9773 opti_type
= OPTI_TYPE_ZERO_BYTE
9774 | OPTI_TYPE_PRECOMPUTE_INIT
9775 | OPTI_TYPE_NOT_ITERATED
;
9782 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9783 salt_type
= SALT_TYPE_EMBEDDED
;
9784 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9785 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9786 | OPTS_TYPE_PT_ADD80
9787 | OPTS_TYPE_PT_UNICODE
;
9788 kern_type
= KERN_TYPE_OLDOFFICE34
;
9789 dgst_size
= DGST_SIZE_4_4
;
9790 parse_func
= oldoffice34_parse_hash
;
9791 sort_by_digest
= sort_by_digest_4_4
;
9792 opti_type
= OPTI_TYPE_ZERO_BYTE
9793 | OPTI_TYPE_PRECOMPUTE_INIT
9794 | OPTI_TYPE_NOT_ITERATED
;
9801 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9802 salt_type
= SALT_TYPE_EMBEDDED
;
9803 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9804 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9805 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9806 dgst_size
= DGST_SIZE_4_4
;
9807 parse_func
= oldoffice34cm1_parse_hash
;
9808 sort_by_digest
= sort_by_digest_4_4
;
9809 opti_type
= OPTI_TYPE_ZERO_BYTE
9810 | OPTI_TYPE_PRECOMPUTE_INIT
9811 | OPTI_TYPE_NOT_ITERATED
;
9818 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9819 salt_type
= SALT_TYPE_EMBEDDED
;
9820 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9821 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9822 | OPTS_TYPE_PT_ADD80
9823 | OPTS_TYPE_PT_UNICODE
9824 | OPTS_TYPE_PT_NEVERCRACK
;
9825 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9826 dgst_size
= DGST_SIZE_4_4
;
9827 parse_func
= oldoffice34cm2_parse_hash
;
9828 sort_by_digest
= sort_by_digest_4_4
;
9829 opti_type
= OPTI_TYPE_ZERO_BYTE
9830 | OPTI_TYPE_PRECOMPUTE_INIT
9831 | OPTI_TYPE_NOT_ITERATED
;
9838 case 9900: hash_type
= HASH_TYPE_MD5
;
9839 salt_type
= SALT_TYPE_NONE
;
9840 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9841 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9842 kern_type
= KERN_TYPE_RADMIN2
;
9843 dgst_size
= DGST_SIZE_4_4
;
9844 parse_func
= radmin2_parse_hash
;
9845 sort_by_digest
= sort_by_digest_4_4
;
9846 opti_type
= OPTI_TYPE_ZERO_BYTE
9847 | OPTI_TYPE_PRECOMPUTE_INIT
9848 | OPTI_TYPE_EARLY_SKIP
9849 | OPTI_TYPE_NOT_ITERATED
9850 | OPTI_TYPE_NOT_SALTED
;
9857 case 10000: hash_type
= HASH_TYPE_SHA256
;
9858 salt_type
= SALT_TYPE_EMBEDDED
;
9859 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9861 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9862 dgst_size
= DGST_SIZE_4_32
;
9863 parse_func
= djangopbkdf2_parse_hash
;
9864 sort_by_digest
= sort_by_digest_4_32
;
9865 opti_type
= OPTI_TYPE_ZERO_BYTE
9866 | OPTI_TYPE_SLOW_HASH_SIMD
;
9873 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9874 salt_type
= SALT_TYPE_EMBEDDED
;
9875 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9876 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9877 kern_type
= KERN_TYPE_SIPHASH
;
9878 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9879 parse_func
= siphash_parse_hash
;
9880 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9881 opti_type
= OPTI_TYPE_ZERO_BYTE
9882 | OPTI_TYPE_NOT_ITERATED
9883 | OPTI_TYPE_RAW_HASH
;
9890 case 10200: hash_type
= HASH_TYPE_MD5
;
9891 salt_type
= SALT_TYPE_EMBEDDED
;
9892 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9893 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9894 | OPTS_TYPE_ST_ADD80
9895 | OPTS_TYPE_ST_ADDBITS14
;
9896 kern_type
= KERN_TYPE_HMACMD5_PW
;
9897 dgst_size
= DGST_SIZE_4_4
;
9898 parse_func
= crammd5_parse_hash
;
9899 sort_by_digest
= sort_by_digest_4_4
;
9900 opti_type
= OPTI_TYPE_ZERO_BYTE
9901 | OPTI_TYPE_NOT_ITERATED
;
9908 case 10300: hash_type
= HASH_TYPE_SHA1
;
9909 salt_type
= SALT_TYPE_EMBEDDED
;
9910 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9911 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9912 kern_type
= KERN_TYPE_SAPH_SHA1
;
9913 dgst_size
= DGST_SIZE_4_5
;
9914 parse_func
= saph_sha1_parse_hash
;
9915 sort_by_digest
= sort_by_digest_4_5
;
9916 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9923 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9924 salt_type
= SALT_TYPE_EMBEDDED
;
9925 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9926 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9927 kern_type
= KERN_TYPE_PDF11
;
9928 dgst_size
= DGST_SIZE_4_4
;
9929 parse_func
= pdf11_parse_hash
;
9930 sort_by_digest
= sort_by_digest_4_4
;
9931 opti_type
= OPTI_TYPE_ZERO_BYTE
9932 | OPTI_TYPE_NOT_ITERATED
;
9939 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9940 salt_type
= SALT_TYPE_EMBEDDED
;
9941 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9942 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9943 kern_type
= KERN_TYPE_PDF11CM1
;
9944 dgst_size
= DGST_SIZE_4_4
;
9945 parse_func
= pdf11cm1_parse_hash
;
9946 sort_by_digest
= sort_by_digest_4_4
;
9947 opti_type
= OPTI_TYPE_ZERO_BYTE
9948 | OPTI_TYPE_NOT_ITERATED
;
9955 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9956 salt_type
= SALT_TYPE_EMBEDDED
;
9957 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9958 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9959 kern_type
= KERN_TYPE_PDF11CM2
;
9960 dgst_size
= DGST_SIZE_4_4
;
9961 parse_func
= pdf11cm2_parse_hash
;
9962 sort_by_digest
= sort_by_digest_4_4
;
9963 opti_type
= OPTI_TYPE_ZERO_BYTE
9964 | OPTI_TYPE_NOT_ITERATED
;
9971 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9972 salt_type
= SALT_TYPE_EMBEDDED
;
9973 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9974 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9975 kern_type
= KERN_TYPE_PDF14
;
9976 dgst_size
= DGST_SIZE_4_4
;
9977 parse_func
= pdf14_parse_hash
;
9978 sort_by_digest
= sort_by_digest_4_4
;
9979 opti_type
= OPTI_TYPE_ZERO_BYTE
9980 | OPTI_TYPE_NOT_ITERATED
;
9987 case 10600: hash_type
= HASH_TYPE_SHA256
;
9988 salt_type
= SALT_TYPE_EMBEDDED
;
9989 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9990 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9991 | OPTS_TYPE_ST_ADD80
9992 | OPTS_TYPE_ST_ADDBITS15
9993 | OPTS_TYPE_HASH_COPY
;
9994 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9995 dgst_size
= DGST_SIZE_4_8
;
9996 parse_func
= pdf17l3_parse_hash
;
9997 sort_by_digest
= sort_by_digest_4_8
;
9998 opti_type
= OPTI_TYPE_ZERO_BYTE
9999 | OPTI_TYPE_PRECOMPUTE_INIT
10000 | OPTI_TYPE_PRECOMPUTE_MERKLE
10001 | OPTI_TYPE_EARLY_SKIP
10002 | OPTI_TYPE_NOT_ITERATED
10003 | OPTI_TYPE_APPENDED_SALT
10004 | OPTI_TYPE_RAW_HASH
;
10011 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10012 salt_type
= SALT_TYPE_EMBEDDED
;
10013 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10014 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10015 | OPTS_TYPE_HASH_COPY
;
10016 kern_type
= KERN_TYPE_PDF17L8
;
10017 dgst_size
= DGST_SIZE_4_8
;
10018 parse_func
= pdf17l8_parse_hash
;
10019 sort_by_digest
= sort_by_digest_4_8
;
10020 opti_type
= OPTI_TYPE_ZERO_BYTE
10021 | OPTI_TYPE_NOT_ITERATED
;
10028 case 10800: hash_type
= HASH_TYPE_SHA384
;
10029 salt_type
= SALT_TYPE_NONE
;
10030 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10031 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10032 | OPTS_TYPE_PT_ADD80
10033 | OPTS_TYPE_PT_ADDBITS15
;
10034 kern_type
= KERN_TYPE_SHA384
;
10035 dgst_size
= DGST_SIZE_8_8
;
10036 parse_func
= sha384_parse_hash
;
10037 sort_by_digest
= sort_by_digest_8_8
;
10038 opti_type
= OPTI_TYPE_ZERO_BYTE
10039 | OPTI_TYPE_PRECOMPUTE_INIT
10040 | OPTI_TYPE_PRECOMPUTE_MERKLE
10041 | OPTI_TYPE_EARLY_SKIP
10042 | OPTI_TYPE_NOT_ITERATED
10043 | OPTI_TYPE_NOT_SALTED
10044 | OPTI_TYPE_USES_BITS_64
10045 | OPTI_TYPE_RAW_HASH
;
10052 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10053 salt_type
= SALT_TYPE_EMBEDDED
;
10054 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10055 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10056 | OPTS_TYPE_ST_BASE64
10057 | OPTS_TYPE_HASH_COPY
;
10058 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10059 dgst_size
= DGST_SIZE_4_32
;
10060 parse_func
= pbkdf2_sha256_parse_hash
;
10061 sort_by_digest
= sort_by_digest_4_32
;
10062 opti_type
= OPTI_TYPE_ZERO_BYTE
10063 | OPTI_TYPE_SLOW_HASH_SIMD
;
10070 case 11000: hash_type
= HASH_TYPE_MD5
;
10071 salt_type
= SALT_TYPE_INTERN
;
10072 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10073 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10074 | OPTS_TYPE_PT_ADD80
;
10075 kern_type
= KERN_TYPE_PRESTASHOP
;
10076 dgst_size
= DGST_SIZE_4_4
;
10077 parse_func
= prestashop_parse_hash
;
10078 sort_by_digest
= sort_by_digest_4_4
;
10079 opti_type
= OPTI_TYPE_ZERO_BYTE
10080 | OPTI_TYPE_PRECOMPUTE_INIT
10081 | OPTI_TYPE_NOT_ITERATED
10082 | OPTI_TYPE_PREPENDED_SALT
;
10089 case 11100: hash_type
= HASH_TYPE_MD5
;
10090 salt_type
= SALT_TYPE_EMBEDDED
;
10091 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10092 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10093 | OPTS_TYPE_ST_ADD80
;
10094 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10095 dgst_size
= DGST_SIZE_4_4
;
10096 parse_func
= postgresql_auth_parse_hash
;
10097 sort_by_digest
= sort_by_digest_4_4
;
10098 opti_type
= OPTI_TYPE_ZERO_BYTE
10099 | OPTI_TYPE_PRECOMPUTE_INIT
10100 | OPTI_TYPE_PRECOMPUTE_MERKLE
10101 | OPTI_TYPE_EARLY_SKIP
;
10108 case 11200: hash_type
= HASH_TYPE_SHA1
;
10109 salt_type
= SALT_TYPE_EMBEDDED
;
10110 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10111 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10112 | OPTS_TYPE_PT_ADD80
10113 | OPTS_TYPE_ST_HEX
;
10114 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10115 dgst_size
= DGST_SIZE_4_5
;
10116 parse_func
= mysql_auth_parse_hash
;
10117 sort_by_digest
= sort_by_digest_4_5
;
10118 opti_type
= OPTI_TYPE_ZERO_BYTE
10119 | OPTI_TYPE_EARLY_SKIP
;
10126 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10127 salt_type
= SALT_TYPE_EMBEDDED
;
10128 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10129 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10131 | OPTS_TYPE_ST_ADD80
;
10132 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10133 dgst_size
= DGST_SIZE_4_4
;
10134 parse_func
= bitcoin_wallet_parse_hash
;
10135 sort_by_digest
= sort_by_digest_4_4
;
10136 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10143 case 11400: hash_type
= HASH_TYPE_MD5
;
10144 salt_type
= SALT_TYPE_EMBEDDED
;
10145 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10146 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10147 | OPTS_TYPE_PT_ADD80
10148 | OPTS_TYPE_HASH_COPY
;
10149 kern_type
= KERN_TYPE_SIP_AUTH
;
10150 dgst_size
= DGST_SIZE_4_4
;
10151 parse_func
= sip_auth_parse_hash
;
10152 sort_by_digest
= sort_by_digest_4_4
;
10153 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10160 case 11500: hash_type
= HASH_TYPE_CRC32
;
10161 salt_type
= SALT_TYPE_INTERN
;
10162 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10164 | OPTS_TYPE_ST_GENERATE_LE
10165 | OPTS_TYPE_ST_HEX
;
10166 kern_type
= KERN_TYPE_CRC32
;
10167 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10168 parse_func
= crc32_parse_hash
;
10169 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10170 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10177 case 11600: hash_type
= HASH_TYPE_AES
;
10178 salt_type
= SALT_TYPE_EMBEDDED
;
10179 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10180 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10181 | OPTS_TYPE_PT_NEVERCRACK
;
10182 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10183 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10184 parse_func
= seven_zip_parse_hash
;
10185 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10186 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10193 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10194 salt_type
= SALT_TYPE_NONE
;
10195 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10197 | OPTS_TYPE_PT_ADD01
;
10198 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10199 dgst_size
= DGST_SIZE_4_8
;
10200 parse_func
= gost2012sbog_256_parse_hash
;
10201 sort_by_digest
= sort_by_digest_4_8
;
10202 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10209 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10210 salt_type
= SALT_TYPE_NONE
;
10211 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10212 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10213 | OPTS_TYPE_PT_ADD01
;
10214 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10215 dgst_size
= DGST_SIZE_4_16
;
10216 parse_func
= gost2012sbog_512_parse_hash
;
10217 sort_by_digest
= sort_by_digest_4_16
;
10218 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10225 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10226 salt_type
= SALT_TYPE_EMBEDDED
;
10227 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10228 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10229 | OPTS_TYPE_ST_BASE64
10230 | OPTS_TYPE_HASH_COPY
;
10231 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10232 dgst_size
= DGST_SIZE_4_32
;
10233 parse_func
= pbkdf2_md5_parse_hash
;
10234 sort_by_digest
= sort_by_digest_4_32
;
10235 opti_type
= OPTI_TYPE_ZERO_BYTE
10236 | OPTI_TYPE_SLOW_HASH_SIMD
;
10243 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10244 salt_type
= SALT_TYPE_EMBEDDED
;
10245 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10246 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10247 | OPTS_TYPE_ST_BASE64
10248 | OPTS_TYPE_HASH_COPY
;
10249 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10250 dgst_size
= DGST_SIZE_4_32
;
10251 parse_func
= pbkdf2_sha1_parse_hash
;
10252 sort_by_digest
= sort_by_digest_4_32
;
10253 opti_type
= OPTI_TYPE_ZERO_BYTE
10254 | OPTI_TYPE_SLOW_HASH_SIMD
;
10261 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10262 salt_type
= SALT_TYPE_EMBEDDED
;
10263 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10264 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10265 | OPTS_TYPE_ST_BASE64
10266 | OPTS_TYPE_HASH_COPY
;
10267 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10268 dgst_size
= DGST_SIZE_8_16
;
10269 parse_func
= pbkdf2_sha512_parse_hash
;
10270 sort_by_digest
= sort_by_digest_8_16
;
10271 opti_type
= OPTI_TYPE_ZERO_BYTE
10272 | OPTI_TYPE_USES_BITS_64
10273 | OPTI_TYPE_SLOW_HASH_SIMD
;
10280 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10281 salt_type
= SALT_TYPE_EMBEDDED
;
10282 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10283 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10284 kern_type
= KERN_TYPE_ECRYPTFS
;
10285 dgst_size
= DGST_SIZE_8_8
;
10286 parse_func
= ecryptfs_parse_hash
;
10287 sort_by_digest
= sort_by_digest_8_8
;
10288 opti_type
= OPTI_TYPE_ZERO_BYTE
10289 | OPTI_TYPE_USES_BITS_64
;
10296 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10297 salt_type
= SALT_TYPE_EMBEDDED
;
10298 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10299 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10300 kern_type
= KERN_TYPE_ORACLET
;
10301 dgst_size
= DGST_SIZE_8_16
;
10302 parse_func
= oraclet_parse_hash
;
10303 sort_by_digest
= sort_by_digest_8_16
;
10304 opti_type
= OPTI_TYPE_ZERO_BYTE
10305 | OPTI_TYPE_USES_BITS_64
;
10312 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10313 salt_type
= SALT_TYPE_EMBEDDED
;
10314 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10315 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10316 kern_type
= KERN_TYPE_BSDICRYPT
;
10317 dgst_size
= DGST_SIZE_4_4
;
10318 parse_func
= bsdicrypt_parse_hash
;
10319 sort_by_digest
= sort_by_digest_4_4
;
10320 opti_type
= OPTI_TYPE_ZERO_BYTE
10321 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10328 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10329 salt_type
= SALT_TYPE_EMBEDDED
;
10330 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10331 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10332 kern_type
= KERN_TYPE_RAR3
;
10333 dgst_size
= DGST_SIZE_4_4
;
10334 parse_func
= rar3hp_parse_hash
;
10335 sort_by_digest
= sort_by_digest_4_4
;
10336 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10343 case 12600: hash_type
= HASH_TYPE_SHA256
;
10344 salt_type
= SALT_TYPE_INTERN
;
10345 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10346 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10347 | OPTS_TYPE_PT_ADD80
;
10348 kern_type
= KERN_TYPE_CF10
;
10349 dgst_size
= DGST_SIZE_4_8
;
10350 parse_func
= cf10_parse_hash
;
10351 sort_by_digest
= sort_by_digest_4_8
;
10352 opti_type
= OPTI_TYPE_ZERO_BYTE
10353 | OPTI_TYPE_PRECOMPUTE_INIT
10354 | OPTI_TYPE_EARLY_SKIP
10355 | OPTI_TYPE_NOT_ITERATED
;
10362 case 12700: hash_type
= HASH_TYPE_AES
;
10363 salt_type
= SALT_TYPE_EMBEDDED
;
10364 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10365 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10366 | OPTS_TYPE_HASH_COPY
;
10367 kern_type
= KERN_TYPE_MYWALLET
;
10368 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10369 parse_func
= mywallet_parse_hash
;
10370 sort_by_digest
= sort_by_digest_4_5
;
10371 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10378 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10379 salt_type
= SALT_TYPE_EMBEDDED
;
10380 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10381 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10382 kern_type
= KERN_TYPE_MS_DRSR
;
10383 dgst_size
= DGST_SIZE_4_8
;
10384 parse_func
= ms_drsr_parse_hash
;
10385 sort_by_digest
= sort_by_digest_4_8
;
10386 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10393 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10394 salt_type
= SALT_TYPE_EMBEDDED
;
10395 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10396 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10397 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10398 dgst_size
= DGST_SIZE_4_8
;
10399 parse_func
= androidfde_samsung_parse_hash
;
10400 sort_by_digest
= sort_by_digest_4_8
;
10401 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10408 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10409 salt_type
= SALT_TYPE_EMBEDDED
;
10410 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10411 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10412 kern_type
= KERN_TYPE_RAR5
;
10413 dgst_size
= DGST_SIZE_4_4
;
10414 parse_func
= rar5_parse_hash
;
10415 sort_by_digest
= sort_by_digest_4_4
;
10416 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10423 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10424 salt_type
= SALT_TYPE_EMBEDDED
;
10425 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10426 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10427 kern_type
= KERN_TYPE_KRB5TGS
;
10428 dgst_size
= DGST_SIZE_4_4
;
10429 parse_func
= krb5tgs_parse_hash
;
10430 sort_by_digest
= sort_by_digest_4_4
;
10431 opti_type
= OPTI_TYPE_ZERO_BYTE
10432 | OPTI_TYPE_NOT_ITERATED
;
10439 case 13200: hash_type
= HASH_TYPE_AES
;
10440 salt_type
= SALT_TYPE_EMBEDDED
;
10441 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10443 kern_type
= KERN_TYPE_AXCRYPT
;
10444 dgst_size
= DGST_SIZE_4_4
;
10445 parse_func
= axcrypt_parse_hash
;
10446 sort_by_digest
= sort_by_digest_4_4
;
10447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10454 case 13300: hash_type
= HASH_TYPE_SHA1
;
10455 salt_type
= SALT_TYPE_NONE
;
10456 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10457 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10458 | OPTS_TYPE_PT_ADD80
10459 | OPTS_TYPE_PT_ADDBITS15
;
10460 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10461 dgst_size
= DGST_SIZE_4_5
;
10462 parse_func
= sha1axcrypt_parse_hash
;
10463 sort_by_digest
= sort_by_digest_4_5
;
10464 opti_type
= OPTI_TYPE_ZERO_BYTE
10465 | OPTI_TYPE_PRECOMPUTE_INIT
10466 | OPTI_TYPE_EARLY_SKIP
10467 | OPTI_TYPE_NOT_ITERATED
10468 | OPTI_TYPE_NOT_SALTED
;
10475 case 13400: hash_type
= HASH_TYPE_AES
;
10476 salt_type
= SALT_TYPE_EMBEDDED
;
10477 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10478 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10479 kern_type
= KERN_TYPE_KEEPASS
;
10480 dgst_size
= DGST_SIZE_4_4
;
10481 parse_func
= keepass_parse_hash
;
10482 sort_by_digest
= sort_by_digest_4_4
;
10483 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10490 case 13500: hash_type
= HASH_TYPE_SHA1
;
10491 salt_type
= SALT_TYPE_EMBEDDED
;
10492 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10493 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10494 | OPTS_TYPE_PT_UNICODE
10495 | OPTS_TYPE_PT_ADD80
;
10496 kern_type
= KERN_TYPE_PSTOKEN
;
10497 dgst_size
= DGST_SIZE_4_5
;
10498 parse_func
= pstoken_parse_hash
;
10499 sort_by_digest
= sort_by_digest_4_5
;
10500 opti_type
= OPTI_TYPE_ZERO_BYTE
10501 | OPTI_TYPE_PRECOMPUTE_INIT
10502 | OPTI_TYPE_EARLY_SKIP
10503 | OPTI_TYPE_NOT_ITERATED
10504 | OPTI_TYPE_PREPENDED_SALT
10505 | OPTI_TYPE_RAW_HASH
;
10512 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10513 salt_type
= SALT_TYPE_EMBEDDED
;
10514 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10515 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10516 kern_type
= KERN_TYPE_ZIP2
;
10517 dgst_size
= DGST_SIZE_4_4
;
10518 parse_func
= zip2_parse_hash
;
10519 sort_by_digest
= sort_by_digest_4_4
;
10520 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10527 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10528 salt_type
= SALT_TYPE_EMBEDDED
;
10529 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10530 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10531 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10532 dgst_size
= DGST_SIZE_4_5
;
10533 parse_func
= veracrypt_parse_hash_655331
;
10534 sort_by_digest
= sort_by_digest_4_5
;
10535 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10542 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10543 salt_type
= SALT_TYPE_EMBEDDED
;
10544 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10546 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10547 dgst_size
= DGST_SIZE_4_5
;
10548 parse_func
= veracrypt_parse_hash_655331
;
10549 sort_by_digest
= sort_by_digest_4_5
;
10550 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10557 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10558 salt_type
= SALT_TYPE_EMBEDDED
;
10559 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10560 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10561 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10562 dgst_size
= DGST_SIZE_4_5
;
10563 parse_func
= veracrypt_parse_hash_655331
;
10564 sort_by_digest
= sort_by_digest_4_5
;
10565 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10572 case 13721: hash_type
= HASH_TYPE_SHA512
;
10573 salt_type
= SALT_TYPE_EMBEDDED
;
10574 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10575 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10576 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10577 dgst_size
= DGST_SIZE_8_8
;
10578 parse_func
= veracrypt_parse_hash_500000
;
10579 sort_by_digest
= sort_by_digest_8_8
;
10580 opti_type
= OPTI_TYPE_ZERO_BYTE
10581 | OPTI_TYPE_USES_BITS_64
;
10588 case 13722: hash_type
= HASH_TYPE_SHA512
;
10589 salt_type
= SALT_TYPE_EMBEDDED
;
10590 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10591 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10592 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10593 dgst_size
= DGST_SIZE_8_8
;
10594 parse_func
= veracrypt_parse_hash_500000
;
10595 sort_by_digest
= sort_by_digest_8_8
;
10596 opti_type
= OPTI_TYPE_ZERO_BYTE
10597 | OPTI_TYPE_USES_BITS_64
;
10604 case 13723: hash_type
= HASH_TYPE_SHA512
;
10605 salt_type
= SALT_TYPE_EMBEDDED
;
10606 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10607 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10608 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10609 dgst_size
= DGST_SIZE_8_8
;
10610 parse_func
= veracrypt_parse_hash_500000
;
10611 sort_by_digest
= sort_by_digest_8_8
;
10612 opti_type
= OPTI_TYPE_ZERO_BYTE
10613 | OPTI_TYPE_USES_BITS_64
;
10620 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10621 salt_type
= SALT_TYPE_EMBEDDED
;
10622 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10623 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10624 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10625 dgst_size
= DGST_SIZE_4_8
;
10626 parse_func
= veracrypt_parse_hash_500000
;
10627 sort_by_digest
= sort_by_digest_4_8
;
10628 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10635 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10636 salt_type
= SALT_TYPE_EMBEDDED
;
10637 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10638 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10639 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10640 dgst_size
= DGST_SIZE_4_8
;
10641 parse_func
= veracrypt_parse_hash_500000
;
10642 sort_by_digest
= sort_by_digest_4_8
;
10643 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10650 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10651 salt_type
= SALT_TYPE_EMBEDDED
;
10652 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10653 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10654 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10655 dgst_size
= DGST_SIZE_4_8
;
10656 parse_func
= veracrypt_parse_hash_500000
;
10657 sort_by_digest
= sort_by_digest_4_8
;
10658 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10665 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10666 salt_type
= SALT_TYPE_EMBEDDED
;
10667 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10668 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10669 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10670 dgst_size
= DGST_SIZE_4_5
;
10671 parse_func
= veracrypt_parse_hash_327661
;
10672 sort_by_digest
= sort_by_digest_4_5
;
10673 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10680 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10681 salt_type
= SALT_TYPE_EMBEDDED
;
10682 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10683 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10684 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10685 dgst_size
= DGST_SIZE_4_5
;
10686 parse_func
= veracrypt_parse_hash_327661
;
10687 sort_by_digest
= sort_by_digest_4_5
;
10688 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10695 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10696 salt_type
= SALT_TYPE_EMBEDDED
;
10697 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10698 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10699 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10700 dgst_size
= DGST_SIZE_4_5
;
10701 parse_func
= veracrypt_parse_hash_327661
;
10702 sort_by_digest
= sort_by_digest_4_5
;
10703 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10710 case 13751: hash_type
= HASH_TYPE_SHA256
;
10711 salt_type
= SALT_TYPE_EMBEDDED
;
10712 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10713 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10714 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10715 dgst_size
= DGST_SIZE_4_8
;
10716 parse_func
= veracrypt_parse_hash_500000
;
10717 sort_by_digest
= sort_by_digest_4_8
;
10718 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10725 case 13752: hash_type
= HASH_TYPE_SHA256
;
10726 salt_type
= SALT_TYPE_EMBEDDED
;
10727 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10728 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10729 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10730 dgst_size
= DGST_SIZE_4_8
;
10731 parse_func
= veracrypt_parse_hash_500000
;
10732 sort_by_digest
= sort_by_digest_4_8
;
10733 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10740 case 13753: hash_type
= HASH_TYPE_SHA256
;
10741 salt_type
= SALT_TYPE_EMBEDDED
;
10742 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10744 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10745 dgst_size
= DGST_SIZE_4_8
;
10746 parse_func
= veracrypt_parse_hash_500000
;
10747 sort_by_digest
= sort_by_digest_4_8
;
10748 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10755 case 13761: hash_type
= HASH_TYPE_SHA256
;
10756 salt_type
= SALT_TYPE_EMBEDDED
;
10757 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10758 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10759 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10760 dgst_size
= DGST_SIZE_4_8
;
10761 parse_func
= veracrypt_parse_hash_200000
;
10762 sort_by_digest
= sort_by_digest_4_8
;
10763 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10770 case 13762: hash_type
= HASH_TYPE_SHA256
;
10771 salt_type
= SALT_TYPE_EMBEDDED
;
10772 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10774 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10775 dgst_size
= DGST_SIZE_4_8
;
10776 parse_func
= veracrypt_parse_hash_200000
;
10777 sort_by_digest
= sort_by_digest_4_8
;
10778 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10785 case 13763: hash_type
= HASH_TYPE_SHA256
;
10786 salt_type
= SALT_TYPE_EMBEDDED
;
10787 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10788 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10789 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10790 dgst_size
= DGST_SIZE_4_8
;
10791 parse_func
= veracrypt_parse_hash_200000
;
10792 sort_by_digest
= sort_by_digest_4_8
;
10793 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10801 default: usage_mini_print (PROGNAME
); return (-1);
10808 data
.parse_func
= parse_func
;
10816 if (salt_type
== SALT_TYPE_INTERN
)
10818 opts_type
|= OPTS_TYPE_ST_HEX
;
10822 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10828 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10829 | (salt_type
== SALT_TYPE_EXTERN
)
10830 | (salt_type
== SALT_TYPE_EMBEDDED
)
10831 | (salt_type
== SALT_TYPE_VIRTUAL
));
10833 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10835 data
.hash_type
= hash_type
;
10836 data
.attack_mode
= attack_mode
;
10837 data
.attack_kern
= attack_kern
;
10838 data
.attack_exec
= attack_exec
;
10839 data
.kern_type
= kern_type
;
10840 data
.opts_type
= opts_type
;
10841 data
.dgst_size
= dgst_size
;
10842 data
.salt_type
= salt_type
;
10843 data
.isSalted
= isSalted
;
10844 data
.sort_by_digest
= sort_by_digest
;
10845 data
.dgst_pos0
= dgst_pos0
;
10846 data
.dgst_pos1
= dgst_pos1
;
10847 data
.dgst_pos2
= dgst_pos2
;
10848 data
.dgst_pos3
= dgst_pos3
;
10854 case 2500: esalt_size
= sizeof (wpa_t
); break;
10855 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10856 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10857 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10858 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10859 case 6211: esalt_size
= sizeof (tc_t
); break;
10860 case 6212: esalt_size
= sizeof (tc_t
); break;
10861 case 6213: esalt_size
= sizeof (tc_t
); break;
10862 case 6221: esalt_size
= sizeof (tc_t
); break;
10863 case 6222: esalt_size
= sizeof (tc_t
); break;
10864 case 6223: esalt_size
= sizeof (tc_t
); break;
10865 case 6231: esalt_size
= sizeof (tc_t
); break;
10866 case 6232: esalt_size
= sizeof (tc_t
); break;
10867 case 6233: esalt_size
= sizeof (tc_t
); break;
10868 case 6241: esalt_size
= sizeof (tc_t
); break;
10869 case 6242: esalt_size
= sizeof (tc_t
); break;
10870 case 6243: esalt_size
= sizeof (tc_t
); break;
10871 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10872 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10873 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10874 case 7300: esalt_size
= sizeof (rakp_t
); break;
10875 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10876 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10877 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10878 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10879 case 9400: esalt_size
= sizeof (office2007_t
); break;
10880 case 9500: esalt_size
= sizeof (office2010_t
); break;
10881 case 9600: esalt_size
= sizeof (office2013_t
); break;
10882 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10883 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10884 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10885 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10886 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10887 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10888 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10889 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10890 case 10400: esalt_size
= sizeof (pdf_t
); break;
10891 case 10410: esalt_size
= sizeof (pdf_t
); break;
10892 case 10420: esalt_size
= sizeof (pdf_t
); break;
10893 case 10500: esalt_size
= sizeof (pdf_t
); break;
10894 case 10600: esalt_size
= sizeof (pdf_t
); break;
10895 case 10700: esalt_size
= sizeof (pdf_t
); break;
10896 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10897 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10898 case 11400: esalt_size
= sizeof (sip_t
); break;
10899 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10900 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10901 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10902 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10903 case 13000: esalt_size
= sizeof (rar5_t
); break;
10904 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10905 case 13400: esalt_size
= sizeof (keepass_t
); break;
10906 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10907 case 13600: esalt_size
= sizeof (zip2_t
); break;
10908 case 13711: esalt_size
= sizeof (tc_t
); break;
10909 case 13712: esalt_size
= sizeof (tc_t
); break;
10910 case 13713: esalt_size
= sizeof (tc_t
); break;
10911 case 13721: esalt_size
= sizeof (tc_t
); break;
10912 case 13722: esalt_size
= sizeof (tc_t
); break;
10913 case 13723: esalt_size
= sizeof (tc_t
); break;
10914 case 13731: esalt_size
= sizeof (tc_t
); break;
10915 case 13732: esalt_size
= sizeof (tc_t
); break;
10916 case 13733: esalt_size
= sizeof (tc_t
); break;
10917 case 13741: esalt_size
= sizeof (tc_t
); break;
10918 case 13742: esalt_size
= sizeof (tc_t
); break;
10919 case 13743: esalt_size
= sizeof (tc_t
); break;
10920 case 13751: esalt_size
= sizeof (tc_t
); break;
10921 case 13752: esalt_size
= sizeof (tc_t
); break;
10922 case 13753: esalt_size
= sizeof (tc_t
); break;
10923 case 13761: esalt_size
= sizeof (tc_t
); break;
10924 case 13762: esalt_size
= sizeof (tc_t
); break;
10925 case 13763: esalt_size
= sizeof (tc_t
); break;
10928 data
.esalt_size
= esalt_size
;
10931 * choose dictionary parser
10934 if (hash_type
== HASH_TYPE_LM
)
10936 get_next_word_func
= get_next_word_lm
;
10938 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10940 get_next_word_func
= get_next_word_uc
;
10944 get_next_word_func
= get_next_word_std
;
10951 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10954 size_t dictstat_nmemb
= 0;
10958 uint dictstat_nmemb
= 0;
10961 char dictstat
[256] = { 0 };
10963 FILE *dictstat_fp
= NULL
;
10967 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10969 dictstat_fp
= fopen (dictstat
, "rb");
10974 struct stat tmpstat
;
10976 fstat (fileno (dictstat_fp
), &tmpstat
);
10980 struct stat64 tmpstat
;
10982 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10985 if (tmpstat
.st_mtime
< COMPTIME
)
10987 /* with v0.15 the format changed so we have to ensure user is using a good version
10988 since there is no version-header in the dictstat file */
10990 fclose (dictstat_fp
);
10996 while (!feof (dictstat_fp
))
11000 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11002 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11004 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11006 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11012 fclose (dictstat_fp
);
11021 char potfile
[256] = { 0 };
11023 if (potfile_path
== NULL
)
11025 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11029 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11032 data
.pot_fp
= NULL
;
11034 FILE *out_fp
= NULL
;
11035 FILE *pot_fp
= NULL
;
11037 if (show
== 1 || left
== 1)
11039 pot_fp
= fopen (potfile
, "rb");
11041 if (pot_fp
== NULL
)
11043 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11048 if (outfile
!= NULL
)
11050 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11052 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11066 if (potfile_disable
== 0)
11068 pot_fp
= fopen (potfile
, "ab");
11070 if (pot_fp
== NULL
)
11072 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11077 data
.pot_fp
= pot_fp
;
11084 uint pot_avail
= 0;
11086 if (show
== 1 || left
== 1)
11088 SUPPRESS_OUTPUT
= 1;
11090 pot_avail
= count_lines (pot_fp
);
11094 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11096 uint pot_hashes_avail
= 0;
11100 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11102 while (!feof (pot_fp
))
11106 int line_len
= fgetl (pot_fp
, line_buf
);
11108 if (line_len
== 0) continue;
11110 char *plain_buf
= line_buf
+ line_len
;
11112 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11114 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11116 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11117 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11119 if (pot_cnt
== pot_hashes_avail
)
11123 for (pos
= 0; pos
< INCR_POT
; pos
++)
11125 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11127 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11129 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11131 tmp_hash
->digest
= mymalloc (dgst_size
);
11135 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11140 tmp_hash
->esalt
= mymalloc (esalt_size
);
11143 pot_hashes_avail
++;
11151 int iter
= MAX_CUT_TRIES
;
11155 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11157 if (line_buf
[i
] == ':')
11165 if (data
.hash_mode
!= 2500)
11167 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11171 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11173 if (line_len
> max_salt_size
)
11175 parser_status
= PARSER_GLOBAL_LENGTH
;
11179 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11181 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11183 hashes_buf
->salt
->salt_len
= line_len
;
11185 parser_status
= PARSER_OK
;
11189 // if NOT parsed without error, we add the ":" to the plain
11191 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11197 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11199 if (parser_status
< PARSER_GLOBAL_ZERO
)
11201 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11206 if (plain_len
>= 255) continue;
11208 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11210 pot_ptr
->plain_len
= plain_len
;
11219 SUPPRESS_OUTPUT
= 0;
11221 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11228 uint pw_min
= PW_MIN
;
11229 uint pw_max
= PW_MAX
;
11233 case 125: if (pw_max
> 32) pw_max
= 32;
11235 case 400: if (pw_max
> 40) pw_max
= 40;
11237 case 500: if (pw_max
> 16) pw_max
= 16;
11239 case 1500: if (pw_max
> 8) pw_max
= 8;
11241 case 1600: if (pw_max
> 16) pw_max
= 16;
11243 case 1800: if (pw_max
> 16) pw_max
= 16;
11245 case 2100: if (pw_max
> 16) pw_max
= 16;
11247 case 2500: if (pw_min
< 8) pw_min
= 8;
11249 case 3000: if (pw_max
> 7) pw_max
= 7;
11251 case 5200: if (pw_max
> 24) pw_max
= 24;
11253 case 5800: if (pw_max
> 16) pw_max
= 16;
11255 case 6300: if (pw_max
> 16) pw_max
= 16;
11257 case 7400: if (pw_max
> 16) pw_max
= 16;
11259 case 7500: if (pw_max
> 8) pw_max
= 8;
11261 case 7900: if (pw_max
> 48) pw_max
= 48;
11263 case 8500: if (pw_max
> 8) pw_max
= 8;
11265 case 8600: if (pw_max
> 16) pw_max
= 16;
11267 case 9710: pw_min
= 5;
11270 case 9810: pw_min
= 5;
11273 case 10410: pw_min
= 5;
11276 case 10300: if (pw_max
< 3) pw_min
= 3;
11277 if (pw_max
> 40) pw_max
= 40;
11279 case 10500: if (pw_max
< 3) pw_min
= 3;
11280 if (pw_max
> 40) pw_max
= 40;
11282 case 10700: if (pw_max
> 16) pw_max
= 16;
11284 case 11300: if (pw_max
> 40) pw_max
= 40;
11286 case 11600: if (pw_max
> 32) pw_max
= 32;
11288 case 12500: if (pw_max
> 20) pw_max
= 20;
11290 case 12800: if (pw_max
> 24) pw_max
= 24;
11294 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11296 switch (attack_kern
)
11298 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11300 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11306 * charsets : keep them together for more easy maintainnce
11309 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11310 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11312 mp_setup_sys (mp_sys
);
11314 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11315 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11316 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11317 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11320 * load hashes, part I: find input mode, count hashes
11323 uint hashlist_mode
= 0;
11324 uint hashlist_format
= HLFMT_HASHCAT
;
11326 uint hashes_avail
= 0;
11328 if (benchmark
== 0)
11332 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11334 if ((hash_mode
== 2500) ||
11335 (hash_mode
== 5200) ||
11336 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11337 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11338 (hash_mode
== 9000))
11340 hashlist_mode
= HL_MODE_ARG
;
11342 char *hashfile
= myargv
[optind
];
11344 data
.hashfile
= hashfile
;
11346 logfile_top_var_string ("target", hashfile
);
11349 if (hashlist_mode
== HL_MODE_ARG
)
11351 if (hash_mode
== 2500)
11355 if (stat (data
.hashfile
, &st
) == -1)
11357 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11362 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11369 else if (hashlist_mode
== HL_MODE_FILE
)
11371 char *hashfile
= myargv
[optind
];
11373 data
.hashfile
= hashfile
;
11375 logfile_top_var_string ("target", hashfile
);
11379 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11381 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11386 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11388 hashes_avail
= count_lines (fp
);
11392 if (hashes_avail
== 0)
11394 log_error ("ERROR: hashfile is empty or corrupt");
11401 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11403 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11405 log_error ("ERROR: remove not supported in native hashfile-format mode");
11417 hashlist_mode
= HL_MODE_ARG
;
11422 if (hash_mode
== 3000) hashes_avail
*= 2;
11424 data
.hashlist_mode
= hashlist_mode
;
11425 data
.hashlist_format
= hashlist_format
;
11427 logfile_top_uint (hashlist_mode
);
11428 logfile_top_uint (hashlist_format
);
11431 * load hashes, part II: allocate required memory, set pointers
11434 hash_t
*hashes_buf
= NULL
;
11435 void *digests_buf
= NULL
;
11436 salt_t
*salts_buf
= NULL
;
11437 void *esalts_buf
= NULL
;
11439 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11441 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11443 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11447 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11449 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11451 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11453 if (username
&& (remove
|| show
|| left
))
11455 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11460 hash_info
->orighash
= (char *) mymalloc (256);
11467 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11471 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11476 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11479 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11481 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11485 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11489 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11494 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11499 * load hashes, part III: parse hashes or generate them if benchmark
11502 uint hashes_cnt
= 0;
11504 if (benchmark
== 0)
11508 // useless to read hash file for keyspace, cheat a little bit w/ optind
11510 else if (hashes_avail
== 0)
11513 else if (hashlist_mode
== HL_MODE_ARG
)
11515 char *input_buf
= myargv
[optind
];
11517 uint input_len
= strlen (input_buf
);
11519 logfile_top_var_string ("target", input_buf
);
11521 char *hash_buf
= NULL
;
11524 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11526 bool hash_fmt_error
= 0;
11528 if (hash_len
< 1) hash_fmt_error
= 1;
11529 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11531 if (hash_fmt_error
)
11533 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11537 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11539 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11541 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11546 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11549 int parser_status
= PARSER_OK
;
11551 if (hash_mode
== 2500)
11555 log_error ("ERROR: hccap file not specified");
11560 hashlist_mode
= HL_MODE_FILE
;
11562 data
.hashlist_mode
= hashlist_mode
;
11564 FILE *fp
= fopen (hash_buf
, "rb");
11568 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11573 if (hashes_avail
< 1)
11575 log_error ("ERROR: hccap file is empty or corrupt");
11582 uint hccap_size
= sizeof (hccap_t
);
11584 char *in
= (char *) mymalloc (hccap_size
);
11588 int n
= fread (in
, hccap_size
, 1, fp
);
11592 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11597 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11599 if (parser_status
!= PARSER_OK
)
11601 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11606 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11608 if ((show
== 1) || (left
== 1))
11610 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11612 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11614 int cur_pos
= tmp_salt
->salt_len
;
11615 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11617 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11619 // do the appending task
11621 snprintf (salt_ptr
+ cur_pos
,
11623 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11635 wpa
->orig_mac2
[5]);
11637 // memset () the remaining part of the salt
11639 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11640 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11642 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11644 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11647 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
);
11648 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
);
11657 else if (hash_mode
== 3000)
11659 if (hash_len
== 32)
11661 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11663 hash_t
*lm_hash_left
= NULL
;
11665 if (parser_status
== PARSER_OK
)
11667 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11673 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11676 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11678 hash_t
*lm_hash_right
= NULL
;
11680 if (parser_status
== PARSER_OK
)
11682 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11688 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11693 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11695 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
);
11696 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
);
11701 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11703 if (parser_status
== PARSER_OK
)
11705 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11706 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11709 if (parser_status
== PARSER_OK
)
11715 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11721 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11723 if (parser_status
== PARSER_OK
)
11725 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11726 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11729 if (parser_status
== PARSER_OK
)
11735 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11740 else if (hashlist_mode
== HL_MODE_FILE
)
11742 char *hashfile
= data
.hashfile
;
11746 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11748 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11755 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11761 int line_len
= fgetl (fp
, line_buf
);
11763 if (line_len
== 0) continue;
11765 char *hash_buf
= NULL
;
11768 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11770 bool hash_fmt_error
= 0;
11772 if (hash_len
< 1) hash_fmt_error
= 1;
11773 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11775 if (hash_fmt_error
)
11777 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11784 char *user_buf
= NULL
;
11787 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11789 if (remove
|| show
)
11791 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11793 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11795 user_t
*user_ptr
= *user
;
11797 if (user_buf
!= NULL
)
11799 user_ptr
->user_name
= mystrdup (user_buf
);
11803 user_ptr
->user_name
= mystrdup ("");
11806 user_ptr
->user_len
= user_len
;
11810 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11812 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11814 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11819 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11822 if (hash_mode
== 3000)
11824 if (hash_len
== 32)
11826 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11828 if (parser_status
< PARSER_GLOBAL_ZERO
)
11830 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11835 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11839 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11841 if (parser_status
< PARSER_GLOBAL_ZERO
)
11843 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11848 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11850 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);
11856 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
);
11857 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
);
11861 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11863 if (parser_status
< PARSER_GLOBAL_ZERO
)
11865 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11870 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);
11872 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11873 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11880 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11882 if (parser_status
< PARSER_GLOBAL_ZERO
)
11884 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11889 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);
11891 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11892 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11902 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11904 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11911 hashes_buf
[0].salt
->salt_len
= 8;
11913 // special salt handling
11917 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11918 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11920 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11922 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11924 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11926 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11928 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11930 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11932 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11934 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11936 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11938 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11939 hashes_buf
[0].salt
->scrypt_N
= 1024;
11940 hashes_buf
[0].salt
->scrypt_r
= 1;
11941 hashes_buf
[0].salt
->scrypt_p
= 1;
11943 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11945 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11946 hashes_buf
[0].salt
->scrypt_N
= 16384;
11947 hashes_buf
[0].salt
->scrypt_r
= 1;
11948 hashes_buf
[0].salt
->scrypt_p
= 1;
11950 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11952 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11954 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11956 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11958 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11960 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11962 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11964 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11966 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11968 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11970 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11972 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11974 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11976 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11978 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11982 // special esalt handling
11986 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11988 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11989 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11991 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11992 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11994 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11995 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11996 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11997 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11999 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12000 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12001 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12002 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12004 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12006 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12007 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12008 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12010 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12011 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12012 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12014 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12015 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12016 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12018 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12019 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12020 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12022 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12023 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12024 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12026 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12027 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12028 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12030 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12031 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12032 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12034 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12036 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12038 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12039 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12040 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12049 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12051 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12053 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12055 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12057 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12059 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12061 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12063 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12065 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12067 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12069 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12071 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12073 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12075 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12077 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12079 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12081 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12083 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12085 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12087 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12089 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12091 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12093 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12095 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12097 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12099 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12101 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12103 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12105 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12107 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12109 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12111 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12113 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12115 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12117 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12119 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12123 // set default iterations
12127 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12129 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12131 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12133 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12135 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12137 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12139 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12141 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12143 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12145 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12147 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12149 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12151 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12153 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12155 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12157 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12159 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12161 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12163 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12165 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12167 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12169 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12171 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12173 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12175 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12177 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12179 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12181 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12183 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12185 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12187 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12189 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12191 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12193 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12195 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12197 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12199 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12201 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12203 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12205 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12207 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12209 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12211 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12213 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12215 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12217 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12219 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12221 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12223 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12225 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12227 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12229 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12231 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12233 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12235 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12237 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12239 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12241 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12243 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12245 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12247 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12249 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12251 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12253 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12255 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12257 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12259 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12261 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12263 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12265 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12267 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12269 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12271 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12273 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12275 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12277 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12279 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12281 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12283 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12285 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12287 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12289 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12296 if (show
== 1 || left
== 1)
12298 for (uint i
= 0; i
< pot_cnt
; i
++)
12300 pot_t
*pot_ptr
= &pot
[i
];
12302 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12304 local_free (hashes_buf
->digest
);
12308 local_free (hashes_buf
->salt
);
12314 if (data
.quiet
== 0) log_info_nn ("");
12321 if (hashes_cnt
== 0)
12323 log_error ("ERROR: No hashes loaded");
12330 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12333 if (data
.outfile
!= NULL
)
12335 if (data
.hashfile
!= NULL
)
12338 struct stat tmpstat_outfile
;
12339 struct stat tmpstat_hashfile
;
12343 struct stat64 tmpstat_outfile
;
12344 struct stat64 tmpstat_hashfile
;
12347 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12349 if (tmp_outfile_fp
)
12352 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12356 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12359 fclose (tmp_outfile_fp
);
12362 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12364 if (tmp_hashfile_fp
)
12367 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12371 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12374 fclose (tmp_hashfile_fp
);
12377 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12379 tmpstat_outfile
.st_mode
= 0;
12380 tmpstat_outfile
.st_nlink
= 0;
12381 tmpstat_outfile
.st_uid
= 0;
12382 tmpstat_outfile
.st_gid
= 0;
12383 tmpstat_outfile
.st_rdev
= 0;
12384 tmpstat_outfile
.st_atime
= 0;
12386 tmpstat_hashfile
.st_mode
= 0;
12387 tmpstat_hashfile
.st_nlink
= 0;
12388 tmpstat_hashfile
.st_uid
= 0;
12389 tmpstat_hashfile
.st_gid
= 0;
12390 tmpstat_hashfile
.st_rdev
= 0;
12391 tmpstat_hashfile
.st_atime
= 0;
12394 tmpstat_outfile
.st_blksize
= 0;
12395 tmpstat_outfile
.st_blocks
= 0;
12397 tmpstat_hashfile
.st_blksize
= 0;
12398 tmpstat_hashfile
.st_blocks
= 0;
12402 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12404 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12411 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12413 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12423 * Remove duplicates
12426 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12430 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12434 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12437 uint hashes_cnt_orig
= hashes_cnt
;
12441 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12445 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12447 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12452 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12455 if (hashes_pos
> hashes_cnt
)
12457 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12467 uint potfile_remove_cracks
= 0;
12469 if (potfile_disable
== 0)
12473 hash_buf
.digest
= mymalloc (dgst_size
);
12474 hash_buf
.salt
= NULL
;
12475 hash_buf
.esalt
= NULL
;
12476 hash_buf
.hash_info
= NULL
;
12477 hash_buf
.cracked
= 0;
12481 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12486 hash_buf
.esalt
= mymalloc (esalt_size
);
12489 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12491 // no solution for these special hash types (for instane because they use hashfile in output etc)
12492 if ((hash_mode
!= 5200) &&
12493 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12494 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12495 (hash_mode
!= 9000))
12497 FILE *fp
= fopen (potfile
, "rb");
12501 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12503 // to be safe work with a copy (because of line_len loop, i etc)
12504 // moved up here because it's easier to handle continue case
12507 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12511 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12513 if (ptr
== NULL
) break;
12515 int line_len
= strlen (line_buf
);
12517 if (line_len
== 0) continue;
12519 int iter
= MAX_CUT_TRIES
;
12521 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12523 if (line_buf
[i
] != ':') continue;
12527 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12530 hash_t
*found
= NULL
;
12532 if (hash_mode
== 6800)
12534 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12536 // manipulate salt_buf
12537 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12539 hash_buf
.salt
->salt_len
= i
;
12541 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12544 else if (hash_mode
== 2500)
12546 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12548 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12549 // manipulate salt_buf
12551 memcpy (line_buf_cpy
, line_buf
, i
);
12553 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12555 if (mac2_pos
== NULL
) continue;
12560 if (strlen (mac2_pos
) != 12) continue;
12562 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12564 if (mac1_pos
== NULL
) continue;
12569 if (strlen (mac1_pos
) != 12) continue;
12571 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12573 // here we need the ESSID
12574 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12576 hash_buf
.salt
->salt_len
= essid_length
;
12578 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12582 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12584 // compare hex string(s) vs binary MAC address(es)
12586 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12588 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12597 if (!found
) continue;
12599 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12601 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12613 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12615 if (parser_status
== PARSER_OK
)
12619 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12623 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12628 if (found
== NULL
) continue;
12630 if (!found
->cracked
) potfile_remove_cracks
++;
12632 found
->cracked
= 1;
12640 myfree (line_buf_cpy
);
12650 local_free (hash_buf
.esalt
);
12655 local_free (hash_buf
.salt
);
12658 local_free (hash_buf
.digest
);
12662 * Now generate all the buffers required for later
12665 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12667 salt_t
*salts_buf_new
= NULL
;
12668 void *esalts_buf_new
= NULL
;
12672 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12676 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12681 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12684 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12686 uint digests_cnt
= hashes_cnt
;
12687 uint digests_done
= 0;
12689 size_t size_digests
= digests_cnt
* dgst_size
;
12690 size_t size_shown
= digests_cnt
* sizeof (uint
);
12692 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12693 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12695 uint salts_cnt
= 0;
12696 uint salts_done
= 0;
12698 hashinfo_t
**hash_info
= NULL
;
12700 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12702 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12704 if (username
&& (remove
|| show
))
12708 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12710 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12712 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12717 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12722 // copied from inner loop
12724 salt_buf
= &salts_buf_new
[salts_cnt
];
12726 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12730 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12733 salt_buf
->digests_cnt
= 0;
12734 salt_buf
->digests_done
= 0;
12735 salt_buf
->digests_offset
= 0;
12740 if (hashes_buf
[0].cracked
== 1)
12742 digests_shown
[0] = 1;
12746 salt_buf
->digests_done
++;
12749 salt_buf
->digests_cnt
++;
12751 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12753 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12755 hash_info
[0] = hashes_buf
[0].hash_info
;
12758 // copy from inner loop
12760 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12764 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12766 salt_buf
= &salts_buf_new
[salts_cnt
];
12768 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12772 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12775 salt_buf
->digests_cnt
= 0;
12776 salt_buf
->digests_done
= 0;
12777 salt_buf
->digests_offset
= hashes_pos
;
12783 if (hashes_buf
[hashes_pos
].cracked
== 1)
12785 digests_shown
[hashes_pos
] = 1;
12789 salt_buf
->digests_done
++;
12792 salt_buf
->digests_cnt
++;
12794 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12796 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12798 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12802 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12804 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12806 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12808 salts_shown
[salt_pos
] = 1;
12813 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12816 local_free (digests_buf
);
12817 local_free (salts_buf
);
12818 local_free (esalts_buf
);
12820 digests_buf
= digests_buf_new
;
12821 salts_buf
= salts_buf_new
;
12822 esalts_buf
= esalts_buf_new
;
12824 local_free (hashes_buf
);
12827 * special modification not set from parser
12832 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12833 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12834 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12835 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12836 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12837 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12838 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12839 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12840 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12841 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12842 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12843 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12844 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12845 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12846 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12847 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12848 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12849 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12850 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12851 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12852 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12853 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12854 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12855 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12856 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12857 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12858 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12859 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12860 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12861 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12864 if (truecrypt_keyfiles
)
12866 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12868 char *keyfiles
= strdup (truecrypt_keyfiles
);
12870 char *keyfile
= strtok (keyfiles
, ",");
12874 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12876 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12881 if (veracrypt_keyfiles
)
12883 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12885 char *keyfiles
= strdup (veracrypt_keyfiles
);
12887 char *keyfile
= strtok (keyfiles
, ",");
12891 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12893 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12898 data
.digests_cnt
= digests_cnt
;
12899 data
.digests_done
= digests_done
;
12900 data
.digests_buf
= digests_buf
;
12901 data
.digests_shown
= digests_shown
;
12902 data
.digests_shown_tmp
= digests_shown_tmp
;
12904 data
.salts_cnt
= salts_cnt
;
12905 data
.salts_done
= salts_done
;
12906 data
.salts_buf
= salts_buf
;
12907 data
.salts_shown
= salts_shown
;
12909 data
.esalts_buf
= esalts_buf
;
12910 data
.hash_info
= hash_info
;
12913 * Automatic Optimizers
12916 if (salts_cnt
== 1)
12917 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12919 if (digests_cnt
== 1)
12920 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12922 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12923 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12925 if (attack_mode
== ATTACK_MODE_BF
)
12926 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12928 data
.opti_type
= opti_type
;
12930 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12932 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12934 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12936 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12938 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12939 opts_type
|= OPTS_TYPE_PT_ADD80
;
12942 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12944 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12945 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12948 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12950 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12951 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12958 * Some algorithm, like descrypt, can benefit from JIT compilation
12961 int force_jit_compilation
= -1;
12963 if (hash_mode
== 8900)
12965 force_jit_compilation
= 8900;
12967 else if (hash_mode
== 9300)
12969 force_jit_compilation
= 8900;
12971 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12973 force_jit_compilation
= 1500;
12977 * generate bitmap tables
12980 const uint bitmap_shift1
= 5;
12981 const uint bitmap_shift2
= 13;
12983 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12985 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12986 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12987 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12988 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12989 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12990 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12991 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12992 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12999 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13001 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13003 bitmap_nums
= 1 << bitmap_bits
;
13005 bitmap_mask
= bitmap_nums
- 1;
13007 bitmap_size
= bitmap_nums
* sizeof (uint
);
13009 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13011 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;
13012 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;
13017 bitmap_nums
= 1 << bitmap_bits
;
13019 bitmap_mask
= bitmap_nums
- 1;
13021 bitmap_size
= bitmap_nums
* sizeof (uint
);
13023 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);
13024 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);
13027 * prepare quick rule
13030 data
.rule_buf_l
= rule_buf_l
;
13031 data
.rule_buf_r
= rule_buf_r
;
13033 int rule_len_l
= (int) strlen (rule_buf_l
);
13034 int rule_len_r
= (int) strlen (rule_buf_r
);
13036 data
.rule_len_l
= rule_len_l
;
13037 data
.rule_len_r
= rule_len_r
;
13043 uint
*all_kernel_rules_cnt
= NULL
;
13045 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13049 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13051 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13054 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13058 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13060 uint kernel_rules_avail
= 0;
13062 uint kernel_rules_cnt
= 0;
13064 kernel_rule_t
*kernel_rules_buf
= NULL
;
13066 char *rp_file
= rp_files
[i
];
13068 char in
[BLOCK_SIZE
] = { 0 };
13069 char out
[BLOCK_SIZE
] = { 0 };
13073 uint rule_line
= 0;
13075 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13077 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13084 memset (rule_buf
, 0, HCBUFSIZ
);
13086 rule_len
= fgetl (fp
, rule_buf
);
13090 if (rule_len
== 0) continue;
13092 if (rule_buf
[0] == '#') continue;
13094 if (kernel_rules_avail
== kernel_rules_cnt
)
13096 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13098 kernel_rules_avail
+= INCR_RULES
;
13101 memset (in
, 0, BLOCK_SIZE
);
13102 memset (out
, 0, BLOCK_SIZE
);
13104 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13108 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13113 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13115 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13117 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13123 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13125 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13131 kernel_rules_cnt
++;
13136 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13138 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13142 * merge rules or automatic rule generator
13145 uint kernel_rules_cnt
= 0;
13147 kernel_rule_t
*kernel_rules_buf
= NULL
;
13149 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13153 kernel_rules_cnt
= 1;
13155 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13157 repeats
[0] = kernel_rules_cnt
;
13159 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13161 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13163 repeats
[i
+ 1] = kernel_rules_cnt
;
13166 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13168 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13170 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13174 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13176 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13178 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13181 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13183 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13185 if (out_pos
== RULES_MAX
- 1)
13187 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13192 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13197 local_free (repeats
);
13201 uint kernel_rules_avail
= 0;
13203 while (kernel_rules_cnt
< rp_gen
)
13205 if (kernel_rules_avail
== kernel_rules_cnt
)
13207 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13209 kernel_rules_avail
+= INCR_RULES
;
13212 memset (rule_buf
, 0, HCBUFSIZ
);
13214 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13216 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13218 kernel_rules_cnt
++;
13226 * generate NOP rules
13229 if (kernel_rules_cnt
== 0)
13231 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13233 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13235 kernel_rules_cnt
++;
13238 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13239 data
.kernel_rules_buf
= kernel_rules_buf
;
13242 * OpenCL platforms: detect
13245 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13246 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13248 cl_uint platforms_cnt
= 0;
13249 cl_uint platform_devices_cnt
= 0;
13253 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13255 if (platforms_cnt
== 0)
13258 log_info ("ATTENTION! No OpenCL compatible platform found");
13260 log_info ("You're probably missing the OpenCL runtime installation");
13261 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13262 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13263 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13269 if (opencl_platforms_filter
!= (uint
) -1)
13271 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13273 if (opencl_platforms_filter
> platform_cnt_mask
)
13275 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13283 * OpenCL device types:
13284 * 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.
13285 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13288 if (opencl_device_types
== NULL
)
13290 cl_device_type device_types_all
= 0;
13292 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13294 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13296 cl_platform_id platform
= platforms
[platform_id
];
13298 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13300 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13302 cl_device_id device
= platform_devices
[platform_devices_id
];
13304 cl_device_type device_type
;
13306 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13308 device_types_all
|= device_type
;
13312 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13314 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13319 * OpenCL devices: simply push all devices from all platforms into the same device array
13323 int need_nvapi
= 0;
13326 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13328 data
.devices_param
= devices_param
;
13330 uint devices_cnt
= 0;
13332 uint devices_active
= 0;
13334 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13336 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13338 cl_platform_id platform
= platforms
[platform_id
];
13340 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13342 char platform_vendor
[INFOSZ
] = { 0 };
13344 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13346 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13347 // this causes trouble with vendor id based macros
13348 // we'll assign generic to those without special optimization available
13350 cl_uint platform_vendor_id
= 0;
13352 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13354 platform_vendor_id
= VENDOR_ID_AMD
;
13356 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13358 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13360 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13362 platform_vendor_id
= VENDOR_ID_APPLE
;
13364 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13366 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13368 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13370 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13372 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13374 platform_vendor_id
= VENDOR_ID_MESA
;
13376 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13378 platform_vendor_id
= VENDOR_ID_NV
;
13380 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13382 platform_vendor_id
= VENDOR_ID_POCL
;
13386 platform_vendor_id
= VENDOR_ID_GENERIC
;
13389 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13391 size_t param_value_size
= 0;
13393 const uint device_id
= devices_cnt
;
13395 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13397 device_param
->platform_vendor_id
= platform_vendor_id
;
13399 device_param
->device
= platform_devices
[platform_devices_id
];
13401 device_param
->device_id
= device_id
;
13403 device_param
->platform_devices_id
= platform_devices_id
;
13407 cl_device_type device_type
;
13409 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13411 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13413 device_param
->device_type
= device_type
;
13417 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13419 char *device_name
= (char *) mymalloc (param_value_size
);
13421 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13423 device_param
->device_name
= device_name
;
13427 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13429 char *device_vendor
= (char *) mymalloc (param_value_size
);
13431 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13433 device_param
->device_vendor
= device_vendor
;
13435 cl_uint device_vendor_id
= 0;
13437 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13439 device_vendor_id
= VENDOR_ID_AMD
;
13441 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13443 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13445 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13447 device_vendor_id
= VENDOR_ID_APPLE
;
13449 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13451 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13453 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13455 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13457 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13459 device_vendor_id
= VENDOR_ID_MESA
;
13461 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13463 device_vendor_id
= VENDOR_ID_NV
;
13465 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13467 device_vendor_id
= VENDOR_ID_POCL
;
13471 device_vendor_id
= VENDOR_ID_GENERIC
;
13474 device_param
->device_vendor_id
= device_vendor_id
;
13478 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13482 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13484 char *device_version
= (char *) mymalloc (param_value_size
);
13486 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13488 device_param
->device_version
= device_version
;
13490 // device_opencl_version
13492 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13494 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13496 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13498 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13500 myfree (device_opencl_version
);
13504 cl_uint vector_width
;
13506 if (opencl_vector_width_chgd
== 0)
13508 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13510 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13512 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13516 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13521 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13526 vector_width
= opencl_vector_width
;
13529 if (vector_width
> 16) vector_width
= 16;
13531 device_param
->vector_width
= vector_width
;
13533 // max_compute_units
13535 cl_uint device_processors
;
13537 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13539 device_param
->device_processors
= device_processors
;
13541 // device_maxmem_alloc
13542 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13544 cl_ulong device_maxmem_alloc
;
13546 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13548 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13550 // device_global_mem
13552 cl_ulong device_global_mem
;
13554 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13556 device_param
->device_global_mem
= device_global_mem
;
13558 // max_work_group_size
13560 size_t device_maxworkgroup_size
;
13562 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13564 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13566 // max_clock_frequency
13568 cl_uint device_maxclock_frequency
;
13570 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13572 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13574 // device_endian_little
13576 cl_bool device_endian_little
;
13578 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13580 if (device_endian_little
== CL_FALSE
)
13582 log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13584 device_param
->skipped
= 1;
13587 // device_available
13589 cl_bool device_available
;
13591 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13593 if (device_available
== CL_FALSE
)
13595 log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13597 device_param
->skipped
= 1;
13600 // device_compiler_available
13602 cl_bool device_compiler_available
;
13604 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13606 if (device_compiler_available
== CL_FALSE
)
13608 log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13610 device_param
->skipped
= 1;
13613 // device_execution_capabilities
13615 cl_device_exec_capabilities device_execution_capabilities
;
13617 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13619 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13621 log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13623 device_param
->skipped
= 1;
13626 // device_extensions
13628 size_t device_extensions_size
;
13630 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13632 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13634 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13636 if (strstr (device_extensions
, "base_atomics") == 0)
13638 log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13640 device_param
->skipped
= 1;
13643 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13645 log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13647 device_param
->skipped
= 1;
13650 myfree (device_extensions
);
13652 // device_local_mem_size
13654 cl_ulong device_local_mem_size
;
13656 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13658 if (device_local_mem_size
< 32768)
13660 log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13662 device_param
->skipped
= 1;
13665 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13666 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13667 // This results in both utilizing it for 50%
13668 // However, Intel has much better SIMD control over their own hardware
13669 // It makes sense to give them full control over their own hardware
13671 if (device_type
& CL_DEVICE_TYPE_CPU
)
13673 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13675 if (data
.force
== 0)
13677 if (algorithm_pos
== 0)
13679 log_info ("Device #%u: WARNING: not native intel opencl runtime, expect massive speed loss", device_id
+ 1);
13680 log_info (" You can use --force to override this but do not post error reports if you do so");
13683 device_param
->skipped
= 1;
13690 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13691 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13695 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13697 char *driver_version
= (char *) mymalloc (param_value_size
);
13699 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13701 device_param
->driver_version
= driver_version
;
13703 // device_name_chksum
13705 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13708 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
);
13710 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
);
13713 uint device_name_digest
[4] = { 0 };
13715 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13717 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13719 device_param
->device_name_chksum
= device_name_chksum
;
13721 // device_processor_cores
13723 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
13725 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
13730 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
13740 // device_processor_cores
13742 if (device_type
& CL_DEVICE_TYPE_CPU
)
13744 cl_uint device_processor_cores
= 1;
13746 device_param
->device_processor_cores
= device_processor_cores
;
13749 if (device_type
& CL_DEVICE_TYPE_GPU
)
13751 if (device_vendor_id
== VENDOR_ID_AMD
)
13753 cl_uint device_processor_cores
= 0;
13755 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13757 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13759 device_param
->device_processor_cores
= device_processor_cores
;
13761 else if (device_vendor_id
== VENDOR_ID_NV
)
13763 cl_uint kernel_exec_timeout
= 0;
13765 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13767 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13769 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13771 cl_uint device_processor_cores
= 0;
13773 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13775 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13777 device_param
->device_processor_cores
= device_processor_cores
;
13779 cl_uint sm_minor
= 0;
13780 cl_uint sm_major
= 0;
13782 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13783 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13785 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13786 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13788 device_param
->sm_minor
= sm_minor
;
13789 device_param
->sm_major
= sm_major
;
13793 cl_uint device_processor_cores
= 1;
13795 device_param
->device_processor_cores
= device_processor_cores
;
13801 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13803 if (machine_readable
== 0)
13805 if (device_param
->skipped
== 0)
13807 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13810 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13811 (unsigned int) (device_global_mem
/ 1024 / 1024),
13812 (unsigned int) device_processors
);
13816 log_info ("Device #%u: %s, skipped",
13823 // common driver check
13825 if (device_param
->skipped
== 0)
13827 if (device_type
& CL_DEVICE_TYPE_GPU
)
13829 if (platform_vendor_id
== VENDOR_ID_AMD
)
13831 int catalyst_check
= (force
== 1) ? 0 : 1;
13833 int catalyst_warn
= 0;
13835 int catalyst_broken
= 0;
13837 if (catalyst_check
== 1)
13841 // v14.9 and higher
13842 if (atoi (device_param
->driver_version
) >= 1573)
13847 catalyst_check
= 0;
13850 if (catalyst_broken
== 1)
13853 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13854 log_info ("It will pass over cracked hashes and does not report them as cracked");
13855 log_info ("You are STRONGLY encouraged not to use it");
13856 log_info ("You can use --force to override this but do not post error reports if you do so");
13862 if (catalyst_warn
== 1)
13865 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13866 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13867 log_info ("See hashcat's homepage for official supported catalyst drivers");
13869 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13871 log_info ("You can use --force to override this but do not post error reports if you do so");
13877 else if (platform_vendor_id
== VENDOR_ID_NV
)
13879 if (device_param
->kernel_exec_timeout
!= 0)
13881 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);
13882 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13887 /* turns out pocl still creates segfaults (because of llvm)
13888 if (device_type & CL_DEVICE_TYPE_CPU)
13890 if (platform_vendor_id == VENDOR_ID_AMD)
13895 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13896 log_info ("You are STRONGLY encouraged not to use it");
13897 log_info ("You can use --force to override this but do not post error reports if you do so");
13898 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13908 * kernel accel and loops tuning db adjustment
13911 device_param
->kernel_accel_min
= 1;
13912 device_param
->kernel_accel_max
= 1024;
13914 device_param
->kernel_loops_min
= 1;
13915 device_param
->kernel_loops_max
= 1024;
13917 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13919 if (tuningdb_entry
)
13921 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13922 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13926 device_param
->kernel_accel_min
= _kernel_accel
;
13927 device_param
->kernel_accel_max
= _kernel_accel
;
13932 if (workload_profile
== 1)
13934 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13936 else if (workload_profile
== 2)
13938 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13941 device_param
->kernel_loops_min
= _kernel_loops
;
13942 device_param
->kernel_loops_max
= _kernel_loops
;
13946 // commandline parameters overwrite tuningdb entries
13950 device_param
->kernel_accel_min
= kernel_accel
;
13951 device_param
->kernel_accel_max
= kernel_accel
;
13956 device_param
->kernel_loops_min
= kernel_loops
;
13957 device_param
->kernel_loops_max
= kernel_loops
;
13973 if (keyspace
== 0 && devices_active
== 0)
13975 log_error ("ERROR: No devices found/left");
13980 // 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)
13982 if (devices_filter
!= (uint
) -1)
13984 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13986 if (devices_filter
> devices_cnt_mask
)
13988 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13994 data
.devices_cnt
= devices_cnt
;
13996 data
.devices_active
= devices_active
;
13998 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14000 if (machine_readable
== 0)
14011 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
] = { { 0 } };
14012 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
] = { { 0 } };
14013 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
] = { { 0 } };
14015 if (gpu_temp_disable
== 0)
14017 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14018 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14019 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14021 data
.hm_adl
= NULL
;
14022 data
.hm_nvapi
= NULL
;
14023 data
.hm_nvml
= NULL
;
14025 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
14027 data
.hm_nvml
= nvml
;
14032 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
14034 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
14036 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
14040 for (int i
= 0; i
< tmp_in
; i
++)
14042 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
14045 for (int i
= 0; i
< tmp_out
; i
++)
14047 unsigned int speed
;
14049 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
14051 hm_NVML_nvmlDeviceSetComputeMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].nvml
, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS
);
14053 hm_NVML_nvmlDeviceSetGpuOperationMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].nvml
, NVML_GOM_ALL_ON
);
14058 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
14060 data
.hm_nvapi
= nvapi
;
14065 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
14067 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
14069 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
14073 for (int i
= 0; i
< tmp_in
; i
++)
14075 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
14080 if ((need_adl
== 1) && (adl_init (adl
) == 0))
14087 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14089 // total number of adapters
14091 int hm_adapters_num
;
14093 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return (-1);
14097 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
14099 if (lpAdapterInfo
== NULL
) return (-1);
14101 // get a list (of ids of) valid/usable adapters
14103 int num_adl_adapters
= 0;
14105 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14107 if (num_adl_adapters
> 0)
14109 hc_thread_mutex_lock (mux_adl
);
14111 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
14113 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14115 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14116 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14118 hc_thread_mutex_unlock (mux_adl
);
14121 myfree (valid_adl_device_list
);
14122 myfree (lpAdapterInfo
);
14126 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14128 gpu_temp_disable
= 1;
14133 * OpenCL devices: allocate buffer for device specific information
14136 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14137 int *temp_retain_fanpolicy_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14139 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14141 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14143 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
14146 * User-defined GPU temp handling
14149 if (gpu_temp_disable
== 1)
14151 gpu_temp_abort
= 0;
14152 gpu_temp_retain
= 0;
14155 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14157 if (gpu_temp_abort
< gpu_temp_retain
)
14159 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14165 data
.gpu_temp_disable
= gpu_temp_disable
;
14166 data
.gpu_temp_abort
= gpu_temp_abort
;
14167 data
.gpu_temp_retain
= gpu_temp_retain
;
14171 * enable custom signal handler(s)
14174 if (benchmark
== 0)
14176 hc_signal (sigHandler_default
);
14180 hc_signal (sigHandler_benchmark
);
14187 if (data
.quiet
== 0)
14189 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14191 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
);
14193 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14195 log_info ("Rules: %u", kernel_rules_cnt
);
14200 log_info ("Applicable Optimizers:");
14202 for (uint i
= 0; i
< 32; i
++)
14204 const uint opti_bit
= 1u << i
;
14206 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14211 * Watchdog and Temperature balance
14215 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14217 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14220 if (gpu_temp_abort
== 0)
14222 log_info ("Watchdog: Temperature abort trigger disabled");
14226 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14229 if (gpu_temp_retain
== 0)
14231 log_info ("Watchdog: Temperature retain trigger disabled");
14235 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14238 if (data
.quiet
== 0) log_info ("");
14248 if (gpu_temp_disable
== 0)
14250 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14252 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14254 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14256 if (device_param
->skipped
) continue;
14258 const uint platform_devices_id
= device_param
->platform_devices_id
;
14260 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14262 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
14263 data
.hm_device
[device_id
].nvapi
= 0;
14264 data
.hm_device
[device_id
].nvml
= 0;
14265 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
14266 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
14267 data
.hm_device
[device_id
].fan_set_supported
= hm_adapters_adl
[platform_devices_id
].fan_set_supported
;
14270 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14272 data
.hm_device
[device_id
].adl
= 0;
14273 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
14274 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
14275 data
.hm_device
[device_id
].od_version
= 0;
14276 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
14277 data
.hm_device
[device_id
].fan_set_supported
= 0;
14283 * powertune on user request
14286 if (powertune_enable
== 1)
14288 hc_thread_mutex_lock (mux_adl
);
14290 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14292 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14294 if (device_param
->skipped
) continue;
14296 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
14300 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14301 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14302 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14303 * Driver / ADL bug?
14306 if (data
.hm_device
[device_id
].od_version
== 6)
14310 // check powertune capabilities first, if not available then skip device
14312 int powertune_supported
= 0;
14314 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
14316 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14321 // first backup current value, we will restore it later
14323 if (powertune_supported
!= 0)
14325 // powercontrol settings
14327 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14329 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
14331 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
14334 if (ADL_rc
!= ADL_OK
)
14336 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14341 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14343 log_error ("ERROR: Failed to set new ADL PowerControl values");
14350 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
14352 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
14354 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
)
14356 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
14361 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
14363 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
14365 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
14367 log_error ("ERROR: Failed to get ADL device capabilities");
14372 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
14373 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
14375 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
14376 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
14378 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
14379 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
14381 // warning if profile has too low max values
14383 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
14385 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
14388 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
14390 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
14393 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
14395 performance_state
->iNumberOfPerformanceLevels
= 2;
14397 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
14398 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
14399 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
14400 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
14402 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
)
14404 log_info ("ERROR: Failed to set ADL performance state");
14409 local_free (performance_state
);
14412 // set powertune value only
14414 if (powertune_supported
!= 0)
14417 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14419 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
14421 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14426 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14428 log_error ("ERROR: Failed to set new ADL PowerControl values");
14436 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
14438 // first backup current value, we will restore it later
14440 unsigned int limit
;
14442 int powertune_supported
= 0;
14444 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
14446 powertune_supported
= 1;
14449 // if backup worked, activate the maximum allowed
14451 if (powertune_supported
!= 0)
14453 unsigned int minLimit
;
14454 unsigned int maxLimit
;
14456 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
14460 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
14462 // now we can be sure we need to reset later
14464 nvml_power_limit
[device_id
] = limit
;
14472 hc_thread_mutex_unlock (mux_adl
);
14475 #endif // HAVE_HWMON
14478 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14481 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14483 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14489 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14491 if (device_param
->skipped
) continue;
14494 * device properties
14497 const char *device_name_chksum
= device_param
->device_name_chksum
;
14498 const u32 device_processors
= device_param
->device_processors
;
14499 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14502 * create context for each device
14505 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14508 * create command-queue
14511 // not supported with NV
14512 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14514 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14517 * kernel threads: some algorithms need a fixed kernel-threads count
14518 * because of shared memory usage or bitslice
14519 * there needs to be some upper limit, otherwise there's too much overhead
14522 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14524 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14526 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14529 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14530 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14531 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14532 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14533 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14534 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14535 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14536 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14537 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14538 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14539 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14540 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14541 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14543 device_param
->kernel_threads
= kernel_threads
;
14545 device_param
->hardware_power
= device_processors
* kernel_threads
;
14548 * create input buffers on device : calculate size of fixed memory buffers
14551 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14552 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14554 device_param
->size_root_css
= size_root_css
;
14555 device_param
->size_markov_css
= size_markov_css
;
14557 size_t size_results
= sizeof (uint
);
14559 device_param
->size_results
= size_results
;
14561 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14562 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14564 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14565 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14566 size_t size_esalts
= salts_cnt
* esalt_size
;
14568 device_param
->size_plains
= size_plains
;
14569 device_param
->size_digests
= size_digests
;
14570 device_param
->size_shown
= size_shown
;
14571 device_param
->size_salts
= size_salts
;
14573 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14574 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14575 size_t size_tm
= 32 * sizeof (bs_word_t
);
14579 size_t size_scryptV
= 1;
14581 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14583 uint tmto_start
= 0;
14584 uint tmto_stop
= 10;
14588 tmto_start
= scrypt_tmto
;
14592 // in case the user did not specify the tmto manually
14593 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14594 // but set the lower end only in case the user has a device with too less memory
14596 if (hash_mode
== 8900)
14598 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14602 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14607 else if (hash_mode
== 9300)
14609 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14613 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14620 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14622 // TODO: in theory the following calculation needs to be done per salt, not global
14623 // we assume all hashes have the same scrypt settings
14625 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14627 size_scryptV
/= 1 << tmto
;
14629 size_scryptV
*= device_processors
* device_processor_cores
;
14631 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14633 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14638 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14640 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14641 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14647 if (data
.salts_buf
[0].scrypt_phy
== 0)
14649 log_error ("ERROR: can't allocate enough device memory");
14654 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14658 * some algorithms need a fixed kernel-loops count
14661 if (hash_mode
== 1500)
14663 const u32 kernel_loops_fixed
= 1024;
14665 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14666 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14669 if (hash_mode
== 3000)
14671 const u32 kernel_loops_fixed
= 1024;
14673 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14674 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14677 if (hash_mode
== 8900)
14679 const u32 kernel_loops_fixed
= 1;
14681 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14682 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14685 if (hash_mode
== 9300)
14687 const u32 kernel_loops_fixed
= 1;
14689 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14690 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14693 if (hash_mode
== 12500)
14695 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14697 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14698 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14702 * some algorithms have a maximum kernel-loops count
14705 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14707 u32 innerloop_cnt
= 0;
14709 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14711 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14712 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14713 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14717 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14720 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14721 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14723 device_param
->kernel_loops_max
= innerloop_cnt
;
14727 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14728 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14730 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14732 size_t size_pws
= 4;
14733 size_t size_tmps
= 4;
14734 size_t size_hooks
= 4;
14736 while (kernel_accel_max
>= kernel_accel_min
)
14738 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14742 size_pws
= kernel_power_max
* sizeof (pw_t
);
14748 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14749 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14750 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14751 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14752 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14753 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14754 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14755 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14756 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14757 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14758 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14759 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14760 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14761 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14762 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14763 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14764 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14765 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14766 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14767 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14768 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14769 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14770 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14771 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14772 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14773 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14774 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14775 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14776 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14777 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14778 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14779 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14780 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14781 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14782 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14783 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14784 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14785 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14786 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14787 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14788 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14789 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14790 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14791 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14792 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14793 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14794 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14795 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14796 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14797 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14798 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14799 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14800 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14801 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14802 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14803 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14804 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14805 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14806 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14807 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14808 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14809 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14810 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14811 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14812 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14813 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14814 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14815 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14816 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14817 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14818 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14819 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14820 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14821 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14822 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14823 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14824 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14825 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14826 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14827 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14828 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14829 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14834 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14839 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14840 // if not, decrease amplifier and try again
14844 const u64 size_total
14861 + size_pws
// not a bug
14872 // Don't ask me, ask AMD!
14874 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14875 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14879 kernel_accel_max
--;
14888 if (kernel_accel_max == 0)
14890 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14896 device_param
->kernel_accel_min
= kernel_accel_min
;
14897 device_param
->kernel_accel_max
= kernel_accel_max
;
14900 if (kernel_accel_max < kernel_accel)
14902 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14904 device_param->kernel_accel = kernel_accel_max;
14908 device_param
->size_bfs
= size_bfs
;
14909 device_param
->size_combs
= size_combs
;
14910 device_param
->size_rules
= size_rules
;
14911 device_param
->size_rules_c
= size_rules_c
;
14912 device_param
->size_pws
= size_pws
;
14913 device_param
->size_tmps
= size_tmps
;
14914 device_param
->size_hooks
= size_hooks
;
14917 * default building options
14920 char build_opts
[1024] = { 0 };
14922 // we don't have sm_* on vendors not NV but it doesn't matter
14925 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
);
14927 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
);
14930 char build_opts_new
[1024] = { 0 };
14932 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
);
14934 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14937 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14939 // we do vectorizing much better than the auto-vectorizer
14941 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14943 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14948 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14957 * kernel source filename
14960 char source_file
[256] = { 0 };
14962 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14966 if (stat (source_file
, &sst
) == -1)
14968 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14974 * kernel cached filename
14977 char cached_file
[256] = { 0 };
14979 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14985 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14991 * kernel compile or load
14994 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14996 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14998 if (force_jit_compilation
== -1)
15002 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15004 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15006 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15008 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15011 size_t build_log_size
= 0;
15013 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15015 if (build_log_size
> 1)
15017 char *build_log
= (char *) malloc (build_log_size
+ 1);
15019 memset (build_log
, 0, build_log_size
+ 1);
15021 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15031 device_param
->skipped
= true;
15033 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15038 size_t binary_size
;
15040 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15042 u8
*binary
= (u8
*) mymalloc (binary_size
);
15044 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15046 writeProgramBin (cached_file
, binary
, binary_size
);
15048 local_free (binary
);
15053 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15056 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15058 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15060 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15066 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
15069 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15071 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15073 char build_opts_update
[1024] = { 0 };
15075 if (force_jit_compilation
== 1500)
15077 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
15079 else if (force_jit_compilation
== 8900)
15081 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
);
15085 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
15088 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
15091 size_t build_log_size
= 0;
15093 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15095 if (build_log_size
> 1)
15097 char *build_log
= (char *) malloc (build_log_size
+ 1);
15099 memset (build_log
, 0, build_log_size
+ 1);
15101 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15111 device_param
->skipped
= true;
15113 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15117 local_free (kernel_lengths
);
15118 local_free (kernel_sources
[0]);
15119 local_free (kernel_sources
);
15123 * word generator kernel
15126 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
15129 * kernel mp source filename
15132 char source_file
[256] = { 0 };
15134 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
15138 if (stat (source_file
, &sst
) == -1)
15140 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15146 * kernel mp cached filename
15149 char cached_file
[256] = { 0 };
15151 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15157 if (stat (cached_file
, &cst
) == -1)
15163 * kernel compile or load
15166 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15168 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15172 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15173 if (quiet
== 0) log_info ("");
15175 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15177 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15179 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15183 device_param
->skipped
= true;
15185 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15190 size_t binary_size
;
15192 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15194 u8
*binary
= (u8
*) mymalloc (binary_size
);
15196 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15198 writeProgramBin (cached_file
, binary
, binary_size
);
15200 local_free (binary
);
15205 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15208 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15210 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15212 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15215 local_free (kernel_lengths
);
15216 local_free (kernel_sources
[0]);
15217 local_free (kernel_sources
);
15224 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15231 * kernel amp source filename
15234 char source_file
[256] = { 0 };
15236 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15240 if (stat (source_file
, &sst
) == -1)
15242 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15248 * kernel amp cached filename
15251 char cached_file
[256] = { 0 };
15253 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15259 if (stat (cached_file
, &cst
) == -1)
15265 * kernel compile or load
15268 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15270 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15274 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15275 if (quiet
== 0) log_info ("");
15277 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15279 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15281 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15285 device_param
->skipped
= true;
15287 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15292 size_t binary_size
;
15294 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15296 u8
*binary
= (u8
*) mymalloc (binary_size
);
15298 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15300 writeProgramBin (cached_file
, binary
, binary_size
);
15302 local_free (binary
);
15307 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15310 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15312 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15314 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15317 local_free (kernel_lengths
);
15318 local_free (kernel_sources
[0]);
15319 local_free (kernel_sources
);
15322 // some algorithm collide too fast, make that impossible
15324 if (benchmark
== 1)
15326 ((uint
*) digests_buf
)[0] = -1;
15327 ((uint
*) digests_buf
)[1] = -1;
15328 ((uint
*) digests_buf
)[2] = -1;
15329 ((uint
*) digests_buf
)[3] = -1;
15336 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15337 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15338 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15339 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15340 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15341 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15342 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15343 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15344 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15345 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15346 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15347 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15348 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15349 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15350 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15351 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15352 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15353 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15355 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
);
15356 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
);
15357 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
);
15358 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
);
15359 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
);
15360 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
);
15361 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
);
15362 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
);
15363 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15364 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15365 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15371 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15373 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15374 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15376 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15378 else if (attack_kern
== ATTACK_KERN_COMBI
)
15380 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15381 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15382 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15383 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15385 else if (attack_kern
== ATTACK_KERN_BF
)
15387 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15388 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15389 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15390 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15391 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15396 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15398 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15405 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15407 device_param
->pws_buf
= pws_buf
;
15409 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15411 device_param
->combs_buf
= combs_buf
;
15413 void *hooks_buf
= mymalloc (size_hooks
);
15415 device_param
->hooks_buf
= hooks_buf
;
15421 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15422 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15423 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15424 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15425 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15426 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15427 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15428 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15429 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15430 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15431 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15433 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15434 ? &device_param
->d_pws_buf
15435 : &device_param
->d_pws_amp_buf
;
15436 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15437 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15438 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15439 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15440 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15441 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15442 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15443 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15444 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15445 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15446 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15447 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15448 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15449 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15450 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15451 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15452 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15453 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15454 device_param
->kernel_params
[19] = &device_param
->d_result
;
15455 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15456 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15457 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15458 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15459 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15460 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15461 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15462 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15463 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15464 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15465 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15466 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15468 device_param
->kernel_params_mp_buf64
[3] = 0;
15469 device_param
->kernel_params_mp_buf32
[4] = 0;
15470 device_param
->kernel_params_mp_buf32
[5] = 0;
15471 device_param
->kernel_params_mp_buf32
[6] = 0;
15472 device_param
->kernel_params_mp_buf32
[7] = 0;
15473 device_param
->kernel_params_mp_buf32
[8] = 0;
15475 device_param
->kernel_params_mp
[0] = NULL
;
15476 device_param
->kernel_params_mp
[1] = NULL
;
15477 device_param
->kernel_params_mp
[2] = NULL
;
15478 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15479 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15480 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15481 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15482 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15483 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15485 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15486 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15487 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15488 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15489 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15490 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15491 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15493 device_param
->kernel_params_mp_l
[0] = NULL
;
15494 device_param
->kernel_params_mp_l
[1] = NULL
;
15495 device_param
->kernel_params_mp_l
[2] = NULL
;
15496 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15497 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15498 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15499 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15500 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15501 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15502 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15504 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15505 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15506 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15507 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15508 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15509 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15511 device_param
->kernel_params_mp_r
[0] = NULL
;
15512 device_param
->kernel_params_mp_r
[1] = NULL
;
15513 device_param
->kernel_params_mp_r
[2] = NULL
;
15514 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15515 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15516 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15517 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15518 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15519 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15521 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15522 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15524 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15525 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15526 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15527 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15528 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15529 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15530 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15532 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15533 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15535 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15536 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15538 device_param
->kernel_params_memset
[0] = NULL
;
15539 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15540 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15546 size_t kernel_wgs_tmp
;
15548 char kernel_name
[64] = { 0 };
15550 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15552 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15554 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15556 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15558 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15560 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15562 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15564 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15568 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15570 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15572 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15574 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15576 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15578 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15581 if (data
.attack_mode
== ATTACK_MODE_BF
)
15583 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15585 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15587 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15589 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
);
15595 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15597 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15599 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15601 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15603 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15605 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15607 if (opts_type
& OPTS_TYPE_HOOK12
)
15609 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15611 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15613 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
);
15616 if (opts_type
& OPTS_TYPE_HOOK23
)
15618 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15620 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15622 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
);
15626 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
);
15627 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
);
15628 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
);
15630 for (uint i
= 0; i
<= 20; i
++)
15632 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15633 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15634 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15636 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15637 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15640 for (uint i
= 21; i
<= 31; i
++)
15642 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15643 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15644 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15646 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15647 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15652 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15654 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
);
15656 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15657 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15658 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15662 if (attack_mode
== ATTACK_MODE_BF
)
15664 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15665 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15667 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
);
15668 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
);
15670 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15672 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15673 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15676 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15678 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15680 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
);
15682 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15684 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15686 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
);
15689 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15695 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15697 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
);
15700 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15706 for (uint i
= 0; i
< 5; i
++)
15708 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15711 for (uint i
= 5; i
< 7; i
++)
15713 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15717 // maybe this has been updated by clGetKernelWorkGroupInfo()
15718 // value can only be decreased, so we don't need to reallocate buffers
15720 device_param
->kernel_threads
= kernel_threads
;
15722 // zero some data buffers
15724 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15725 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15726 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15727 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15728 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15729 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15735 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15737 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15739 else if (attack_kern
== ATTACK_KERN_COMBI
)
15741 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15742 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15743 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15744 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15746 else if (attack_kern
== ATTACK_KERN_BF
)
15748 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15749 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15750 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15751 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15752 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15755 #if defined(HAVE_HWMON)
15758 * Store initial fanspeed if gpu_temp_retain is enabled
15761 if (gpu_temp_disable
== 0)
15763 if (gpu_temp_retain
!= 0)
15765 hc_thread_mutex_lock (mux_adl
);
15767 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
15769 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
15770 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
15772 temp_retain_fanspeed_value
[device_id
] = fanspeed
;
15773 temp_retain_fanpolicy_value
[device_id
] = fanpolicy
;
15775 // we also set it to tell the OS we take control over the fan and it's automatic controller
15776 // if it was set to automatic. we do not control user-defined fanspeeds.
15778 if (fanpolicy
== 1)
15780 data
.hm_device
[device_id
].fan_set_supported
= 1;
15784 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15786 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
15788 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15795 data
.hm_device
[device_id
].fan_set_supported
= 1;
15799 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
15801 data
.hm_device
[device_id
].fan_set_supported
= 0;
15806 data
.hm_device
[device_id
].fan_set_supported
= 0;
15810 hc_thread_mutex_unlock (mux_adl
);
15814 #endif // HAVE_HWMON
15817 if (data
.quiet
== 0) log_info_nn ("");
15820 * In benchmark-mode, inform user which algorithm is checked
15823 if (benchmark
== 1)
15825 if (machine_readable
== 0)
15829 data
.quiet
= quiet
;
15831 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15833 log_info ("Hashtype: %s", hash_type
);
15839 * keep track of the progress
15842 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15843 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15844 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15851 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15853 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15858 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15860 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15865 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15867 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15877 segment_size
*= (1024 * 1024);
15879 data
.segment_size
= segment_size
;
15881 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15883 wl_data
->buf
= (char *) mymalloc (segment_size
);
15884 wl_data
->avail
= segment_size
;
15885 wl_data
->incr
= segment_size
;
15889 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15891 data
.wordlist_mode
= wordlist_mode
;
15893 cs_t
*css_buf
= NULL
;
15897 char **masks
= NULL
;
15898 char **dictfiles
= NULL
;
15900 uint mask_from_file
= 0;
15902 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15904 if (wordlist_mode
== WL_MODE_FILE
)
15906 int wls_left
= myargc
- (optind
+ 1);
15908 for (int i
= 0; i
< wls_left
; i
++)
15910 char *l0_filename
= myargv
[optind
+ 1 + i
];
15912 struct stat l0_stat
;
15914 if (stat (l0_filename
, &l0_stat
) == -1)
15916 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15921 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15925 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15929 dictfiles
[dictcnt
- 1] = l0_filename
;
15933 // do not allow --keyspace w/ a directory
15937 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15942 char **dictionary_files
= NULL
;
15944 dictionary_files
= scan_directory (l0_filename
);
15946 if (dictionary_files
!= NULL
)
15948 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15950 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15952 char *l1_filename
= dictionary_files
[d
];
15954 struct stat l1_stat
;
15956 if (stat (l1_filename
, &l1_stat
) == -1)
15958 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15963 if (S_ISREG (l1_stat
.st_mode
))
15965 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15969 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15974 local_free (dictionary_files
);
15980 log_error ("ERROR: No usable dictionary file found.");
15985 else if (wordlist_mode
== WL_MODE_STDIN
)
15990 else if (attack_mode
== ATTACK_MODE_COMBI
)
15994 char *dictfile1
= myargv
[optind
+ 1 + 0];
15995 char *dictfile2
= myargv
[optind
+ 1 + 1];
15997 // find the bigger dictionary and use as base
16002 struct stat tmp_stat
;
16004 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
16006 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16011 if (stat (dictfile1
, &tmp_stat
) == -1)
16013 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16020 if (S_ISDIR (tmp_stat
.st_mode
))
16022 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16029 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16031 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16038 if (stat (dictfile2
, &tmp_stat
) == -1)
16040 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16048 if (S_ISDIR (tmp_stat
.st_mode
))
16050 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16058 data
.combs_cnt
= 1;
16062 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16064 data
.quiet
= quiet
;
16066 if (words1_cnt
== 0)
16068 log_error ("ERROR: %s: empty file", dictfile1
);
16076 data
.combs_cnt
= 1;
16080 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16082 data
.quiet
= quiet
;
16084 if (words2_cnt
== 0)
16086 log_error ("ERROR: %s: empty file", dictfile2
);
16097 data
.dictfile
= dictfile1
;
16098 data
.dictfile2
= dictfile2
;
16100 if (words1_cnt
>= words2_cnt
)
16102 data
.combs_cnt
= words2_cnt
;
16103 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16105 dictfiles
= &data
.dictfile
;
16111 data
.combs_cnt
= words1_cnt
;
16112 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16114 dictfiles
= &data
.dictfile2
;
16118 // we also have to switch wordlist related rules!
16120 char *tmpc
= data
.rule_buf_l
;
16122 data
.rule_buf_l
= data
.rule_buf_r
;
16123 data
.rule_buf_r
= tmpc
;
16125 int tmpi
= data
.rule_len_l
;
16127 data
.rule_len_l
= data
.rule_len_r
;
16128 data
.rule_len_r
= tmpi
;
16131 else if (attack_mode
== ATTACK_MODE_BF
)
16137 if (benchmark
== 0)
16139 mask
= myargv
[optind
+ 1];
16141 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16143 if ((optind
+ 2) <= myargc
)
16145 struct stat file_stat
;
16147 if (stat (mask
, &file_stat
) == -1)
16151 masks
[maskcnt
- 1] = mystrdup (mask
);
16155 int wls_left
= myargc
- (optind
+ 1);
16157 uint masks_avail
= INCR_MASKS
;
16159 for (int i
= 0; i
< wls_left
; i
++)
16163 mask
= myargv
[optind
+ 1 + i
];
16165 if (stat (mask
, &file_stat
) == -1)
16167 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16173 uint is_file
= S_ISREG (file_stat
.st_mode
);
16179 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16181 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16186 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16188 while (!feof (mask_fp
))
16190 memset (line_buf
, 0, HCBUFSIZ
);
16192 int line_len
= fgetl (mask_fp
, line_buf
);
16194 if (line_len
== 0) continue;
16196 if (line_buf
[0] == '#') continue;
16198 if (masks_avail
== maskcnt
)
16200 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16202 masks_avail
+= INCR_MASKS
;
16205 masks
[maskcnt
] = mystrdup (line_buf
);
16216 log_error ("ERROR: %s: unsupported file-type", mask
);
16222 mask_from_file
= 1;
16227 custom_charset_1
= (char *) "?l?d?u";
16228 custom_charset_2
= (char *) "?l?d";
16229 custom_charset_3
= (char *) "?l?d*!$@_";
16231 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16232 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16233 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16235 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16237 wordlist_mode
= WL_MODE_MASK
;
16239 data
.wordlist_mode
= wordlist_mode
;
16249 * generate full masks and charsets
16252 masks
= (char **) mymalloc (sizeof (char *));
16256 case 1731: pw_min
= 5;
16258 mask
= mystrdup ("?b?b?b?b?b");
16260 case 12500: pw_min
= 5;
16262 mask
= mystrdup ("?b?b?b?b?b");
16264 default: pw_min
= 7;
16266 mask
= mystrdup ("?b?b?b?b?b?b?b");
16272 masks
[maskcnt
- 1] = mystrdup (mask
);
16274 wordlist_mode
= WL_MODE_MASK
;
16276 data
.wordlist_mode
= wordlist_mode
;
16281 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16285 if (increment_min
> pw_min
) pw_min
= increment_min
;
16287 if (increment_max
< pw_max
) pw_max
= increment_max
;
16290 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16292 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16296 char *mask
= myargv
[myargc
- 1];
16300 masks
= (char **) mymalloc (1 * sizeof (char *));
16304 struct stat file_stat
;
16306 if (stat (mask
, &file_stat
) == -1)
16310 masks
[maskcnt
- 1] = mystrdup (mask
);
16314 uint is_file
= S_ISREG (file_stat
.st_mode
);
16320 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16322 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16327 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16329 uint masks_avail
= 1;
16331 while (!feof (mask_fp
))
16333 memset (line_buf
, 0, HCBUFSIZ
);
16335 int line_len
= fgetl (mask_fp
, line_buf
);
16337 if (line_len
== 0) continue;
16339 if (line_buf
[0] == '#') continue;
16341 if (masks_avail
== maskcnt
)
16343 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16345 masks_avail
+= INCR_MASKS
;
16348 masks
[maskcnt
] = mystrdup (line_buf
);
16357 mask_from_file
= 1;
16363 masks
[maskcnt
- 1] = mystrdup (mask
);
16369 int wls_left
= myargc
- (optind
+ 2);
16371 for (int i
= 0; i
< wls_left
; i
++)
16373 char *filename
= myargv
[optind
+ 1 + i
];
16375 struct stat file_stat
;
16377 if (stat (filename
, &file_stat
) == -1)
16379 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16384 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16388 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16392 dictfiles
[dictcnt
- 1] = filename
;
16396 // do not allow --keyspace w/ a directory
16400 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16405 char **dictionary_files
= NULL
;
16407 dictionary_files
= scan_directory (filename
);
16409 if (dictionary_files
!= NULL
)
16411 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16413 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16415 char *l1_filename
= dictionary_files
[d
];
16417 struct stat l1_stat
;
16419 if (stat (l1_filename
, &l1_stat
) == -1)
16421 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16426 if (S_ISREG (l1_stat
.st_mode
))
16428 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16432 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16437 local_free (dictionary_files
);
16443 log_error ("ERROR: No usable dictionary file found.");
16452 uint mask_min
= increment_min
; // we can't reject smaller masks here
16453 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16455 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16457 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16459 if (cur_mask
== NULL
) break;
16461 masks
[maskcnt
] = cur_mask
;
16465 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16469 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16471 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16475 char *mask
= myargv
[optind
+ 1 + 0];
16479 masks
= (char **) mymalloc (1 * sizeof (char *));
16483 struct stat file_stat
;
16485 if (stat (mask
, &file_stat
) == -1)
16489 masks
[maskcnt
- 1] = mystrdup (mask
);
16493 uint is_file
= S_ISREG (file_stat
.st_mode
);
16499 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16501 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16506 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16508 uint masks_avail
= 1;
16510 while (!feof (mask_fp
))
16512 memset (line_buf
, 0, HCBUFSIZ
);
16514 int line_len
= fgetl (mask_fp
, line_buf
);
16516 if (line_len
== 0) continue;
16518 if (line_buf
[0] == '#') continue;
16520 if (masks_avail
== maskcnt
)
16522 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16524 masks_avail
+= INCR_MASKS
;
16527 masks
[maskcnt
] = mystrdup (line_buf
);
16536 mask_from_file
= 1;
16542 masks
[maskcnt
- 1] = mystrdup (mask
);
16548 int wls_left
= myargc
- (optind
+ 2);
16550 for (int i
= 0; i
< wls_left
; i
++)
16552 char *filename
= myargv
[optind
+ 2 + i
];
16554 struct stat file_stat
;
16556 if (stat (filename
, &file_stat
) == -1)
16558 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16563 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16567 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16571 dictfiles
[dictcnt
- 1] = filename
;
16575 // do not allow --keyspace w/ a directory
16579 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16584 char **dictionary_files
= NULL
;
16586 dictionary_files
= scan_directory (filename
);
16588 if (dictionary_files
!= NULL
)
16590 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16592 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16594 char *l1_filename
= dictionary_files
[d
];
16596 struct stat l1_stat
;
16598 if (stat (l1_filename
, &l1_stat
) == -1)
16600 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16605 if (S_ISREG (l1_stat
.st_mode
))
16607 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16611 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16616 local_free (dictionary_files
);
16622 log_error ("ERROR: No usable dictionary file found.");
16631 uint mask_min
= increment_min
; // we can't reject smaller masks here
16632 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16634 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16636 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16638 if (cur_mask
== NULL
) break;
16640 masks
[maskcnt
] = cur_mask
;
16644 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16649 data
.pw_min
= pw_min
;
16650 data
.pw_max
= pw_max
;
16656 if (weak_hash_threshold
>= salts_cnt
)
16658 hc_device_param_t
*device_param
= NULL
;
16660 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16662 device_param
= &data
.devices_param
[device_id
];
16664 if (device_param
->skipped
) continue;
16669 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16671 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16673 weak_hash_check (device_param
, salt_pos
);
16676 // Display hack, guarantee that there is at least one \r before real start
16678 //if (data.quiet == 0) log_info ("");
16682 * status and monitor threads
16685 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16687 hc_thread_t i_thread
= 0;
16689 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16691 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16694 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16696 uint ni_threads_cnt
= 0;
16698 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16700 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16710 if (outfile_check_timer
!= 0)
16712 if (data
.outfile_check_directory
!= NULL
)
16714 if ((hash_mode
!= 5200) &&
16715 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16716 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16717 (hash_mode
!= 9000))
16719 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16725 outfile_check_timer
= 0;
16730 outfile_check_timer
= 0;
16736 * Inform the user if we got some hashes remove because of the pot file remove feature
16739 if (data
.quiet
== 0)
16741 if (potfile_remove_cracks
> 0)
16743 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16744 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16748 data
.outfile_check_timer
= outfile_check_timer
;
16754 char **induction_dictionaries
= NULL
;
16756 int induction_dictionaries_cnt
= 0;
16758 hcstat_table_t
*root_table_buf
= NULL
;
16759 hcstat_table_t
*markov_table_buf
= NULL
;
16761 uint initial_restore_done
= 0;
16763 data
.maskcnt
= maskcnt
;
16765 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16767 if (data
.devices_status
== STATUS_CRACKED
) break;
16769 data
.devices_status
= STATUS_INIT
;
16771 if (maskpos
> rd
->maskpos
)
16776 rd
->maskpos
= maskpos
;
16777 data
.maskpos
= maskpos
;
16779 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16781 char *mask
= masks
[maskpos
];
16783 if (mask_from_file
== 1)
16785 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16790 uint mask_offset
= 0;
16792 uint separator_cnt
;
16794 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16796 str_ptr
= strstr (mask
+ mask_offset
, ",");
16798 if (str_ptr
== NULL
) break;
16800 str_pos
= str_ptr
- mask
;
16802 // escaped separator, i.e. "\,"
16806 if (mask
[str_pos
- 1] == '\\')
16810 mask_offset
= str_pos
+ 1;
16816 // reset the offset
16820 mask
[str_pos
] = '\0';
16822 switch (separator_cnt
)
16825 mp_reset_usr (mp_usr
, 0);
16827 custom_charset_1
= mask
;
16828 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16832 mp_reset_usr (mp_usr
, 1);
16834 custom_charset_2
= mask
;
16835 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16839 mp_reset_usr (mp_usr
, 2);
16841 custom_charset_3
= mask
;
16842 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16846 mp_reset_usr (mp_usr
, 3);
16848 custom_charset_4
= mask
;
16849 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16853 mask
= mask
+ str_pos
+ 1;
16857 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16861 local_free (css_buf
);
16862 local_free (data
.root_css_buf
);
16863 local_free (data
.markov_css_buf
);
16865 local_free (masks
[maskpos
- 1]);
16868 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16871 data
.css_cnt
= css_cnt
;
16872 data
.css_buf
= css_buf
;
16874 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16876 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16878 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16879 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16881 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16883 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16885 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16886 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16888 data
.root_css_buf
= root_css_buf
;
16889 data
.markov_css_buf
= markov_css_buf
;
16891 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16893 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16895 local_free (root_table_buf
);
16896 local_free (markov_table_buf
);
16900 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16902 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16904 if (device_param
->skipped
) continue;
16906 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16907 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16908 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16910 device_param
->kernel_params_mp_buf64
[3] = 0;
16911 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16912 device_param
->kernel_params_mp_buf32
[5] = 0;
16913 device_param
->kernel_params_mp_buf32
[6] = 0;
16914 device_param
->kernel_params_mp_buf32
[7] = 0;
16916 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16918 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16919 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16920 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16921 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16923 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16925 device_param
->kernel_params_mp_buf32
[5] = 0;
16926 device_param
->kernel_params_mp_buf32
[6] = 0;
16927 device_param
->kernel_params_mp_buf32
[7] = 0;
16930 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
]);
16931 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
]);
16932 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
]);
16934 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
);
16935 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
);
16938 else if (attack_mode
== ATTACK_MODE_BF
)
16940 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16944 for (uint i
= 0; i
< dictcnt
; i
++)
16946 local_free (dictfiles
[i
]);
16949 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16951 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16953 if (l1_filename
== NULL
) break;
16957 dictfiles
[dictcnt
- 1] = l1_filename
;
16964 dictfiles
[dictcnt
- 1] = mask
;
16969 log_error ("ERROR: Mask is too small");
16976 free (induction_dictionaries
);
16978 // induction_dictionaries_cnt = 0; // implied
16980 if (attack_mode
!= ATTACK_MODE_BF
)
16984 induction_dictionaries
= scan_directory (induction_directory
);
16986 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16990 if (induction_dictionaries_cnt
)
16992 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16996 * prevent the user from using --keyspace together w/ maskfile and or dictfile
17000 if ((maskcnt
> 1) || (dictcnt
> 1))
17002 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
17008 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
17010 char *subid
= logfile_generate_subid ();
17012 data
.subid
= subid
;
17014 logfile_sub_msg ("START");
17016 data
.devices_status
= STATUS_INIT
;
17018 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17019 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17020 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17022 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17026 data
.cpt_start
= time (NULL
);
17028 data
.cpt_total
= 0;
17030 if (data
.restore
== 0)
17032 rd
->words_cur
= skip
;
17039 data
.ms_paused
= 0;
17041 data
.kernel_power_final
= 0;
17043 data
.words_cur
= rd
->words_cur
;
17045 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17047 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17049 if (device_param
->skipped
) continue;
17051 device_param
->speed_pos
= 0;
17053 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17054 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17056 device_param
->exec_pos
= 0;
17058 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17060 device_param
->outerloop_pos
= 0;
17061 device_param
->outerloop_left
= 0;
17062 device_param
->innerloop_pos
= 0;
17063 device_param
->innerloop_left
= 0;
17065 // some more resets:
17067 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17069 device_param
->pws_cnt
= 0;
17071 device_param
->words_off
= 0;
17072 device_param
->words_done
= 0;
17075 // figure out some workload
17077 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17079 if (data
.wordlist_mode
== WL_MODE_FILE
)
17081 char *dictfile
= NULL
;
17083 if (induction_dictionaries_cnt
)
17085 dictfile
= induction_dictionaries
[0];
17089 dictfile
= dictfiles
[dictpos
];
17092 data
.dictfile
= dictfile
;
17094 logfile_sub_string (dictfile
);
17096 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17098 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17101 FILE *fd2
= fopen (dictfile
, "rb");
17105 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17110 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17114 if (data
.words_cnt
== 0)
17116 if (data
.devices_status
== STATUS_CRACKED
) break;
17117 if (data
.devices_status
== STATUS_ABORTED
) break;
17125 else if (attack_mode
== ATTACK_MODE_COMBI
)
17127 char *dictfile
= data
.dictfile
;
17128 char *dictfile2
= data
.dictfile2
;
17130 logfile_sub_string (dictfile
);
17131 logfile_sub_string (dictfile2
);
17133 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17135 FILE *fd2
= fopen (dictfile
, "rb");
17139 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17144 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17148 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17150 FILE *fd2
= fopen (dictfile2
, "rb");
17154 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17159 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17164 if (data
.words_cnt
== 0)
17166 if (data
.devices_status
== STATUS_CRACKED
) break;
17167 if (data
.devices_status
== STATUS_ABORTED
) break;
17174 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17176 char *dictfile
= NULL
;
17178 if (induction_dictionaries_cnt
)
17180 dictfile
= induction_dictionaries
[0];
17184 dictfile
= dictfiles
[dictpos
];
17187 data
.dictfile
= dictfile
;
17189 char *mask
= data
.mask
;
17191 logfile_sub_string (dictfile
);
17192 logfile_sub_string (mask
);
17194 FILE *fd2
= fopen (dictfile
, "rb");
17198 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17203 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17207 if (data
.words_cnt
== 0)
17209 if (data
.devices_status
== STATUS_CRACKED
) break;
17210 if (data
.devices_status
== STATUS_ABORTED
) break;
17217 else if (attack_mode
== ATTACK_MODE_BF
)
17219 local_free (css_buf
);
17220 local_free (data
.root_css_buf
);
17221 local_free (data
.markov_css_buf
);
17223 char *mask
= dictfiles
[dictpos
];
17225 logfile_sub_string (mask
);
17229 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17231 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17233 uint css_cnt_unicode
= css_cnt
* 2;
17235 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17237 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17239 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17241 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17242 css_buf_unicode
[j
+ 1].cs_len
= 1;
17247 css_buf
= css_buf_unicode
;
17248 css_cnt
= css_cnt_unicode
;
17251 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17253 uint mask_min
= pw_min
;
17254 uint mask_max
= pw_max
;
17256 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17262 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17264 if (css_cnt
< mask_min
)
17266 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17269 if (css_cnt
> mask_max
)
17271 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17274 // skip to next mask
17278 rd
->dictpos
= dictpos
;
17280 logfile_sub_msg ("STOP");
17285 uint save_css_cnt
= css_cnt
;
17287 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17289 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17291 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17292 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17294 uint css_cnt_salt
= css_cnt
+ salt_len
;
17296 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17298 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17300 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17302 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17303 css_buf_salt
[j
].cs_len
= 1;
17308 css_buf
= css_buf_salt
;
17309 css_cnt
= css_cnt_salt
;
17314 data
.css_cnt
= css_cnt
;
17315 data
.css_buf
= css_buf
;
17317 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17319 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17321 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17323 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17324 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17326 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17328 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17330 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17331 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17333 data
.root_css_buf
= root_css_buf
;
17334 data
.markov_css_buf
= markov_css_buf
;
17336 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17338 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17340 local_free (root_table_buf
);
17341 local_free (markov_table_buf
);
17345 uint css_cnt_l
= css_cnt
;
17348 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17350 if (save_css_cnt
< 6)
17354 else if (save_css_cnt
== 6)
17360 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17362 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17373 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17388 /* unfinished code?
17389 int sum = css_buf[css_cnt_r - 1].cs_len;
17391 for (uint i = 1; i < 4 && i < css_cnt; i++)
17393 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17397 sum *= css_buf[css_cnt_r - 1].cs_len;
17402 css_cnt_l
-= css_cnt_r
;
17404 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17406 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17408 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17410 if (device_param
->skipped
) continue;
17412 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17413 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17414 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17416 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17417 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17418 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17419 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17420 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17421 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17423 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17424 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17425 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17426 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17428 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17429 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17430 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17432 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17433 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17434 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17435 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17436 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17438 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
]);
17439 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
]);
17440 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
]);
17442 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
]);
17443 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
]);
17444 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
]);
17446 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
);
17447 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
);
17451 u64 words_base
= data
.words_cnt
;
17453 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17455 if (data
.kernel_rules_cnt
)
17457 words_base
/= data
.kernel_rules_cnt
;
17460 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17462 if (data
.combs_cnt
)
17464 words_base
/= data
.combs_cnt
;
17467 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17471 words_base
/= data
.bfs_cnt
;
17475 data
.words_base
= words_base
;
17479 log_info ("%llu", (unsigned long long int) words_base
);
17484 if (data
.words_cur
> data
.words_base
)
17486 log_error ("ERROR: restore value greater keyspace");
17491 if (data
.words_cur
)
17493 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17495 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17497 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17500 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17502 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17504 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17507 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17509 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17511 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17517 * Update loopback file
17526 uint random_num
= get_random_num (0, 9999);
17528 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17530 data
.loopback_file
= loopback_file
;
17534 * Update dictionary statistic
17539 dictstat_fp
= fopen (dictstat
, "wb");
17543 lock_file (dictstat_fp
);
17545 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17547 fclose (dictstat_fp
);
17552 * create autotune threads
17555 data
.devices_status
= STATUS_AUTOTUNE
;
17557 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17559 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17561 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17563 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
17566 hc_thread_wait (data
.devices_cnt
, c_threads
);
17569 * Inform user about possible slow speeds
17572 uint hardware_power_all
= 0;
17574 uint kernel_power_all
= 0;
17576 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17578 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17580 hardware_power_all
+= device_param
->hardware_power
;
17582 kernel_power_all
+= device_param
->kernel_power
;
17585 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
17587 data
.kernel_power_all
= kernel_power_all
;
17589 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17591 if (data
.words_base
< kernel_power_all
)
17595 log_info ("ATTENTION!");
17596 log_info (" The wordlist or mask you are using is too small.");
17597 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17598 log_info (" The cracking speed will drop.");
17599 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17606 * create cracker threads
17609 data
.devices_status
= STATUS_RUNNING
;
17611 if (initial_restore_done
== 0)
17613 if (data
.restore_disable
== 0) cycle_restore ();
17615 initial_restore_done
= 1;
17618 hc_timer_set (&data
.timer_running
);
17620 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17622 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17624 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17625 if (quiet
== 0) fflush (stdout
);
17628 else if (wordlist_mode
== WL_MODE_STDIN
)
17630 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17631 if (data
.quiet
== 0) log_info ("");
17634 time_t runtime_start
;
17636 time (&runtime_start
);
17638 data
.runtime_start
= runtime_start
;
17640 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17642 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17644 if (wordlist_mode
== WL_MODE_STDIN
)
17646 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17650 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17654 hc_thread_wait (data
.devices_cnt
, c_threads
);
17656 local_free (c_threads
);
17662 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17664 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17666 if (data
.devices_status
== STATUS_CRACKED
) break;
17667 if (data
.devices_status
== STATUS_ABORTED
) break;
17669 if (data
.devices_status
== STATUS_BYPASS
)
17671 data
.devices_status
= STATUS_RUNNING
;
17674 if (induction_dictionaries_cnt
)
17676 unlink (induction_dictionaries
[0]);
17679 free (induction_dictionaries
);
17681 if (attack_mode
!= ATTACK_MODE_BF
)
17683 induction_dictionaries
= scan_directory (induction_directory
);
17685 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17688 if (benchmark
== 0)
17690 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17692 if (quiet
== 0) clear_prompt ();
17694 if (quiet
== 0) log_info ("");
17702 if (quiet
== 0) status_display ();
17705 if (quiet
== 0) log_info ("");
17709 if (attack_mode
== ATTACK_MODE_BF
)
17713 rd
->dictpos
= dictpos
;
17717 if (induction_dictionaries_cnt
)
17719 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17725 rd
->dictpos
= dictpos
;
17729 time_t runtime_stop
;
17731 time (&runtime_stop
);
17733 data
.runtime_stop
= runtime_stop
;
17735 logfile_sub_uint (runtime_start
);
17736 logfile_sub_uint (runtime_stop
);
17738 logfile_sub_msg ("STOP");
17740 global_free (subid
);
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;
17747 if (data
.devices_status
== STATUS_QUIT
) break;
17749 if (data
.devices_status
== STATUS_BYPASS
)
17751 data
.devices_status
= STATUS_RUNNING
;
17755 // 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
17757 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17759 if (data
.wordlist_mode
== WL_MODE_FILE
)
17761 if (data
.dictfile
== NULL
)
17763 if (dictfiles
!= NULL
)
17765 data
.dictfile
= dictfiles
[0];
17767 hc_timer_set (&data
.timer_running
);
17772 // NOTE: combi is okay because it is already set beforehand
17773 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17775 if (data
.dictfile
== NULL
)
17777 if (dictfiles
!= NULL
)
17779 hc_timer_set (&data
.timer_running
);
17781 data
.dictfile
= dictfiles
[0];
17785 else if (attack_mode
== ATTACK_MODE_BF
)
17787 if (data
.mask
== NULL
)
17789 hc_timer_set (&data
.timer_running
);
17791 data
.mask
= masks
[0];
17795 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17797 data
.devices_status
= STATUS_EXHAUSTED
;
17800 // if cracked / aborted remove last induction dictionary
17802 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17804 struct stat induct_stat
;
17806 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17808 unlink (induction_dictionaries
[file_pos
]);
17812 // wait for non-interactive threads
17814 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17816 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17819 local_free (ni_threads
);
17821 // wait for interactive threads
17823 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17825 hc_thread_wait (1, &i_thread
);
17828 // we dont need restore file anymore
17829 if (data
.restore_disable
== 0)
17831 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17833 unlink (eff_restore_file
);
17834 unlink (new_restore_file
);
17842 // finally save left hashes
17844 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17853 if (benchmark
== 1)
17855 status_benchmark ();
17857 if (machine_readable
== 0)
17864 if (quiet
== 0) clear_prompt ();
17866 if (quiet
== 0) log_info ("");
17874 if (quiet
== 0) status_display ();
17877 if (quiet
== 0) log_info ("");
17880 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17884 if (device_param
->skipped
) continue;
17886 local_free (device_param
->combs_buf
);
17888 local_free (device_param
->hooks_buf
);
17890 local_free (device_param
->device_name
);
17892 local_free (device_param
->device_name_chksum
);
17894 local_free (device_param
->device_version
);
17896 local_free (device_param
->driver_version
);
17898 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17899 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17900 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17901 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17902 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17903 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17904 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17905 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17906 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17907 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17908 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17909 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17910 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17911 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17912 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17913 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17914 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17915 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17916 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17917 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17918 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17919 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17920 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17921 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17922 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17923 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17924 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17925 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17926 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17928 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17929 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17930 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17931 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17932 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17933 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17934 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17935 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17936 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17937 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17938 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17940 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17941 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17942 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17944 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17945 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17948 // reset default fan speed
17951 if (gpu_temp_disable
== 0)
17953 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17955 hc_thread_mutex_lock (mux_adl
);
17957 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17959 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17961 if (device_param
->skipped
) continue;
17963 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
17965 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17966 int fanpolicy
= temp_retain_fanpolicy_value
[device_id
];
17968 if (fanpolicy
== 1)
17972 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17974 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 0);
17976 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17981 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
17986 hc_thread_mutex_unlock (mux_adl
);
17990 // reset power tuning
17992 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17994 hc_thread_mutex_lock (mux_adl
);
17996 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17998 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18000 if (device_param
->skipped
) continue;
18002 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
18004 if (data
.hm_device
[device_id
].od_version
== 6)
18006 // check powertune capabilities first, if not available then skip device
18008 int powertune_supported
= 0;
18010 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
18012 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
18017 if (powertune_supported
!= 0)
18019 // powercontrol settings
18021 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
18023 log_info ("ERROR: Failed to restore the ADL PowerControl values");
18030 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
18032 performance_state
->iNumberOfPerformanceLevels
= 2;
18034 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
18035 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
18036 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
18037 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
18039 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
18041 log_info ("ERROR: Failed to restore ADL performance state");
18046 local_free (performance_state
);
18051 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
18053 unsigned int limit
= nvml_power_limit
[device_id
];
18057 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
18062 hc_thread_mutex_unlock (mux_adl
);
18065 if (gpu_temp_disable
== 0)
18069 hm_NVML_nvmlShutdown (data
.hm_nvml
);
18071 nvml_close (data
.hm_nvml
);
18073 data
.hm_nvml
= NULL
;
18078 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
18080 adl_close (data
.hm_adl
);
18082 data
.hm_adl
= NULL
;
18085 #endif // HAVE_HWMON
18089 local_free (masks
);
18091 local_free (dictstat_base
);
18093 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18095 pot_t
*pot_ptr
= &pot
[pot_pos
];
18097 hash_t
*hash
= &pot_ptr
->hash
;
18099 local_free (hash
->digest
);
18103 local_free (hash
->salt
);
18109 local_free (all_kernel_rules_cnt
);
18110 local_free (all_kernel_rules_buf
);
18112 local_free (wl_data
->buf
);
18113 local_free (wl_data
);
18115 local_free (bitmap_s1_a
);
18116 local_free (bitmap_s1_b
);
18117 local_free (bitmap_s1_c
);
18118 local_free (bitmap_s1_d
);
18119 local_free (bitmap_s2_a
);
18120 local_free (bitmap_s2_b
);
18121 local_free (bitmap_s2_c
);
18122 local_free (bitmap_s2_d
);
18125 local_free (temp_retain_fanspeed_value
);
18126 local_free (od_clock_mem_status
);
18127 local_free (od_power_control_status
);
18128 local_free (nvml_power_limit
);
18131 global_free (devices_param
);
18133 global_free (kernel_rules_buf
);
18135 global_free (root_css_buf
);
18136 global_free (markov_css_buf
);
18138 global_free (digests_buf
);
18139 global_free (digests_shown
);
18140 global_free (digests_shown_tmp
);
18142 global_free (salts_buf
);
18143 global_free (salts_shown
);
18145 global_free (esalts_buf
);
18147 global_free (words_progress_done
);
18148 global_free (words_progress_rejected
);
18149 global_free (words_progress_restored
);
18151 if (pot_fp
) fclose (pot_fp
);
18153 if (data
.devices_status
== STATUS_QUIT
) break;
18156 // destroy others mutex
18158 hc_thread_mutex_delete (mux_dispatcher
);
18159 hc_thread_mutex_delete (mux_counter
);
18160 hc_thread_mutex_delete (mux_display
);
18161 hc_thread_mutex_delete (mux_adl
);
18165 local_free (eff_restore_file
);
18166 local_free (new_restore_file
);
18172 tuning_db_destroy (tuning_db
);
18176 local_free (loopback_file
);
18178 if (loopback
== 1) unlink (loopback_file
);
18180 // induction directory
18182 if (induction_dir
== NULL
)
18184 if (attack_mode
!= ATTACK_MODE_BF
)
18186 if (rmdir (induction_directory
) == -1)
18188 if (errno
== ENOENT
)
18190 // good, we can ignore
18192 else if (errno
== ENOTEMPTY
)
18194 // good, we can ignore
18198 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18204 local_free (induction_directory
);
18208 // outfile-check directory
18210 if (outfile_check_dir
== NULL
)
18212 if (rmdir (outfile_check_directory
) == -1)
18214 if (errno
== ENOENT
)
18216 // good, we can ignore
18218 else if (errno
== ENOTEMPTY
)
18220 // good, we can ignore
18224 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18230 local_free (outfile_check_directory
);
18237 logfile_top_uint (proc_start
);
18238 logfile_top_uint (proc_stop
);
18240 logfile_top_msg ("STOP");
18242 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18243 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18245 if (data
.ocl
) ocl_close (data
.ocl
);
18247 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18248 if (data
.devices_status
== STATUS_QUIT
) return 2;
18249 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18250 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18251 if (data
.devices_status
== STATUS_CRACKED
) return 0;