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 70
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 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
318 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
324 static unsigned int full01
= 0x01010101;
325 static unsigned int full80
= 0x80808080;
327 int SUPPRESS_OUTPUT
= 0;
329 hc_thread_mutex_t mux_adl
;
330 hc_thread_mutex_t mux_counter
;
331 hc_thread_mutex_t mux_dispatcher
;
332 hc_thread_mutex_t mux_display
;
334 hc_global_data_t data
;
336 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
338 const char *USAGE_MINI
[] =
340 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
342 "Try --help for more help.",
346 const char *USAGE_BIG
[] =
348 "%s, advanced password recovery",
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
354 " Options Short / Long | Type | Description | Example",
355 "===============================|======|======================================================|=======================",
356 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
357 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
358 " -V, --version | | Print version |",
359 " -h, --help | | Print help |",
360 " --quiet | | Suppress output |",
361 " --hex-charset | | Assume charset is given in hex |",
362 " --hex-salt | | Assume salt is given in hex |",
363 " --hex-wordlist | | Assume words in wordlist is given in hex |",
364 " --force | | Ignore warnings |",
365 " --status | | Enable automatic update of the status-screen |",
366 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
367 " --machine-readable | | Display the status view in a machine readable format |",
368 " --loopback | | Add new plains to induct directory |",
369 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
370 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
371 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
372 " --markov-classic | | Enables classic markov-chains, no per-position |",
373 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
374 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
375 " --session | Str | Define specific session name | --session=mysession",
376 " --restore | | Restore session from --session |",
377 " --restore-disable | | Do not write restore file |",
378 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
379 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
380 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
381 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
382 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
383 " --show | | Show cracked passwords only |",
384 " --left | | Show un-cracked passwords only |",
385 " --username | | Enable ignoring of usernames in hashfile |",
386 " --remove | | Enable remove of hash once it is cracked |",
387 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
388 " --potfile-disable | | Do not write potfile |",
389 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
390 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
391 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
392 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
393 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
394 " --logfile-disable | | Disable the logfile |",
395 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
396 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
397 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
398 " -b, --benchmark | | Run benchmark |",
399 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
400 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
401 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
402 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
403 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
404 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
405 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
406 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
407 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
408 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
409 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
410 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
412 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
413 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
415 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
418 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
419 " -s, --skip | Num | Skip X words from the start | -s 1000000",
420 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
421 " --keyspace | | Show keyspace base:mod values and quit |",
422 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
423 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
424 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
425 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
426 " --generate-rules-func-min | Num | Force min X funcs per rule |",
427 " --generate-rules-func-max | Num | Force max X funcs per rule |",
428 " --generate-rules-seed | Num | Force RNG seed set to X |",
429 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
430 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
431 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
432 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
433 " -i, --increment | | Enable mask increment mode |",
434 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
435 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
437 "- [ Hash modes ] -",
439 " # | Name | Category",
440 " ======+==================================================+======================================",
441 " 900 | MD4 | Raw Hash",
442 " 0 | MD5 | Raw Hash",
443 " 5100 | Half MD5 | Raw Hash",
444 " 100 | SHA1 | Raw Hash",
445 " 10800 | SHA-384 | Raw Hash",
446 " 1400 | SHA-256 | Raw Hash",
447 " 1700 | SHA-512 | Raw Hash",
448 " 5000 | SHA-3(Keccak) | Raw Hash",
449 " 10100 | SipHash | Raw Hash",
450 " 6000 | RipeMD160 | Raw Hash",
451 " 6100 | Whirlpool | Raw Hash",
452 " 6900 | GOST R 34.11-94 | Raw Hash",
453 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
454 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
455 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
456 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
457 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
458 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
459 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
461 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
462 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
463 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
464 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
465 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
466 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
467 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
469 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
470 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
471 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
480 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
481 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
482 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
483 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
484 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
485 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
486 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
487 " 400 | phpass | Generic KDF",
488 " 8900 | scrypt | Generic KDF",
489 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
490 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
491 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
492 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
493 " 23 | Skype | Network protocols",
494 " 2500 | WPA/WPA2 | Network protocols",
495 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
496 " 5300 | IKE-PSK MD5 | Network protocols",
497 " 5400 | IKE-PSK SHA1 | Network protocols",
498 " 5500 | NetNTLMv1 | Network protocols",
499 " 5500 | NetNTLMv1 + ESS | Network protocols",
500 " 5600 | NetNTLMv2 | Network protocols",
501 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
502 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
503 " 8300 | DNSSEC (NSEC3) | Network protocols",
504 " 10200 | Cram MD5 | Network protocols",
505 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
506 " 11200 | MySQL CRAM (SHA1) | Network protocols",
507 " 11400 | SIP digest authentication (MD5) | Network protocols",
508 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
509 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
510 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
511 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
512 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
513 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
514 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
515 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
516 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
517 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
518 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
519 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
520 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
521 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
522 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
523 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
524 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
525 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
526 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
527 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
528 " 12 | PostgreSQL | Database Server",
529 " 131 | MSSQL(2000) | Database Server",
530 " 132 | MSSQL(2005) | Database Server",
531 " 1731 | MSSQL(2012) | Database Server",
532 " 1731 | MSSQL(2014) | Database Server",
533 " 200 | MySQL323 | Database Server",
534 " 300 | MySQL4.1/MySQL5 | Database Server",
535 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
536 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
537 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
538 " 8000 | Sybase ASE | Database Server",
539 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
540 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
541 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
542 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
543 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
544 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
545 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
546 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
547 " 11500 | CRC32 | Checksums",
548 " 3000 | LM | Operating-Systems",
549 " 1000 | NTLM | Operating-Systems",
550 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
551 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
552 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
553 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
554 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
555 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
556 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
557 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
558 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
559 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
560 " 1722 | OSX v10.7 | Operating-Systems",
561 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
562 " 6300 | AIX {smd5} | Operating-Systems",
563 " 6700 | AIX {ssha1} | Operating-Systems",
564 " 6400 | AIX {ssha256} | Operating-Systems",
565 " 6500 | AIX {ssha512} | Operating-Systems",
566 " 2400 | Cisco-PIX | Operating-Systems",
567 " 2410 | Cisco-ASA | Operating-Systems",
568 " 500 | Cisco-IOS $1$ | Operating-Systems",
569 " 5700 | Cisco-IOS $4$ | Operating-Systems",
570 " 9200 | Cisco-IOS $8$ | Operating-Systems",
571 " 9300 | Cisco-IOS $9$ | Operating-Systems",
572 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
573 " 501 | Juniper IVE | Operating-Systems",
574 " 5800 | Android PIN | Operating-Systems",
575 " 8100 | Citrix Netscaler | Operating-Systems",
576 " 8500 | RACF | Operating-Systems",
577 " 7200 | GRUB 2 | Operating-Systems",
578 " 9900 | Radmin2 | Operating-Systems",
579 " 125 | ArubaOS | Operating-Systems",
580 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
581 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
582 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
583 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
584 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
585 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
586 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
587 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
588 " 11600 | 7-Zip | Archives",
589 " 12500 | RAR3-hp | Archives",
590 " 13000 | RAR5 | Archives",
591 " 13200 | AxCrypt | Archives",
592 " 13300 | AxCrypt in memory SHA1 | Archives",
593 " 13600 | WinZip | Archives",
594 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
595 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
596 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
597 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
598 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
600 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
601 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
608 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
609 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
610 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
611 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
612 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
613 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
614 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
615 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
616 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
617 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
618 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
628 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
629 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
630 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
631 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
632 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
633 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
634 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
635 " 9400 | MS Office 2007 | Documents",
636 " 9500 | MS Office 2010 | Documents",
637 " 9600 | MS Office 2013 | Documents",
638 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
639 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
640 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
641 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
642 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
643 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
644 " 9000 | Password Safe v2 | Password Managers",
645 " 5200 | Password Safe v3 | Password Managers",
646 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
647 " 6600 | 1Password, agilekeychain | Password Managers",
648 " 8200 | 1Password, cloudkeychain | Password Managers",
649 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
650 " 12700 | Blockchain, My Wallet | Password Managers",
651 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
653 "- [ Outfile Formats ] -",
659 " 3 | hash[:salt]:plain",
661 " 5 | hash[:salt]:hex_plain",
662 " 6 | plain:hex_plain",
663 " 7 | hash[:salt]:plain:hex_plain",
665 " 9 | hash[:salt]:crack_pos",
666 " 10 | plain:crack_pos",
667 " 11 | hash[:salt]:plain:crack_pos",
668 " 12 | hex_plain:crack_pos",
669 " 13 | hash[:salt]:hex_plain:crack_pos",
670 " 14 | plain:hex_plain:crack_pos",
671 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
673 "- [ Rule Debugging Modes ] -",
678 " 2 | Original-Word",
679 " 3 | Original-Word:Finding-Rule",
680 " 4 | Original-Word:Finding-Rule:Processed-Word",
682 "- [ Attack Modes ] -",
689 " 6 | Hybrid Wordlist + Mask",
690 " 7 | Hybrid Mask + Wordlist",
692 "- [ Built-in Charsets ] -",
696 " l | abcdefghijklmnopqrstuvwxyz",
697 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
699 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
703 "- [ OpenCL Device Types ] -",
706 " ===+=============",
709 " 3 | FPGA, DSP, Co-Processor",
711 "- [ Workload Profiles ] -",
713 " # | Performance | Runtime | Power Consumption | Desktop Impact",
714 " ===+=============+=========+===================+=================",
715 " 1 | Low | 2 ms | Low | Minimal",
716 " 2 | Default | 12 ms | Economic | Noticeable",
717 " 3 | High | 96 ms | High | Unresponsive",
718 " 4 | Nightmare | 480 ms | Insane | Headless",
720 "If you have no idea what just happened then visit the following pages:",
722 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
723 "* https://hashcat.net/wiki/#frequently_asked_questions",
729 * hashcat specific functions
732 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
734 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
736 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
738 double exec_ms_sum
= 0;
742 for (int i
= 0; i
< last_num_entries
; i
++)
744 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
748 exec_ms_sum
+= exec_ms
;
754 if (exec_ms_cnt
== 0) return 0;
756 return exec_ms_sum
/ exec_ms_cnt
;
759 void status_display_machine_readable ()
763 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
769 fprintf (out
, "SPEED\t");
771 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
773 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
775 if (device_param
->skipped
) continue;
780 for (int i
= 0; i
< SPEED_CACHE
; i
++)
782 speed_cnt
+= device_param
->speed_cnt
[i
];
783 speed_ms
+= device_param
->speed_ms
[i
];
786 speed_cnt
/= SPEED_CACHE
;
787 speed_ms
/= SPEED_CACHE
;
789 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
796 fprintf (out
, "EXEC_RUNTIME\t");
798 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
800 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
802 if (device_param
->skipped
) continue;
804 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
806 fprintf (out
, "%f\t", exec_ms_avg
);
813 u64 words_cur
= get_lowest_words_done ();
815 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
821 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
824 u64 all_rejected
= 0;
825 u64 all_restored
= 0;
827 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
829 all_done
+= data
.words_progress_done
[salt_pos
];
830 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
831 all_restored
+= data
.words_progress_restored
[salt_pos
];
834 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
835 u64 progress_end
= progress_total
;
837 u64 progress_skip
= 0;
841 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
843 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
844 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
845 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
850 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
852 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
853 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
854 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
857 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
858 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
860 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
866 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
867 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
874 if (data
.gpu_temp_disable
== 0)
876 fprintf (out
, "TEMP\t");
878 hc_thread_mutex_lock (mux_adl
);
880 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
884 if (device_param
->skipped
) continue;
886 int temp
= hm_get_temperature_with_device_id (device_id
);
888 fprintf (out
, "%d\t", temp
);
891 hc_thread_mutex_unlock (mux_adl
);
911 void status_display ()
913 if (data
.devices_status
== STATUS_INIT
) return;
914 if (data
.devices_status
== STATUS_STARTING
) return;
915 if (data
.devices_status
== STATUS_BYPASS
) return;
917 if (data
.machine_readable
== 1)
919 status_display_machine_readable ();
924 char tmp_buf
[1000] = { 0 };
928 log_info ("Session.Name...: %s", data
.session
);
930 char *status_type
= strstatus (data
.devices_status
);
932 uint hash_mode
= data
.hash_mode
;
934 char *hash_type
= strhashtype (hash_mode
); // not a bug
936 log_info ("Status.........: %s", status_type
);
942 if (data
.rp_files_cnt
)
946 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
948 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
951 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
953 log_info ("Rules.Type.....: %s", tmp_buf
);
960 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
962 if (data
.rp_gen_seed
)
964 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
972 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
974 if (data
.wordlist_mode
== WL_MODE_FILE
)
976 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
978 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
980 log_info ("Input.Mode.....: Pipe");
983 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
985 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
986 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
988 else if (data
.attack_mode
== ATTACK_MODE_BF
)
990 char *mask
= data
.mask
;
994 uint mask_len
= data
.css_cnt
;
996 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1000 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1002 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1004 mask_len
-= data
.salts_buf
[0].salt_len
;
1008 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1010 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1013 if (data
.maskcnt
> 1)
1015 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1017 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1020 log_info ("Input.Mode.....: %s", tmp_buf
);
1025 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1027 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1028 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1030 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1032 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1033 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1036 if (data
.digests_cnt
== 1)
1038 if (data
.hash_mode
== 2500)
1040 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1042 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1043 (char *) data
.salts_buf
[0].salt_buf
,
1057 else if (data
.hash_mode
== 5200)
1059 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1061 else if (data
.hash_mode
== 9000)
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1065 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1069 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1071 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1075 char out_buf
[HCBUFSIZ
] = { 0 };
1077 ascii_digest (out_buf
, 0, 0);
1080 if (strlen (out_buf
) > 40)
1088 log_info ("Hash.Target....: %s", out_buf
);
1093 if (data
.hash_mode
== 3000)
1095 char out_buf1
[32] = { 0 };
1096 char out_buf2
[32] = { 0 };
1098 ascii_digest (out_buf1
, 0, 0);
1099 ascii_digest (out_buf2
, 0, 1);
1101 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1105 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1109 log_info ("Hash.Type......: %s", hash_type
);
1115 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1116 double speed_ms
[DEVICES_MAX
] = { 0 };
1118 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1120 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1122 if (device_param
->skipped
) continue;
1124 speed_cnt
[device_id
] = 0;
1125 speed_ms
[device_id
] = 0;
1127 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1129 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1130 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1133 speed_cnt
[device_id
] /= SPEED_CACHE
;
1134 speed_ms
[device_id
] /= SPEED_CACHE
;
1137 double hashes_all_ms
= 0;
1139 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1141 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1143 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1145 if (device_param
->skipped
) continue;
1147 hashes_dev_ms
[device_id
] = 0;
1149 if (speed_ms
[device_id
])
1151 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1153 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1161 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1163 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1165 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1167 if (device_param
->skipped
) continue;
1169 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1171 exec_all_ms
[device_id
] = exec_ms_avg
;
1178 double ms_running
= 0;
1180 hc_timer_get (data
.timer_running
, ms_running
);
1182 double ms_paused
= data
.ms_paused
;
1184 if (data
.devices_status
== STATUS_PAUSED
)
1186 double ms_paused_tmp
= 0;
1188 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1190 ms_paused
+= ms_paused_tmp
;
1195 __time64_t sec_run
= ms_running
/ 1000;
1199 time_t sec_run
= ms_running
/ 1000;
1205 char display_run
[32] = { 0 };
1209 struct tm
*tmp
= NULL
;
1213 tmp
= _gmtime64 (&sec_run
);
1217 tmp
= gmtime (&sec_run
);
1223 memset (&tm_run
, 0, sizeof (tm_run
));
1225 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1227 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1229 char *start
= ctime (&data
.proc_start
);
1231 size_t start_len
= strlen (start
);
1233 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1234 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1236 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1241 log_info ("Time.Started...: 0 secs");
1248 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1251 u64 all_rejected
= 0;
1252 u64 all_restored
= 0;
1254 u64 progress_noneed
= 0;
1256 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1258 all_done
+= data
.words_progress_done
[salt_pos
];
1259 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1260 all_restored
+= data
.words_progress_restored
[salt_pos
];
1262 // Important for ETA only
1264 if (data
.salts_shown
[salt_pos
] == 1)
1266 const u64 all
= data
.words_progress_done
[salt_pos
]
1267 + data
.words_progress_rejected
[salt_pos
]
1268 + data
.words_progress_restored
[salt_pos
];
1270 const u64 left
= data
.words_cnt
- all
;
1272 progress_noneed
+= left
;
1276 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1277 u64 progress_end
= progress_total
;
1279 u64 progress_skip
= 0;
1283 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1285 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1286 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1287 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1292 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1294 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1295 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1296 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1299 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1300 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1302 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1304 if (data
.devices_status
!= STATUS_CRACKED
)
1307 __time64_t sec_etc
= 0;
1314 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1316 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1318 sec_etc
= ms_left
/ 1000;
1323 //log_info ("Time.Estimated.: 0 secs");
1325 else if ((u64
) sec_etc
> ETC_MAX
)
1327 log_info ("Time.Estimated.: > 10 Years");
1331 char display_etc
[32] = { 0 };
1335 struct tm
*tmp
= NULL
;
1339 tmp
= _gmtime64 (&sec_etc
);
1343 tmp
= gmtime (&sec_etc
);
1349 memset (&tm_etc
, 0, sizeof (tm_etc
));
1351 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1353 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1361 char *etc
= ctime (&now
);
1363 size_t etc_len
= strlen (etc
);
1365 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1366 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1368 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1374 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1376 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1378 if (device_param
->skipped
) continue;
1380 char display_dev_cur
[16] = { 0 };
1382 strncpy (display_dev_cur
, "0.00", 4);
1384 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1386 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1389 char display_all_cur
[16] = { 0 };
1391 strncpy (display_all_cur
, "0.00", 4);
1393 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1395 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1397 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1398 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1400 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);
1404 if (data
.digests_cnt
> 100)
1406 time_t now
= time (NULL
);
1408 int cpt_cur_min
= 0;
1409 int cpt_cur_hour
= 0;
1410 int cpt_cur_day
= 0;
1412 for (int i
= 0; i
< CPT_BUF
; i
++)
1414 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1415 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1417 if ((timestamp
+ 60) > now
)
1419 cpt_cur_min
+= cracked
;
1422 if ((timestamp
+ 3600) > now
)
1424 cpt_cur_hour
+= cracked
;
1427 if ((timestamp
+ 86400) > now
)
1429 cpt_cur_day
+= cracked
;
1433 double ms_real
= ms_running
- ms_paused
;
1435 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1436 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1437 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1439 if ((data
.cpt_start
+ 86400) < now
)
1441 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1449 else if ((data
.cpt_start
+ 3600) < now
)
1451 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1458 else if ((data
.cpt_start
+ 60) < now
)
1460 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1468 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1477 u64 restore_point
= get_lowest_words_done ();
1479 u64 restore_total
= data
.words_base
;
1481 float percent_restore
= 0;
1483 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1485 if (progress_end_relative_skip
)
1487 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1489 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1490 float percent_rejected
= 0.0;
1494 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1497 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);
1498 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1500 if (data
.restore_disable
== 0)
1502 if (percent_finished
!= 1)
1504 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1511 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1513 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1516 if (data
.restore_disable
== 0)
1518 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1523 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1524 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1526 // --restore not allowed if stdin is used -- really? why?
1528 //if (data.restore_disable == 0)
1530 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1536 if (data
.gpu_temp_disable
== 0)
1538 hc_thread_mutex_lock (mux_adl
);
1540 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1542 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1544 if (device_param
->skipped
) continue;
1546 #define HM_STR_BUF_SIZE 255
1548 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1549 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1550 char fanspeed
[HM_STR_BUF_SIZE
] = { 0 };
1551 char corespeed
[HM_STR_BUF_SIZE
] = { 0 };
1552 char memoryspeed
[HM_STR_BUF_SIZE
] = { 0 };
1553 char buslanes
[HM_STR_BUF_SIZE
] = { 0 };
1555 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1556 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1557 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1558 hm_device_val_to_str ((char *) corespeed
, HM_STR_BUF_SIZE
, "Mhz", hm_get_corespeed_with_device_id (device_id
));
1559 hm_device_val_to_str ((char *) memoryspeed
, HM_STR_BUF_SIZE
, "Mhz", hm_get_memoryspeed_with_device_id (device_id
));
1560 hm_device_val_to_str ((char *) buslanes
, HM_STR_BUF_SIZE
, "", hm_get_buslanes_with_device_id (device_id
));
1562 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan, %s Core, %s Mem, %s Lanes", device_id
+ 1, utilization
, temperature
, fanspeed
, corespeed
, memoryspeed
, buslanes
);
1565 hc_thread_mutex_unlock (mux_adl
);
1567 #endif // HAVE_HWMON
1570 static void status_benchmark_automate ()
1572 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1573 double speed_ms
[DEVICES_MAX
] = { 0 };
1575 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1577 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1579 if (device_param
->skipped
) continue;
1581 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1582 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1585 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1587 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1589 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1591 if (device_param
->skipped
) continue;
1593 hashes_dev_ms
[device_id
] = 0;
1595 if (speed_ms
[device_id
])
1597 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1601 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1603 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1605 if (device_param
->skipped
) continue;
1607 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1611 static void status_benchmark ()
1613 if (data
.devices_status
== STATUS_INIT
) return;
1614 if (data
.devices_status
== STATUS_STARTING
) return;
1615 if (data
.devices_status
== STATUS_BYPASS
) return;
1617 if (data
.machine_readable
== 1)
1619 status_benchmark_automate ();
1624 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1625 double speed_ms
[DEVICES_MAX
] = { 0 };
1627 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1629 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1631 if (device_param
->skipped
) continue;
1633 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1634 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1637 double hashes_all_ms
= 0;
1639 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1641 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1643 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1645 if (device_param
->skipped
) continue;
1647 hashes_dev_ms
[device_id
] = 0;
1649 if (speed_ms
[device_id
])
1651 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1653 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1661 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1663 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1665 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1667 if (device_param
->skipped
) continue;
1669 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1671 exec_all_ms
[device_id
] = exec_ms_avg
;
1674 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1676 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1678 if (device_param
->skipped
) continue;
1680 char display_dev_cur
[16] = { 0 };
1682 strncpy (display_dev_cur
, "0.00", 4);
1684 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1686 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1689 char display_all_cur
[16] = { 0 };
1691 strncpy (display_all_cur
, "0.00", 4);
1693 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1695 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1699 * hashcat -only- functions
1702 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1704 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1706 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1707 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1708 else if (attack_kern
== ATTACK_KERN_COMBI
)
1709 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1710 else if (attack_kern
== ATTACK_KERN_BF
)
1711 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1714 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1717 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
)
1719 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1721 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1722 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1723 else if (attack_kern
== ATTACK_KERN_COMBI
)
1724 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1725 else if (attack_kern
== ATTACK_KERN_BF
)
1726 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1730 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1734 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1736 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1738 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1742 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1746 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
)
1748 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1750 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1754 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1758 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1760 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1763 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1765 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1768 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1770 if (line_len
& 1) return (line_len
); // not in hex
1772 if (data
.hex_wordlist
== 1)
1777 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1779 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1782 memset (line_buf
+ i
, 0, line_len
- i
);
1786 else if (line_len
>= 6) // $HEX[] = 6
1788 if (line_buf
[0] != '$') return (line_len
);
1789 if (line_buf
[1] != 'H') return (line_len
);
1790 if (line_buf
[2] != 'E') return (line_len
);
1791 if (line_buf
[3] != 'X') return (line_len
);
1792 if (line_buf
[4] != '[') return (line_len
);
1793 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1798 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1800 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1803 memset (line_buf
+ i
, 0, line_len
- i
);
1811 static void clear_prompt ()
1813 fputc ('\r', stdout
);
1815 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1817 fputc (' ', stdout
);
1820 fputc ('\r', stdout
);
1825 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1827 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
);
1830 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1832 char *outfile
= data
.outfile
;
1833 uint quiet
= data
.quiet
;
1834 FILE *pot_fp
= data
.pot_fp
;
1835 uint loopback
= data
.loopback
;
1836 uint debug_mode
= data
.debug_mode
;
1837 char *debug_file
= data
.debug_file
;
1839 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1840 int debug_rule_len
= 0; // -1 error
1841 uint debug_plain_len
= 0;
1843 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1847 char out_buf
[HCBUFSIZ
] = { 0 };
1849 const u32 salt_pos
= plain
->salt_pos
;
1850 const u32 digest_pos
= plain
->digest_pos
; // relative
1851 const u32 gidvid
= plain
->gidvid
;
1852 const u32 il_pos
= plain
->il_pos
;
1854 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1858 u64 crackpos
= device_param
->words_off
;
1860 uint plain_buf
[16] = { 0 };
1862 u8
*plain_ptr
= (u8
*) plain_buf
;
1864 unsigned int plain_len
= 0;
1866 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1870 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1872 for (int i
= 0; i
< 16; i
++)
1874 plain_buf
[i
] = pw
.i
[i
];
1877 plain_len
= pw
.pw_len
;
1879 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1886 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1888 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1890 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1894 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1896 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1898 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1900 debug_plain_len
= plain_len
;
1904 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1907 crackpos
*= data
.kernel_rules_cnt
;
1908 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1910 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1912 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1916 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1918 for (int i
= 0; i
< 16; i
++)
1920 plain_buf
[i
] = pw
.i
[i
];
1923 plain_len
= pw
.pw_len
;
1925 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1926 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1928 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1930 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1934 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1936 memcpy (plain_ptr
, comb_buf
, comb_len
);
1939 plain_len
+= comb_len
;
1942 crackpos
*= data
.combs_cnt
;
1943 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1945 if (data
.pw_max
!= PW_DICTMAX1
)
1947 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1950 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1952 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1953 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1955 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1956 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1958 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1959 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1961 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1962 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1964 plain_len
= data
.css_cnt
;
1967 crackpos
*= data
.bfs_cnt
;
1968 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1970 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1974 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1976 for (int i
= 0; i
< 16; i
++)
1978 plain_buf
[i
] = pw
.i
[i
];
1981 plain_len
= pw
.pw_len
;
1983 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1986 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1988 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1990 plain_len
+= start
+ stop
;
1993 crackpos
*= data
.combs_cnt
;
1994 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1996 if (data
.pw_max
!= PW_DICTMAX1
)
1998 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2001 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2005 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2007 for (int i
= 0; i
< 16; i
++)
2009 plain_buf
[i
] = pw
.i
[i
];
2012 plain_len
= pw
.pw_len
;
2014 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2017 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2019 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2021 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2023 plain_len
+= start
+ stop
;
2026 crackpos
*= data
.combs_cnt
;
2027 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2029 if (data
.pw_max
!= PW_DICTMAX1
)
2031 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2035 if (data
.attack_mode
== ATTACK_MODE_BF
)
2037 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2039 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2041 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2043 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2047 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2049 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2051 plain_ptr
[j
] = plain_ptr
[i
];
2054 plain_len
= plain_len
/ 2;
2059 // if enabled, update also the potfile
2065 fprintf (pot_fp
, "%s:", out_buf
);
2067 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2069 fputc ('\n', pot_fp
);
2073 unlock_file (pot_fp
);
2078 FILE *out_fp
= NULL
;
2080 if (outfile
!= NULL
)
2082 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2084 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2095 if (quiet
== 0) clear_prompt ();
2098 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2100 if (outfile
!= NULL
)
2102 if (out_fp
!= stdout
)
2109 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2111 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2113 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2114 if (quiet
== 0) fflush (stdout
);
2123 char *loopback_file
= data
.loopback_file
;
2127 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2131 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2133 fputc ('\n', fb_fp
);
2139 // (rule) debug mode
2141 // the next check implies that:
2142 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2145 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2147 if (debug_rule_len
< 0) debug_rule_len
= 0;
2149 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2151 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2153 if ((quiet
== 0) && (debug_file
== NULL
))
2155 fprintf (stdout
, "%s", PROMPT
);
2162 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2164 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2168 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2172 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2176 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2178 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
);
2180 uint cpt_cracked
= 0;
2182 for (uint i
= 0; i
< num_cracked
; i
++)
2184 const uint hash_pos
= cracked
[i
].hash_pos
;
2186 if (data
.digests_shown
[hash_pos
] == 1) continue;
2188 hc_thread_mutex_lock (mux_display
);
2190 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2192 data
.digests_shown
[hash_pos
] = 1;
2194 data
.digests_done
++;
2198 salt_buf
->digests_done
++;
2200 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2202 data
.salts_shown
[salt_pos
] = 1;
2208 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2210 hc_thread_mutex_unlock (mux_display
);
2212 check_hash (device_param
, &cracked
[i
]);
2217 if (cpt_cracked
> 0)
2219 hc_thread_mutex_lock (mux_display
);
2221 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2222 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2226 data
.cpt_total
+= cpt_cracked
;
2228 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2230 hc_thread_mutex_unlock (mux_display
);
2233 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2235 // we need to reset cracked state on the device
2236 // otherwise host thinks again and again the hash was cracked
2237 // and returns invalid password each time
2239 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2241 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
);
2246 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2250 static void save_hash ()
2252 char *hashfile
= data
.hashfile
;
2254 char new_hashfile
[256] = { 0 };
2255 char old_hashfile
[256] = { 0 };
2257 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2258 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2260 unlink (new_hashfile
);
2262 char separator
= data
.separator
;
2264 FILE *fp
= fopen (new_hashfile
, "wb");
2268 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2273 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2275 if (data
.salts_shown
[salt_pos
] == 1) continue;
2277 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2279 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2281 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2283 if (data
.digests_shown
[idx
] == 1) continue;
2285 if (data
.hash_mode
!= 2500)
2287 char out_buf
[HCBUFSIZ
] = { 0 };
2289 if (data
.username
== 1)
2291 user_t
*user
= data
.hash_info
[idx
]->user
;
2295 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2297 fputc (separator
, fp
);
2300 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2302 fputs (out_buf
, fp
);
2310 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2312 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2321 unlink (old_hashfile
);
2323 if (rename (hashfile
, old_hashfile
) != 0)
2325 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2332 if (rename (new_hashfile
, hashfile
) != 0)
2334 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2339 unlink (old_hashfile
);
2342 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2344 // function called only in case kernel_power_all > words_left
2346 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2348 kernel_power_div
+= kernel_power_div
/ 100;
2350 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2352 while (kernel_power_new
< total_left
)
2354 kernel_power_div
+= kernel_power_div
/ 100;
2356 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2359 if (data
.quiet
== 0)
2365 log_info ("INFO: approaching final keyspace, workload adjusted");
2368 fprintf (stdout
, "%s", PROMPT
);
2373 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2375 return kernel_power_div
;
2378 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2380 uint num_elements
= num
;
2382 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2383 device_param
->kernel_params_buf32
[31] = num
;
2385 uint kernel_threads
= device_param
->kernel_threads
;
2387 while (num_elements
% kernel_threads
) num_elements
++;
2389 cl_kernel kernel
= NULL
;
2393 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2394 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2395 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2396 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2397 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2400 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2401 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2402 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2403 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2404 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2405 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2406 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2407 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2408 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2409 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2410 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2414 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2416 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2417 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2419 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2423 if (kern_run
== KERN_RUN_2
)
2425 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2427 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2431 while (num_elements
% kernel_threads
) num_elements
++;
2433 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2434 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2436 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2439 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2441 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2445 cl_ulong time_start
;
2448 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2449 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2451 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2453 uint exec_pos
= device_param
->exec_pos
;
2455 device_param
->exec_ms
[exec_pos
] = exec_time
;
2459 if (exec_pos
== EXEC_CACHE
)
2464 device_param
->exec_pos
= exec_pos
;
2467 hc_clReleaseEvent (data
.ocl
, event
);
2469 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2472 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2474 uint num_elements
= num
;
2478 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2479 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2480 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2483 // causes problems with special threads like in bcrypt
2484 // const uint kernel_threads = device_param->kernel_threads;
2486 uint kernel_threads
= device_param
->kernel_threads
;
2488 while (num_elements
% kernel_threads
) num_elements
++;
2490 cl_kernel kernel
= NULL
;
2494 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2495 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2496 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2501 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2502 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2503 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2504 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2505 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2506 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2508 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2509 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2510 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2511 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2512 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2513 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2515 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2516 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2517 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2518 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2519 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2520 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2521 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2525 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2526 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2528 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2530 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2532 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2535 static void run_kernel_tm (hc_device_param_t
*device_param
)
2537 const uint num_elements
= 1024; // fixed
2539 uint kernel_threads
= 32;
2541 cl_kernel kernel
= device_param
->kernel_tm
;
2543 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2544 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2546 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2548 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2550 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2553 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2555 uint num_elements
= num
;
2557 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2558 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2560 // causes problems with special threads like in bcrypt
2561 // const uint kernel_threads = device_param->kernel_threads;
2563 uint kernel_threads
= device_param
->kernel_threads
;
2565 while (num_elements
% kernel_threads
) num_elements
++;
2567 cl_kernel kernel
= device_param
->kernel_amp
;
2569 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2570 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2572 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2573 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2575 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2577 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2579 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2582 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2584 const u32 num16d
= num
/ 16;
2585 const u32 num16m
= num
% 16;
2589 device_param
->kernel_params_memset_buf32
[1] = value
;
2590 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2592 uint kernel_threads
= device_param
->kernel_threads
;
2594 uint num_elements
= num16d
;
2596 while (num_elements
% kernel_threads
) num_elements
++;
2598 cl_kernel kernel
= device_param
->kernel_memset
;
2600 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2601 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2602 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2604 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2605 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2607 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2609 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2611 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2623 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2627 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2629 run_kernel_memset (device_param
, buf
, 0, size
);
2634 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2636 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2638 const cl_uchar zero = 0;
2640 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2645 // NOTE: clEnqueueFillBuffer () always fails with -59
2646 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2647 // How's that possible, OpenCL 1.2 support is advertised??
2648 // We need to workaround...
2650 #define FILLSZ 0x100000
2652 char *tmp = (char *) mymalloc (FILLSZ);
2654 for (size_t i = 0; i < size; i += FILLSZ)
2656 const size_t left = size - i;
2658 const size_t fillsz = MIN (FILLSZ, left);
2660 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2668 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
)
2670 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2672 if (attack_mode
== ATTACK_MODE_BF
)
2674 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2676 const uint size_tm
= 32 * sizeof (bs_word_t
);
2678 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2680 run_kernel_tm (device_param
);
2682 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
);
2686 if (highest_pw_len
< 16)
2688 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2690 else if (highest_pw_len
< 32)
2692 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2696 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2701 run_kernel_amp (device_param
, pws_cnt
);
2703 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2705 if (opts_type
& OPTS_TYPE_HOOK12
)
2707 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2710 uint iter
= salt_buf
->salt_iter
;
2712 uint loop_step
= device_param
->kernel_loops
;
2714 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2716 uint loop_left
= iter
- loop_pos
;
2718 loop_left
= MIN (loop_left
, loop_step
);
2720 device_param
->kernel_params_buf32
[25] = loop_pos
;
2721 device_param
->kernel_params_buf32
[26] = loop_left
;
2723 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2725 if (data
.devices_status
== STATUS_CRACKED
) break;
2726 if (data
.devices_status
== STATUS_ABORTED
) break;
2727 if (data
.devices_status
== STATUS_QUIT
) break;
2733 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2735 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2739 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2741 const u32 speed_pos
= device_param
->speed_pos
;
2743 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2745 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2747 if (data
.benchmark
== 1)
2749 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2753 if (opts_type
& OPTS_TYPE_HOOK23
)
2755 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2757 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
);
2759 // do something with data
2761 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
);
2764 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2768 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2774 else if (rule_len
== 1)
2776 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2782 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2784 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2786 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
);
2788 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2790 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2792 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2794 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2796 for (u32 i
= 0; i
< pws_cnt
; i
++)
2798 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2800 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2805 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2807 for (u32 i
= 0; i
< pws_cnt
; i
++)
2809 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2811 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2818 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2820 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2822 for (u32 i
= 0; i
< pws_cnt
; i
++)
2824 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2826 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2831 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2833 for (u32 i
= 0; i
< pws_cnt
; i
++)
2835 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2837 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2844 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
);
2846 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2848 const u64 off
= device_param
->words_off
;
2850 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2852 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2856 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2858 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2860 device_param
->kernel_params_buf32
[25] = 0;
2861 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2862 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2864 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2866 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2870 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2873 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2875 return exec_ms_prev
;
2878 static void autotune (hc_device_param_t
*device_param
)
2880 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2882 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2883 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2885 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2886 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2888 u32 kernel_accel
= kernel_accel_min
;
2889 u32 kernel_loops
= kernel_loops_min
;
2891 // in this case the user specified a fixed -u and -n on the commandline
2892 // no way to tune anything
2893 // but we need to run a few caching rounds
2895 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2897 try_run (device_param
, kernel_accel
, kernel_loops
);
2898 try_run (device_param
, kernel_accel
, kernel_loops
);
2899 try_run (device_param
, kernel_accel
, kernel_loops
);
2900 try_run (device_param
, kernel_accel
, kernel_loops
);
2902 device_param
->kernel_accel
= kernel_accel
;
2903 device_param
->kernel_loops
= kernel_loops
;
2905 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2907 device_param
->kernel_power
= kernel_power
;
2912 // from here it's clear we are allowed to autotune
2913 // so let's init some fake words
2915 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2917 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2919 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2921 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2925 for (u32 i = 0; i < kernel_power_max; i++)
2927 device_param->pws_buf[i].i[0] = i;
2928 device_param->pws_buf[i].i[1] = 0x01234567;
2929 device_param->pws_buf[i].pw_len = 7;
2932 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);
2934 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2936 run_kernel_amp (device_param, kernel_power_max);
2940 #define VERIFIER_CNT 1
2942 // first find out highest kernel-loops that stays below target_ms
2944 if (kernel_loops_min
< kernel_loops_max
)
2946 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2948 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2950 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2952 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2954 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2957 if (exec_ms
< target_ms
) break;
2961 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2963 #define STEPS_CNT 10
2965 if (kernel_accel_min
< kernel_accel_max
)
2967 for (int i
= 0; i
< STEPS_CNT
; i
++)
2969 const u32 kernel_accel_try
= 1 << i
;
2971 if (kernel_accel_try
< kernel_accel_min
) continue;
2972 if (kernel_accel_try
> kernel_accel_max
) break;
2974 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2976 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2978 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2980 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2983 if (exec_ms
> target_ms
) break;
2985 kernel_accel
= kernel_accel_try
;
2989 // at this point we want to know the actual runtime for the following reason:
2990 // we need a reference for the balancing loop following up, and this
2991 // the balancing loop can have an effect that the creates a new opportunity, for example:
2992 // if the target is 95 ms and the current runtime is 48ms the above loop
2993 // stopped the execution because the previous exec_ms was > 95ms
2994 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
2995 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
2997 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
2999 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3001 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3003 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3006 u32 diff
= kernel_loops
- kernel_accel
;
3008 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3010 u32 kernel_accel_orig
= kernel_accel
;
3011 u32 kernel_loops_orig
= kernel_loops
;
3013 for (u32 f
= 1; f
< 1024; f
++)
3015 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3016 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3018 if (kernel_accel_try
> kernel_accel_max
) break;
3019 if (kernel_loops_try
< kernel_loops_min
) break;
3021 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3023 if (diff_new
> diff
) break;
3027 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3029 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3031 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3033 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3036 if (exec_ms
< exec_ms_pre_final
)
3038 exec_ms_pre_final
= exec_ms
;
3040 kernel_accel
= kernel_accel_try
;
3041 kernel_loops
= kernel_loops_try
;
3046 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3048 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3050 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3052 if (exec_accel_min
>= 1.0)
3054 // this is safe to not overflow kernel_accel_max because of accel_left
3056 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3059 // reset them fake words
3062 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3064 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);
3065 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);
3068 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3070 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3072 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3077 device_param
->exec_pos
= 0;
3079 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3083 device_param
->kernel_accel
= kernel_accel
;
3084 device_param
->kernel_loops
= kernel_loops
;
3086 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3088 device_param
->kernel_power
= kernel_power
;
3092 if (data
.quiet
== 0)
3096 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3097 "Device #%u: autotuned kernel-loops to %u\n",
3098 device_param
->device_id
+ 1, kernel_accel
,
3099 device_param
->device_id
+ 1, kernel_loops
);
3101 fprintf (stdout
, "%s", PROMPT
);
3109 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3111 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3115 uint speed_pos
= device_param
->speed_pos
;
3118 if (device_param
->timer_speed
.tv_sec
== 0)
3120 hc_timer_set (&device_param
->timer_speed
);
3125 if (device_param
->timer_speed
.QuadPart
== 0)
3127 hc_timer_set (&device_param
->timer_speed
);
3131 // find higest password length, this is for optimization stuff
3133 uint highest_pw_len
= 0;
3135 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3138 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3141 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3143 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3144 + device_param
->kernel_params_mp_l_buf32
[5];
3149 uint innerloop_step
= 0;
3150 uint innerloop_cnt
= 0;
3152 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3153 else innerloop_step
= 1;
3155 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3156 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3157 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3159 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3161 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3163 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3165 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3167 if (data
.devices_status
== STATUS_CRACKED
) break;
3168 if (data
.devices_status
== STATUS_ABORTED
) break;
3169 if (data
.devices_status
== STATUS_QUIT
) break;
3170 if (data
.devices_status
== STATUS_BYPASS
) break;
3172 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3174 device_param
->kernel_params_buf32
[24] = salt_pos
;
3175 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3176 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3178 FILE *combs_fp
= device_param
->combs_fp
;
3180 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3187 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3189 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3191 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3193 if (data
.devices_status
== STATUS_CRACKED
) break;
3194 if (data
.devices_status
== STATUS_ABORTED
) break;
3195 if (data
.devices_status
== STATUS_QUIT
) break;
3196 if (data
.devices_status
== STATUS_BYPASS
) break;
3198 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3200 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3202 device_param
->innerloop_pos
= innerloop_pos
;
3203 device_param
->innerloop_left
= innerloop_left
;
3205 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3207 // i think we can get rid of this
3208 if (innerloop_left
== 0)
3210 puts ("bug, how should this happen????\n");
3215 if (data
.salts_shown
[salt_pos
] == 1)
3217 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3222 // initialize amplifiers
3224 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3228 while (i
< innerloop_left
)
3230 if (feof (combs_fp
)) break;
3232 int line_len
= fgetl (combs_fp
, line_buf
);
3234 if (line_len
>= PW_MAX1
) continue;
3236 line_len
= convert_from_hex (line_buf
, line_len
);
3238 char *line_buf_new
= line_buf
;
3240 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3242 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3244 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3246 if (rule_len_out
< 0)
3248 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3253 line_len
= rule_len_out
;
3255 line_buf_new
= rule_buf_out
;
3258 line_len
= MIN (line_len
, PW_DICTMAX
);
3260 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3262 memcpy (ptr
, line_buf_new
, line_len
);
3264 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3266 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3268 uppercase (ptr
, line_len
);
3271 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3273 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3275 ptr
[line_len
] = 0x80;
3278 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3280 ptr
[line_len
] = 0x01;
3284 device_param
->combs_buf
[i
].pw_len
= line_len
;
3289 for (uint j
= i
; j
< innerloop_left
; j
++)
3291 device_param
->combs_buf
[j
].i
[0] = 0;
3292 device_param
->combs_buf
[j
].i
[1] = 0;
3293 device_param
->combs_buf
[j
].i
[2] = 0;
3294 device_param
->combs_buf
[j
].i
[3] = 0;
3295 device_param
->combs_buf
[j
].i
[4] = 0;
3296 device_param
->combs_buf
[j
].i
[5] = 0;
3297 device_param
->combs_buf
[j
].i
[6] = 0;
3298 device_param
->combs_buf
[j
].i
[7] = 0;
3300 device_param
->combs_buf
[j
].pw_len
= 0;
3305 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3307 u64 off
= innerloop_pos
;
3309 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3311 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3313 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3315 u64 off
= innerloop_pos
;
3317 device_param
->kernel_params_mp_buf64
[3] = off
;
3319 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3321 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3323 u64 off
= innerloop_pos
;
3325 device_param
->kernel_params_mp_buf64
[3] = off
;
3327 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3332 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3334 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
);
3336 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3338 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
);
3340 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3342 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
);
3344 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3346 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
);
3348 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3350 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
);
3353 if (data
.benchmark
== 1)
3355 hc_timer_set (&device_param
->timer_speed
);
3358 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3360 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3362 if (data
.devices_status
== STATUS_CRACKED
) break;
3363 if (data
.devices_status
== STATUS_ABORTED
) break;
3364 if (data
.devices_status
== STATUS_QUIT
) break;
3370 check_cracked (device_param
, salt_pos
);
3376 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3378 hc_thread_mutex_lock (mux_counter
);
3380 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3382 hc_thread_mutex_unlock (mux_counter
);
3390 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3392 hc_timer_set (&device_param
->timer_speed
);
3396 //hc_thread_mutex_lock (mux_display);
3398 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3400 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3402 //hc_thread_mutex_unlock (mux_display);
3406 if (speed_pos
== SPEED_CACHE
)
3415 if (data
.benchmark
== 1) break;
3419 device_param
->speed_pos
= speed_pos
;
3424 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3426 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3430 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3432 wl_data
->buf
[wl_data
->cnt
] = 0;
3434 if (wl_data
->cnt
== 0) return;
3436 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3440 if (wl_data
->cnt
== wl_data
->avail
)
3442 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3444 wl_data
->avail
+= wl_data
->incr
;
3447 const int c
= fgetc (fd
);
3449 if (c
== EOF
) break;
3451 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3455 if (c
== '\n') break;
3458 // ensure stream ends with a newline
3460 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3464 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3470 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3474 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3476 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3486 if (*ptr
!= '\n') continue;
3490 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3501 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3505 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3507 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3509 if (*ptr
!= '\n') continue;
3513 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3524 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3528 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3530 if (*ptr
!= '\n') continue;
3534 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3545 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3547 while (wl_data
->pos
< wl_data
->cnt
)
3552 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3554 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3556 wl_data
->pos
+= off
;
3558 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3560 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3562 int rule_len_out
= -1;
3564 if (len
< BLOCK_SIZE
)
3566 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3569 if (rule_len_out
< 0)
3574 if (rule_len_out
> PW_MAX
)
3595 fprintf (stderr
, "BUG feof()!!\n");
3600 load_segment (wl_data
, fd
);
3602 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3606 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3610 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3620 fstat (fileno (fd
), &d
.stat
);
3624 _fstat64 (fileno (fd
), &d
.stat
);
3628 d
.stat
.st_nlink
= 0;
3632 d
.stat
.st_atime
= 0;
3635 d
.stat
.st_blksize
= 0;
3636 d
.stat
.st_blocks
= 0;
3639 if (d
.stat
.st_size
== 0) return 0;
3641 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3643 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3647 u64 cnt
= d_cache
->cnt
;
3651 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3653 keyspace
*= data
.kernel_rules_cnt
;
3655 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3657 keyspace
*= data
.combs_cnt
;
3660 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
);
3661 if (data
.quiet
== 0) log_info ("");
3663 hc_signal (sigHandler_default
);
3678 load_segment (wl_data
, fd
);
3680 comp
+= wl_data
->cnt
;
3684 while (i
< wl_data
->cnt
)
3689 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3691 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3693 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3695 int rule_len_out
= -1;
3697 if (len
< BLOCK_SIZE
)
3699 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3702 if (rule_len_out
< 0)
3714 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3716 cnt
+= data
.kernel_rules_cnt
;
3718 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3720 cnt
+= data
.combs_cnt
;
3733 if ((now
- prev
) == 0) continue;
3735 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3737 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
);
3742 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
);
3743 if (data
.quiet
== 0) log_info ("");
3745 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3747 hc_signal (sigHandler_default
);
3752 static void *thread_monitor (void *p
)
3754 uint runtime_check
= 0;
3755 uint remove_check
= 0;
3756 uint status_check
= 0;
3757 uint restore_check
= 0;
3759 uint restore_left
= data
.restore_timer
;
3760 uint remove_left
= data
.remove_timer
;
3761 uint status_left
= data
.status_timer
;
3764 uint hwmon_check
= 0;
3766 int slowdown_warnings
= 0;
3768 // these variables are mainly used for fan control (AMD only)
3770 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3772 // temperature controller "loopback" values
3774 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3775 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3778 int temp_threshold
= 1; // degrees celcius
3780 int fan_speed_min
= 15; // in percentage
3781 int fan_speed_max
= 100;
3784 time_t last_temp_check_time
;
3785 #endif // HAVE_HWMON
3787 uint sleep_time
= 1;
3794 if (data
.restore_timer
)
3799 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3804 if (data
.status
== 1)
3810 if (data
.gpu_temp_disable
== 0)
3812 time (&last_temp_check_time
);
3818 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3821 if (hwmon_check
== 0)
3826 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3828 hc_sleep (sleep_time
);
3830 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3836 hc_thread_mutex_lock (mux_adl
);
3838 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3840 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3842 if (device_param
->skipped
) continue;
3844 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3846 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3848 const int threshold
= data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
;
3850 if (temperature
>= threshold
)
3852 if (slowdown_warnings
< 3)
3854 if (data
.quiet
== 0) clear_prompt ();
3856 log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold
, device_id
+ 1);
3858 if (slowdown_warnings
== 2)
3863 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3864 if (data
.quiet
== 0) fflush (stdout
);
3866 slowdown_warnings
++;
3871 slowdown_warnings
= 0;
3875 hc_thread_mutex_unlock (mux_adl
);
3878 if (hwmon_check
== 1)
3880 hc_thread_mutex_lock (mux_adl
);
3882 time_t temp_check_time
;
3884 time (&temp_check_time
);
3886 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3888 if (Ta
== 0) Ta
= 1;
3890 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3892 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3894 if (device_param
->skipped
) continue;
3896 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3898 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3900 if (temperature
> (int) data
.gpu_temp_abort
)
3902 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3904 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3910 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3912 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3914 if (data
.hm_device
[device_id
].fan_supported
== 1)
3916 int temp_cur
= temperature
;
3918 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3920 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3922 // calculate Ta value (time difference in seconds between the last check and this check)
3924 last_temp_check_time
= temp_check_time
;
3930 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3932 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
);
3934 if (abs (fan_diff_required
) >= temp_threshold
)
3936 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3938 int fan_speed_level
= fan_speed_cur
;
3940 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3942 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3944 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3945 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3947 if (fan_speed_new
!= fan_speed_cur
)
3949 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3950 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3952 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3954 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
3956 fan_speed_chgd
[device_id
] = 1;
3959 temp_diff_old
[device_id
] = temp_diff_new
;
3967 hc_thread_mutex_unlock (mux_adl
);
3969 #endif // HAVE_HWMON
3971 if (restore_check
== 1)
3975 if (restore_left
== 0)
3977 if (data
.restore_disable
== 0) cycle_restore ();
3979 restore_left
= data
.restore_timer
;
3983 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3987 time (&runtime_cur
);
3989 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3991 if (runtime_left
<= 0)
3993 if (data
.benchmark
== 0)
3995 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3998 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4002 if (remove_check
== 1)
4006 if (remove_left
== 0)
4008 if (data
.digests_saved
!= data
.digests_done
)
4010 data
.digests_saved
= data
.digests_done
;
4015 remove_left
= data
.remove_timer
;
4019 if (status_check
== 1)
4023 if (status_left
== 0)
4025 //hc_thread_mutex_lock (mux_display);
4027 if (data
.quiet
== 0) clear_prompt ();
4029 if (data
.quiet
== 0) log_info ("");
4033 if (data
.quiet
== 0) log_info ("");
4035 //hc_thread_mutex_unlock (mux_display);
4037 status_left
= data
.status_timer
;
4043 myfree (fan_speed_chgd
);
4045 myfree (temp_diff_old
);
4046 myfree (temp_diff_sum
);
4054 static void *thread_outfile_remove (void *p
)
4056 // some hash-dependent constants
4057 char *outfile_dir
= data
.outfile_check_directory
;
4058 uint dgst_size
= data
.dgst_size
;
4059 uint isSalted
= data
.isSalted
;
4060 uint esalt_size
= data
.esalt_size
;
4061 uint hash_mode
= data
.hash_mode
;
4063 uint outfile_check_timer
= data
.outfile_check_timer
;
4065 char separator
= data
.separator
;
4067 // some hash-dependent functions
4068 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4069 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4072 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4074 hash_buf
.digest
= mymalloc (dgst_size
);
4076 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4078 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4080 uint digest_buf
[64] = { 0 };
4082 outfile_data_t
*out_info
= NULL
;
4084 char **out_files
= NULL
;
4086 time_t folder_mtime
= 0;
4090 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4092 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4096 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4100 if (check_left
== 0)
4102 struct stat outfile_check_stat
;
4104 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4106 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4110 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4112 char **out_files_new
= scan_directory (outfile_dir
);
4114 int out_cnt_new
= count_dictionaries (out_files_new
);
4116 outfile_data_t
*out_info_new
= NULL
;
4118 if (out_cnt_new
> 0)
4120 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4122 for (int i
= 0; i
< out_cnt_new
; i
++)
4124 out_info_new
[i
].file_name
= out_files_new
[i
];
4126 // check if there are files that we have seen/checked before (and not changed)
4128 for (int j
= 0; j
< out_cnt
; j
++)
4130 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4132 struct stat outfile_stat
;
4134 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4136 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4138 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4139 out_info_new
[i
].seek
= out_info
[j
].seek
;
4147 local_free (out_info
);
4148 local_free (out_files
);
4150 out_files
= out_files_new
;
4151 out_cnt
= out_cnt_new
;
4152 out_info
= out_info_new
;
4154 folder_mtime
= outfile_check_stat
.st_mtime
;
4157 for (int j
= 0; j
< out_cnt
; j
++)
4159 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4163 //hc_thread_mutex_lock (mux_display);
4166 struct stat outfile_stat
;
4168 fstat (fileno (fp
), &outfile_stat
);
4172 struct stat64 outfile_stat
;
4174 _fstat64 (fileno (fp
), &outfile_stat
);
4177 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4179 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4180 out_info
[j
].seek
= 0;
4183 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4185 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4189 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4191 if (ptr
== NULL
) break;
4193 int line_len
= strlen (line_buf
);
4195 if (line_len
<= 0) continue;
4197 int iter
= MAX_CUT_TRIES
;
4199 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4201 if (line_buf
[i
] != separator
) continue;
4203 int parser_status
= PARSER_OK
;
4205 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4207 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4212 if (parser_status
== PARSER_OK
)
4214 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4216 if (data
.salts_shown
[salt_pos
] == 1) continue;
4218 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4220 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4222 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4224 if (data
.digests_shown
[idx
] == 1) continue;
4228 if (hash_mode
== 6800)
4230 if (i
== salt_buf
->salt_len
)
4232 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4235 else if (hash_mode
== 2500)
4237 // BSSID : MAC1 : MAC2 (:plain)
4238 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4240 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4242 if (!cracked
) continue;
4244 // now compare MAC1 and MAC2 too, since we have this additional info
4245 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4246 char *mac2_pos
= mac1_pos
+ 12 + 1;
4248 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4249 wpa_t
*wpa
= &wpas
[salt_pos
];
4251 // compare hex string(s) vs binary MAC address(es)
4253 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4255 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4264 if (!cracked
) continue;
4266 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4268 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4279 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4281 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4283 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4290 data
.digests_shown
[idx
] = 1;
4292 data
.digests_done
++;
4294 salt_buf
->digests_done
++;
4296 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4298 data
.salts_shown
[salt_pos
] = 1;
4302 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4307 if (data
.devices_status
== STATUS_CRACKED
) break;
4313 if (data
.devices_status
== STATUS_CRACKED
) break;
4318 if (data
.devices_status
== STATUS_CRACKED
) break;
4323 out_info
[j
].seek
= ftell (fp
);
4325 //hc_thread_mutex_unlock (mux_display);
4333 check_left
= outfile_check_timer
;
4337 if (esalt_size
) local_free (hash_buf
.esalt
);
4339 if (isSalted
) local_free (hash_buf
.salt
);
4341 local_free (hash_buf
.digest
);
4343 local_free (out_info
);
4345 local_free (out_files
);
4352 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4354 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4356 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4358 u8
*ptr
= (u8
*) pw
->i
;
4360 memcpy (ptr
, pw_buf
, pw_len
);
4362 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4364 pw
->pw_len
= pw_len
;
4366 device_param
->pws_cnt
++;
4370 fprintf (stderr
, "BUG pw_add()!!\n");
4376 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4378 hc_thread_mutex_lock (mux_dispatcher
);
4380 const u64 words_cur
= data
.words_cur
;
4381 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4383 device_param
->words_off
= words_cur
;
4385 const u64 words_left
= words_base
- words_cur
;
4389 if (data
.kernel_power_all
> words_left
)
4391 if (data
.kernel_power_div
== 0)
4393 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4397 if (data
.kernel_power_div
)
4399 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4401 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4403 if (kernel_power_new
< device_param
->kernel_power
)
4405 device_param
->kernel_power
= kernel_power_new
;
4411 const uint kernel_power
= device_param
->kernel_power
;
4413 uint work
= MIN (words_left
, kernel_power
);
4415 work
= MIN (work
, max
);
4417 data
.words_cur
+= work
;
4419 hc_thread_mutex_unlock (mux_dispatcher
);
4424 static void *thread_calc_stdin (void *p
)
4426 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4428 if (device_param
->skipped
) return NULL
;
4430 autotune (device_param
);
4432 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4434 const uint attack_kern
= data
.attack_kern
;
4436 const uint kernel_power
= device_param
->kernel_power
;
4438 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4440 hc_thread_mutex_lock (mux_dispatcher
);
4442 if (feof (stdin
) != 0)
4444 hc_thread_mutex_unlock (mux_dispatcher
);
4451 while (words_cur
< kernel_power
)
4453 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4455 if (line_buf
== NULL
) break;
4457 uint line_len
= in_superchop (line_buf
);
4459 line_len
= convert_from_hex (line_buf
, line_len
);
4461 // post-process rule engine
4463 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4465 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4467 int rule_len_out
= -1;
4469 if (line_len
< BLOCK_SIZE
)
4471 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4474 if (rule_len_out
< 0) continue;
4476 line_buf
= rule_buf_out
;
4477 line_len
= rule_len_out
;
4480 if (line_len
> PW_MAX
)
4485 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4487 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4489 hc_thread_mutex_lock (mux_counter
);
4491 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4493 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4496 hc_thread_mutex_unlock (mux_counter
);
4501 else if (attack_kern
== ATTACK_KERN_COMBI
)
4503 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4504 // since we still need to combine the plains
4506 if (line_len
> data
.pw_max
)
4508 hc_thread_mutex_lock (mux_counter
);
4510 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4512 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4515 hc_thread_mutex_unlock (mux_counter
);
4521 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4525 if (data
.devices_status
== STATUS_CRACKED
) break;
4526 if (data
.devices_status
== STATUS_ABORTED
) break;
4527 if (data
.devices_status
== STATUS_QUIT
) break;
4528 if (data
.devices_status
== STATUS_BYPASS
) break;
4531 hc_thread_mutex_unlock (mux_dispatcher
);
4533 if (data
.devices_status
== STATUS_CRACKED
) break;
4534 if (data
.devices_status
== STATUS_ABORTED
) break;
4535 if (data
.devices_status
== STATUS_QUIT
) break;
4536 if (data
.devices_status
== STATUS_BYPASS
) break;
4540 const uint pws_cnt
= device_param
->pws_cnt
;
4544 run_copy (device_param
, pws_cnt
);
4546 run_cracker (device_param
, pws_cnt
);
4548 device_param
->pws_cnt
= 0;
4552 if (attack_kern == ATTACK_KERN_STRAIGHT)
4554 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4556 else if (attack_kern == ATTACK_KERN_COMBI)
4558 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4564 device_param
->kernel_accel
= 0;
4565 device_param
->kernel_loops
= 0;
4572 static void *thread_calc (void *p
)
4574 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4576 if (device_param
->skipped
) return NULL
;
4578 autotune (device_param
);
4580 const uint attack_mode
= data
.attack_mode
;
4581 const uint attack_kern
= data
.attack_kern
;
4583 if (attack_mode
== ATTACK_MODE_BF
)
4585 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4587 const uint work
= get_work (device_param
, -1, true);
4589 if (work
== 0) break;
4591 const u64 words_off
= device_param
->words_off
;
4592 const u64 words_fin
= words_off
+ work
;
4594 const uint pws_cnt
= work
;
4596 device_param
->pws_cnt
= pws_cnt
;
4600 run_copy (device_param
, pws_cnt
);
4602 run_cracker (device_param
, pws_cnt
);
4604 device_param
->pws_cnt
= 0;
4608 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4612 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4614 if (data
.devices_status
== STATUS_CRACKED
) break;
4615 if (data
.devices_status
== STATUS_ABORTED
) break;
4616 if (data
.devices_status
== STATUS_QUIT
) break;
4617 if (data
.devices_status
== STATUS_BYPASS
) break;
4619 if (data
.benchmark
== 1) break;
4621 device_param
->words_done
= words_fin
;
4626 const uint segment_size
= data
.segment_size
;
4628 char *dictfile
= data
.dictfile
;
4630 if (attack_mode
== ATTACK_MODE_COMBI
)
4632 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4634 dictfile
= data
.dictfile2
;
4638 FILE *fd
= fopen (dictfile
, "rb");
4642 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4647 if (attack_mode
== ATTACK_MODE_COMBI
)
4649 const uint combs_mode
= data
.combs_mode
;
4651 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4653 const char *dictfilec
= data
.dictfile2
;
4655 FILE *combs_fp
= fopen (dictfilec
, "rb");
4657 if (combs_fp
== NULL
)
4659 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4666 device_param
->combs_fp
= combs_fp
;
4668 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4670 const char *dictfilec
= data
.dictfile
;
4672 FILE *combs_fp
= fopen (dictfilec
, "rb");
4674 if (combs_fp
== NULL
)
4676 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4683 device_param
->combs_fp
= combs_fp
;
4687 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4689 wl_data
->buf
= (char *) mymalloc (segment_size
);
4690 wl_data
->avail
= segment_size
;
4691 wl_data
->incr
= segment_size
;
4697 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4702 bool allow_div
= true;
4708 const uint work
= get_work (device_param
, max
, allow_div
);
4712 if (work
== 0) break;
4714 words_off
= device_param
->words_off
;
4715 words_fin
= words_off
+ work
;
4720 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4724 for ( ; words_cur
< words_fin
; words_cur
++)
4726 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4728 line_len
= convert_from_hex (line_buf
, line_len
);
4730 // post-process rule engine
4732 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4734 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4736 int rule_len_out
= -1;
4738 if (line_len
< BLOCK_SIZE
)
4740 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4743 if (rule_len_out
< 0) continue;
4745 line_buf
= rule_buf_out
;
4746 line_len
= rule_len_out
;
4749 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4751 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4755 hc_thread_mutex_lock (mux_counter
);
4757 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4759 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4762 hc_thread_mutex_unlock (mux_counter
);
4767 else if (attack_kern
== ATTACK_KERN_COMBI
)
4769 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4770 // since we still need to combine the plains
4772 if (line_len
> data
.pw_max
)
4776 hc_thread_mutex_lock (mux_counter
);
4778 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4780 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4783 hc_thread_mutex_unlock (mux_counter
);
4789 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4791 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4793 if (data
.devices_status
== STATUS_CRACKED
) break;
4794 if (data
.devices_status
== STATUS_ABORTED
) break;
4795 if (data
.devices_status
== STATUS_QUIT
) break;
4796 if (data
.devices_status
== STATUS_BYPASS
) break;
4799 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4801 if (data
.devices_status
== STATUS_CRACKED
) break;
4802 if (data
.devices_status
== STATUS_ABORTED
) break;
4803 if (data
.devices_status
== STATUS_QUIT
) break;
4804 if (data
.devices_status
== STATUS_BYPASS
) break;
4807 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4809 if (data
.devices_status
== STATUS_CRACKED
) break;
4810 if (data
.devices_status
== STATUS_ABORTED
) break;
4811 if (data
.devices_status
== STATUS_QUIT
) break;
4812 if (data
.devices_status
== STATUS_BYPASS
) break;
4818 const uint pws_cnt
= device_param
->pws_cnt
;
4822 run_copy (device_param
, pws_cnt
);
4824 run_cracker (device_param
, pws_cnt
);
4826 device_param
->pws_cnt
= 0;
4830 if (attack_kern == ATTACK_KERN_STRAIGHT)
4832 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4834 else if (attack_kern == ATTACK_KERN_COMBI)
4836 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4841 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4843 if (data
.devices_status
== STATUS_CRACKED
) break;
4844 if (data
.devices_status
== STATUS_ABORTED
) break;
4845 if (data
.devices_status
== STATUS_QUIT
) break;
4846 if (data
.devices_status
== STATUS_BYPASS
) break;
4848 if (words_fin
== 0) break;
4850 device_param
->words_done
= words_fin
;
4853 if (attack_mode
== ATTACK_MODE_COMBI
)
4855 fclose (device_param
->combs_fp
);
4858 free (wl_data
->buf
);
4864 device_param
->kernel_accel
= 0;
4865 device_param
->kernel_loops
= 0;
4870 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4874 log_error ("ERROR: %s : Invalid argument", __func__
);
4879 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4881 device_param
->kernel_params_buf32
[24] = salt_pos
;
4882 device_param
->kernel_params_buf32
[27] = 1;
4883 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4884 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4885 device_param
->kernel_params_buf32
[30] = 0;
4886 device_param
->kernel_params_buf32
[31] = 1;
4888 char *dictfile_old
= data
.dictfile
;
4890 const char *weak_hash_check
= "weak-hash-check";
4892 data
.dictfile
= (char *) weak_hash_check
;
4894 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4896 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4902 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4904 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4908 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4910 uint loop_step
= 16;
4912 const uint iter
= salt_buf
->salt_iter
;
4914 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4916 uint loop_left
= iter
- loop_pos
;
4918 loop_left
= MIN (loop_left
, loop_step
);
4920 device_param
->kernel_params_buf32
[25] = loop_pos
;
4921 device_param
->kernel_params_buf32
[26] = loop_left
;
4923 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4926 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4933 check_cracked (device_param
, salt_pos
);
4939 device_param
->kernel_params_buf32
[24] = 0;
4940 device_param
->kernel_params_buf32
[25] = 0;
4941 device_param
->kernel_params_buf32
[26] = 0;
4942 device_param
->kernel_params_buf32
[27] = 0;
4943 device_param
->kernel_params_buf32
[28] = 0;
4944 device_param
->kernel_params_buf32
[29] = 0;
4945 device_param
->kernel_params_buf32
[30] = 0;
4946 device_param
->kernel_params_buf32
[31] = 0;
4948 data
.dictfile
= dictfile_old
;
4950 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4955 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4957 if (data
.username
== 0)
4959 *hashbuf_pos
= line_buf
;
4960 *hashbuf_len
= line_len
;
4964 char *pos
= line_buf
;
4967 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4969 if (line_buf
[i
] == data
.separator
)
4984 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
4991 for (int i
= 0; i
< line_len
; i
++)
4993 if (line_buf
[i
] == data
.separator
)
5002 if (pos
== NULL
) pos
= line_buf
+ i
;
5014 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5021 for (int i
= 0; i
< line_len
; i
++)
5023 if (line_buf
[i
] == ':')
5030 if (sep_cnt
== 2) sep2_len
++;
5031 if (sep_cnt
== 3) sep3_len
++;
5034 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5039 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5046 for (int i
= 0; i
< line_len
; i
++)
5048 if (line_buf
[i
] == ':')
5055 if (data
.hash_mode
== 1000)
5059 if (pos
== NULL
) pos
= line_buf
+ i
;
5064 else if (data
.hash_mode
== 3000)
5068 if (pos
== NULL
) pos
= line_buf
+ i
;
5079 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5086 for (int i
= 0; i
< line_len
; i
++)
5088 if (line_buf
[i
] == ':')
5097 if (pos
== NULL
) pos
= line_buf
+ i
;
5109 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5113 char sep5_first
= 0;
5114 char sep6_first
= 0;
5116 for (int i
= 0; i
< line_len
; i
++)
5118 if (line_buf
[i
] == ':')
5125 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5126 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5129 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5134 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5141 for (int i
= 0; i
< line_len
; i
++)
5143 if (line_buf
[i
] == ':')
5152 if (pos
== NULL
) pos
= line_buf
+ i
;
5162 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5169 for (int i
= 0; i
< line_len
; i
++)
5171 if (line_buf
[i
] == ':')
5180 if (pos
== NULL
) pos
= line_buf
+ i
;
5192 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5196 for (int i
= 0; i
< line_len
; i
++)
5198 if (line_buf
[i
] == ':') sep_cnt
++;
5201 if (sep_cnt
== 8) return 1;
5206 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5208 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5211 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5213 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5218 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5220 switch (hashfile_format
)
5222 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5223 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5224 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5225 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5229 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5231 switch (hashfile_format
)
5233 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5234 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5235 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5236 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5240 char *strhlfmt (const uint hashfile_format
)
5242 switch (hashfile_format
)
5244 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5245 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5246 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5247 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5248 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5249 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5250 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5251 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5252 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5253 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5256 return ((char *) "Unknown");
5259 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5261 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5263 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5264 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5266 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5270 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5274 int line_len
= fgetl (fp
, line_buf
);
5276 if (line_len
== 0) continue;
5278 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5279 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5280 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5282 if (num_check
== max_check
) break;
5289 uint hashlist_format
= HLFMT_HASHCAT
;
5291 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5293 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5295 hashlist_format
= i
;
5300 return hashlist_format
;
5304 * some further helper function
5307 // wrapper around mymalloc for ADL
5309 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5310 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5312 return mymalloc (iSize
);
5316 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
)
5320 const uint dgst_pos0
= data
.dgst_pos0
;
5321 const uint dgst_pos1
= data
.dgst_pos1
;
5322 const uint dgst_pos2
= data
.dgst_pos2
;
5323 const uint dgst_pos3
= data
.dgst_pos3
;
5325 memset (bitmap_a
, 0, bitmap_size
);
5326 memset (bitmap_b
, 0, bitmap_size
);
5327 memset (bitmap_c
, 0, bitmap_size
);
5328 memset (bitmap_d
, 0, bitmap_size
);
5330 for (uint i
= 0; i
< digests_cnt
; i
++)
5332 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5334 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5336 digests_buf_ptr
+= dgst_size
;
5338 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5339 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5340 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5341 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5343 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5344 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5345 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5346 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5348 if (bitmap_a
[idx0
] & val0
) collisions
++;
5349 if (bitmap_b
[idx1
] & val1
) collisions
++;
5350 if (bitmap_c
[idx2
] & val2
) collisions
++;
5351 if (bitmap_d
[idx3
] & val3
) collisions
++;
5353 bitmap_a
[idx0
] |= val0
;
5354 bitmap_b
[idx1
] |= val1
;
5355 bitmap_c
[idx2
] |= val2
;
5356 bitmap_d
[idx3
] |= val3
;
5358 if (collisions
>= collisions_max
) return 0x7fffffff;
5369 void SetConsoleWindowSize (const int x
)
5371 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5373 if (h
== INVALID_HANDLE_VALUE
) return;
5375 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5377 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5379 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5381 sr
->Right
= MAX (sr
->Right
, x
- 1);
5385 co
.X
= sr
->Right
+ 1;
5386 co
.Y
= sr
->Bottom
+ 1;
5388 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5390 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5394 int main (int argc
, char **argv
)
5397 SetConsoleWindowSize (132);
5401 * To help users a bit
5404 char *compute
= getenv ("COMPUTE");
5408 static char display
[100];
5410 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5416 if (getenv ("DISPLAY") == NULL
)
5417 putenv ((char *) "DISPLAY=:0");
5420 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5421 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5423 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5424 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5426 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5427 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5429 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5430 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5432 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5433 putenv ((char *) "POCL_KERNEL_CACHE=0");
5441 memset (&data
, 0, sizeof (hc_global_data_t
));
5447 data
.proc_start
= proc_start
;
5450 char **myargv
= argv
;
5452 hc_thread_mutex_init (mux_dispatcher
);
5453 hc_thread_mutex_init (mux_counter
);
5454 hc_thread_mutex_init (mux_display
);
5455 hc_thread_mutex_init (mux_adl
);
5458 * commandline parameters
5462 uint version
= VERSION
;
5464 uint benchmark
= BENCHMARK
;
5467 uint username
= USERNAME
;
5468 uint remove
= REMOVE
;
5469 uint remove_timer
= REMOVE_TIMER
;
5472 uint keyspace
= KEYSPACE
;
5473 uint potfile_disable
= POTFILE_DISABLE
;
5474 char *potfile_path
= NULL
;
5475 uint debug_mode
= DEBUG_MODE
;
5476 char *debug_file
= NULL
;
5477 char *induction_dir
= NULL
;
5478 char *outfile_check_dir
= NULL
;
5480 uint runtime
= RUNTIME
;
5481 uint hash_mode
= HASH_MODE
;
5482 uint attack_mode
= ATTACK_MODE
;
5483 uint markov_disable
= MARKOV_DISABLE
;
5484 uint markov_classic
= MARKOV_CLASSIC
;
5485 uint markov_threshold
= MARKOV_THRESHOLD
;
5486 char *markov_hcstat
= NULL
;
5487 char *outfile
= NULL
;
5488 uint outfile_format
= OUTFILE_FORMAT
;
5489 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5490 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5491 uint restore
= RESTORE
;
5492 uint restore_timer
= RESTORE_TIMER
;
5493 uint restore_disable
= RESTORE_DISABLE
;
5494 uint status
= STATUS
;
5495 uint status_timer
= STATUS_TIMER
;
5496 uint machine_readable
= MACHINE_READABLE
;
5497 uint loopback
= LOOPBACK
;
5498 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5499 char *session
= NULL
;
5500 uint hex_charset
= HEX_CHARSET
;
5501 uint hex_salt
= HEX_SALT
;
5502 uint hex_wordlist
= HEX_WORDLIST
;
5503 uint rp_gen
= RP_GEN
;
5504 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5505 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5506 uint rp_gen_seed
= RP_GEN_SEED
;
5507 char *rule_buf_l
= (char *) RULE_BUF_L
;
5508 char *rule_buf_r
= (char *) RULE_BUF_R
;
5509 uint increment
= INCREMENT
;
5510 uint increment_min
= INCREMENT_MIN
;
5511 uint increment_max
= INCREMENT_MAX
;
5512 char *cpu_affinity
= NULL
;
5513 OCL_PTR
*ocl
= NULL
;
5514 char *opencl_devices
= NULL
;
5515 char *opencl_platforms
= NULL
;
5516 char *opencl_device_types
= NULL
;
5517 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5518 char *truecrypt_keyfiles
= NULL
;
5519 char *veracrypt_keyfiles
= NULL
;
5520 uint veracrypt_pim
= 0;
5521 uint workload_profile
= WORKLOAD_PROFILE
;
5522 uint kernel_accel
= KERNEL_ACCEL
;
5523 uint kernel_loops
= KERNEL_LOOPS
;
5524 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5526 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5527 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5529 uint powertune_enable
= POWERTUNE_ENABLE
;
5532 uint logfile_disable
= LOGFILE_DISABLE
;
5533 uint segment_size
= SEGMENT_SIZE
;
5534 uint scrypt_tmto
= SCRYPT_TMTO
;
5535 char separator
= SEPARATOR
;
5536 uint bitmap_min
= BITMAP_MIN
;
5537 uint bitmap_max
= BITMAP_MAX
;
5538 char *custom_charset_1
= NULL
;
5539 char *custom_charset_2
= NULL
;
5540 char *custom_charset_3
= NULL
;
5541 char *custom_charset_4
= NULL
;
5543 #define IDX_HELP 'h'
5544 #define IDX_VERSION 'V'
5545 #define IDX_VERSION_LOWER 'v'
5546 #define IDX_QUIET 0xff02
5547 #define IDX_SHOW 0xff03
5548 #define IDX_LEFT 0xff04
5549 #define IDX_REMOVE 0xff05
5550 #define IDX_REMOVE_TIMER 0xff37
5551 #define IDX_SKIP 's'
5552 #define IDX_LIMIT 'l'
5553 #define IDX_KEYSPACE 0xff35
5554 #define IDX_POTFILE_DISABLE 0xff06
5555 #define IDX_POTFILE_PATH 0xffe0
5556 #define IDX_DEBUG_MODE 0xff43
5557 #define IDX_DEBUG_FILE 0xff44
5558 #define IDX_INDUCTION_DIR 0xff46
5559 #define IDX_OUTFILE_CHECK_DIR 0xff47
5560 #define IDX_USERNAME 0xff07
5561 #define IDX_FORCE 0xff08
5562 #define IDX_RUNTIME 0xff09
5563 #define IDX_BENCHMARK 'b'
5564 #define IDX_HASH_MODE 'm'
5565 #define IDX_ATTACK_MODE 'a'
5566 #define IDX_RP_FILE 'r'
5567 #define IDX_RP_GEN 'g'
5568 #define IDX_RP_GEN_FUNC_MIN 0xff10
5569 #define IDX_RP_GEN_FUNC_MAX 0xff11
5570 #define IDX_RP_GEN_SEED 0xff34
5571 #define IDX_RULE_BUF_L 'j'
5572 #define IDX_RULE_BUF_R 'k'
5573 #define IDX_INCREMENT 'i'
5574 #define IDX_INCREMENT_MIN 0xff12
5575 #define IDX_INCREMENT_MAX 0xff13
5576 #define IDX_OUTFILE 'o'
5577 #define IDX_OUTFILE_FORMAT 0xff14
5578 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5579 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5580 #define IDX_RESTORE 0xff15
5581 #define IDX_RESTORE_DISABLE 0xff27
5582 #define IDX_STATUS 0xff17
5583 #define IDX_STATUS_TIMER 0xff18
5584 #define IDX_MACHINE_READABLE 0xff50
5585 #define IDX_LOOPBACK 0xff38
5586 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5587 #define IDX_SESSION 0xff19
5588 #define IDX_HEX_CHARSET 0xff20
5589 #define IDX_HEX_SALT 0xff21
5590 #define IDX_HEX_WORDLIST 0xff40
5591 #define IDX_MARKOV_DISABLE 0xff22
5592 #define IDX_MARKOV_CLASSIC 0xff23
5593 #define IDX_MARKOV_THRESHOLD 't'
5594 #define IDX_MARKOV_HCSTAT 0xff24
5595 #define IDX_CPU_AFFINITY 0xff25
5596 #define IDX_OPENCL_DEVICES 'd'
5597 #define IDX_OPENCL_PLATFORMS 0xff72
5598 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5599 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5600 #define IDX_WORKLOAD_PROFILE 'w'
5601 #define IDX_KERNEL_ACCEL 'n'
5602 #define IDX_KERNEL_LOOPS 'u'
5603 #define IDX_GPU_TEMP_DISABLE 0xff29
5604 #define IDX_GPU_TEMP_ABORT 0xff30
5605 #define IDX_GPU_TEMP_RETAIN 0xff31
5606 #define IDX_POWERTUNE_ENABLE 0xff41
5607 #define IDX_LOGFILE_DISABLE 0xff51
5608 #define IDX_TRUECRYPT_KEYFILES 0xff52
5609 #define IDX_VERACRYPT_KEYFILES 0xff53
5610 #define IDX_VERACRYPT_PIM 0xff54
5611 #define IDX_SCRYPT_TMTO 0xff61
5612 #define IDX_SEGMENT_SIZE 'c'
5613 #define IDX_SEPARATOR 'p'
5614 #define IDX_BITMAP_MIN 0xff70
5615 #define IDX_BITMAP_MAX 0xff71
5616 #define IDX_CUSTOM_CHARSET_1 '1'
5617 #define IDX_CUSTOM_CHARSET_2 '2'
5618 #define IDX_CUSTOM_CHARSET_3 '3'
5619 #define IDX_CUSTOM_CHARSET_4 '4'
5621 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5623 struct option long_options
[] =
5625 {"help", no_argument
, 0, IDX_HELP
},
5626 {"version", no_argument
, 0, IDX_VERSION
},
5627 {"quiet", no_argument
, 0, IDX_QUIET
},
5628 {"show", no_argument
, 0, IDX_SHOW
},
5629 {"left", no_argument
, 0, IDX_LEFT
},
5630 {"username", no_argument
, 0, IDX_USERNAME
},
5631 {"remove", no_argument
, 0, IDX_REMOVE
},
5632 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5633 {"skip", required_argument
, 0, IDX_SKIP
},
5634 {"limit", required_argument
, 0, IDX_LIMIT
},
5635 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5636 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5637 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5638 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5639 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5640 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5641 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5642 {"force", no_argument
, 0, IDX_FORCE
},
5643 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5644 {"restore", no_argument
, 0, IDX_RESTORE
},
5645 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5646 {"status", no_argument
, 0, IDX_STATUS
},
5647 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5648 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5649 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5650 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5651 {"session", required_argument
, 0, IDX_SESSION
},
5652 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5653 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5654 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5655 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5656 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5657 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5658 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5659 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5660 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5661 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5662 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5663 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5664 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5665 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5666 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5667 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5668 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5669 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5670 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5671 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5672 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5673 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5674 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5675 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5676 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5677 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5678 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5679 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5680 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5681 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5683 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5684 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5686 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5688 #endif // HAVE_HWMON
5689 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5690 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5691 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5692 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5693 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5694 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5695 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5696 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5697 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5698 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5699 {"increment", no_argument
, 0, IDX_INCREMENT
},
5700 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5701 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5702 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5703 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5704 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5705 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5709 uint rp_files_cnt
= 0;
5711 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5713 int option_index
= 0;
5719 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5723 case IDX_HELP
: usage
= 1; break;
5725 case IDX_VERSION_LOWER
: version
= 1; break;
5726 case IDX_RESTORE
: restore
= 1; break;
5727 case IDX_SESSION
: session
= optarg
; break;
5728 case IDX_SHOW
: show
= 1; break;
5729 case IDX_LEFT
: left
= 1; break;
5730 case '?': return (-1);
5736 log_error ("ERROR: Invalid argument specified");
5747 log_info ("%s", VERSION_TAG
);
5754 usage_big_print (PROGNAME
);
5760 * session needs to be set, always!
5763 if (session
== NULL
) session
= (char *) PROGNAME
;
5766 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5769 char *exec_path
= get_exec_path ();
5773 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5774 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5776 char *install_dir
= get_install_dir (resolved_exec_path
);
5777 char *profile_dir
= NULL
;
5778 char *session_dir
= NULL
;
5779 char *shared_dir
= NULL
;
5781 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5783 struct passwd
*pw
= getpwuid (getuid ());
5785 const char *homedir
= pw
->pw_dir
;
5787 profile_dir
= get_profile_dir (homedir
);
5788 session_dir
= get_session_dir (profile_dir
);
5789 shared_dir
= strdup (SHARED_FOLDER
);
5791 mkdir (profile_dir
, 0700);
5792 mkdir (session_dir
, 0700);
5796 profile_dir
= install_dir
;
5797 session_dir
= install_dir
;
5798 shared_dir
= install_dir
;
5801 myfree (resolved_install_folder
);
5802 myfree (resolved_exec_path
);
5806 char *install_dir
= get_install_dir (exec_path
);
5807 char *profile_dir
= install_dir
;
5808 char *session_dir
= install_dir
;
5809 char *shared_dir
= install_dir
;
5813 data
.install_dir
= install_dir
;
5814 data
.profile_dir
= profile_dir
;
5815 data
.session_dir
= session_dir
;
5816 data
.shared_dir
= shared_dir
;
5821 * kernel cache, we need to make sure folder exist
5824 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5826 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5828 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5830 mkdir (kernels_folder
, 0700);
5832 myfree (kernels_folder
);
5838 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5840 data
.session
= session
;
5842 char *eff_restore_file
= (char *) mymalloc (session_size
);
5843 char *new_restore_file
= (char *) mymalloc (session_size
);
5845 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5846 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5848 data
.eff_restore_file
= eff_restore_file
;
5849 data
.new_restore_file
= new_restore_file
;
5851 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5853 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5854 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5859 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5860 if ((show
== 1) || (left
== 1))
5862 restore_disable
= 1;
5867 data
.restore_disable
= restore_disable
;
5869 restore_data_t
*rd
= init_restore (argc
, argv
);
5879 read_restore (eff_restore_file
, rd
);
5881 if (rd
->version_bin
< RESTORE_MIN
)
5883 log_error ("ERROR: Incompatible restore-file version");
5892 rd
->pid
= getpid ();
5894 rd
->pid
= GetCurrentProcessId ();
5898 uint hash_mode_chgd
= 0;
5899 uint runtime_chgd
= 0;
5900 uint kernel_loops_chgd
= 0;
5901 uint kernel_accel_chgd
= 0;
5902 uint attack_mode_chgd
= 0;
5903 uint outfile_format_chgd
= 0;
5904 uint rp_gen_seed_chgd
= 0;
5905 uint remove_timer_chgd
= 0;
5906 uint increment_min_chgd
= 0;
5907 uint increment_max_chgd
= 0;
5908 uint workload_profile_chgd
= 0;
5909 uint opencl_vector_width_chgd
= 0;
5911 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5912 uint gpu_temp_retain_chgd
= 0;
5913 uint gpu_temp_abort_chgd
= 0;
5920 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5924 //case IDX_HELP: usage = 1; break;
5925 //case IDX_VERSION: version = 1; break;
5926 //case IDX_RESTORE: restore = 1; break;
5927 case IDX_QUIET
: quiet
= 1; break;
5928 //case IDX_SHOW: show = 1; break;
5929 case IDX_SHOW
: break;
5930 //case IDX_LEFT: left = 1; break;
5931 case IDX_LEFT
: break;
5932 case IDX_USERNAME
: username
= 1; break;
5933 case IDX_REMOVE
: remove
= 1; break;
5934 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5935 remove_timer_chgd
= 1; break;
5936 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5937 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5938 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5939 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5940 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5941 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5942 case IDX_FORCE
: force
= 1; break;
5943 case IDX_SKIP
: skip
= atoll (optarg
); break;
5944 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5945 case IDX_KEYSPACE
: keyspace
= 1; break;
5946 case IDX_BENCHMARK
: benchmark
= 1; break;
5947 case IDX_RESTORE
: break;
5948 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5949 case IDX_STATUS
: status
= 1; break;
5950 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5951 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5952 case IDX_LOOPBACK
: loopback
= 1; break;
5953 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5954 //case IDX_SESSION: session = optarg; break;
5955 case IDX_SESSION
: break;
5956 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5957 hash_mode_chgd
= 1; break;
5958 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5959 runtime_chgd
= 1; break;
5960 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5961 attack_mode_chgd
= 1; break;
5962 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5963 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5964 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5965 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5966 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5967 rp_gen_seed_chgd
= 1; break;
5968 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5969 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5970 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5971 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5972 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5973 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5974 case IDX_OUTFILE
: outfile
= optarg
; break;
5975 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5976 outfile_format_chgd
= 1; break;
5977 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
5978 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
5979 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5980 case IDX_HEX_SALT
: hex_salt
= 1; break;
5981 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5982 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5983 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
5984 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
5985 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
5986 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
5987 opencl_vector_width_chgd
= 1; break;
5988 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
5989 workload_profile_chgd
= 1; break;
5990 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
5991 kernel_accel_chgd
= 1; break;
5992 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
5993 kernel_loops_chgd
= 1; break;
5994 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5996 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
5998 gpu_temp_abort_chgd
= 1;
6001 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
6003 gpu_temp_retain_chgd
= 1;
6007 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6009 #endif // HAVE_HWMON
6010 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6011 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6012 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6013 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6014 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6015 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6016 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6017 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6018 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6019 case IDX_INCREMENT
: increment
= 1; break;
6020 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6021 increment_min_chgd
= 1; break;
6022 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6023 increment_max_chgd
= 1; break;
6024 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6025 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6026 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6027 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6030 log_error ("ERROR: Invalid argument specified");
6037 log_error ("ERROR: Invalid argument specified");
6043 * Inform user things getting started,
6044 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6045 * - we do not need to check algorithm_pos
6052 if (machine_readable
== 0)
6054 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6059 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6062 else if (restore
== 1)
6064 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6069 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6078 if (attack_mode
> 7)
6080 log_error ("ERROR: Invalid attack-mode specified");
6085 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6087 log_error ("ERROR: Invalid runtime specified");
6092 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6094 log_error ("ERROR: Invalid hash-type specified");
6099 // renamed hash modes
6113 log_error ("Old -m specified, use -m %d instead", n
);
6121 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6123 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6129 if (outfile_format
> 16)
6131 log_error ("ERROR: Invalid outfile-format specified");
6138 if (outfile_format_chgd
== 1)
6140 if (outfile_format
> 1)
6142 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6149 outfile_format
= OUTFILE_FMT_HASH
;
6155 if (outfile_format_chgd
== 1)
6157 if ((outfile_format
> 7) && (outfile_format
< 16))
6159 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6166 if (increment_min
< INCREMENT_MIN
)
6168 log_error ("ERROR: Invalid increment-min specified");
6173 if (increment_max
> INCREMENT_MAX
)
6175 log_error ("ERROR: Invalid increment-max specified");
6180 if (increment_min
> increment_max
)
6182 log_error ("ERROR: Invalid increment-min specified");
6187 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6189 log_error ("ERROR: increment is not allowed in attack-mode 0");
6194 if ((increment
== 0) && (increment_min_chgd
== 1))
6196 log_error ("ERROR: increment-min is only supported together with increment switch");
6201 if ((increment
== 0) && (increment_max_chgd
== 1))
6203 log_error ("ERROR: increment-max is only supported together with increment switch");
6208 if (rp_files_cnt
&& rp_gen
)
6210 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6215 if (rp_files_cnt
|| rp_gen
)
6217 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6219 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6225 if (rp_gen_func_min
> rp_gen_func_max
)
6227 log_error ("ERROR: Invalid rp-gen-func-min specified");
6232 if (kernel_accel_chgd
== 1)
6236 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6237 log_info ("Please consider using the option -w instead");
6238 log_info ("You can use --force to override this but do not post error reports if you do so");
6244 if (kernel_accel
< 1)
6246 log_error ("ERROR: Invalid kernel-accel specified");
6251 if (kernel_accel
> 1024)
6253 log_error ("ERROR: Invalid kernel-accel specified");
6259 if (kernel_loops_chgd
== 1)
6263 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6264 log_info ("Please consider using the option -w instead");
6265 log_info ("You can use --force to override this but do not post error reports if you do so");
6271 if (kernel_loops
< 1)
6273 log_error ("ERROR: Invalid kernel-loops specified");
6278 if (kernel_loops
> 1024)
6280 log_error ("ERROR: Invalid kernel-loops specified");
6286 if ((workload_profile
< 1) || (workload_profile
> 4))
6288 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6293 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6295 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6300 if (show
== 1 || left
== 1)
6302 attack_mode
= ATTACK_MODE_NONE
;
6306 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6311 if (potfile_disable
== 1)
6313 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6319 uint attack_kern
= ATTACK_KERN_NONE
;
6321 switch (attack_mode
)
6323 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6324 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6325 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6326 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6327 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6334 int num_additional_params
= 1;
6336 if (attack_kern
== ATTACK_KERN_COMBI
)
6338 num_additional_params
= 2;
6341 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6343 if (keyspace_wordlist_specified
== 0) optind
--;
6346 if (attack_kern
== ATTACK_KERN_NONE
)
6348 if ((optind
+ 1) != myargc
)
6350 usage_mini_print (myargv
[0]);
6355 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6357 if ((optind
+ 1) > myargc
)
6359 usage_mini_print (myargv
[0]);
6364 else if (attack_kern
== ATTACK_KERN_COMBI
)
6366 if ((optind
+ 3) != myargc
)
6368 usage_mini_print (myargv
[0]);
6373 else if (attack_kern
== ATTACK_KERN_BF
)
6375 if ((optind
+ 1) > myargc
)
6377 usage_mini_print (myargv
[0]);
6384 usage_mini_print (myargv
[0]);
6391 if (myargv
[optind
] != 0)
6393 log_error ("ERROR: Invalid argument for benchmark mode specified");
6398 if (attack_mode_chgd
== 1)
6400 if (attack_mode
!= ATTACK_MODE_BF
)
6402 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6409 if (skip
!= 0 && limit
!= 0)
6418 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6424 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6429 potfile_disable
= 1;
6431 restore_disable
= 1;
6435 weak_hash_threshold
= 0;
6440 if (remove_timer_chgd
== 1)
6444 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6449 if (remove_timer
< 1)
6451 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6459 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6461 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6463 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6470 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6478 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6480 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6485 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6487 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6495 log_error ("ERROR: Invalid debug-mode specified");
6500 if (debug_file
!= NULL
)
6504 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6510 if (induction_dir
!= NULL
)
6512 if (attack_mode
== ATTACK_MODE_BF
)
6514 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6520 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6522 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6524 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6529 weak_hash_threshold
= 0;
6533 * induction directory
6536 char *induction_directory
= NULL
;
6538 if (attack_mode
!= ATTACK_MODE_BF
)
6540 if (induction_dir
== NULL
)
6542 induction_directory
= (char *) mymalloc (session_size
);
6544 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6546 // create induction folder if it does not already exist
6550 if (rmdir (induction_directory
) == -1)
6552 if (errno
== ENOENT
)
6554 // good, we can ignore
6556 else if (errno
== ENOTEMPTY
)
6558 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6560 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6562 if (rename (induction_directory
, induction_directory_mv
) != 0)
6564 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6571 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6577 if (mkdir (induction_directory
, 0700) == -1)
6579 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6587 induction_directory
= induction_dir
;
6591 data
.induction_directory
= induction_directory
;
6597 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6599 char *loopback_file
= (char *) mymalloc (loopback_size
);
6605 char tuning_db_file
[256] = { 0 };
6607 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6609 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6612 * outfile-check directory
6615 char *outfile_check_directory
= NULL
;
6617 if (outfile_check_dir
== NULL
)
6619 outfile_check_directory
= (char *) mymalloc (session_size
);
6621 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6625 outfile_check_directory
= outfile_check_dir
;
6628 data
.outfile_check_directory
= outfile_check_directory
;
6632 struct stat outfile_check_stat
;
6634 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6636 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6640 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6645 else if (outfile_check_dir
== NULL
)
6647 if (mkdir (outfile_check_directory
, 0700) == -1)
6649 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6657 * special other stuff
6660 if (hash_mode
== 9710)
6663 outfile_format_chgd
= 1;
6666 if (hash_mode
== 9810)
6669 outfile_format_chgd
= 1;
6672 if (hash_mode
== 10410)
6675 outfile_format_chgd
= 1;
6682 data
.hash_mode
= hash_mode
;
6683 data
.restore
= restore
;
6684 data
.restore_timer
= restore_timer
;
6685 data
.restore_disable
= restore_disable
;
6686 data
.status
= status
;
6687 data
.status_timer
= status_timer
;
6688 data
.machine_readable
= machine_readable
;
6689 data
.loopback
= loopback
;
6690 data
.runtime
= runtime
;
6691 data
.remove
= remove
;
6692 data
.remove_timer
= remove_timer
;
6693 data
.debug_mode
= debug_mode
;
6694 data
.debug_file
= debug_file
;
6695 data
.username
= username
;
6697 data
.outfile
= outfile
;
6698 data
.outfile_format
= outfile_format
;
6699 data
.outfile_autohex
= outfile_autohex
;
6700 data
.hex_charset
= hex_charset
;
6701 data
.hex_salt
= hex_salt
;
6702 data
.hex_wordlist
= hex_wordlist
;
6703 data
.separator
= separator
;
6704 data
.rp_files
= rp_files
;
6705 data
.rp_files_cnt
= rp_files_cnt
;
6706 data
.rp_gen
= rp_gen
;
6707 data
.rp_gen_seed
= rp_gen_seed
;
6709 data
.benchmark
= benchmark
;
6714 data
.powertune_enable
= powertune_enable
;
6717 data
.logfile_disable
= logfile_disable
;
6718 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6719 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6720 data
.veracrypt_pim
= veracrypt_pim
;
6721 data
.scrypt_tmto
= scrypt_tmto
;
6722 data
.workload_profile
= workload_profile
;
6730 set_cpu_affinity (cpu_affinity
);
6733 if (rp_gen_seed_chgd
== 0)
6739 srand (rp_gen_seed
);
6746 if (logfile_disable
== 0)
6748 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6750 char *logfile
= (char *) mymalloc (logfile_size
);
6752 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6754 data
.logfile
= logfile
;
6756 char *topid
= logfile_generate_topid ();
6761 // logfile_append() checks for logfile_disable internally to make it easier from here
6763 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6764 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6765 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6766 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6767 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6768 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6769 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6770 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6771 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6772 #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));
6774 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6775 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6776 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6777 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6778 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6779 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6780 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6781 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6783 logfile_top_msg ("START");
6785 logfile_top_uint (attack_mode
);
6786 logfile_top_uint (attack_kern
);
6787 logfile_top_uint (benchmark
);
6788 logfile_top_uint (bitmap_min
);
6789 logfile_top_uint (bitmap_max
);
6790 logfile_top_uint (debug_mode
);
6791 logfile_top_uint (force
);
6792 logfile_top_uint (kernel_accel
);
6793 logfile_top_uint (kernel_loops
);
6794 logfile_top_uint (gpu_temp_disable
);
6796 logfile_top_uint (gpu_temp_abort
);
6797 logfile_top_uint (gpu_temp_retain
);
6799 logfile_top_uint (hash_mode
);
6800 logfile_top_uint (hex_charset
);
6801 logfile_top_uint (hex_salt
);
6802 logfile_top_uint (hex_wordlist
);
6803 logfile_top_uint (increment
);
6804 logfile_top_uint (increment_max
);
6805 logfile_top_uint (increment_min
);
6806 logfile_top_uint (keyspace
);
6807 logfile_top_uint (left
);
6808 logfile_top_uint (logfile_disable
);
6809 logfile_top_uint (loopback
);
6810 logfile_top_uint (markov_classic
);
6811 logfile_top_uint (markov_disable
);
6812 logfile_top_uint (markov_threshold
);
6813 logfile_top_uint (outfile_autohex
);
6814 logfile_top_uint (outfile_check_timer
);
6815 logfile_top_uint (outfile_format
);
6816 logfile_top_uint (potfile_disable
);
6817 logfile_top_string (potfile_path
);
6818 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6819 logfile_top_uint (powertune_enable
);
6821 logfile_top_uint (scrypt_tmto
);
6822 logfile_top_uint (quiet
);
6823 logfile_top_uint (remove
);
6824 logfile_top_uint (remove_timer
);
6825 logfile_top_uint (restore
);
6826 logfile_top_uint (restore_disable
);
6827 logfile_top_uint (restore_timer
);
6828 logfile_top_uint (rp_gen
);
6829 logfile_top_uint (rp_gen_func_max
);
6830 logfile_top_uint (rp_gen_func_min
);
6831 logfile_top_uint (rp_gen_seed
);
6832 logfile_top_uint (runtime
);
6833 logfile_top_uint (segment_size
);
6834 logfile_top_uint (show
);
6835 logfile_top_uint (status
);
6836 logfile_top_uint (machine_readable
);
6837 logfile_top_uint (status_timer
);
6838 logfile_top_uint (usage
);
6839 logfile_top_uint (username
);
6840 logfile_top_uint (version
);
6841 logfile_top_uint (weak_hash_threshold
);
6842 logfile_top_uint (workload_profile
);
6843 logfile_top_uint64 (limit
);
6844 logfile_top_uint64 (skip
);
6845 logfile_top_char (separator
);
6846 logfile_top_string (cpu_affinity
);
6847 logfile_top_string (custom_charset_1
);
6848 logfile_top_string (custom_charset_2
);
6849 logfile_top_string (custom_charset_3
);
6850 logfile_top_string (custom_charset_4
);
6851 logfile_top_string (debug_file
);
6852 logfile_top_string (opencl_devices
);
6853 logfile_top_string (opencl_platforms
);
6854 logfile_top_string (opencl_device_types
);
6855 logfile_top_uint (opencl_vector_width
);
6856 logfile_top_string (induction_dir
);
6857 logfile_top_string (markov_hcstat
);
6858 logfile_top_string (outfile
);
6859 logfile_top_string (outfile_check_dir
);
6860 logfile_top_string (rule_buf_l
);
6861 logfile_top_string (rule_buf_r
);
6862 logfile_top_string (session
);
6863 logfile_top_string (truecrypt_keyfiles
);
6864 logfile_top_string (veracrypt_keyfiles
);
6865 logfile_top_uint (veracrypt_pim
);
6868 * Init OpenCL library loader
6873 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6881 * OpenCL platform selection
6884 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6887 * OpenCL device selection
6890 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6893 * OpenCL device type selection
6896 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6905 * disable useless stuff for benchmark
6910 restore_disable
= 1;
6911 potfile_disable
= 1;
6912 weak_hash_threshold
= 0;
6913 gpu_temp_disable
= 1;
6917 powertune_enable
= 1;
6921 data
.status_timer
= status_timer
;
6922 data
.restore_timer
= restore_timer
;
6923 data
.restore_disable
= restore_disable
;
6926 * force attack mode to be bruteforce
6929 attack_mode
= ATTACK_MODE_BF
;
6930 attack_kern
= ATTACK_KERN_BF
;
6932 if (workload_profile_chgd
== 0)
6934 workload_profile
= 3;
6936 data
.workload_profile
= workload_profile
;
6946 uint attack_exec
= 0;
6950 uint esalt_size
= 0;
6952 uint dgst_pos0
= -1;
6953 uint dgst_pos1
= -1;
6954 uint dgst_pos2
= -1;
6955 uint dgst_pos3
= -1;
6957 int (*parse_func
) (char *, uint
, hash_t
*);
6958 int (*sort_by_digest
) (const void *, const void *);
6960 uint algorithm_pos
= 0;
6961 uint algorithm_max
= 1;
6963 uint
*algorithms
= default_benchmark_algorithms
;
6965 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6967 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6970 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6971 * the following algos are skipped entirely
6974 if (algorithm_pos
> 0)
6978 rd
= init_restore (argc
, argv
);
6984 * update hash_mode in case of multihash benchmark
6989 if (hash_mode_chgd
== 0)
6991 hash_mode
= algorithms
[algorithm_pos
];
6993 data
.hash_mode
= hash_mode
;
7003 case 0: hash_type
= HASH_TYPE_MD5
;
7004 salt_type
= SALT_TYPE_NONE
;
7005 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7006 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7007 | OPTS_TYPE_PT_ADD80
7008 | OPTS_TYPE_PT_ADDBITS14
;
7009 kern_type
= KERN_TYPE_MD5
;
7010 dgst_size
= DGST_SIZE_4_4
;
7011 parse_func
= md5_parse_hash
;
7012 sort_by_digest
= sort_by_digest_4_4
;
7013 opti_type
= OPTI_TYPE_ZERO_BYTE
7014 | OPTI_TYPE_PRECOMPUTE_INIT
7015 | OPTI_TYPE_PRECOMPUTE_MERKLE
7016 | OPTI_TYPE_MEET_IN_MIDDLE
7017 | OPTI_TYPE_EARLY_SKIP
7018 | OPTI_TYPE_NOT_ITERATED
7019 | OPTI_TYPE_NOT_SALTED
7020 | OPTI_TYPE_RAW_HASH
;
7027 case 10: hash_type
= HASH_TYPE_MD5
;
7028 salt_type
= SALT_TYPE_INTERN
;
7029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7030 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7031 | OPTS_TYPE_ST_ADD80
7032 | OPTS_TYPE_ST_ADDBITS14
;
7033 kern_type
= KERN_TYPE_MD5_PWSLT
;
7034 dgst_size
= DGST_SIZE_4_4
;
7035 parse_func
= md5s_parse_hash
;
7036 sort_by_digest
= sort_by_digest_4_4
;
7037 opti_type
= OPTI_TYPE_ZERO_BYTE
7038 | OPTI_TYPE_PRECOMPUTE_INIT
7039 | OPTI_TYPE_PRECOMPUTE_MERKLE
7040 | OPTI_TYPE_MEET_IN_MIDDLE
7041 | OPTI_TYPE_EARLY_SKIP
7042 | OPTI_TYPE_NOT_ITERATED
7043 | OPTI_TYPE_APPENDED_SALT
7044 | OPTI_TYPE_RAW_HASH
;
7051 case 11: hash_type
= HASH_TYPE_MD5
;
7052 salt_type
= SALT_TYPE_INTERN
;
7053 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7054 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7055 | OPTS_TYPE_ST_ADD80
7056 | OPTS_TYPE_ST_ADDBITS14
;
7057 kern_type
= KERN_TYPE_MD5_PWSLT
;
7058 dgst_size
= DGST_SIZE_4_4
;
7059 parse_func
= joomla_parse_hash
;
7060 sort_by_digest
= sort_by_digest_4_4
;
7061 opti_type
= OPTI_TYPE_ZERO_BYTE
7062 | OPTI_TYPE_PRECOMPUTE_INIT
7063 | OPTI_TYPE_PRECOMPUTE_MERKLE
7064 | OPTI_TYPE_MEET_IN_MIDDLE
7065 | OPTI_TYPE_EARLY_SKIP
7066 | OPTI_TYPE_NOT_ITERATED
7067 | OPTI_TYPE_APPENDED_SALT
7068 | OPTI_TYPE_RAW_HASH
;
7075 case 12: hash_type
= HASH_TYPE_MD5
;
7076 salt_type
= SALT_TYPE_INTERN
;
7077 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7078 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7079 | OPTS_TYPE_ST_ADD80
7080 | OPTS_TYPE_ST_ADDBITS14
;
7081 kern_type
= KERN_TYPE_MD5_PWSLT
;
7082 dgst_size
= DGST_SIZE_4_4
;
7083 parse_func
= postgresql_parse_hash
;
7084 sort_by_digest
= sort_by_digest_4_4
;
7085 opti_type
= OPTI_TYPE_ZERO_BYTE
7086 | OPTI_TYPE_PRECOMPUTE_INIT
7087 | OPTI_TYPE_PRECOMPUTE_MERKLE
7088 | OPTI_TYPE_MEET_IN_MIDDLE
7089 | OPTI_TYPE_EARLY_SKIP
7090 | OPTI_TYPE_NOT_ITERATED
7091 | OPTI_TYPE_APPENDED_SALT
7092 | OPTI_TYPE_RAW_HASH
;
7099 case 20: hash_type
= HASH_TYPE_MD5
;
7100 salt_type
= SALT_TYPE_INTERN
;
7101 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7102 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7103 | OPTS_TYPE_PT_ADD80
7104 | OPTS_TYPE_PT_ADDBITS14
;
7105 kern_type
= KERN_TYPE_MD5_SLTPW
;
7106 dgst_size
= DGST_SIZE_4_4
;
7107 parse_func
= md5s_parse_hash
;
7108 sort_by_digest
= sort_by_digest_4_4
;
7109 opti_type
= OPTI_TYPE_ZERO_BYTE
7110 | OPTI_TYPE_PRECOMPUTE_INIT
7111 | OPTI_TYPE_PRECOMPUTE_MERKLE
7112 | OPTI_TYPE_EARLY_SKIP
7113 | OPTI_TYPE_NOT_ITERATED
7114 | OPTI_TYPE_PREPENDED_SALT
7115 | OPTI_TYPE_RAW_HASH
;
7122 case 21: hash_type
= HASH_TYPE_MD5
;
7123 salt_type
= SALT_TYPE_INTERN
;
7124 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7125 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7126 | OPTS_TYPE_PT_ADD80
7127 | OPTS_TYPE_PT_ADDBITS14
;
7128 kern_type
= KERN_TYPE_MD5_SLTPW
;
7129 dgst_size
= DGST_SIZE_4_4
;
7130 parse_func
= osc_parse_hash
;
7131 sort_by_digest
= sort_by_digest_4_4
;
7132 opti_type
= OPTI_TYPE_ZERO_BYTE
7133 | OPTI_TYPE_PRECOMPUTE_INIT
7134 | OPTI_TYPE_PRECOMPUTE_MERKLE
7135 | OPTI_TYPE_EARLY_SKIP
7136 | OPTI_TYPE_NOT_ITERATED
7137 | OPTI_TYPE_PREPENDED_SALT
7138 | OPTI_TYPE_RAW_HASH
;
7145 case 22: hash_type
= HASH_TYPE_MD5
;
7146 salt_type
= SALT_TYPE_EMBEDDED
;
7147 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7148 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7149 | OPTS_TYPE_PT_ADD80
7150 | OPTS_TYPE_PT_ADDBITS14
;
7151 kern_type
= KERN_TYPE_MD5_SLTPW
;
7152 dgst_size
= DGST_SIZE_4_4
;
7153 parse_func
= netscreen_parse_hash
;
7154 sort_by_digest
= sort_by_digest_4_4
;
7155 opti_type
= OPTI_TYPE_ZERO_BYTE
7156 | OPTI_TYPE_PRECOMPUTE_INIT
7157 | OPTI_TYPE_PRECOMPUTE_MERKLE
7158 | OPTI_TYPE_EARLY_SKIP
7159 | OPTI_TYPE_NOT_ITERATED
7160 | OPTI_TYPE_PREPENDED_SALT
7161 | OPTI_TYPE_RAW_HASH
;
7168 case 23: hash_type
= HASH_TYPE_MD5
;
7169 salt_type
= SALT_TYPE_EMBEDDED
;
7170 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7171 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7172 | OPTS_TYPE_PT_ADD80
7173 | OPTS_TYPE_PT_ADDBITS14
;
7174 kern_type
= KERN_TYPE_MD5_SLTPW
;
7175 dgst_size
= DGST_SIZE_4_4
;
7176 parse_func
= skype_parse_hash
;
7177 sort_by_digest
= sort_by_digest_4_4
;
7178 opti_type
= OPTI_TYPE_ZERO_BYTE
7179 | OPTI_TYPE_PRECOMPUTE_INIT
7180 | OPTI_TYPE_PRECOMPUTE_MERKLE
7181 | OPTI_TYPE_EARLY_SKIP
7182 | OPTI_TYPE_NOT_ITERATED
7183 | OPTI_TYPE_PREPENDED_SALT
7184 | OPTI_TYPE_RAW_HASH
;
7191 case 30: hash_type
= HASH_TYPE_MD5
;
7192 salt_type
= SALT_TYPE_INTERN
;
7193 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7194 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7195 | OPTS_TYPE_PT_UNICODE
7196 | OPTS_TYPE_ST_ADD80
7197 | OPTS_TYPE_ST_ADDBITS14
;
7198 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7199 dgst_size
= DGST_SIZE_4_4
;
7200 parse_func
= md5s_parse_hash
;
7201 sort_by_digest
= sort_by_digest_4_4
;
7202 opti_type
= OPTI_TYPE_ZERO_BYTE
7203 | OPTI_TYPE_PRECOMPUTE_INIT
7204 | OPTI_TYPE_PRECOMPUTE_MERKLE
7205 | OPTI_TYPE_MEET_IN_MIDDLE
7206 | OPTI_TYPE_EARLY_SKIP
7207 | OPTI_TYPE_NOT_ITERATED
7208 | OPTI_TYPE_APPENDED_SALT
7209 | OPTI_TYPE_RAW_HASH
;
7216 case 40: hash_type
= HASH_TYPE_MD5
;
7217 salt_type
= SALT_TYPE_INTERN
;
7218 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7219 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7220 | OPTS_TYPE_PT_ADD80
7221 | OPTS_TYPE_PT_ADDBITS14
7222 | OPTS_TYPE_PT_UNICODE
;
7223 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7224 dgst_size
= DGST_SIZE_4_4
;
7225 parse_func
= md5s_parse_hash
;
7226 sort_by_digest
= sort_by_digest_4_4
;
7227 opti_type
= OPTI_TYPE_ZERO_BYTE
7228 | OPTI_TYPE_PRECOMPUTE_INIT
7229 | OPTI_TYPE_PRECOMPUTE_MERKLE
7230 | OPTI_TYPE_EARLY_SKIP
7231 | OPTI_TYPE_NOT_ITERATED
7232 | OPTI_TYPE_PREPENDED_SALT
7233 | OPTI_TYPE_RAW_HASH
;
7240 case 50: hash_type
= HASH_TYPE_MD5
;
7241 salt_type
= SALT_TYPE_INTERN
;
7242 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7243 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7244 | OPTS_TYPE_ST_ADD80
7245 | OPTS_TYPE_ST_ADDBITS14
;
7246 kern_type
= KERN_TYPE_HMACMD5_PW
;
7247 dgst_size
= DGST_SIZE_4_4
;
7248 parse_func
= hmacmd5_parse_hash
;
7249 sort_by_digest
= sort_by_digest_4_4
;
7250 opti_type
= OPTI_TYPE_ZERO_BYTE
7251 | OPTI_TYPE_NOT_ITERATED
;
7258 case 60: hash_type
= HASH_TYPE_MD5
;
7259 salt_type
= SALT_TYPE_INTERN
;
7260 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7261 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7262 | OPTS_TYPE_PT_ADD80
7263 | OPTS_TYPE_PT_ADDBITS14
;
7264 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7265 dgst_size
= DGST_SIZE_4_4
;
7266 parse_func
= hmacmd5_parse_hash
;
7267 sort_by_digest
= sort_by_digest_4_4
;
7268 opti_type
= OPTI_TYPE_ZERO_BYTE
7269 | OPTI_TYPE_NOT_ITERATED
;
7276 case 100: hash_type
= HASH_TYPE_SHA1
;
7277 salt_type
= SALT_TYPE_NONE
;
7278 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7279 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7280 | OPTS_TYPE_PT_ADD80
7281 | OPTS_TYPE_PT_ADDBITS15
;
7282 kern_type
= KERN_TYPE_SHA1
;
7283 dgst_size
= DGST_SIZE_4_5
;
7284 parse_func
= sha1_parse_hash
;
7285 sort_by_digest
= sort_by_digest_4_5
;
7286 opti_type
= OPTI_TYPE_ZERO_BYTE
7287 | OPTI_TYPE_PRECOMPUTE_INIT
7288 | OPTI_TYPE_PRECOMPUTE_MERKLE
7289 | OPTI_TYPE_EARLY_SKIP
7290 | OPTI_TYPE_NOT_ITERATED
7291 | OPTI_TYPE_NOT_SALTED
7292 | OPTI_TYPE_RAW_HASH
;
7299 case 101: hash_type
= HASH_TYPE_SHA1
;
7300 salt_type
= SALT_TYPE_NONE
;
7301 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7302 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7303 | OPTS_TYPE_PT_ADD80
7304 | OPTS_TYPE_PT_ADDBITS15
;
7305 kern_type
= KERN_TYPE_SHA1
;
7306 dgst_size
= DGST_SIZE_4_5
;
7307 parse_func
= sha1b64_parse_hash
;
7308 sort_by_digest
= sort_by_digest_4_5
;
7309 opti_type
= OPTI_TYPE_ZERO_BYTE
7310 | OPTI_TYPE_PRECOMPUTE_INIT
7311 | OPTI_TYPE_PRECOMPUTE_MERKLE
7312 | OPTI_TYPE_EARLY_SKIP
7313 | OPTI_TYPE_NOT_ITERATED
7314 | OPTI_TYPE_NOT_SALTED
7315 | OPTI_TYPE_RAW_HASH
;
7322 case 110: hash_type
= HASH_TYPE_SHA1
;
7323 salt_type
= SALT_TYPE_INTERN
;
7324 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7325 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7326 | OPTS_TYPE_ST_ADD80
7327 | OPTS_TYPE_ST_ADDBITS15
;
7328 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7329 dgst_size
= DGST_SIZE_4_5
;
7330 parse_func
= sha1s_parse_hash
;
7331 sort_by_digest
= sort_by_digest_4_5
;
7332 opti_type
= OPTI_TYPE_ZERO_BYTE
7333 | OPTI_TYPE_PRECOMPUTE_INIT
7334 | OPTI_TYPE_PRECOMPUTE_MERKLE
7335 | OPTI_TYPE_EARLY_SKIP
7336 | OPTI_TYPE_NOT_ITERATED
7337 | OPTI_TYPE_APPENDED_SALT
7338 | OPTI_TYPE_RAW_HASH
;
7345 case 111: hash_type
= HASH_TYPE_SHA1
;
7346 salt_type
= SALT_TYPE_EMBEDDED
;
7347 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7348 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7349 | OPTS_TYPE_ST_ADD80
7350 | OPTS_TYPE_ST_ADDBITS15
;
7351 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7352 dgst_size
= DGST_SIZE_4_5
;
7353 parse_func
= sha1b64s_parse_hash
;
7354 sort_by_digest
= sort_by_digest_4_5
;
7355 opti_type
= OPTI_TYPE_ZERO_BYTE
7356 | OPTI_TYPE_PRECOMPUTE_INIT
7357 | OPTI_TYPE_PRECOMPUTE_MERKLE
7358 | OPTI_TYPE_EARLY_SKIP
7359 | OPTI_TYPE_NOT_ITERATED
7360 | OPTI_TYPE_APPENDED_SALT
7361 | OPTI_TYPE_RAW_HASH
;
7368 case 112: hash_type
= HASH_TYPE_SHA1
;
7369 salt_type
= SALT_TYPE_INTERN
;
7370 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7371 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7372 | OPTS_TYPE_ST_ADD80
7373 | OPTS_TYPE_ST_ADDBITS15
7375 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7376 dgst_size
= DGST_SIZE_4_5
;
7377 parse_func
= oracles_parse_hash
;
7378 sort_by_digest
= sort_by_digest_4_5
;
7379 opti_type
= OPTI_TYPE_ZERO_BYTE
7380 | OPTI_TYPE_PRECOMPUTE_INIT
7381 | OPTI_TYPE_PRECOMPUTE_MERKLE
7382 | OPTI_TYPE_EARLY_SKIP
7383 | OPTI_TYPE_NOT_ITERATED
7384 | OPTI_TYPE_APPENDED_SALT
7385 | OPTI_TYPE_RAW_HASH
;
7392 case 120: hash_type
= HASH_TYPE_SHA1
;
7393 salt_type
= SALT_TYPE_INTERN
;
7394 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7395 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7396 | OPTS_TYPE_PT_ADD80
7397 | OPTS_TYPE_PT_ADDBITS15
;
7398 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7399 dgst_size
= DGST_SIZE_4_5
;
7400 parse_func
= sha1s_parse_hash
;
7401 sort_by_digest
= sort_by_digest_4_5
;
7402 opti_type
= OPTI_TYPE_ZERO_BYTE
7403 | OPTI_TYPE_PRECOMPUTE_INIT
7404 | OPTI_TYPE_PRECOMPUTE_MERKLE
7405 | OPTI_TYPE_EARLY_SKIP
7406 | OPTI_TYPE_NOT_ITERATED
7407 | OPTI_TYPE_PREPENDED_SALT
7408 | OPTI_TYPE_RAW_HASH
;
7415 case 121: hash_type
= HASH_TYPE_SHA1
;
7416 salt_type
= SALT_TYPE_INTERN
;
7417 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7418 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7419 | OPTS_TYPE_PT_ADD80
7420 | OPTS_TYPE_PT_ADDBITS15
7421 | OPTS_TYPE_ST_LOWER
;
7422 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7423 dgst_size
= DGST_SIZE_4_5
;
7424 parse_func
= smf_parse_hash
;
7425 sort_by_digest
= sort_by_digest_4_5
;
7426 opti_type
= OPTI_TYPE_ZERO_BYTE
7427 | OPTI_TYPE_PRECOMPUTE_INIT
7428 | OPTI_TYPE_PRECOMPUTE_MERKLE
7429 | OPTI_TYPE_EARLY_SKIP
7430 | OPTI_TYPE_NOT_ITERATED
7431 | OPTI_TYPE_PREPENDED_SALT
7432 | OPTI_TYPE_RAW_HASH
;
7439 case 122: hash_type
= HASH_TYPE_SHA1
;
7440 salt_type
= SALT_TYPE_EMBEDDED
;
7441 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7442 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7443 | OPTS_TYPE_PT_ADD80
7444 | OPTS_TYPE_PT_ADDBITS15
7446 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7447 dgst_size
= DGST_SIZE_4_5
;
7448 parse_func
= osx1_parse_hash
;
7449 sort_by_digest
= sort_by_digest_4_5
;
7450 opti_type
= OPTI_TYPE_ZERO_BYTE
7451 | OPTI_TYPE_PRECOMPUTE_INIT
7452 | OPTI_TYPE_PRECOMPUTE_MERKLE
7453 | OPTI_TYPE_EARLY_SKIP
7454 | OPTI_TYPE_NOT_ITERATED
7455 | OPTI_TYPE_PREPENDED_SALT
7456 | OPTI_TYPE_RAW_HASH
;
7463 case 124: hash_type
= HASH_TYPE_SHA1
;
7464 salt_type
= SALT_TYPE_EMBEDDED
;
7465 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7466 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7467 | OPTS_TYPE_PT_ADD80
7468 | OPTS_TYPE_PT_ADDBITS15
;
7469 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7470 dgst_size
= DGST_SIZE_4_5
;
7471 parse_func
= djangosha1_parse_hash
;
7472 sort_by_digest
= sort_by_digest_4_5
;
7473 opti_type
= OPTI_TYPE_ZERO_BYTE
7474 | OPTI_TYPE_PRECOMPUTE_INIT
7475 | OPTI_TYPE_PRECOMPUTE_MERKLE
7476 | OPTI_TYPE_EARLY_SKIP
7477 | OPTI_TYPE_NOT_ITERATED
7478 | OPTI_TYPE_PREPENDED_SALT
7479 | OPTI_TYPE_RAW_HASH
;
7486 case 125: hash_type
= HASH_TYPE_SHA1
;
7487 salt_type
= SALT_TYPE_EMBEDDED
;
7488 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7489 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7490 | OPTS_TYPE_PT_ADD80
7491 | OPTS_TYPE_PT_ADDBITS15
7493 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7494 dgst_size
= DGST_SIZE_4_5
;
7495 parse_func
= arubaos_parse_hash
;
7496 sort_by_digest
= sort_by_digest_4_5
;
7497 opti_type
= OPTI_TYPE_ZERO_BYTE
7498 | OPTI_TYPE_PRECOMPUTE_INIT
7499 | OPTI_TYPE_PRECOMPUTE_MERKLE
7500 | OPTI_TYPE_EARLY_SKIP
7501 | OPTI_TYPE_NOT_ITERATED
7502 | OPTI_TYPE_PREPENDED_SALT
7503 | OPTI_TYPE_RAW_HASH
;
7510 case 130: hash_type
= HASH_TYPE_SHA1
;
7511 salt_type
= SALT_TYPE_INTERN
;
7512 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7513 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7514 | OPTS_TYPE_PT_UNICODE
7515 | OPTS_TYPE_ST_ADD80
7516 | OPTS_TYPE_ST_ADDBITS15
;
7517 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7518 dgst_size
= DGST_SIZE_4_5
;
7519 parse_func
= sha1s_parse_hash
;
7520 sort_by_digest
= sort_by_digest_4_5
;
7521 opti_type
= OPTI_TYPE_ZERO_BYTE
7522 | OPTI_TYPE_PRECOMPUTE_INIT
7523 | OPTI_TYPE_PRECOMPUTE_MERKLE
7524 | OPTI_TYPE_EARLY_SKIP
7525 | OPTI_TYPE_NOT_ITERATED
7526 | OPTI_TYPE_APPENDED_SALT
7527 | OPTI_TYPE_RAW_HASH
;
7534 case 131: hash_type
= HASH_TYPE_SHA1
;
7535 salt_type
= SALT_TYPE_EMBEDDED
;
7536 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7537 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7538 | OPTS_TYPE_PT_UNICODE
7539 | OPTS_TYPE_PT_UPPER
7540 | OPTS_TYPE_ST_ADD80
7541 | OPTS_TYPE_ST_ADDBITS15
7543 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7544 dgst_size
= DGST_SIZE_4_5
;
7545 parse_func
= mssql2000_parse_hash
;
7546 sort_by_digest
= sort_by_digest_4_5
;
7547 opti_type
= OPTI_TYPE_ZERO_BYTE
7548 | OPTI_TYPE_PRECOMPUTE_INIT
7549 | OPTI_TYPE_PRECOMPUTE_MERKLE
7550 | OPTI_TYPE_EARLY_SKIP
7551 | OPTI_TYPE_NOT_ITERATED
7552 | OPTI_TYPE_APPENDED_SALT
7553 | OPTI_TYPE_RAW_HASH
;
7560 case 132: hash_type
= HASH_TYPE_SHA1
;
7561 salt_type
= SALT_TYPE_EMBEDDED
;
7562 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7563 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7564 | OPTS_TYPE_PT_UNICODE
7565 | OPTS_TYPE_ST_ADD80
7566 | OPTS_TYPE_ST_ADDBITS15
7568 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7569 dgst_size
= DGST_SIZE_4_5
;
7570 parse_func
= mssql2005_parse_hash
;
7571 sort_by_digest
= sort_by_digest_4_5
;
7572 opti_type
= OPTI_TYPE_ZERO_BYTE
7573 | OPTI_TYPE_PRECOMPUTE_INIT
7574 | OPTI_TYPE_PRECOMPUTE_MERKLE
7575 | OPTI_TYPE_EARLY_SKIP
7576 | OPTI_TYPE_NOT_ITERATED
7577 | OPTI_TYPE_APPENDED_SALT
7578 | OPTI_TYPE_RAW_HASH
;
7585 case 133: hash_type
= HASH_TYPE_SHA1
;
7586 salt_type
= SALT_TYPE_EMBEDDED
;
7587 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7588 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7589 | OPTS_TYPE_PT_UNICODE
7590 | OPTS_TYPE_ST_ADD80
7591 | OPTS_TYPE_ST_ADDBITS15
;
7592 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7593 dgst_size
= DGST_SIZE_4_5
;
7594 parse_func
= peoplesoft_parse_hash
;
7595 sort_by_digest
= sort_by_digest_4_5
;
7596 opti_type
= OPTI_TYPE_ZERO_BYTE
7597 | OPTI_TYPE_PRECOMPUTE_INIT
7598 | OPTI_TYPE_PRECOMPUTE_MERKLE
7599 | OPTI_TYPE_EARLY_SKIP
7600 | OPTI_TYPE_NOT_ITERATED
7601 | OPTI_TYPE_APPENDED_SALT
7602 | OPTI_TYPE_RAW_HASH
;
7609 case 140: hash_type
= HASH_TYPE_SHA1
;
7610 salt_type
= SALT_TYPE_INTERN
;
7611 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7612 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7613 | OPTS_TYPE_PT_ADD80
7614 | OPTS_TYPE_PT_ADDBITS15
7615 | OPTS_TYPE_PT_UNICODE
;
7616 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7617 dgst_size
= DGST_SIZE_4_5
;
7618 parse_func
= sha1s_parse_hash
;
7619 sort_by_digest
= sort_by_digest_4_5
;
7620 opti_type
= OPTI_TYPE_ZERO_BYTE
7621 | OPTI_TYPE_PRECOMPUTE_INIT
7622 | OPTI_TYPE_PRECOMPUTE_MERKLE
7623 | OPTI_TYPE_EARLY_SKIP
7624 | OPTI_TYPE_NOT_ITERATED
7625 | OPTI_TYPE_PREPENDED_SALT
7626 | OPTI_TYPE_RAW_HASH
;
7633 case 141: hash_type
= HASH_TYPE_SHA1
;
7634 salt_type
= SALT_TYPE_EMBEDDED
;
7635 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7636 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7637 | OPTS_TYPE_PT_ADD80
7638 | OPTS_TYPE_PT_ADDBITS15
7639 | OPTS_TYPE_PT_UNICODE
7640 | OPTS_TYPE_ST_BASE64
;
7641 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7642 dgst_size
= DGST_SIZE_4_5
;
7643 parse_func
= episerver_parse_hash
;
7644 sort_by_digest
= sort_by_digest_4_5
;
7645 opti_type
= OPTI_TYPE_ZERO_BYTE
7646 | OPTI_TYPE_PRECOMPUTE_INIT
7647 | OPTI_TYPE_PRECOMPUTE_MERKLE
7648 | OPTI_TYPE_EARLY_SKIP
7649 | OPTI_TYPE_NOT_ITERATED
7650 | OPTI_TYPE_PREPENDED_SALT
7651 | OPTI_TYPE_RAW_HASH
;
7658 case 150: hash_type
= HASH_TYPE_SHA1
;
7659 salt_type
= SALT_TYPE_INTERN
;
7660 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7661 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7662 | OPTS_TYPE_ST_ADD80
7663 | OPTS_TYPE_ST_ADDBITS15
;
7664 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7665 dgst_size
= DGST_SIZE_4_5
;
7666 parse_func
= hmacsha1_parse_hash
;
7667 sort_by_digest
= sort_by_digest_4_5
;
7668 opti_type
= OPTI_TYPE_ZERO_BYTE
7669 | OPTI_TYPE_NOT_ITERATED
;
7676 case 160: hash_type
= HASH_TYPE_SHA1
;
7677 salt_type
= SALT_TYPE_INTERN
;
7678 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7679 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7680 | OPTS_TYPE_PT_ADD80
7681 | OPTS_TYPE_PT_ADDBITS15
;
7682 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7683 dgst_size
= DGST_SIZE_4_5
;
7684 parse_func
= hmacsha1_parse_hash
;
7685 sort_by_digest
= sort_by_digest_4_5
;
7686 opti_type
= OPTI_TYPE_ZERO_BYTE
7687 | OPTI_TYPE_NOT_ITERATED
;
7694 case 190: hash_type
= HASH_TYPE_SHA1
;
7695 salt_type
= SALT_TYPE_NONE
;
7696 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7697 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7698 | OPTS_TYPE_PT_ADD80
7699 | OPTS_TYPE_PT_ADDBITS15
;
7700 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7701 dgst_size
= DGST_SIZE_4_5
;
7702 parse_func
= sha1linkedin_parse_hash
;
7703 sort_by_digest
= sort_by_digest_4_5
;
7704 opti_type
= OPTI_TYPE_ZERO_BYTE
7705 | OPTI_TYPE_PRECOMPUTE_INIT
7706 | OPTI_TYPE_EARLY_SKIP
7707 | OPTI_TYPE_NOT_ITERATED
7708 | OPTI_TYPE_NOT_SALTED
;
7715 case 200: hash_type
= HASH_TYPE_MYSQL
;
7716 salt_type
= SALT_TYPE_NONE
;
7717 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7719 kern_type
= KERN_TYPE_MYSQL
;
7720 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7721 parse_func
= mysql323_parse_hash
;
7722 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7723 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7730 case 300: hash_type
= HASH_TYPE_SHA1
;
7731 salt_type
= SALT_TYPE_NONE
;
7732 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7733 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7734 | OPTS_TYPE_PT_ADD80
7735 | OPTS_TYPE_PT_ADDBITS15
;
7736 kern_type
= KERN_TYPE_MYSQL41
;
7737 dgst_size
= DGST_SIZE_4_5
;
7738 parse_func
= sha1_parse_hash
;
7739 sort_by_digest
= sort_by_digest_4_5
;
7740 opti_type
= OPTI_TYPE_ZERO_BYTE
7741 | OPTI_TYPE_PRECOMPUTE_INIT
7742 | OPTI_TYPE_PRECOMPUTE_MERKLE
7743 | OPTI_TYPE_EARLY_SKIP
7744 | OPTI_TYPE_NOT_ITERATED
7745 | OPTI_TYPE_NOT_SALTED
;
7752 case 400: hash_type
= HASH_TYPE_MD5
;
7753 salt_type
= SALT_TYPE_EMBEDDED
;
7754 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7755 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7756 kern_type
= KERN_TYPE_PHPASS
;
7757 dgst_size
= DGST_SIZE_4_4
;
7758 parse_func
= phpass_parse_hash
;
7759 sort_by_digest
= sort_by_digest_4_4
;
7760 opti_type
= OPTI_TYPE_ZERO_BYTE
7761 | OPTI_TYPE_SLOW_HASH_SIMD
;
7768 case 500: hash_type
= HASH_TYPE_MD5
;
7769 salt_type
= SALT_TYPE_EMBEDDED
;
7770 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7771 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7772 kern_type
= KERN_TYPE_MD5CRYPT
;
7773 dgst_size
= DGST_SIZE_4_4
;
7774 parse_func
= md5crypt_parse_hash
;
7775 sort_by_digest
= sort_by_digest_4_4
;
7776 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7783 case 501: 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 | OPTS_TYPE_HASH_COPY
;
7788 kern_type
= KERN_TYPE_MD5CRYPT
;
7789 dgst_size
= DGST_SIZE_4_4
;
7790 parse_func
= juniper_parse_hash
;
7791 sort_by_digest
= sort_by_digest_4_4
;
7792 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7799 case 900: hash_type
= HASH_TYPE_MD4
;
7800 salt_type
= SALT_TYPE_NONE
;
7801 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7802 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7803 | OPTS_TYPE_PT_ADD80
7804 | OPTS_TYPE_PT_ADDBITS14
;
7805 kern_type
= KERN_TYPE_MD4
;
7806 dgst_size
= DGST_SIZE_4_4
;
7807 parse_func
= md4_parse_hash
;
7808 sort_by_digest
= sort_by_digest_4_4
;
7809 opti_type
= OPTI_TYPE_ZERO_BYTE
7810 | OPTI_TYPE_PRECOMPUTE_INIT
7811 | OPTI_TYPE_PRECOMPUTE_MERKLE
7812 | OPTI_TYPE_MEET_IN_MIDDLE
7813 | OPTI_TYPE_EARLY_SKIP
7814 | OPTI_TYPE_NOT_ITERATED
7815 | OPTI_TYPE_NOT_SALTED
7816 | OPTI_TYPE_RAW_HASH
;
7823 case 1000: hash_type
= HASH_TYPE_MD4
;
7824 salt_type
= SALT_TYPE_NONE
;
7825 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7826 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7827 | OPTS_TYPE_PT_ADD80
7828 | OPTS_TYPE_PT_ADDBITS14
7829 | OPTS_TYPE_PT_UNICODE
;
7830 kern_type
= KERN_TYPE_MD4_PWU
;
7831 dgst_size
= DGST_SIZE_4_4
;
7832 parse_func
= md4_parse_hash
;
7833 sort_by_digest
= sort_by_digest_4_4
;
7834 opti_type
= OPTI_TYPE_ZERO_BYTE
7835 | OPTI_TYPE_PRECOMPUTE_INIT
7836 | OPTI_TYPE_PRECOMPUTE_MERKLE
7837 | OPTI_TYPE_MEET_IN_MIDDLE
7838 | OPTI_TYPE_EARLY_SKIP
7839 | OPTI_TYPE_NOT_ITERATED
7840 | OPTI_TYPE_NOT_SALTED
7841 | OPTI_TYPE_RAW_HASH
;
7848 case 1100: hash_type
= HASH_TYPE_MD4
;
7849 salt_type
= SALT_TYPE_INTERN
;
7850 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7851 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7852 | OPTS_TYPE_PT_ADD80
7853 | OPTS_TYPE_PT_ADDBITS14
7854 | OPTS_TYPE_PT_UNICODE
7855 | OPTS_TYPE_ST_ADD80
7856 | OPTS_TYPE_ST_UNICODE
7857 | OPTS_TYPE_ST_LOWER
;
7858 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7859 dgst_size
= DGST_SIZE_4_4
;
7860 parse_func
= dcc_parse_hash
;
7861 sort_by_digest
= sort_by_digest_4_4
;
7862 opti_type
= OPTI_TYPE_ZERO_BYTE
7863 | OPTI_TYPE_PRECOMPUTE_INIT
7864 | OPTI_TYPE_PRECOMPUTE_MERKLE
7865 | OPTI_TYPE_EARLY_SKIP
7866 | OPTI_TYPE_NOT_ITERATED
;
7873 case 1400: hash_type
= HASH_TYPE_SHA256
;
7874 salt_type
= SALT_TYPE_NONE
;
7875 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7876 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7877 | OPTS_TYPE_PT_ADD80
7878 | OPTS_TYPE_PT_ADDBITS15
;
7879 kern_type
= KERN_TYPE_SHA256
;
7880 dgst_size
= DGST_SIZE_4_8
;
7881 parse_func
= sha256_parse_hash
;
7882 sort_by_digest
= sort_by_digest_4_8
;
7883 opti_type
= OPTI_TYPE_ZERO_BYTE
7884 | OPTI_TYPE_PRECOMPUTE_INIT
7885 | OPTI_TYPE_PRECOMPUTE_MERKLE
7886 | OPTI_TYPE_EARLY_SKIP
7887 | OPTI_TYPE_NOT_ITERATED
7888 | OPTI_TYPE_NOT_SALTED
7889 | OPTI_TYPE_RAW_HASH
;
7896 case 1410: hash_type
= HASH_TYPE_SHA256
;
7897 salt_type
= SALT_TYPE_INTERN
;
7898 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7899 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7900 | OPTS_TYPE_ST_ADD80
7901 | OPTS_TYPE_ST_ADDBITS15
;
7902 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7903 dgst_size
= DGST_SIZE_4_8
;
7904 parse_func
= sha256s_parse_hash
;
7905 sort_by_digest
= sort_by_digest_4_8
;
7906 opti_type
= OPTI_TYPE_ZERO_BYTE
7907 | OPTI_TYPE_PRECOMPUTE_INIT
7908 | OPTI_TYPE_PRECOMPUTE_MERKLE
7909 | OPTI_TYPE_EARLY_SKIP
7910 | OPTI_TYPE_NOT_ITERATED
7911 | OPTI_TYPE_APPENDED_SALT
7912 | OPTI_TYPE_RAW_HASH
;
7919 case 1420: hash_type
= HASH_TYPE_SHA256
;
7920 salt_type
= SALT_TYPE_INTERN
;
7921 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7922 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7923 | OPTS_TYPE_PT_ADD80
7924 | OPTS_TYPE_PT_ADDBITS15
;
7925 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7926 dgst_size
= DGST_SIZE_4_8
;
7927 parse_func
= sha256s_parse_hash
;
7928 sort_by_digest
= sort_by_digest_4_8
;
7929 opti_type
= OPTI_TYPE_ZERO_BYTE
7930 | OPTI_TYPE_PRECOMPUTE_INIT
7931 | OPTI_TYPE_PRECOMPUTE_MERKLE
7932 | OPTI_TYPE_EARLY_SKIP
7933 | OPTI_TYPE_NOT_ITERATED
7934 | OPTI_TYPE_PREPENDED_SALT
7935 | OPTI_TYPE_RAW_HASH
;
7942 case 1421: hash_type
= HASH_TYPE_SHA256
;
7943 salt_type
= SALT_TYPE_EMBEDDED
;
7944 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7945 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7946 | OPTS_TYPE_PT_ADD80
7947 | OPTS_TYPE_PT_ADDBITS15
;
7948 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7949 dgst_size
= DGST_SIZE_4_8
;
7950 parse_func
= hmailserver_parse_hash
;
7951 sort_by_digest
= sort_by_digest_4_8
;
7952 opti_type
= OPTI_TYPE_ZERO_BYTE
7953 | OPTI_TYPE_PRECOMPUTE_INIT
7954 | OPTI_TYPE_PRECOMPUTE_MERKLE
7955 | OPTI_TYPE_EARLY_SKIP
7956 | OPTI_TYPE_NOT_ITERATED
7957 | OPTI_TYPE_PREPENDED_SALT
7958 | OPTI_TYPE_RAW_HASH
;
7965 case 1430: hash_type
= HASH_TYPE_SHA256
;
7966 salt_type
= SALT_TYPE_INTERN
;
7967 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7968 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7969 | OPTS_TYPE_PT_UNICODE
7970 | OPTS_TYPE_ST_ADD80
7971 | OPTS_TYPE_ST_ADDBITS15
;
7972 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7973 dgst_size
= DGST_SIZE_4_8
;
7974 parse_func
= sha256s_parse_hash
;
7975 sort_by_digest
= sort_by_digest_4_8
;
7976 opti_type
= OPTI_TYPE_ZERO_BYTE
7977 | OPTI_TYPE_PRECOMPUTE_INIT
7978 | OPTI_TYPE_PRECOMPUTE_MERKLE
7979 | OPTI_TYPE_EARLY_SKIP
7980 | OPTI_TYPE_NOT_ITERATED
7981 | OPTI_TYPE_APPENDED_SALT
7982 | OPTI_TYPE_RAW_HASH
;
7989 case 1440: hash_type
= HASH_TYPE_SHA256
;
7990 salt_type
= SALT_TYPE_INTERN
;
7991 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7992 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7993 | OPTS_TYPE_PT_ADD80
7994 | OPTS_TYPE_PT_ADDBITS15
7995 | OPTS_TYPE_PT_UNICODE
;
7996 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7997 dgst_size
= DGST_SIZE_4_8
;
7998 parse_func
= sha256s_parse_hash
;
7999 sort_by_digest
= sort_by_digest_4_8
;
8000 opti_type
= OPTI_TYPE_ZERO_BYTE
8001 | OPTI_TYPE_PRECOMPUTE_INIT
8002 | OPTI_TYPE_PRECOMPUTE_MERKLE
8003 | OPTI_TYPE_EARLY_SKIP
8004 | OPTI_TYPE_NOT_ITERATED
8005 | OPTI_TYPE_PREPENDED_SALT
8006 | OPTI_TYPE_RAW_HASH
;
8013 case 1441: hash_type
= HASH_TYPE_SHA256
;
8014 salt_type
= SALT_TYPE_EMBEDDED
;
8015 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8016 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8017 | OPTS_TYPE_PT_ADD80
8018 | OPTS_TYPE_PT_ADDBITS15
8019 | OPTS_TYPE_PT_UNICODE
8020 | OPTS_TYPE_ST_BASE64
;
8021 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8022 dgst_size
= DGST_SIZE_4_8
;
8023 parse_func
= episerver4_parse_hash
;
8024 sort_by_digest
= sort_by_digest_4_8
;
8025 opti_type
= OPTI_TYPE_ZERO_BYTE
8026 | OPTI_TYPE_PRECOMPUTE_INIT
8027 | OPTI_TYPE_PRECOMPUTE_MERKLE
8028 | OPTI_TYPE_EARLY_SKIP
8029 | OPTI_TYPE_NOT_ITERATED
8030 | OPTI_TYPE_PREPENDED_SALT
8031 | OPTI_TYPE_RAW_HASH
;
8038 case 1450: hash_type
= HASH_TYPE_SHA256
;
8039 salt_type
= SALT_TYPE_INTERN
;
8040 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8041 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8042 | OPTS_TYPE_ST_ADD80
;
8043 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8044 dgst_size
= DGST_SIZE_4_8
;
8045 parse_func
= hmacsha256_parse_hash
;
8046 sort_by_digest
= sort_by_digest_4_8
;
8047 opti_type
= OPTI_TYPE_ZERO_BYTE
8048 | OPTI_TYPE_NOT_ITERATED
;
8055 case 1460: hash_type
= HASH_TYPE_SHA256
;
8056 salt_type
= SALT_TYPE_INTERN
;
8057 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8058 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8059 | OPTS_TYPE_PT_ADD80
8060 | OPTS_TYPE_PT_ADDBITS15
;
8061 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8062 dgst_size
= DGST_SIZE_4_8
;
8063 parse_func
= hmacsha256_parse_hash
;
8064 sort_by_digest
= sort_by_digest_4_8
;
8065 opti_type
= OPTI_TYPE_ZERO_BYTE
8066 | OPTI_TYPE_NOT_ITERATED
;
8073 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8074 salt_type
= SALT_TYPE_EMBEDDED
;
8075 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8076 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8077 | OPTS_TYPE_PT_BITSLICE
;
8078 kern_type
= KERN_TYPE_DESCRYPT
;
8079 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8080 parse_func
= descrypt_parse_hash
;
8081 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8082 opti_type
= OPTI_TYPE_ZERO_BYTE
8083 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8090 case 1600: hash_type
= HASH_TYPE_MD5
;
8091 salt_type
= SALT_TYPE_EMBEDDED
;
8092 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8093 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8094 kern_type
= KERN_TYPE_APR1CRYPT
;
8095 dgst_size
= DGST_SIZE_4_4
;
8096 parse_func
= md5apr1_parse_hash
;
8097 sort_by_digest
= sort_by_digest_4_4
;
8098 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8105 case 1700: hash_type
= HASH_TYPE_SHA512
;
8106 salt_type
= SALT_TYPE_NONE
;
8107 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8108 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8109 | OPTS_TYPE_PT_ADD80
8110 | OPTS_TYPE_PT_ADDBITS15
;
8111 kern_type
= KERN_TYPE_SHA512
;
8112 dgst_size
= DGST_SIZE_8_8
;
8113 parse_func
= sha512_parse_hash
;
8114 sort_by_digest
= sort_by_digest_8_8
;
8115 opti_type
= OPTI_TYPE_ZERO_BYTE
8116 | OPTI_TYPE_PRECOMPUTE_INIT
8117 | OPTI_TYPE_PRECOMPUTE_MERKLE
8118 | OPTI_TYPE_EARLY_SKIP
8119 | OPTI_TYPE_NOT_ITERATED
8120 | OPTI_TYPE_NOT_SALTED
8121 | OPTI_TYPE_USES_BITS_64
8122 | OPTI_TYPE_RAW_HASH
;
8129 case 1710: hash_type
= HASH_TYPE_SHA512
;
8130 salt_type
= SALT_TYPE_INTERN
;
8131 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8132 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8133 | OPTS_TYPE_ST_ADD80
8134 | OPTS_TYPE_ST_ADDBITS15
;
8135 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8136 dgst_size
= DGST_SIZE_8_8
;
8137 parse_func
= sha512s_parse_hash
;
8138 sort_by_digest
= sort_by_digest_8_8
;
8139 opti_type
= OPTI_TYPE_ZERO_BYTE
8140 | OPTI_TYPE_PRECOMPUTE_INIT
8141 | OPTI_TYPE_PRECOMPUTE_MERKLE
8142 | OPTI_TYPE_EARLY_SKIP
8143 | OPTI_TYPE_NOT_ITERATED
8144 | OPTI_TYPE_APPENDED_SALT
8145 | OPTI_TYPE_USES_BITS_64
8146 | OPTI_TYPE_RAW_HASH
;
8153 case 1711: hash_type
= HASH_TYPE_SHA512
;
8154 salt_type
= SALT_TYPE_EMBEDDED
;
8155 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8156 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8157 | OPTS_TYPE_ST_ADD80
8158 | OPTS_TYPE_ST_ADDBITS15
;
8159 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8160 dgst_size
= DGST_SIZE_8_8
;
8161 parse_func
= sha512b64s_parse_hash
;
8162 sort_by_digest
= sort_by_digest_8_8
;
8163 opti_type
= OPTI_TYPE_ZERO_BYTE
8164 | OPTI_TYPE_PRECOMPUTE_INIT
8165 | OPTI_TYPE_PRECOMPUTE_MERKLE
8166 | OPTI_TYPE_EARLY_SKIP
8167 | OPTI_TYPE_NOT_ITERATED
8168 | OPTI_TYPE_APPENDED_SALT
8169 | OPTI_TYPE_USES_BITS_64
8170 | OPTI_TYPE_RAW_HASH
;
8177 case 1720: hash_type
= HASH_TYPE_SHA512
;
8178 salt_type
= SALT_TYPE_INTERN
;
8179 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8180 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8181 | OPTS_TYPE_PT_ADD80
8182 | OPTS_TYPE_PT_ADDBITS15
;
8183 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8184 dgst_size
= DGST_SIZE_8_8
;
8185 parse_func
= sha512s_parse_hash
;
8186 sort_by_digest
= sort_by_digest_8_8
;
8187 opti_type
= OPTI_TYPE_ZERO_BYTE
8188 | OPTI_TYPE_PRECOMPUTE_INIT
8189 | OPTI_TYPE_PRECOMPUTE_MERKLE
8190 | OPTI_TYPE_EARLY_SKIP
8191 | OPTI_TYPE_NOT_ITERATED
8192 | OPTI_TYPE_PREPENDED_SALT
8193 | OPTI_TYPE_USES_BITS_64
8194 | OPTI_TYPE_RAW_HASH
;
8201 case 1722: hash_type
= HASH_TYPE_SHA512
;
8202 salt_type
= SALT_TYPE_EMBEDDED
;
8203 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8204 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8205 | OPTS_TYPE_PT_ADD80
8206 | OPTS_TYPE_PT_ADDBITS15
8208 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8209 dgst_size
= DGST_SIZE_8_8
;
8210 parse_func
= osx512_parse_hash
;
8211 sort_by_digest
= sort_by_digest_8_8
;
8212 opti_type
= OPTI_TYPE_ZERO_BYTE
8213 | OPTI_TYPE_PRECOMPUTE_INIT
8214 | OPTI_TYPE_PRECOMPUTE_MERKLE
8215 | OPTI_TYPE_EARLY_SKIP
8216 | OPTI_TYPE_NOT_ITERATED
8217 | OPTI_TYPE_PREPENDED_SALT
8218 | OPTI_TYPE_USES_BITS_64
8219 | OPTI_TYPE_RAW_HASH
;
8226 case 1730: hash_type
= HASH_TYPE_SHA512
;
8227 salt_type
= SALT_TYPE_INTERN
;
8228 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8229 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8230 | OPTS_TYPE_PT_UNICODE
8231 | OPTS_TYPE_ST_ADD80
8232 | OPTS_TYPE_ST_ADDBITS15
;
8233 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8234 dgst_size
= DGST_SIZE_8_8
;
8235 parse_func
= sha512s_parse_hash
;
8236 sort_by_digest
= sort_by_digest_8_8
;
8237 opti_type
= OPTI_TYPE_ZERO_BYTE
8238 | OPTI_TYPE_PRECOMPUTE_INIT
8239 | OPTI_TYPE_PRECOMPUTE_MERKLE
8240 | OPTI_TYPE_EARLY_SKIP
8241 | OPTI_TYPE_NOT_ITERATED
8242 | OPTI_TYPE_APPENDED_SALT
8243 | OPTI_TYPE_USES_BITS_64
8244 | OPTI_TYPE_RAW_HASH
;
8251 case 1731: hash_type
= HASH_TYPE_SHA512
;
8252 salt_type
= SALT_TYPE_EMBEDDED
;
8253 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8254 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8255 | OPTS_TYPE_PT_UNICODE
8256 | OPTS_TYPE_ST_ADD80
8257 | OPTS_TYPE_ST_ADDBITS15
8259 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8260 dgst_size
= DGST_SIZE_8_8
;
8261 parse_func
= mssql2012_parse_hash
;
8262 sort_by_digest
= sort_by_digest_8_8
;
8263 opti_type
= OPTI_TYPE_ZERO_BYTE
8264 | OPTI_TYPE_PRECOMPUTE_INIT
8265 | OPTI_TYPE_PRECOMPUTE_MERKLE
8266 | OPTI_TYPE_EARLY_SKIP
8267 | OPTI_TYPE_NOT_ITERATED
8268 | OPTI_TYPE_APPENDED_SALT
8269 | OPTI_TYPE_USES_BITS_64
8270 | OPTI_TYPE_RAW_HASH
;
8277 case 1740: hash_type
= HASH_TYPE_SHA512
;
8278 salt_type
= SALT_TYPE_INTERN
;
8279 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8280 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8281 | OPTS_TYPE_PT_ADD80
8282 | OPTS_TYPE_PT_ADDBITS15
8283 | OPTS_TYPE_PT_UNICODE
;
8284 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8285 dgst_size
= DGST_SIZE_8_8
;
8286 parse_func
= sha512s_parse_hash
;
8287 sort_by_digest
= sort_by_digest_8_8
;
8288 opti_type
= OPTI_TYPE_ZERO_BYTE
8289 | OPTI_TYPE_PRECOMPUTE_INIT
8290 | OPTI_TYPE_PRECOMPUTE_MERKLE
8291 | OPTI_TYPE_EARLY_SKIP
8292 | OPTI_TYPE_NOT_ITERATED
8293 | OPTI_TYPE_PREPENDED_SALT
8294 | OPTI_TYPE_USES_BITS_64
8295 | OPTI_TYPE_RAW_HASH
;
8302 case 1750: hash_type
= HASH_TYPE_SHA512
;
8303 salt_type
= SALT_TYPE_INTERN
;
8304 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8305 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8306 | OPTS_TYPE_ST_ADD80
;
8307 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8308 dgst_size
= DGST_SIZE_8_8
;
8309 parse_func
= hmacsha512_parse_hash
;
8310 sort_by_digest
= sort_by_digest_8_8
;
8311 opti_type
= OPTI_TYPE_ZERO_BYTE
8312 | OPTI_TYPE_USES_BITS_64
8313 | OPTI_TYPE_NOT_ITERATED
;
8320 case 1760: hash_type
= HASH_TYPE_SHA512
;
8321 salt_type
= SALT_TYPE_INTERN
;
8322 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8323 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8324 | OPTS_TYPE_PT_ADD80
8325 | OPTS_TYPE_PT_ADDBITS15
;
8326 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8327 dgst_size
= DGST_SIZE_8_8
;
8328 parse_func
= hmacsha512_parse_hash
;
8329 sort_by_digest
= sort_by_digest_8_8
;
8330 opti_type
= OPTI_TYPE_ZERO_BYTE
8331 | OPTI_TYPE_USES_BITS_64
8332 | OPTI_TYPE_NOT_ITERATED
;
8339 case 1800: hash_type
= HASH_TYPE_SHA512
;
8340 salt_type
= SALT_TYPE_EMBEDDED
;
8341 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8343 kern_type
= KERN_TYPE_SHA512CRYPT
;
8344 dgst_size
= DGST_SIZE_8_8
;
8345 parse_func
= sha512crypt_parse_hash
;
8346 sort_by_digest
= sort_by_digest_8_8
;
8347 opti_type
= OPTI_TYPE_ZERO_BYTE
8348 | OPTI_TYPE_USES_BITS_64
;
8355 case 2100: hash_type
= HASH_TYPE_DCC2
;
8356 salt_type
= SALT_TYPE_EMBEDDED
;
8357 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8358 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8359 | OPTS_TYPE_ST_LOWER
8360 | OPTS_TYPE_ST_UNICODE
;
8361 kern_type
= KERN_TYPE_DCC2
;
8362 dgst_size
= DGST_SIZE_4_4
;
8363 parse_func
= dcc2_parse_hash
;
8364 sort_by_digest
= sort_by_digest_4_4
;
8365 opti_type
= OPTI_TYPE_ZERO_BYTE
8366 | OPTI_TYPE_SLOW_HASH_SIMD
;
8373 case 2400: hash_type
= HASH_TYPE_MD5
;
8374 salt_type
= SALT_TYPE_NONE
;
8375 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8376 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8377 kern_type
= KERN_TYPE_MD5PIX
;
8378 dgst_size
= DGST_SIZE_4_4
;
8379 parse_func
= md5pix_parse_hash
;
8380 sort_by_digest
= sort_by_digest_4_4
;
8381 opti_type
= OPTI_TYPE_ZERO_BYTE
8382 | OPTI_TYPE_PRECOMPUTE_INIT
8383 | OPTI_TYPE_PRECOMPUTE_MERKLE
8384 | OPTI_TYPE_EARLY_SKIP
8385 | OPTI_TYPE_NOT_ITERATED
8386 | OPTI_TYPE_NOT_SALTED
;
8393 case 2410: hash_type
= HASH_TYPE_MD5
;
8394 salt_type
= SALT_TYPE_INTERN
;
8395 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8396 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8397 kern_type
= KERN_TYPE_MD5ASA
;
8398 dgst_size
= DGST_SIZE_4_4
;
8399 parse_func
= md5asa_parse_hash
;
8400 sort_by_digest
= sort_by_digest_4_4
;
8401 opti_type
= OPTI_TYPE_ZERO_BYTE
8402 | OPTI_TYPE_PRECOMPUTE_INIT
8403 | OPTI_TYPE_PRECOMPUTE_MERKLE
8404 | OPTI_TYPE_EARLY_SKIP
8405 | OPTI_TYPE_NOT_ITERATED
;
8412 case 2500: hash_type
= HASH_TYPE_WPA
;
8413 salt_type
= SALT_TYPE_EMBEDDED
;
8414 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8415 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8416 kern_type
= KERN_TYPE_WPA
;
8417 dgst_size
= DGST_SIZE_4_4
;
8418 parse_func
= wpa_parse_hash
;
8419 sort_by_digest
= sort_by_digest_4_4
;
8420 opti_type
= OPTI_TYPE_ZERO_BYTE
8421 | OPTI_TYPE_SLOW_HASH_SIMD
;
8428 case 2600: hash_type
= HASH_TYPE_MD5
;
8429 salt_type
= SALT_TYPE_VIRTUAL
;
8430 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8431 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8432 | OPTS_TYPE_PT_ADD80
8433 | OPTS_TYPE_PT_ADDBITS14
8434 | OPTS_TYPE_ST_ADD80
;
8435 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8436 dgst_size
= DGST_SIZE_4_4
;
8437 parse_func
= md5md5_parse_hash
;
8438 sort_by_digest
= sort_by_digest_4_4
;
8439 opti_type
= OPTI_TYPE_ZERO_BYTE
8440 | OPTI_TYPE_PRECOMPUTE_INIT
8441 | OPTI_TYPE_PRECOMPUTE_MERKLE
8442 | OPTI_TYPE_EARLY_SKIP
;
8449 case 2611: hash_type
= HASH_TYPE_MD5
;
8450 salt_type
= SALT_TYPE_INTERN
;
8451 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8452 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8453 | OPTS_TYPE_PT_ADD80
8454 | OPTS_TYPE_PT_ADDBITS14
8455 | OPTS_TYPE_ST_ADD80
;
8456 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8457 dgst_size
= DGST_SIZE_4_4
;
8458 parse_func
= vb3_parse_hash
;
8459 sort_by_digest
= sort_by_digest_4_4
;
8460 opti_type
= OPTI_TYPE_ZERO_BYTE
8461 | OPTI_TYPE_PRECOMPUTE_INIT
8462 | OPTI_TYPE_PRECOMPUTE_MERKLE
8463 | OPTI_TYPE_EARLY_SKIP
;
8470 case 2612: hash_type
= HASH_TYPE_MD5
;
8471 salt_type
= SALT_TYPE_EMBEDDED
;
8472 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8473 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8474 | OPTS_TYPE_PT_ADD80
8475 | OPTS_TYPE_PT_ADDBITS14
8476 | OPTS_TYPE_ST_ADD80
8478 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8479 dgst_size
= DGST_SIZE_4_4
;
8480 parse_func
= phps_parse_hash
;
8481 sort_by_digest
= sort_by_digest_4_4
;
8482 opti_type
= OPTI_TYPE_ZERO_BYTE
8483 | OPTI_TYPE_PRECOMPUTE_INIT
8484 | OPTI_TYPE_PRECOMPUTE_MERKLE
8485 | OPTI_TYPE_EARLY_SKIP
;
8492 case 2711: hash_type
= HASH_TYPE_MD5
;
8493 salt_type
= SALT_TYPE_INTERN
;
8494 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8495 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8496 | OPTS_TYPE_PT_ADD80
8497 | OPTS_TYPE_PT_ADDBITS14
8498 | OPTS_TYPE_ST_ADD80
;
8499 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8500 dgst_size
= DGST_SIZE_4_4
;
8501 parse_func
= vb30_parse_hash
;
8502 sort_by_digest
= sort_by_digest_4_4
;
8503 opti_type
= OPTI_TYPE_ZERO_BYTE
8504 | OPTI_TYPE_PRECOMPUTE_INIT
8505 | OPTI_TYPE_EARLY_SKIP
;
8512 case 2811: hash_type
= HASH_TYPE_MD5
;
8513 salt_type
= SALT_TYPE_INTERN
;
8514 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8515 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8516 | OPTS_TYPE_PT_ADD80
8517 | OPTS_TYPE_PT_ADDBITS14
;
8518 kern_type
= KERN_TYPE_MD55_SLTPW
;
8519 dgst_size
= DGST_SIZE_4_4
;
8520 parse_func
= ipb2_parse_hash
;
8521 sort_by_digest
= sort_by_digest_4_4
;
8522 opti_type
= OPTI_TYPE_ZERO_BYTE
8523 | OPTI_TYPE_PRECOMPUTE_INIT
8524 | OPTI_TYPE_EARLY_SKIP
;
8531 case 3000: hash_type
= HASH_TYPE_LM
;
8532 salt_type
= SALT_TYPE_NONE
;
8533 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8534 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8535 | OPTS_TYPE_PT_UPPER
8536 | OPTS_TYPE_PT_BITSLICE
;
8537 kern_type
= KERN_TYPE_LM
;
8538 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8539 parse_func
= lm_parse_hash
;
8540 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8541 opti_type
= OPTI_TYPE_ZERO_BYTE
8542 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8549 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8550 salt_type
= SALT_TYPE_INTERN
;
8551 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8553 | OPTS_TYPE_PT_UPPER
8554 | OPTS_TYPE_ST_UPPER
;
8555 kern_type
= KERN_TYPE_ORACLEH
;
8556 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8557 parse_func
= oracleh_parse_hash
;
8558 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8559 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8566 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8567 salt_type
= SALT_TYPE_EMBEDDED
;
8568 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8569 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8570 | OPTS_TYPE_ST_GENERATE_LE
;
8571 kern_type
= KERN_TYPE_BCRYPT
;
8572 dgst_size
= DGST_SIZE_4_6
;
8573 parse_func
= bcrypt_parse_hash
;
8574 sort_by_digest
= sort_by_digest_4_6
;
8575 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8582 case 3710: hash_type
= HASH_TYPE_MD5
;
8583 salt_type
= SALT_TYPE_INTERN
;
8584 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8585 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8586 | OPTS_TYPE_PT_ADD80
8587 | OPTS_TYPE_PT_ADDBITS14
;
8588 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8589 dgst_size
= DGST_SIZE_4_4
;
8590 parse_func
= md5s_parse_hash
;
8591 sort_by_digest
= sort_by_digest_4_4
;
8592 opti_type
= OPTI_TYPE_ZERO_BYTE
8593 | OPTI_TYPE_PRECOMPUTE_INIT
8594 | OPTI_TYPE_PRECOMPUTE_MERKLE
8595 | OPTI_TYPE_EARLY_SKIP
;
8602 case 3711: hash_type
= HASH_TYPE_MD5
;
8603 salt_type
= SALT_TYPE_EMBEDDED
;
8604 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8606 | OPTS_TYPE_PT_ADD80
8607 | OPTS_TYPE_PT_ADDBITS14
;
8608 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8609 dgst_size
= DGST_SIZE_4_4
;
8610 parse_func
= mediawiki_b_parse_hash
;
8611 sort_by_digest
= sort_by_digest_4_4
;
8612 opti_type
= OPTI_TYPE_ZERO_BYTE
8613 | OPTI_TYPE_PRECOMPUTE_INIT
8614 | OPTI_TYPE_PRECOMPUTE_MERKLE
8615 | OPTI_TYPE_EARLY_SKIP
;
8622 case 3800: hash_type
= HASH_TYPE_MD5
;
8623 salt_type
= SALT_TYPE_INTERN
;
8624 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8625 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8626 | OPTS_TYPE_ST_ADDBITS14
;
8627 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8628 dgst_size
= DGST_SIZE_4_4
;
8629 parse_func
= md5s_parse_hash
;
8630 sort_by_digest
= sort_by_digest_4_4
;
8631 opti_type
= OPTI_TYPE_ZERO_BYTE
8632 | OPTI_TYPE_PRECOMPUTE_INIT
8633 | OPTI_TYPE_PRECOMPUTE_MERKLE
8634 | OPTI_TYPE_EARLY_SKIP
8635 | OPTI_TYPE_NOT_ITERATED
8636 | OPTI_TYPE_RAW_HASH
;
8643 case 4300: hash_type
= HASH_TYPE_MD5
;
8644 salt_type
= SALT_TYPE_VIRTUAL
;
8645 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8646 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8647 | OPTS_TYPE_PT_ADD80
8648 | OPTS_TYPE_PT_ADDBITS14
8649 | OPTS_TYPE_ST_ADD80
;
8650 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8651 dgst_size
= DGST_SIZE_4_4
;
8652 parse_func
= md5md5_parse_hash
;
8653 sort_by_digest
= sort_by_digest_4_4
;
8654 opti_type
= OPTI_TYPE_ZERO_BYTE
8655 | OPTI_TYPE_PRECOMPUTE_INIT
8656 | OPTI_TYPE_PRECOMPUTE_MERKLE
8657 | OPTI_TYPE_EARLY_SKIP
;
8665 case 4400: hash_type
= HASH_TYPE_MD5
;
8666 salt_type
= SALT_TYPE_NONE
;
8667 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8668 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8669 | OPTS_TYPE_PT_ADD80
8670 | OPTS_TYPE_PT_ADDBITS15
;
8671 kern_type
= KERN_TYPE_MD5_SHA1
;
8672 dgst_size
= DGST_SIZE_4_4
;
8673 parse_func
= md5_parse_hash
;
8674 sort_by_digest
= sort_by_digest_4_4
;
8675 opti_type
= OPTI_TYPE_ZERO_BYTE
8676 | OPTI_TYPE_PRECOMPUTE_INIT
8677 | OPTI_TYPE_PRECOMPUTE_MERKLE
8678 | OPTI_TYPE_EARLY_SKIP
8679 | OPTI_TYPE_NOT_ITERATED
8680 | OPTI_TYPE_NOT_SALTED
8681 | OPTI_TYPE_RAW_HASH
;
8688 case 4500: hash_type
= HASH_TYPE_SHA1
;
8689 salt_type
= SALT_TYPE_NONE
;
8690 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8691 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8692 | OPTS_TYPE_PT_ADD80
8693 | OPTS_TYPE_PT_ADDBITS15
;
8694 kern_type
= KERN_TYPE_SHA11
;
8695 dgst_size
= DGST_SIZE_4_5
;
8696 parse_func
= sha1_parse_hash
;
8697 sort_by_digest
= sort_by_digest_4_5
;
8698 opti_type
= OPTI_TYPE_ZERO_BYTE
8699 | OPTI_TYPE_PRECOMPUTE_INIT
8700 | OPTI_TYPE_PRECOMPUTE_MERKLE
8701 | OPTI_TYPE_EARLY_SKIP
8702 | OPTI_TYPE_NOT_SALTED
;
8709 case 4700: hash_type
= HASH_TYPE_SHA1
;
8710 salt_type
= SALT_TYPE_NONE
;
8711 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8713 | OPTS_TYPE_PT_ADD80
8714 | OPTS_TYPE_PT_ADDBITS14
;
8715 kern_type
= KERN_TYPE_SHA1_MD5
;
8716 dgst_size
= DGST_SIZE_4_5
;
8717 parse_func
= sha1_parse_hash
;
8718 sort_by_digest
= sort_by_digest_4_5
;
8719 opti_type
= OPTI_TYPE_ZERO_BYTE
8720 | OPTI_TYPE_PRECOMPUTE_INIT
8721 | OPTI_TYPE_PRECOMPUTE_MERKLE
8722 | OPTI_TYPE_EARLY_SKIP
8723 | OPTI_TYPE_NOT_ITERATED
8724 | OPTI_TYPE_NOT_SALTED
8725 | OPTI_TYPE_RAW_HASH
;
8732 case 4800: hash_type
= HASH_TYPE_MD5
;
8733 salt_type
= SALT_TYPE_EMBEDDED
;
8734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8735 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8736 | OPTS_TYPE_PT_ADDBITS14
;
8737 kern_type
= KERN_TYPE_MD5_CHAP
;
8738 dgst_size
= DGST_SIZE_4_4
;
8739 parse_func
= chap_parse_hash
;
8740 sort_by_digest
= sort_by_digest_4_4
;
8741 opti_type
= OPTI_TYPE_ZERO_BYTE
8742 | OPTI_TYPE_PRECOMPUTE_INIT
8743 | OPTI_TYPE_PRECOMPUTE_MERKLE
8744 | OPTI_TYPE_MEET_IN_MIDDLE
8745 | OPTI_TYPE_EARLY_SKIP
8746 | OPTI_TYPE_NOT_ITERATED
8747 | OPTI_TYPE_RAW_HASH
;
8754 case 4900: hash_type
= HASH_TYPE_SHA1
;
8755 salt_type
= SALT_TYPE_INTERN
;
8756 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8758 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8759 dgst_size
= DGST_SIZE_4_5
;
8760 parse_func
= sha1s_parse_hash
;
8761 sort_by_digest
= sort_by_digest_4_5
;
8762 opti_type
= OPTI_TYPE_ZERO_BYTE
8763 | OPTI_TYPE_PRECOMPUTE_INIT
8764 | OPTI_TYPE_PRECOMPUTE_MERKLE
8765 | OPTI_TYPE_EARLY_SKIP
;
8772 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8773 salt_type
= SALT_TYPE_EMBEDDED
;
8774 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8775 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8776 | OPTS_TYPE_PT_ADD01
;
8777 kern_type
= KERN_TYPE_KECCAK
;
8778 dgst_size
= DGST_SIZE_8_25
;
8779 parse_func
= keccak_parse_hash
;
8780 sort_by_digest
= sort_by_digest_8_25
;
8781 opti_type
= OPTI_TYPE_ZERO_BYTE
8782 | OPTI_TYPE_USES_BITS_64
8783 | OPTI_TYPE_RAW_HASH
;
8790 case 5100: hash_type
= HASH_TYPE_MD5H
;
8791 salt_type
= SALT_TYPE_NONE
;
8792 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8793 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8794 | OPTS_TYPE_PT_ADD80
8795 | OPTS_TYPE_PT_ADDBITS14
;
8796 kern_type
= KERN_TYPE_MD5H
;
8797 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8798 parse_func
= md5half_parse_hash
;
8799 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8800 opti_type
= OPTI_TYPE_ZERO_BYTE
8801 | OPTI_TYPE_RAW_HASH
;
8808 case 5200: hash_type
= HASH_TYPE_SHA256
;
8809 salt_type
= SALT_TYPE_EMBEDDED
;
8810 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8811 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8812 kern_type
= KERN_TYPE_PSAFE3
;
8813 dgst_size
= DGST_SIZE_4_8
;
8814 parse_func
= psafe3_parse_hash
;
8815 sort_by_digest
= sort_by_digest_4_8
;
8816 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8823 case 5300: hash_type
= HASH_TYPE_MD5
;
8824 salt_type
= SALT_TYPE_EMBEDDED
;
8825 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8826 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8827 | OPTS_TYPE_ST_ADD80
;
8828 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8829 dgst_size
= DGST_SIZE_4_4
;
8830 parse_func
= ikepsk_md5_parse_hash
;
8831 sort_by_digest
= sort_by_digest_4_4
;
8832 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8839 case 5400: hash_type
= HASH_TYPE_SHA1
;
8840 salt_type
= SALT_TYPE_EMBEDDED
;
8841 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8842 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8843 | OPTS_TYPE_ST_ADD80
;
8844 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8845 dgst_size
= DGST_SIZE_4_5
;
8846 parse_func
= ikepsk_sha1_parse_hash
;
8847 sort_by_digest
= sort_by_digest_4_5
;
8848 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8855 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8856 salt_type
= SALT_TYPE_EMBEDDED
;
8857 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8858 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8859 | OPTS_TYPE_PT_ADD80
8860 | OPTS_TYPE_PT_ADDBITS14
8861 | OPTS_TYPE_PT_UNICODE
8863 kern_type
= KERN_TYPE_NETNTLMv1
;
8864 dgst_size
= DGST_SIZE_4_4
;
8865 parse_func
= netntlmv1_parse_hash
;
8866 sort_by_digest
= sort_by_digest_4_4
;
8867 opti_type
= OPTI_TYPE_ZERO_BYTE
8868 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8875 case 5600: hash_type
= HASH_TYPE_MD5
;
8876 salt_type
= SALT_TYPE_EMBEDDED
;
8877 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8878 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8879 | OPTS_TYPE_PT_ADD80
8880 | OPTS_TYPE_PT_ADDBITS14
8881 | OPTS_TYPE_PT_UNICODE
;
8882 kern_type
= KERN_TYPE_NETNTLMv2
;
8883 dgst_size
= DGST_SIZE_4_4
;
8884 parse_func
= netntlmv2_parse_hash
;
8885 sort_by_digest
= sort_by_digest_4_4
;
8886 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8893 case 5700: hash_type
= HASH_TYPE_SHA256
;
8894 salt_type
= SALT_TYPE_NONE
;
8895 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8896 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8897 | OPTS_TYPE_PT_ADD80
8898 | OPTS_TYPE_PT_ADDBITS15
;
8899 kern_type
= KERN_TYPE_SHA256
;
8900 dgst_size
= DGST_SIZE_4_8
;
8901 parse_func
= cisco4_parse_hash
;
8902 sort_by_digest
= sort_by_digest_4_8
;
8903 opti_type
= OPTI_TYPE_ZERO_BYTE
8904 | OPTI_TYPE_PRECOMPUTE_INIT
8905 | OPTI_TYPE_PRECOMPUTE_MERKLE
8906 | OPTI_TYPE_EARLY_SKIP
8907 | OPTI_TYPE_NOT_ITERATED
8908 | OPTI_TYPE_NOT_SALTED
8909 | OPTI_TYPE_RAW_HASH
;
8916 case 5800: hash_type
= HASH_TYPE_SHA1
;
8917 salt_type
= SALT_TYPE_INTERN
;
8918 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8919 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8920 | OPTS_TYPE_ST_ADD80
;
8921 kern_type
= KERN_TYPE_ANDROIDPIN
;
8922 dgst_size
= DGST_SIZE_4_5
;
8923 parse_func
= androidpin_parse_hash
;
8924 sort_by_digest
= sort_by_digest_4_5
;
8925 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8932 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8933 salt_type
= SALT_TYPE_NONE
;
8934 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8935 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8936 | OPTS_TYPE_PT_ADD80
;
8937 kern_type
= KERN_TYPE_RIPEMD160
;
8938 dgst_size
= DGST_SIZE_4_5
;
8939 parse_func
= ripemd160_parse_hash
;
8940 sort_by_digest
= sort_by_digest_4_5
;
8941 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8948 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8949 salt_type
= SALT_TYPE_NONE
;
8950 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8951 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8952 | OPTS_TYPE_PT_ADD80
;
8953 kern_type
= KERN_TYPE_WHIRLPOOL
;
8954 dgst_size
= DGST_SIZE_4_16
;
8955 parse_func
= whirlpool_parse_hash
;
8956 sort_by_digest
= sort_by_digest_4_16
;
8957 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8964 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8965 salt_type
= SALT_TYPE_EMBEDDED
;
8966 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8967 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8968 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8969 dgst_size
= DGST_SIZE_4_5
;
8970 parse_func
= truecrypt_parse_hash_2k
;
8971 sort_by_digest
= sort_by_digest_4_5
;
8972 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8979 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8980 salt_type
= SALT_TYPE_EMBEDDED
;
8981 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8982 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8983 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8984 dgst_size
= DGST_SIZE_4_5
;
8985 parse_func
= truecrypt_parse_hash_2k
;
8986 sort_by_digest
= sort_by_digest_4_5
;
8987 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8994 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8995 salt_type
= SALT_TYPE_EMBEDDED
;
8996 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8997 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8998 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8999 dgst_size
= DGST_SIZE_4_5
;
9000 parse_func
= truecrypt_parse_hash_2k
;
9001 sort_by_digest
= sort_by_digest_4_5
;
9002 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9009 case 6221: hash_type
= HASH_TYPE_SHA512
;
9010 salt_type
= SALT_TYPE_EMBEDDED
;
9011 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9012 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9013 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9014 dgst_size
= DGST_SIZE_8_8
;
9015 parse_func
= truecrypt_parse_hash_1k
;
9016 sort_by_digest
= sort_by_digest_8_8
;
9017 opti_type
= OPTI_TYPE_ZERO_BYTE
9018 | OPTI_TYPE_USES_BITS_64
;
9025 case 6222: hash_type
= HASH_TYPE_SHA512
;
9026 salt_type
= SALT_TYPE_EMBEDDED
;
9027 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9028 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9029 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9030 dgst_size
= DGST_SIZE_8_8
;
9031 parse_func
= truecrypt_parse_hash_1k
;
9032 sort_by_digest
= sort_by_digest_8_8
;
9033 opti_type
= OPTI_TYPE_ZERO_BYTE
9034 | OPTI_TYPE_USES_BITS_64
;
9041 case 6223: hash_type
= HASH_TYPE_SHA512
;
9042 salt_type
= SALT_TYPE_EMBEDDED
;
9043 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9045 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9046 dgst_size
= DGST_SIZE_8_8
;
9047 parse_func
= truecrypt_parse_hash_1k
;
9048 sort_by_digest
= sort_by_digest_8_8
;
9049 opti_type
= OPTI_TYPE_ZERO_BYTE
9050 | OPTI_TYPE_USES_BITS_64
;
9057 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9058 salt_type
= SALT_TYPE_EMBEDDED
;
9059 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9060 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9061 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9062 dgst_size
= DGST_SIZE_4_8
;
9063 parse_func
= truecrypt_parse_hash_1k
;
9064 sort_by_digest
= sort_by_digest_4_8
;
9065 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9072 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9073 salt_type
= SALT_TYPE_EMBEDDED
;
9074 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9075 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9076 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9077 dgst_size
= DGST_SIZE_4_8
;
9078 parse_func
= truecrypt_parse_hash_1k
;
9079 sort_by_digest
= sort_by_digest_4_8
;
9080 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9087 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9088 salt_type
= SALT_TYPE_EMBEDDED
;
9089 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9090 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9091 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9092 dgst_size
= DGST_SIZE_4_8
;
9093 parse_func
= truecrypt_parse_hash_1k
;
9094 sort_by_digest
= sort_by_digest_4_8
;
9095 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9102 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9103 salt_type
= SALT_TYPE_EMBEDDED
;
9104 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9106 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9107 dgst_size
= DGST_SIZE_4_5
;
9108 parse_func
= truecrypt_parse_hash_1k
;
9109 sort_by_digest
= sort_by_digest_4_5
;
9110 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9117 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9118 salt_type
= SALT_TYPE_EMBEDDED
;
9119 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9120 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9121 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9122 dgst_size
= DGST_SIZE_4_5
;
9123 parse_func
= truecrypt_parse_hash_1k
;
9124 sort_by_digest
= sort_by_digest_4_5
;
9125 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9132 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9133 salt_type
= SALT_TYPE_EMBEDDED
;
9134 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9135 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9136 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9137 dgst_size
= DGST_SIZE_4_5
;
9138 parse_func
= truecrypt_parse_hash_1k
;
9139 sort_by_digest
= sort_by_digest_4_5
;
9140 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9147 case 6300: hash_type
= HASH_TYPE_MD5
;
9148 salt_type
= SALT_TYPE_EMBEDDED
;
9149 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9150 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9151 kern_type
= KERN_TYPE_MD5AIX
;
9152 dgst_size
= DGST_SIZE_4_4
;
9153 parse_func
= md5aix_parse_hash
;
9154 sort_by_digest
= sort_by_digest_4_4
;
9155 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9162 case 6400: hash_type
= HASH_TYPE_SHA256
;
9163 salt_type
= SALT_TYPE_EMBEDDED
;
9164 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9166 kern_type
= KERN_TYPE_SHA256AIX
;
9167 dgst_size
= DGST_SIZE_4_8
;
9168 parse_func
= sha256aix_parse_hash
;
9169 sort_by_digest
= sort_by_digest_4_8
;
9170 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9177 case 6500: hash_type
= HASH_TYPE_SHA512
;
9178 salt_type
= SALT_TYPE_EMBEDDED
;
9179 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9180 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9181 kern_type
= KERN_TYPE_SHA512AIX
;
9182 dgst_size
= DGST_SIZE_8_8
;
9183 parse_func
= sha512aix_parse_hash
;
9184 sort_by_digest
= sort_by_digest_8_8
;
9185 opti_type
= OPTI_TYPE_ZERO_BYTE
9186 | OPTI_TYPE_USES_BITS_64
;
9193 case 6600: hash_type
= HASH_TYPE_AES
;
9194 salt_type
= SALT_TYPE_EMBEDDED
;
9195 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9197 kern_type
= KERN_TYPE_AGILEKEY
;
9198 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9199 parse_func
= agilekey_parse_hash
;
9200 sort_by_digest
= sort_by_digest_4_5
;
9201 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9208 case 6700: hash_type
= HASH_TYPE_SHA1
;
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_SHA1AIX
;
9213 dgst_size
= DGST_SIZE_4_5
;
9214 parse_func
= sha1aix_parse_hash
;
9215 sort_by_digest
= sort_by_digest_4_5
;
9216 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9223 case 6800: hash_type
= HASH_TYPE_AES
;
9224 salt_type
= SALT_TYPE_EMBEDDED
;
9225 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9226 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9227 kern_type
= KERN_TYPE_LASTPASS
;
9228 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9229 parse_func
= lastpass_parse_hash
;
9230 sort_by_digest
= sort_by_digest_4_8
;
9231 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9238 case 6900: hash_type
= HASH_TYPE_GOST
;
9239 salt_type
= SALT_TYPE_NONE
;
9240 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9242 kern_type
= KERN_TYPE_GOST
;
9243 dgst_size
= DGST_SIZE_4_8
;
9244 parse_func
= gost_parse_hash
;
9245 sort_by_digest
= sort_by_digest_4_8
;
9246 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9253 case 7100: hash_type
= HASH_TYPE_SHA512
;
9254 salt_type
= SALT_TYPE_EMBEDDED
;
9255 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9256 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9257 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9258 dgst_size
= DGST_SIZE_8_16
;
9259 parse_func
= sha512osx_parse_hash
;
9260 sort_by_digest
= sort_by_digest_8_16
;
9261 opti_type
= OPTI_TYPE_ZERO_BYTE
9262 | OPTI_TYPE_USES_BITS_64
9263 | OPTI_TYPE_SLOW_HASH_SIMD
;
9270 case 7200: hash_type
= HASH_TYPE_SHA512
;
9271 salt_type
= SALT_TYPE_EMBEDDED
;
9272 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9273 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9274 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9275 dgst_size
= DGST_SIZE_8_16
;
9276 parse_func
= sha512grub_parse_hash
;
9277 sort_by_digest
= sort_by_digest_8_16
;
9278 opti_type
= OPTI_TYPE_ZERO_BYTE
9279 | OPTI_TYPE_USES_BITS_64
9280 | OPTI_TYPE_SLOW_HASH_SIMD
;
9287 case 7300: hash_type
= HASH_TYPE_SHA1
;
9288 salt_type
= SALT_TYPE_EMBEDDED
;
9289 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9290 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9291 | OPTS_TYPE_ST_ADD80
9292 | OPTS_TYPE_ST_ADDBITS15
;
9293 kern_type
= KERN_TYPE_RAKP
;
9294 dgst_size
= DGST_SIZE_4_5
;
9295 parse_func
= rakp_parse_hash
;
9296 sort_by_digest
= sort_by_digest_4_5
;
9297 opti_type
= OPTI_TYPE_ZERO_BYTE
9298 | OPTI_TYPE_NOT_ITERATED
;
9305 case 7400: hash_type
= HASH_TYPE_SHA256
;
9306 salt_type
= SALT_TYPE_EMBEDDED
;
9307 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9308 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9309 kern_type
= KERN_TYPE_SHA256CRYPT
;
9310 dgst_size
= DGST_SIZE_4_8
;
9311 parse_func
= sha256crypt_parse_hash
;
9312 sort_by_digest
= sort_by_digest_4_8
;
9313 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9320 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9321 salt_type
= SALT_TYPE_EMBEDDED
;
9322 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9323 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9324 kern_type
= KERN_TYPE_KRB5PA
;
9325 dgst_size
= DGST_SIZE_4_4
;
9326 parse_func
= krb5pa_parse_hash
;
9327 sort_by_digest
= sort_by_digest_4_4
;
9328 opti_type
= OPTI_TYPE_ZERO_BYTE
9329 | OPTI_TYPE_NOT_ITERATED
;
9336 case 7600: hash_type
= HASH_TYPE_SHA1
;
9337 salt_type
= SALT_TYPE_INTERN
;
9338 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9339 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9340 | OPTS_TYPE_PT_ADD80
9341 | OPTS_TYPE_PT_ADDBITS15
;
9342 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9343 dgst_size
= DGST_SIZE_4_5
;
9344 parse_func
= redmine_parse_hash
;
9345 sort_by_digest
= sort_by_digest_4_5
;
9346 opti_type
= OPTI_TYPE_ZERO_BYTE
9347 | OPTI_TYPE_PRECOMPUTE_INIT
9348 | OPTI_TYPE_EARLY_SKIP
9349 | OPTI_TYPE_NOT_ITERATED
9350 | OPTI_TYPE_PREPENDED_SALT
;
9357 case 7700: hash_type
= HASH_TYPE_SAPB
;
9358 salt_type
= SALT_TYPE_EMBEDDED
;
9359 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9360 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9361 | OPTS_TYPE_PT_UPPER
9362 | OPTS_TYPE_ST_UPPER
;
9363 kern_type
= KERN_TYPE_SAPB
;
9364 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9365 parse_func
= sapb_parse_hash
;
9366 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9367 opti_type
= OPTI_TYPE_ZERO_BYTE
9368 | OPTI_TYPE_PRECOMPUTE_INIT
9369 | OPTI_TYPE_NOT_ITERATED
;
9376 case 7800: hash_type
= HASH_TYPE_SAPG
;
9377 salt_type
= SALT_TYPE_EMBEDDED
;
9378 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9379 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9380 | OPTS_TYPE_ST_ADD80
9381 | OPTS_TYPE_ST_UPPER
;
9382 kern_type
= KERN_TYPE_SAPG
;
9383 dgst_size
= DGST_SIZE_4_5
;
9384 parse_func
= sapg_parse_hash
;
9385 sort_by_digest
= sort_by_digest_4_5
;
9386 opti_type
= OPTI_TYPE_ZERO_BYTE
9387 | OPTI_TYPE_PRECOMPUTE_INIT
9388 | OPTI_TYPE_NOT_ITERATED
;
9395 case 7900: hash_type
= HASH_TYPE_SHA512
;
9396 salt_type
= SALT_TYPE_EMBEDDED
;
9397 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9398 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9399 kern_type
= KERN_TYPE_DRUPAL7
;
9400 dgst_size
= DGST_SIZE_8_8
;
9401 parse_func
= drupal7_parse_hash
;
9402 sort_by_digest
= sort_by_digest_8_8
;
9403 opti_type
= OPTI_TYPE_ZERO_BYTE
9404 | OPTI_TYPE_USES_BITS_64
;
9411 case 8000: hash_type
= HASH_TYPE_SHA256
;
9412 salt_type
= SALT_TYPE_EMBEDDED
;
9413 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9414 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9415 | OPTS_TYPE_PT_UNICODE
9416 | OPTS_TYPE_ST_ADD80
9418 kern_type
= KERN_TYPE_SYBASEASE
;
9419 dgst_size
= DGST_SIZE_4_8
;
9420 parse_func
= sybasease_parse_hash
;
9421 sort_by_digest
= sort_by_digest_4_8
;
9422 opti_type
= OPTI_TYPE_ZERO_BYTE
9423 | OPTI_TYPE_PRECOMPUTE_INIT
9424 | OPTI_TYPE_EARLY_SKIP
9425 | OPTI_TYPE_NOT_ITERATED
9426 | OPTI_TYPE_RAW_HASH
;
9433 case 8100: hash_type
= HASH_TYPE_SHA1
;
9434 salt_type
= SALT_TYPE_EMBEDDED
;
9435 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9436 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9437 kern_type
= KERN_TYPE_NETSCALER
;
9438 dgst_size
= DGST_SIZE_4_5
;
9439 parse_func
= netscaler_parse_hash
;
9440 sort_by_digest
= sort_by_digest_4_5
;
9441 opti_type
= OPTI_TYPE_ZERO_BYTE
9442 | OPTI_TYPE_PRECOMPUTE_INIT
9443 | OPTI_TYPE_PRECOMPUTE_MERKLE
9444 | OPTI_TYPE_EARLY_SKIP
9445 | OPTI_TYPE_NOT_ITERATED
9446 | OPTI_TYPE_PREPENDED_SALT
9447 | OPTI_TYPE_RAW_HASH
;
9454 case 8200: hash_type
= HASH_TYPE_SHA256
;
9455 salt_type
= SALT_TYPE_EMBEDDED
;
9456 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9458 kern_type
= KERN_TYPE_CLOUDKEY
;
9459 dgst_size
= DGST_SIZE_4_8
;
9460 parse_func
= cloudkey_parse_hash
;
9461 sort_by_digest
= sort_by_digest_4_8
;
9462 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9469 case 8300: hash_type
= HASH_TYPE_SHA1
;
9470 salt_type
= SALT_TYPE_EMBEDDED
;
9471 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9472 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9474 | OPTS_TYPE_ST_ADD80
;
9475 kern_type
= KERN_TYPE_NSEC3
;
9476 dgst_size
= DGST_SIZE_4_5
;
9477 parse_func
= nsec3_parse_hash
;
9478 sort_by_digest
= sort_by_digest_4_5
;
9479 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9486 case 8400: hash_type
= HASH_TYPE_SHA1
;
9487 salt_type
= SALT_TYPE_INTERN
;
9488 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9489 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9490 | OPTS_TYPE_PT_ADD80
9491 | OPTS_TYPE_PT_ADDBITS15
;
9492 kern_type
= KERN_TYPE_WBB3
;
9493 dgst_size
= DGST_SIZE_4_5
;
9494 parse_func
= wbb3_parse_hash
;
9495 sort_by_digest
= sort_by_digest_4_5
;
9496 opti_type
= OPTI_TYPE_ZERO_BYTE
9497 | OPTI_TYPE_PRECOMPUTE_INIT
9498 | OPTI_TYPE_NOT_ITERATED
;
9505 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9506 salt_type
= SALT_TYPE_EMBEDDED
;
9507 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9508 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9509 | OPTS_TYPE_ST_UPPER
;
9510 kern_type
= KERN_TYPE_RACF
;
9511 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9512 parse_func
= racf_parse_hash
;
9513 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9514 opti_type
= OPTI_TYPE_ZERO_BYTE
9515 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9522 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9523 salt_type
= SALT_TYPE_NONE
;
9524 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9525 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9526 kern_type
= KERN_TYPE_LOTUS5
;
9527 dgst_size
= DGST_SIZE_4_4
;
9528 parse_func
= lotus5_parse_hash
;
9529 sort_by_digest
= sort_by_digest_4_4
;
9530 opti_type
= OPTI_TYPE_EARLY_SKIP
9531 | OPTI_TYPE_NOT_ITERATED
9532 | OPTI_TYPE_NOT_SALTED
9533 | OPTI_TYPE_RAW_HASH
;
9540 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9541 salt_type
= SALT_TYPE_EMBEDDED
;
9542 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9543 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9544 kern_type
= KERN_TYPE_LOTUS6
;
9545 dgst_size
= DGST_SIZE_4_4
;
9546 parse_func
= lotus6_parse_hash
;
9547 sort_by_digest
= sort_by_digest_4_4
;
9548 opti_type
= OPTI_TYPE_EARLY_SKIP
9549 | OPTI_TYPE_NOT_ITERATED
9550 | OPTI_TYPE_RAW_HASH
;
9557 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9558 salt_type
= SALT_TYPE_EMBEDDED
;
9559 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9560 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9561 kern_type
= KERN_TYPE_ANDROIDFDE
;
9562 dgst_size
= DGST_SIZE_4_4
;
9563 parse_func
= androidfde_parse_hash
;
9564 sort_by_digest
= sort_by_digest_4_4
;
9565 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9572 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9573 salt_type
= SALT_TYPE_EMBEDDED
;
9574 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9575 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9576 kern_type
= KERN_TYPE_SCRYPT
;
9577 dgst_size
= DGST_SIZE_4_8
;
9578 parse_func
= scrypt_parse_hash
;
9579 sort_by_digest
= sort_by_digest_4_8
;
9580 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9587 case 9000: hash_type
= HASH_TYPE_SHA1
;
9588 salt_type
= SALT_TYPE_EMBEDDED
;
9589 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9590 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9591 | OPTS_TYPE_ST_GENERATE_LE
;
9592 kern_type
= KERN_TYPE_PSAFE2
;
9593 dgst_size
= DGST_SIZE_4_5
;
9594 parse_func
= psafe2_parse_hash
;
9595 sort_by_digest
= sort_by_digest_4_5
;
9596 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9603 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
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_LOTUS8
;
9608 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9609 parse_func
= lotus8_parse_hash
;
9610 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9611 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9618 case 9200: hash_type
= HASH_TYPE_SHA256
;
9619 salt_type
= SALT_TYPE_EMBEDDED
;
9620 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9621 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9622 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9623 dgst_size
= DGST_SIZE_4_32
;
9624 parse_func
= cisco8_parse_hash
;
9625 sort_by_digest
= sort_by_digest_4_32
;
9626 opti_type
= OPTI_TYPE_ZERO_BYTE
9627 | OPTI_TYPE_SLOW_HASH_SIMD
;
9634 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
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_SCRYPT
;
9639 dgst_size
= DGST_SIZE_4_8
;
9640 parse_func
= cisco9_parse_hash
;
9641 sort_by_digest
= sort_by_digest_4_8
;
9642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9649 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9650 salt_type
= SALT_TYPE_EMBEDDED
;
9651 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9653 kern_type
= KERN_TYPE_OFFICE2007
;
9654 dgst_size
= DGST_SIZE_4_4
;
9655 parse_func
= office2007_parse_hash
;
9656 sort_by_digest
= sort_by_digest_4_4
;
9657 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9664 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9665 salt_type
= SALT_TYPE_EMBEDDED
;
9666 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9667 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9668 kern_type
= KERN_TYPE_OFFICE2010
;
9669 dgst_size
= DGST_SIZE_4_4
;
9670 parse_func
= office2010_parse_hash
;
9671 sort_by_digest
= sort_by_digest_4_4
;
9672 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9679 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9680 salt_type
= SALT_TYPE_EMBEDDED
;
9681 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9683 kern_type
= KERN_TYPE_OFFICE2013
;
9684 dgst_size
= DGST_SIZE_4_4
;
9685 parse_func
= office2013_parse_hash
;
9686 sort_by_digest
= sort_by_digest_4_4
;
9687 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9694 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9695 salt_type
= SALT_TYPE_EMBEDDED
;
9696 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9697 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9698 | OPTS_TYPE_PT_ADD80
9699 | OPTS_TYPE_PT_UNICODE
;
9700 kern_type
= KERN_TYPE_OLDOFFICE01
;
9701 dgst_size
= DGST_SIZE_4_4
;
9702 parse_func
= oldoffice01_parse_hash
;
9703 sort_by_digest
= sort_by_digest_4_4
;
9704 opti_type
= OPTI_TYPE_ZERO_BYTE
9705 | OPTI_TYPE_PRECOMPUTE_INIT
9706 | OPTI_TYPE_NOT_ITERATED
;
9713 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9714 salt_type
= SALT_TYPE_EMBEDDED
;
9715 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9716 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9717 | OPTS_TYPE_PT_ADD80
;
9718 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9719 dgst_size
= DGST_SIZE_4_4
;
9720 parse_func
= oldoffice01cm1_parse_hash
;
9721 sort_by_digest
= sort_by_digest_4_4
;
9722 opti_type
= OPTI_TYPE_ZERO_BYTE
9723 | OPTI_TYPE_PRECOMPUTE_INIT
9724 | OPTI_TYPE_NOT_ITERATED
;
9731 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9732 salt_type
= SALT_TYPE_EMBEDDED
;
9733 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9734 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9735 | OPTS_TYPE_PT_ADD80
9736 | OPTS_TYPE_PT_UNICODE
9737 | OPTS_TYPE_PT_NEVERCRACK
;
9738 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9739 dgst_size
= DGST_SIZE_4_4
;
9740 parse_func
= oldoffice01cm2_parse_hash
;
9741 sort_by_digest
= sort_by_digest_4_4
;
9742 opti_type
= OPTI_TYPE_ZERO_BYTE
9743 | OPTI_TYPE_PRECOMPUTE_INIT
9744 | OPTI_TYPE_NOT_ITERATED
;
9751 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9752 salt_type
= SALT_TYPE_EMBEDDED
;
9753 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9754 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9755 | OPTS_TYPE_PT_ADD80
9756 | OPTS_TYPE_PT_UNICODE
;
9757 kern_type
= KERN_TYPE_OLDOFFICE34
;
9758 dgst_size
= DGST_SIZE_4_4
;
9759 parse_func
= oldoffice34_parse_hash
;
9760 sort_by_digest
= sort_by_digest_4_4
;
9761 opti_type
= OPTI_TYPE_ZERO_BYTE
9762 | OPTI_TYPE_PRECOMPUTE_INIT
9763 | OPTI_TYPE_NOT_ITERATED
;
9770 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9771 salt_type
= SALT_TYPE_EMBEDDED
;
9772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9774 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9775 dgst_size
= DGST_SIZE_4_4
;
9776 parse_func
= oldoffice34cm1_parse_hash
;
9777 sort_by_digest
= sort_by_digest_4_4
;
9778 opti_type
= OPTI_TYPE_ZERO_BYTE
9779 | OPTI_TYPE_PRECOMPUTE_INIT
9780 | OPTI_TYPE_NOT_ITERATED
;
9787 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9788 salt_type
= SALT_TYPE_EMBEDDED
;
9789 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9790 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9791 | OPTS_TYPE_PT_ADD80
9792 | OPTS_TYPE_PT_UNICODE
9793 | OPTS_TYPE_PT_NEVERCRACK
;
9794 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9795 dgst_size
= DGST_SIZE_4_4
;
9796 parse_func
= oldoffice34cm2_parse_hash
;
9797 sort_by_digest
= sort_by_digest_4_4
;
9798 opti_type
= OPTI_TYPE_ZERO_BYTE
9799 | OPTI_TYPE_PRECOMPUTE_INIT
9800 | OPTI_TYPE_NOT_ITERATED
;
9807 case 9900: hash_type
= HASH_TYPE_MD5
;
9808 salt_type
= SALT_TYPE_NONE
;
9809 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9810 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9811 kern_type
= KERN_TYPE_RADMIN2
;
9812 dgst_size
= DGST_SIZE_4_4
;
9813 parse_func
= radmin2_parse_hash
;
9814 sort_by_digest
= sort_by_digest_4_4
;
9815 opti_type
= OPTI_TYPE_ZERO_BYTE
9816 | OPTI_TYPE_PRECOMPUTE_INIT
9817 | OPTI_TYPE_EARLY_SKIP
9818 | OPTI_TYPE_NOT_ITERATED
9819 | OPTI_TYPE_NOT_SALTED
;
9826 case 10000: hash_type
= HASH_TYPE_SHA256
;
9827 salt_type
= SALT_TYPE_EMBEDDED
;
9828 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9829 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9830 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9831 dgst_size
= DGST_SIZE_4_32
;
9832 parse_func
= djangopbkdf2_parse_hash
;
9833 sort_by_digest
= sort_by_digest_4_32
;
9834 opti_type
= OPTI_TYPE_ZERO_BYTE
9835 | OPTI_TYPE_SLOW_HASH_SIMD
;
9842 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9843 salt_type
= SALT_TYPE_EMBEDDED
;
9844 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9845 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9846 kern_type
= KERN_TYPE_SIPHASH
;
9847 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9848 parse_func
= siphash_parse_hash
;
9849 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9850 opti_type
= OPTI_TYPE_ZERO_BYTE
9851 | OPTI_TYPE_NOT_ITERATED
9852 | OPTI_TYPE_RAW_HASH
;
9859 case 10200: hash_type
= HASH_TYPE_MD5
;
9860 salt_type
= SALT_TYPE_EMBEDDED
;
9861 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9862 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9863 | OPTS_TYPE_ST_ADD80
9864 | OPTS_TYPE_ST_ADDBITS14
;
9865 kern_type
= KERN_TYPE_HMACMD5_PW
;
9866 dgst_size
= DGST_SIZE_4_4
;
9867 parse_func
= crammd5_parse_hash
;
9868 sort_by_digest
= sort_by_digest_4_4
;
9869 opti_type
= OPTI_TYPE_ZERO_BYTE
9870 | OPTI_TYPE_NOT_ITERATED
;
9877 case 10300: hash_type
= HASH_TYPE_SHA1
;
9878 salt_type
= SALT_TYPE_EMBEDDED
;
9879 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9880 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9881 kern_type
= KERN_TYPE_SAPH_SHA1
;
9882 dgst_size
= DGST_SIZE_4_5
;
9883 parse_func
= saph_sha1_parse_hash
;
9884 sort_by_digest
= sort_by_digest_4_5
;
9885 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9892 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9893 salt_type
= SALT_TYPE_EMBEDDED
;
9894 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9895 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9896 kern_type
= KERN_TYPE_PDF11
;
9897 dgst_size
= DGST_SIZE_4_4
;
9898 parse_func
= pdf11_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 10410: hash_type
= HASH_TYPE_PDFU16
;
9909 salt_type
= SALT_TYPE_EMBEDDED
;
9910 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9911 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9912 kern_type
= KERN_TYPE_PDF11CM1
;
9913 dgst_size
= DGST_SIZE_4_4
;
9914 parse_func
= pdf11cm1_parse_hash
;
9915 sort_by_digest
= sort_by_digest_4_4
;
9916 opti_type
= OPTI_TYPE_ZERO_BYTE
9917 | OPTI_TYPE_NOT_ITERATED
;
9924 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9925 salt_type
= SALT_TYPE_EMBEDDED
;
9926 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9927 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9928 kern_type
= KERN_TYPE_PDF11CM2
;
9929 dgst_size
= DGST_SIZE_4_4
;
9930 parse_func
= pdf11cm2_parse_hash
;
9931 sort_by_digest
= sort_by_digest_4_4
;
9932 opti_type
= OPTI_TYPE_ZERO_BYTE
9933 | OPTI_TYPE_NOT_ITERATED
;
9940 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9941 salt_type
= SALT_TYPE_EMBEDDED
;
9942 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9943 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9944 kern_type
= KERN_TYPE_PDF14
;
9945 dgst_size
= DGST_SIZE_4_4
;
9946 parse_func
= pdf14_parse_hash
;
9947 sort_by_digest
= sort_by_digest_4_4
;
9948 opti_type
= OPTI_TYPE_ZERO_BYTE
9949 | OPTI_TYPE_NOT_ITERATED
;
9956 case 10600: hash_type
= HASH_TYPE_SHA256
;
9957 salt_type
= SALT_TYPE_EMBEDDED
;
9958 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9959 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9960 | OPTS_TYPE_ST_ADD80
9961 | OPTS_TYPE_ST_ADDBITS15
9962 | OPTS_TYPE_HASH_COPY
;
9963 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9964 dgst_size
= DGST_SIZE_4_8
;
9965 parse_func
= pdf17l3_parse_hash
;
9966 sort_by_digest
= sort_by_digest_4_8
;
9967 opti_type
= OPTI_TYPE_ZERO_BYTE
9968 | OPTI_TYPE_PRECOMPUTE_INIT
9969 | OPTI_TYPE_PRECOMPUTE_MERKLE
9970 | OPTI_TYPE_EARLY_SKIP
9971 | OPTI_TYPE_NOT_ITERATED
9972 | OPTI_TYPE_APPENDED_SALT
9973 | OPTI_TYPE_RAW_HASH
;
9980 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9981 salt_type
= SALT_TYPE_EMBEDDED
;
9982 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9983 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9984 | OPTS_TYPE_HASH_COPY
;
9985 kern_type
= KERN_TYPE_PDF17L8
;
9986 dgst_size
= DGST_SIZE_4_8
;
9987 parse_func
= pdf17l8_parse_hash
;
9988 sort_by_digest
= sort_by_digest_4_8
;
9989 opti_type
= OPTI_TYPE_ZERO_BYTE
9990 | OPTI_TYPE_NOT_ITERATED
;
9997 case 10800: hash_type
= HASH_TYPE_SHA384
;
9998 salt_type
= SALT_TYPE_NONE
;
9999 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10000 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10001 | OPTS_TYPE_PT_ADD80
10002 | OPTS_TYPE_PT_ADDBITS15
;
10003 kern_type
= KERN_TYPE_SHA384
;
10004 dgst_size
= DGST_SIZE_8_8
;
10005 parse_func
= sha384_parse_hash
;
10006 sort_by_digest
= sort_by_digest_8_8
;
10007 opti_type
= OPTI_TYPE_ZERO_BYTE
10008 | OPTI_TYPE_PRECOMPUTE_INIT
10009 | OPTI_TYPE_PRECOMPUTE_MERKLE
10010 | OPTI_TYPE_EARLY_SKIP
10011 | OPTI_TYPE_NOT_ITERATED
10012 | OPTI_TYPE_NOT_SALTED
10013 | OPTI_TYPE_USES_BITS_64
10014 | OPTI_TYPE_RAW_HASH
;
10021 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10022 salt_type
= SALT_TYPE_EMBEDDED
;
10023 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10025 | OPTS_TYPE_ST_BASE64
10026 | OPTS_TYPE_HASH_COPY
;
10027 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10028 dgst_size
= DGST_SIZE_4_32
;
10029 parse_func
= pbkdf2_sha256_parse_hash
;
10030 sort_by_digest
= sort_by_digest_4_32
;
10031 opti_type
= OPTI_TYPE_ZERO_BYTE
10032 | OPTI_TYPE_SLOW_HASH_SIMD
;
10039 case 11000: hash_type
= HASH_TYPE_MD5
;
10040 salt_type
= SALT_TYPE_INTERN
;
10041 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10042 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10043 | OPTS_TYPE_PT_ADD80
;
10044 kern_type
= KERN_TYPE_PRESTASHOP
;
10045 dgst_size
= DGST_SIZE_4_4
;
10046 parse_func
= prestashop_parse_hash
;
10047 sort_by_digest
= sort_by_digest_4_4
;
10048 opti_type
= OPTI_TYPE_ZERO_BYTE
10049 | OPTI_TYPE_PRECOMPUTE_INIT
10050 | OPTI_TYPE_NOT_ITERATED
10051 | OPTI_TYPE_PREPENDED_SALT
;
10058 case 11100: hash_type
= HASH_TYPE_MD5
;
10059 salt_type
= SALT_TYPE_EMBEDDED
;
10060 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10062 | OPTS_TYPE_ST_ADD80
;
10063 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10064 dgst_size
= DGST_SIZE_4_4
;
10065 parse_func
= postgresql_auth_parse_hash
;
10066 sort_by_digest
= sort_by_digest_4_4
;
10067 opti_type
= OPTI_TYPE_ZERO_BYTE
10068 | OPTI_TYPE_PRECOMPUTE_INIT
10069 | OPTI_TYPE_PRECOMPUTE_MERKLE
10070 | OPTI_TYPE_EARLY_SKIP
;
10077 case 11200: hash_type
= HASH_TYPE_SHA1
;
10078 salt_type
= SALT_TYPE_EMBEDDED
;
10079 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10080 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10081 | OPTS_TYPE_PT_ADD80
10082 | OPTS_TYPE_ST_HEX
;
10083 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10084 dgst_size
= DGST_SIZE_4_5
;
10085 parse_func
= mysql_auth_parse_hash
;
10086 sort_by_digest
= sort_by_digest_4_5
;
10087 opti_type
= OPTI_TYPE_ZERO_BYTE
10088 | OPTI_TYPE_EARLY_SKIP
;
10095 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10096 salt_type
= SALT_TYPE_EMBEDDED
;
10097 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10100 | OPTS_TYPE_ST_ADD80
;
10101 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10102 dgst_size
= DGST_SIZE_4_4
;
10103 parse_func
= bitcoin_wallet_parse_hash
;
10104 sort_by_digest
= sort_by_digest_4_4
;
10105 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10112 case 11400: hash_type
= HASH_TYPE_MD5
;
10113 salt_type
= SALT_TYPE_EMBEDDED
;
10114 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10115 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10116 | OPTS_TYPE_PT_ADD80
10117 | OPTS_TYPE_HASH_COPY
;
10118 kern_type
= KERN_TYPE_SIP_AUTH
;
10119 dgst_size
= DGST_SIZE_4_4
;
10120 parse_func
= sip_auth_parse_hash
;
10121 sort_by_digest
= sort_by_digest_4_4
;
10122 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10129 case 11500: hash_type
= HASH_TYPE_CRC32
;
10130 salt_type
= SALT_TYPE_INTERN
;
10131 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10132 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10133 | OPTS_TYPE_ST_GENERATE_LE
10134 | OPTS_TYPE_ST_HEX
;
10135 kern_type
= KERN_TYPE_CRC32
;
10136 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10137 parse_func
= crc32_parse_hash
;
10138 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10139 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10146 case 11600: hash_type
= HASH_TYPE_AES
;
10147 salt_type
= SALT_TYPE_EMBEDDED
;
10148 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10149 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10150 | OPTS_TYPE_PT_NEVERCRACK
;
10151 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10152 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10153 parse_func
= seven_zip_parse_hash
;
10154 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10155 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10162 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10163 salt_type
= SALT_TYPE_NONE
;
10164 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10166 | OPTS_TYPE_PT_ADD01
;
10167 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10168 dgst_size
= DGST_SIZE_4_8
;
10169 parse_func
= gost2012sbog_256_parse_hash
;
10170 sort_by_digest
= sort_by_digest_4_8
;
10171 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10178 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10179 salt_type
= SALT_TYPE_NONE
;
10180 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10182 | OPTS_TYPE_PT_ADD01
;
10183 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10184 dgst_size
= DGST_SIZE_4_16
;
10185 parse_func
= gost2012sbog_512_parse_hash
;
10186 sort_by_digest
= sort_by_digest_4_16
;
10187 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10194 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10195 salt_type
= SALT_TYPE_EMBEDDED
;
10196 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10197 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10198 | OPTS_TYPE_ST_BASE64
10199 | OPTS_TYPE_HASH_COPY
;
10200 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10201 dgst_size
= DGST_SIZE_4_32
;
10202 parse_func
= pbkdf2_md5_parse_hash
;
10203 sort_by_digest
= sort_by_digest_4_32
;
10204 opti_type
= OPTI_TYPE_ZERO_BYTE
10205 | OPTI_TYPE_SLOW_HASH_SIMD
;
10212 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10213 salt_type
= SALT_TYPE_EMBEDDED
;
10214 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10216 | OPTS_TYPE_ST_BASE64
10217 | OPTS_TYPE_HASH_COPY
;
10218 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10219 dgst_size
= DGST_SIZE_4_32
;
10220 parse_func
= pbkdf2_sha1_parse_hash
;
10221 sort_by_digest
= sort_by_digest_4_32
;
10222 opti_type
= OPTI_TYPE_ZERO_BYTE
10223 | OPTI_TYPE_SLOW_HASH_SIMD
;
10230 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10231 salt_type
= SALT_TYPE_EMBEDDED
;
10232 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10233 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10234 | OPTS_TYPE_ST_BASE64
10235 | OPTS_TYPE_HASH_COPY
;
10236 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10237 dgst_size
= DGST_SIZE_8_16
;
10238 parse_func
= pbkdf2_sha512_parse_hash
;
10239 sort_by_digest
= sort_by_digest_8_16
;
10240 opti_type
= OPTI_TYPE_ZERO_BYTE
10241 | OPTI_TYPE_USES_BITS_64
10242 | OPTI_TYPE_SLOW_HASH_SIMD
;
10249 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10250 salt_type
= SALT_TYPE_EMBEDDED
;
10251 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10252 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10253 kern_type
= KERN_TYPE_ECRYPTFS
;
10254 dgst_size
= DGST_SIZE_8_8
;
10255 parse_func
= ecryptfs_parse_hash
;
10256 sort_by_digest
= sort_by_digest_8_8
;
10257 opti_type
= OPTI_TYPE_ZERO_BYTE
10258 | OPTI_TYPE_USES_BITS_64
;
10265 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10266 salt_type
= SALT_TYPE_EMBEDDED
;
10267 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10268 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10269 kern_type
= KERN_TYPE_ORACLET
;
10270 dgst_size
= DGST_SIZE_8_16
;
10271 parse_func
= oraclet_parse_hash
;
10272 sort_by_digest
= sort_by_digest_8_16
;
10273 opti_type
= OPTI_TYPE_ZERO_BYTE
10274 | OPTI_TYPE_USES_BITS_64
;
10281 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10282 salt_type
= SALT_TYPE_EMBEDDED
;
10283 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10284 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10285 kern_type
= KERN_TYPE_BSDICRYPT
;
10286 dgst_size
= DGST_SIZE_4_4
;
10287 parse_func
= bsdicrypt_parse_hash
;
10288 sort_by_digest
= sort_by_digest_4_4
;
10289 opti_type
= OPTI_TYPE_ZERO_BYTE
10290 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10297 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10298 salt_type
= SALT_TYPE_EMBEDDED
;
10299 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10301 kern_type
= KERN_TYPE_RAR3
;
10302 dgst_size
= DGST_SIZE_4_4
;
10303 parse_func
= rar3hp_parse_hash
;
10304 sort_by_digest
= sort_by_digest_4_4
;
10305 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10312 case 12600: hash_type
= HASH_TYPE_SHA256
;
10313 salt_type
= SALT_TYPE_INTERN
;
10314 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10315 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10316 | OPTS_TYPE_PT_ADD80
;
10317 kern_type
= KERN_TYPE_CF10
;
10318 dgst_size
= DGST_SIZE_4_8
;
10319 parse_func
= cf10_parse_hash
;
10320 sort_by_digest
= sort_by_digest_4_8
;
10321 opti_type
= OPTI_TYPE_ZERO_BYTE
10322 | OPTI_TYPE_PRECOMPUTE_INIT
10323 | OPTI_TYPE_EARLY_SKIP
10324 | OPTI_TYPE_NOT_ITERATED
;
10331 case 12700: hash_type
= HASH_TYPE_AES
;
10332 salt_type
= SALT_TYPE_EMBEDDED
;
10333 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10334 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10335 | OPTS_TYPE_HASH_COPY
;
10336 kern_type
= KERN_TYPE_MYWALLET
;
10337 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10338 parse_func
= mywallet_parse_hash
;
10339 sort_by_digest
= sort_by_digest_4_5
;
10340 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10347 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10348 salt_type
= SALT_TYPE_EMBEDDED
;
10349 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10350 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10351 kern_type
= KERN_TYPE_MS_DRSR
;
10352 dgst_size
= DGST_SIZE_4_8
;
10353 parse_func
= ms_drsr_parse_hash
;
10354 sort_by_digest
= sort_by_digest_4_8
;
10355 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10362 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10363 salt_type
= SALT_TYPE_EMBEDDED
;
10364 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10365 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10366 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10367 dgst_size
= DGST_SIZE_4_8
;
10368 parse_func
= androidfde_samsung_parse_hash
;
10369 sort_by_digest
= sort_by_digest_4_8
;
10370 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10377 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10378 salt_type
= SALT_TYPE_EMBEDDED
;
10379 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10381 kern_type
= KERN_TYPE_RAR5
;
10382 dgst_size
= DGST_SIZE_4_4
;
10383 parse_func
= rar5_parse_hash
;
10384 sort_by_digest
= sort_by_digest_4_4
;
10385 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10392 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10393 salt_type
= SALT_TYPE_EMBEDDED
;
10394 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10395 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10396 kern_type
= KERN_TYPE_KRB5TGS
;
10397 dgst_size
= DGST_SIZE_4_4
;
10398 parse_func
= krb5tgs_parse_hash
;
10399 sort_by_digest
= sort_by_digest_4_4
;
10400 opti_type
= OPTI_TYPE_ZERO_BYTE
10401 | OPTI_TYPE_NOT_ITERATED
;
10408 case 13200: hash_type
= HASH_TYPE_AES
;
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_AXCRYPT
;
10413 dgst_size
= DGST_SIZE_4_4
;
10414 parse_func
= axcrypt_parse_hash
;
10415 sort_by_digest
= sort_by_digest_4_4
;
10416 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10423 case 13300: hash_type
= HASH_TYPE_SHA1
;
10424 salt_type
= SALT_TYPE_NONE
;
10425 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10426 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10427 | OPTS_TYPE_PT_ADD80
10428 | OPTS_TYPE_PT_ADDBITS15
;
10429 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10430 dgst_size
= DGST_SIZE_4_5
;
10431 parse_func
= sha1axcrypt_parse_hash
;
10432 sort_by_digest
= sort_by_digest_4_5
;
10433 opti_type
= OPTI_TYPE_ZERO_BYTE
10434 | OPTI_TYPE_PRECOMPUTE_INIT
10435 | OPTI_TYPE_EARLY_SKIP
10436 | OPTI_TYPE_NOT_ITERATED
10437 | OPTI_TYPE_NOT_SALTED
;
10444 case 13400: hash_type
= HASH_TYPE_AES
;
10445 salt_type
= SALT_TYPE_EMBEDDED
;
10446 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10447 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10448 kern_type
= KERN_TYPE_KEEPASS
;
10449 dgst_size
= DGST_SIZE_4_4
;
10450 parse_func
= keepass_parse_hash
;
10451 sort_by_digest
= sort_by_digest_4_4
;
10452 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10459 case 13500: hash_type
= HASH_TYPE_SHA1
;
10460 salt_type
= SALT_TYPE_EMBEDDED
;
10461 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10462 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10463 | OPTS_TYPE_PT_UNICODE
10464 | OPTS_TYPE_PT_ADD80
;
10465 kern_type
= KERN_TYPE_PSTOKEN
;
10466 dgst_size
= DGST_SIZE_4_5
;
10467 parse_func
= pstoken_parse_hash
;
10468 sort_by_digest
= sort_by_digest_4_5
;
10469 opti_type
= OPTI_TYPE_ZERO_BYTE
10470 | OPTI_TYPE_PRECOMPUTE_INIT
10471 | OPTI_TYPE_EARLY_SKIP
10472 | OPTI_TYPE_NOT_ITERATED
10473 | OPTI_TYPE_PREPENDED_SALT
10474 | OPTI_TYPE_RAW_HASH
;
10481 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10482 salt_type
= SALT_TYPE_EMBEDDED
;
10483 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10484 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10485 kern_type
= KERN_TYPE_ZIP2
;
10486 dgst_size
= DGST_SIZE_4_4
;
10487 parse_func
= zip2_parse_hash
;
10488 sort_by_digest
= sort_by_digest_4_4
;
10489 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10496 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10497 salt_type
= SALT_TYPE_EMBEDDED
;
10498 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10500 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10501 dgst_size
= DGST_SIZE_4_5
;
10502 parse_func
= veracrypt_parse_hash_655331
;
10503 sort_by_digest
= sort_by_digest_4_5
;
10504 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10511 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10512 salt_type
= SALT_TYPE_EMBEDDED
;
10513 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10515 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10516 dgst_size
= DGST_SIZE_4_5
;
10517 parse_func
= veracrypt_parse_hash_655331
;
10518 sort_by_digest
= sort_by_digest_4_5
;
10519 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10526 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10527 salt_type
= SALT_TYPE_EMBEDDED
;
10528 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10530 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10531 dgst_size
= DGST_SIZE_4_5
;
10532 parse_func
= veracrypt_parse_hash_655331
;
10533 sort_by_digest
= sort_by_digest_4_5
;
10534 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10541 case 13721: hash_type
= HASH_TYPE_SHA512
;
10542 salt_type
= SALT_TYPE_EMBEDDED
;
10543 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10544 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10545 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10546 dgst_size
= DGST_SIZE_8_8
;
10547 parse_func
= veracrypt_parse_hash_500000
;
10548 sort_by_digest
= sort_by_digest_8_8
;
10549 opti_type
= OPTI_TYPE_ZERO_BYTE
10550 | OPTI_TYPE_USES_BITS_64
;
10557 case 13722: hash_type
= HASH_TYPE_SHA512
;
10558 salt_type
= SALT_TYPE_EMBEDDED
;
10559 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10560 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10561 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10562 dgst_size
= DGST_SIZE_8_8
;
10563 parse_func
= veracrypt_parse_hash_500000
;
10564 sort_by_digest
= sort_by_digest_8_8
;
10565 opti_type
= OPTI_TYPE_ZERO_BYTE
10566 | OPTI_TYPE_USES_BITS_64
;
10573 case 13723: hash_type
= HASH_TYPE_SHA512
;
10574 salt_type
= SALT_TYPE_EMBEDDED
;
10575 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10576 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10577 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10578 dgst_size
= DGST_SIZE_8_8
;
10579 parse_func
= veracrypt_parse_hash_500000
;
10580 sort_by_digest
= sort_by_digest_8_8
;
10581 opti_type
= OPTI_TYPE_ZERO_BYTE
10582 | OPTI_TYPE_USES_BITS_64
;
10589 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10590 salt_type
= SALT_TYPE_EMBEDDED
;
10591 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10592 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10593 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10594 dgst_size
= DGST_SIZE_4_8
;
10595 parse_func
= veracrypt_parse_hash_500000
;
10596 sort_by_digest
= sort_by_digest_4_8
;
10597 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10604 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10605 salt_type
= SALT_TYPE_EMBEDDED
;
10606 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10607 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10608 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10609 dgst_size
= DGST_SIZE_4_8
;
10610 parse_func
= veracrypt_parse_hash_500000
;
10611 sort_by_digest
= sort_by_digest_4_8
;
10612 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10619 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10620 salt_type
= SALT_TYPE_EMBEDDED
;
10621 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10623 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10624 dgst_size
= DGST_SIZE_4_8
;
10625 parse_func
= veracrypt_parse_hash_500000
;
10626 sort_by_digest
= sort_by_digest_4_8
;
10627 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10634 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10635 salt_type
= SALT_TYPE_EMBEDDED
;
10636 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10637 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10638 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10639 dgst_size
= DGST_SIZE_4_5
;
10640 parse_func
= veracrypt_parse_hash_327661
;
10641 sort_by_digest
= sort_by_digest_4_5
;
10642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10649 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10650 salt_type
= SALT_TYPE_EMBEDDED
;
10651 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10653 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10654 dgst_size
= DGST_SIZE_4_5
;
10655 parse_func
= veracrypt_parse_hash_327661
;
10656 sort_by_digest
= sort_by_digest_4_5
;
10657 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10664 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10665 salt_type
= SALT_TYPE_EMBEDDED
;
10666 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10667 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10668 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10669 dgst_size
= DGST_SIZE_4_5
;
10670 parse_func
= veracrypt_parse_hash_327661
;
10671 sort_by_digest
= sort_by_digest_4_5
;
10672 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10679 case 13751: hash_type
= HASH_TYPE_SHA256
;
10680 salt_type
= SALT_TYPE_EMBEDDED
;
10681 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10683 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10684 dgst_size
= DGST_SIZE_4_8
;
10685 parse_func
= veracrypt_parse_hash_500000
;
10686 sort_by_digest
= sort_by_digest_4_8
;
10687 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10694 case 13752: hash_type
= HASH_TYPE_SHA256
;
10695 salt_type
= SALT_TYPE_EMBEDDED
;
10696 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10697 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10698 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10699 dgst_size
= DGST_SIZE_4_8
;
10700 parse_func
= veracrypt_parse_hash_500000
;
10701 sort_by_digest
= sort_by_digest_4_8
;
10702 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10709 case 13753: hash_type
= HASH_TYPE_SHA256
;
10710 salt_type
= SALT_TYPE_EMBEDDED
;
10711 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10713 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10714 dgst_size
= DGST_SIZE_4_8
;
10715 parse_func
= veracrypt_parse_hash_500000
;
10716 sort_by_digest
= sort_by_digest_4_8
;
10717 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10724 case 13761: hash_type
= HASH_TYPE_SHA256
;
10725 salt_type
= SALT_TYPE_EMBEDDED
;
10726 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10728 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10729 dgst_size
= DGST_SIZE_4_8
;
10730 parse_func
= veracrypt_parse_hash_200000
;
10731 sort_by_digest
= sort_by_digest_4_8
;
10732 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10739 case 13762: hash_type
= HASH_TYPE_SHA256
;
10740 salt_type
= SALT_TYPE_EMBEDDED
;
10741 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10742 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10743 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10744 dgst_size
= DGST_SIZE_4_8
;
10745 parse_func
= veracrypt_parse_hash_200000
;
10746 sort_by_digest
= sort_by_digest_4_8
;
10747 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10754 case 13763: hash_type
= HASH_TYPE_SHA256
;
10755 salt_type
= SALT_TYPE_EMBEDDED
;
10756 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10758 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10759 dgst_size
= DGST_SIZE_4_8
;
10760 parse_func
= veracrypt_parse_hash_200000
;
10761 sort_by_digest
= sort_by_digest_4_8
;
10762 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10770 default: usage_mini_print (PROGNAME
); return (-1);
10777 data
.parse_func
= parse_func
;
10785 if (salt_type
== SALT_TYPE_INTERN
)
10787 opts_type
|= OPTS_TYPE_ST_HEX
;
10791 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10797 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10798 | (salt_type
== SALT_TYPE_EXTERN
)
10799 | (salt_type
== SALT_TYPE_EMBEDDED
)
10800 | (salt_type
== SALT_TYPE_VIRTUAL
));
10802 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10804 data
.hash_type
= hash_type
;
10805 data
.attack_mode
= attack_mode
;
10806 data
.attack_kern
= attack_kern
;
10807 data
.attack_exec
= attack_exec
;
10808 data
.kern_type
= kern_type
;
10809 data
.opts_type
= opts_type
;
10810 data
.dgst_size
= dgst_size
;
10811 data
.salt_type
= salt_type
;
10812 data
.isSalted
= isSalted
;
10813 data
.sort_by_digest
= sort_by_digest
;
10814 data
.dgst_pos0
= dgst_pos0
;
10815 data
.dgst_pos1
= dgst_pos1
;
10816 data
.dgst_pos2
= dgst_pos2
;
10817 data
.dgst_pos3
= dgst_pos3
;
10823 case 2500: esalt_size
= sizeof (wpa_t
); break;
10824 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10825 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10826 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10827 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10828 case 6211: esalt_size
= sizeof (tc_t
); break;
10829 case 6212: esalt_size
= sizeof (tc_t
); break;
10830 case 6213: esalt_size
= sizeof (tc_t
); break;
10831 case 6221: esalt_size
= sizeof (tc_t
); break;
10832 case 6222: esalt_size
= sizeof (tc_t
); break;
10833 case 6223: esalt_size
= sizeof (tc_t
); break;
10834 case 6231: esalt_size
= sizeof (tc_t
); break;
10835 case 6232: esalt_size
= sizeof (tc_t
); break;
10836 case 6233: esalt_size
= sizeof (tc_t
); break;
10837 case 6241: esalt_size
= sizeof (tc_t
); break;
10838 case 6242: esalt_size
= sizeof (tc_t
); break;
10839 case 6243: esalt_size
= sizeof (tc_t
); break;
10840 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10841 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10842 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10843 case 7300: esalt_size
= sizeof (rakp_t
); break;
10844 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10845 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10846 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10847 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10848 case 9400: esalt_size
= sizeof (office2007_t
); break;
10849 case 9500: esalt_size
= sizeof (office2010_t
); break;
10850 case 9600: esalt_size
= sizeof (office2013_t
); break;
10851 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10852 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10853 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10854 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10855 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10856 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10857 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10858 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10859 case 10400: esalt_size
= sizeof (pdf_t
); break;
10860 case 10410: esalt_size
= sizeof (pdf_t
); break;
10861 case 10420: esalt_size
= sizeof (pdf_t
); break;
10862 case 10500: esalt_size
= sizeof (pdf_t
); break;
10863 case 10600: esalt_size
= sizeof (pdf_t
); break;
10864 case 10700: esalt_size
= sizeof (pdf_t
); break;
10865 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10866 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10867 case 11400: esalt_size
= sizeof (sip_t
); break;
10868 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10869 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10870 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10871 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10872 case 13000: esalt_size
= sizeof (rar5_t
); break;
10873 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10874 case 13400: esalt_size
= sizeof (keepass_t
); break;
10875 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10876 case 13600: esalt_size
= sizeof (zip2_t
); break;
10877 case 13711: esalt_size
= sizeof (tc_t
); break;
10878 case 13712: esalt_size
= sizeof (tc_t
); break;
10879 case 13713: esalt_size
= sizeof (tc_t
); break;
10880 case 13721: esalt_size
= sizeof (tc_t
); break;
10881 case 13722: esalt_size
= sizeof (tc_t
); break;
10882 case 13723: esalt_size
= sizeof (tc_t
); break;
10883 case 13731: esalt_size
= sizeof (tc_t
); break;
10884 case 13732: esalt_size
= sizeof (tc_t
); break;
10885 case 13733: esalt_size
= sizeof (tc_t
); break;
10886 case 13741: esalt_size
= sizeof (tc_t
); break;
10887 case 13742: esalt_size
= sizeof (tc_t
); break;
10888 case 13743: esalt_size
= sizeof (tc_t
); break;
10889 case 13751: esalt_size
= sizeof (tc_t
); break;
10890 case 13752: esalt_size
= sizeof (tc_t
); break;
10891 case 13753: esalt_size
= sizeof (tc_t
); break;
10892 case 13761: esalt_size
= sizeof (tc_t
); break;
10893 case 13762: esalt_size
= sizeof (tc_t
); break;
10894 case 13763: esalt_size
= sizeof (tc_t
); break;
10897 data
.esalt_size
= esalt_size
;
10900 * choose dictionary parser
10903 if (hash_type
== HASH_TYPE_LM
)
10905 get_next_word_func
= get_next_word_lm
;
10907 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10909 get_next_word_func
= get_next_word_uc
;
10913 get_next_word_func
= get_next_word_std
;
10920 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10923 size_t dictstat_nmemb
= 0;
10927 uint dictstat_nmemb
= 0;
10930 char dictstat
[256] = { 0 };
10932 FILE *dictstat_fp
= NULL
;
10936 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10938 dictstat_fp
= fopen (dictstat
, "rb");
10943 struct stat tmpstat
;
10945 fstat (fileno (dictstat_fp
), &tmpstat
);
10949 struct stat64 tmpstat
;
10951 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10954 if (tmpstat
.st_mtime
< COMPTIME
)
10956 /* with v0.15 the format changed so we have to ensure user is using a good version
10957 since there is no version-header in the dictstat file */
10959 fclose (dictstat_fp
);
10965 while (!feof (dictstat_fp
))
10969 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
10971 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
10973 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
10975 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
10981 fclose (dictstat_fp
);
10990 char potfile
[256] = { 0 };
10992 if (potfile_path
== NULL
)
10994 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
10998 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11001 data
.pot_fp
= NULL
;
11003 FILE *out_fp
= NULL
;
11004 FILE *pot_fp
= NULL
;
11006 if (show
== 1 || left
== 1)
11008 pot_fp
= fopen (potfile
, "rb");
11010 if (pot_fp
== NULL
)
11012 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11017 if (outfile
!= NULL
)
11019 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11021 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11035 if (potfile_disable
== 0)
11037 pot_fp
= fopen (potfile
, "ab");
11039 if (pot_fp
== NULL
)
11041 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11046 data
.pot_fp
= pot_fp
;
11053 uint pot_avail
= 0;
11055 if (show
== 1 || left
== 1)
11057 SUPPRESS_OUTPUT
= 1;
11059 pot_avail
= count_lines (pot_fp
);
11063 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11065 uint pot_hashes_avail
= 0;
11069 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11071 while (!feof (pot_fp
))
11075 int line_len
= fgetl (pot_fp
, line_buf
);
11077 if (line_len
== 0) continue;
11079 char *plain_buf
= line_buf
+ line_len
;
11081 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11083 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11085 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11086 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11088 if (pot_cnt
== pot_hashes_avail
)
11092 for (pos
= 0; pos
< INCR_POT
; pos
++)
11094 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11096 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11098 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11100 tmp_hash
->digest
= mymalloc (dgst_size
);
11104 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11109 tmp_hash
->esalt
= mymalloc (esalt_size
);
11112 pot_hashes_avail
++;
11120 int iter
= MAX_CUT_TRIES
;
11124 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11126 if (line_buf
[i
] == ':')
11134 if (data
.hash_mode
!= 2500)
11136 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11140 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11142 if (line_len
> max_salt_size
)
11144 parser_status
= PARSER_GLOBAL_LENGTH
;
11148 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11150 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11152 hashes_buf
->salt
->salt_len
= line_len
;
11154 parser_status
= PARSER_OK
;
11158 // if NOT parsed without error, we add the ":" to the plain
11160 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11166 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11168 if (parser_status
< PARSER_GLOBAL_ZERO
)
11170 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11175 if (plain_len
>= 255) continue;
11177 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11179 pot_ptr
->plain_len
= plain_len
;
11188 SUPPRESS_OUTPUT
= 0;
11190 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11197 uint pw_min
= PW_MIN
;
11198 uint pw_max
= PW_MAX
;
11202 case 125: if (pw_max
> 32) pw_max
= 32;
11204 case 400: if (pw_max
> 40) pw_max
= 40;
11206 case 500: if (pw_max
> 16) pw_max
= 16;
11208 case 1500: if (pw_max
> 8) pw_max
= 8;
11210 case 1600: if (pw_max
> 16) pw_max
= 16;
11212 case 1800: if (pw_max
> 16) pw_max
= 16;
11214 case 2100: if (pw_max
> 16) pw_max
= 16;
11216 case 2500: if (pw_min
< 8) pw_min
= 8;
11218 case 3000: if (pw_max
> 7) pw_max
= 7;
11220 case 5200: if (pw_max
> 24) pw_max
= 24;
11222 case 5800: if (pw_max
> 16) pw_max
= 16;
11224 case 6300: if (pw_max
> 16) pw_max
= 16;
11226 case 7400: if (pw_max
> 16) pw_max
= 16;
11228 case 7500: if (pw_max
> 8) pw_max
= 8;
11230 case 7900: if (pw_max
> 48) pw_max
= 48;
11232 case 8500: if (pw_max
> 8) pw_max
= 8;
11234 case 8600: if (pw_max
> 16) pw_max
= 16;
11236 case 9710: pw_min
= 5;
11239 case 9810: pw_min
= 5;
11242 case 10410: pw_min
= 5;
11245 case 10300: if (pw_max
< 3) pw_min
= 3;
11246 if (pw_max
> 40) pw_max
= 40;
11248 case 10500: if (pw_max
< 3) pw_min
= 3;
11249 if (pw_max
> 40) pw_max
= 40;
11251 case 10700: if (pw_max
> 16) pw_max
= 16;
11253 case 11300: if (pw_max
> 40) pw_max
= 40;
11255 case 11600: if (pw_max
> 32) pw_max
= 32;
11257 case 12500: if (pw_max
> 20) pw_max
= 20;
11259 case 12800: if (pw_max
> 24) pw_max
= 24;
11263 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11265 switch (attack_kern
)
11267 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11269 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11275 * charsets : keep them together for more easy maintainnce
11278 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11279 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11281 mp_setup_sys (mp_sys
);
11283 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11284 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11285 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11286 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11289 * load hashes, part I: find input mode, count hashes
11292 uint hashlist_mode
= 0;
11293 uint hashlist_format
= HLFMT_HASHCAT
;
11295 uint hashes_avail
= 0;
11297 if (benchmark
== 0)
11301 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11303 if ((hash_mode
== 2500) ||
11304 (hash_mode
== 5200) ||
11305 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11306 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11307 (hash_mode
== 9000))
11309 hashlist_mode
= HL_MODE_ARG
;
11311 char *hashfile
= myargv
[optind
];
11313 data
.hashfile
= hashfile
;
11315 logfile_top_var_string ("target", hashfile
);
11318 if (hashlist_mode
== HL_MODE_ARG
)
11320 if (hash_mode
== 2500)
11324 if (stat (data
.hashfile
, &st
) == -1)
11326 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11331 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11338 else if (hashlist_mode
== HL_MODE_FILE
)
11340 char *hashfile
= myargv
[optind
];
11342 data
.hashfile
= hashfile
;
11344 logfile_top_var_string ("target", hashfile
);
11348 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11350 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11355 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11357 hashes_avail
= count_lines (fp
);
11361 if (hashes_avail
== 0)
11363 log_error ("ERROR: hashfile is empty or corrupt");
11370 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11372 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11374 log_error ("ERROR: remove not supported in native hashfile-format mode");
11386 hashlist_mode
= HL_MODE_ARG
;
11391 if (hash_mode
== 3000) hashes_avail
*= 2;
11393 data
.hashlist_mode
= hashlist_mode
;
11394 data
.hashlist_format
= hashlist_format
;
11396 logfile_top_uint (hashlist_mode
);
11397 logfile_top_uint (hashlist_format
);
11400 * load hashes, part II: allocate required memory, set pointers
11403 hash_t
*hashes_buf
= NULL
;
11404 void *digests_buf
= NULL
;
11405 salt_t
*salts_buf
= NULL
;
11406 void *esalts_buf
= NULL
;
11408 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11410 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11412 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11416 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11418 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11420 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11422 if (username
&& (remove
|| show
|| left
))
11424 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11429 hash_info
->orighash
= (char *) mymalloc (256);
11436 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11440 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11445 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11448 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11450 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11454 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11458 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11463 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11468 * load hashes, part III: parse hashes or generate them if benchmark
11471 uint hashes_cnt
= 0;
11473 if (benchmark
== 0)
11477 // useless to read hash file for keyspace, cheat a little bit w/ optind
11479 else if (hashes_avail
== 0)
11482 else if (hashlist_mode
== HL_MODE_ARG
)
11484 char *input_buf
= myargv
[optind
];
11486 uint input_len
= strlen (input_buf
);
11488 logfile_top_var_string ("target", input_buf
);
11490 char *hash_buf
= NULL
;
11493 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11495 bool hash_fmt_error
= 0;
11497 if (hash_len
< 1) hash_fmt_error
= 1;
11498 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11500 if (hash_fmt_error
)
11502 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11506 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11508 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11510 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11515 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11518 int parser_status
= PARSER_OK
;
11520 if (hash_mode
== 2500)
11524 log_error ("ERROR: hccap file not specified");
11529 hashlist_mode
= HL_MODE_FILE
;
11531 data
.hashlist_mode
= hashlist_mode
;
11533 FILE *fp
= fopen (hash_buf
, "rb");
11537 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11542 if (hashes_avail
< 1)
11544 log_error ("ERROR: hccap file is empty or corrupt");
11551 uint hccap_size
= sizeof (hccap_t
);
11553 char *in
= (char *) mymalloc (hccap_size
);
11557 int n
= fread (in
, hccap_size
, 1, fp
);
11561 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11566 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11568 if (parser_status
!= PARSER_OK
)
11570 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11575 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11577 if ((show
== 1) || (left
== 1))
11579 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11581 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11583 int cur_pos
= tmp_salt
->salt_len
;
11584 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11586 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11588 // do the appending task
11590 snprintf (salt_ptr
+ cur_pos
,
11592 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11604 wpa
->orig_mac2
[5]);
11606 // memset () the remaining part of the salt
11608 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11609 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11611 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11613 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11616 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
);
11617 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
);
11626 else if (hash_mode
== 3000)
11628 if (hash_len
== 32)
11630 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11632 hash_t
*lm_hash_left
= NULL
;
11634 if (parser_status
== PARSER_OK
)
11636 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11642 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11645 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11647 hash_t
*lm_hash_right
= NULL
;
11649 if (parser_status
== PARSER_OK
)
11651 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11657 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11662 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11664 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
);
11665 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
);
11670 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11672 if (parser_status
== PARSER_OK
)
11674 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11675 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11678 if (parser_status
== PARSER_OK
)
11684 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11690 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11692 if (parser_status
== PARSER_OK
)
11694 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11695 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11698 if (parser_status
== PARSER_OK
)
11704 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11709 else if (hashlist_mode
== HL_MODE_FILE
)
11711 char *hashfile
= data
.hashfile
;
11715 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11717 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11724 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11730 int line_len
= fgetl (fp
, line_buf
);
11732 if (line_len
== 0) continue;
11734 char *hash_buf
= NULL
;
11737 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11739 bool hash_fmt_error
= 0;
11741 if (hash_len
< 1) hash_fmt_error
= 1;
11742 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11744 if (hash_fmt_error
)
11746 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11753 char *user_buf
= NULL
;
11756 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11758 if (remove
|| show
)
11760 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11762 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11764 user_t
*user_ptr
= *user
;
11766 if (user_buf
!= NULL
)
11768 user_ptr
->user_name
= mystrdup (user_buf
);
11772 user_ptr
->user_name
= mystrdup ("");
11775 user_ptr
->user_len
= user_len
;
11779 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11781 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11783 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11788 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11791 if (hash_mode
== 3000)
11793 if (hash_len
== 32)
11795 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11797 if (parser_status
< PARSER_GLOBAL_ZERO
)
11799 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11804 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11808 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11810 if (parser_status
< PARSER_GLOBAL_ZERO
)
11812 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11817 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11819 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);
11825 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
);
11826 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
);
11830 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11832 if (parser_status
< PARSER_GLOBAL_ZERO
)
11834 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11839 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);
11841 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11842 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11849 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11851 if (parser_status
< PARSER_GLOBAL_ZERO
)
11853 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11858 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);
11860 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11861 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11871 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11873 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11880 hashes_buf
[0].salt
->salt_len
= 8;
11882 // special salt handling
11886 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11887 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11889 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11891 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11893 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11895 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11897 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11899 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11901 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11903 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11905 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11907 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11908 hashes_buf
[0].salt
->scrypt_N
= 1024;
11909 hashes_buf
[0].salt
->scrypt_r
= 1;
11910 hashes_buf
[0].salt
->scrypt_p
= 1;
11912 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11914 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11915 hashes_buf
[0].salt
->scrypt_N
= 16384;
11916 hashes_buf
[0].salt
->scrypt_r
= 1;
11917 hashes_buf
[0].salt
->scrypt_p
= 1;
11919 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11921 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11923 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11925 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11927 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11929 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11931 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11933 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11935 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11937 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11939 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11941 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11943 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11945 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11947 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11951 // special esalt handling
11955 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11957 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11958 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11960 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11961 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11963 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11964 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11965 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11966 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11968 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11969 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11970 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11971 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11973 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
11975 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11976 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11977 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11979 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11980 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11981 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11983 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11984 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11985 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11987 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11988 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11989 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11991 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11992 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11993 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11995 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11996 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11997 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11999 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12000 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12001 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12003 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12005 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12007 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12008 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12009 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12018 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12020 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12022 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12024 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12026 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12028 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12030 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12032 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12034 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12036 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12038 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12040 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12042 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12044 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12046 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12048 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12050 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12052 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12054 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12056 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12058 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12060 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12062 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12064 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12066 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12068 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12070 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12072 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12074 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12076 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12078 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12080 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12082 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12084 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12086 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12088 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12092 // set default iterations
12096 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12098 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12100 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12102 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12104 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12106 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12108 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12110 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12112 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12114 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12116 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12118 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12120 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12122 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12124 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12126 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12128 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12130 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12132 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12134 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12136 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12138 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12140 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12142 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12144 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12146 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12148 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12150 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12152 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12154 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12156 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12158 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12160 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12162 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12164 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12166 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12168 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12170 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12172 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12174 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12176 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12178 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12180 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12182 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12184 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12186 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12188 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12190 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12192 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12194 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12196 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12198 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12200 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12202 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12204 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12206 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12208 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12210 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12212 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12214 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12216 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12218 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12220 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12222 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12224 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12226 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12228 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12230 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12232 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12234 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12236 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12238 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12240 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12242 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12244 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12246 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12248 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12250 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12252 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12254 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12256 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12258 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12265 if (show
== 1 || left
== 1)
12267 for (uint i
= 0; i
< pot_cnt
; i
++)
12269 pot_t
*pot_ptr
= &pot
[i
];
12271 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12273 local_free (hashes_buf
->digest
);
12277 local_free (hashes_buf
->salt
);
12283 if (data
.quiet
== 0) log_info_nn ("");
12290 if (hashes_cnt
== 0)
12292 log_error ("ERROR: No hashes loaded");
12299 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12302 if (data
.outfile
!= NULL
)
12304 if (data
.hashfile
!= NULL
)
12307 struct stat tmpstat_outfile
;
12308 struct stat tmpstat_hashfile
;
12312 struct stat64 tmpstat_outfile
;
12313 struct stat64 tmpstat_hashfile
;
12316 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12318 if (tmp_outfile_fp
)
12321 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12325 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12328 fclose (tmp_outfile_fp
);
12331 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12333 if (tmp_hashfile_fp
)
12336 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12340 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12343 fclose (tmp_hashfile_fp
);
12346 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12348 tmpstat_outfile
.st_mode
= 0;
12349 tmpstat_outfile
.st_nlink
= 0;
12350 tmpstat_outfile
.st_uid
= 0;
12351 tmpstat_outfile
.st_gid
= 0;
12352 tmpstat_outfile
.st_rdev
= 0;
12353 tmpstat_outfile
.st_atime
= 0;
12355 tmpstat_hashfile
.st_mode
= 0;
12356 tmpstat_hashfile
.st_nlink
= 0;
12357 tmpstat_hashfile
.st_uid
= 0;
12358 tmpstat_hashfile
.st_gid
= 0;
12359 tmpstat_hashfile
.st_rdev
= 0;
12360 tmpstat_hashfile
.st_atime
= 0;
12363 tmpstat_outfile
.st_blksize
= 0;
12364 tmpstat_outfile
.st_blocks
= 0;
12366 tmpstat_hashfile
.st_blksize
= 0;
12367 tmpstat_hashfile
.st_blocks
= 0;
12371 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12373 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12380 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12382 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12392 * Remove duplicates
12395 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12399 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12403 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12406 uint hashes_cnt_orig
= hashes_cnt
;
12410 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12414 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12416 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12421 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12424 if (hashes_pos
> hashes_cnt
)
12426 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12436 uint potfile_remove_cracks
= 0;
12438 if (potfile_disable
== 0)
12442 hash_buf
.digest
= mymalloc (dgst_size
);
12443 hash_buf
.salt
= NULL
;
12444 hash_buf
.esalt
= NULL
;
12445 hash_buf
.hash_info
= NULL
;
12446 hash_buf
.cracked
= 0;
12450 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12455 hash_buf
.esalt
= mymalloc (esalt_size
);
12458 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12460 // no solution for these special hash types (for instane because they use hashfile in output etc)
12461 if ((hash_mode
!= 5200) &&
12462 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12463 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12464 (hash_mode
!= 9000))
12466 FILE *fp
= fopen (potfile
, "rb");
12470 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12472 // to be safe work with a copy (because of line_len loop, i etc)
12473 // moved up here because it's easier to handle continue case
12476 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12480 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12482 if (ptr
== NULL
) break;
12484 int line_len
= strlen (line_buf
);
12486 if (line_len
== 0) continue;
12488 int iter
= MAX_CUT_TRIES
;
12490 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12492 if (line_buf
[i
] != ':') continue;
12496 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12499 hash_t
*found
= NULL
;
12501 if (hash_mode
== 6800)
12503 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12505 // manipulate salt_buf
12506 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12508 hash_buf
.salt
->salt_len
= i
;
12510 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12513 else if (hash_mode
== 2500)
12515 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12517 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12518 // manipulate salt_buf
12520 memcpy (line_buf_cpy
, line_buf
, i
);
12522 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12524 if (mac2_pos
== NULL
) continue;
12529 if (strlen (mac2_pos
) != 12) continue;
12531 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12533 if (mac1_pos
== NULL
) continue;
12538 if (strlen (mac1_pos
) != 12) continue;
12540 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12542 // here we need the ESSID
12543 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12545 hash_buf
.salt
->salt_len
= essid_length
;
12547 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12551 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12553 // compare hex string(s) vs binary MAC address(es)
12555 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12557 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12566 if (!found
) continue;
12568 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12570 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12582 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12584 if (parser_status
== PARSER_OK
)
12588 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12592 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12597 if (found
== NULL
) continue;
12599 if (!found
->cracked
) potfile_remove_cracks
++;
12601 found
->cracked
= 1;
12609 myfree (line_buf_cpy
);
12619 local_free (hash_buf
.esalt
);
12624 local_free (hash_buf
.salt
);
12627 local_free (hash_buf
.digest
);
12631 * Now generate all the buffers required for later
12634 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12636 salt_t
*salts_buf_new
= NULL
;
12637 void *esalts_buf_new
= NULL
;
12641 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12645 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12650 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12653 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12655 uint digests_cnt
= hashes_cnt
;
12656 uint digests_done
= 0;
12658 size_t size_digests
= digests_cnt
* dgst_size
;
12659 size_t size_shown
= digests_cnt
* sizeof (uint
);
12661 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12662 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12664 uint salts_cnt
= 0;
12665 uint salts_done
= 0;
12667 hashinfo_t
**hash_info
= NULL
;
12669 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12671 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12673 if (username
&& (remove
|| show
))
12677 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12679 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12681 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12686 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12691 // copied from inner loop
12693 salt_buf
= &salts_buf_new
[salts_cnt
];
12695 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12699 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12702 salt_buf
->digests_cnt
= 0;
12703 salt_buf
->digests_done
= 0;
12704 salt_buf
->digests_offset
= 0;
12709 if (hashes_buf
[0].cracked
== 1)
12711 digests_shown
[0] = 1;
12715 salt_buf
->digests_done
++;
12718 salt_buf
->digests_cnt
++;
12720 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12722 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12724 hash_info
[0] = hashes_buf
[0].hash_info
;
12727 // copy from inner loop
12729 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12733 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12735 salt_buf
= &salts_buf_new
[salts_cnt
];
12737 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12741 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12744 salt_buf
->digests_cnt
= 0;
12745 salt_buf
->digests_done
= 0;
12746 salt_buf
->digests_offset
= hashes_pos
;
12752 if (hashes_buf
[hashes_pos
].cracked
== 1)
12754 digests_shown
[hashes_pos
] = 1;
12758 salt_buf
->digests_done
++;
12761 salt_buf
->digests_cnt
++;
12763 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12765 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12767 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12771 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12773 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12775 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12777 salts_shown
[salt_pos
] = 1;
12782 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12785 local_free (digests_buf
);
12786 local_free (salts_buf
);
12787 local_free (esalts_buf
);
12789 digests_buf
= digests_buf_new
;
12790 salts_buf
= salts_buf_new
;
12791 esalts_buf
= esalts_buf_new
;
12793 local_free (hashes_buf
);
12796 * special modification not set from parser
12801 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12802 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12803 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12804 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12805 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12806 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12807 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12808 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12809 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12810 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12811 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12812 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12813 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12814 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12815 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12816 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12817 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12818 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12819 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12820 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12821 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12822 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12823 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12824 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12825 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12826 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12827 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12828 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12829 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12830 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12833 if (truecrypt_keyfiles
)
12835 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12837 char *keyfiles
= strdup (truecrypt_keyfiles
);
12839 char *keyfile
= strtok (keyfiles
, ",");
12843 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12845 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12850 if (veracrypt_keyfiles
)
12852 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12854 char *keyfiles
= strdup (veracrypt_keyfiles
);
12856 char *keyfile
= strtok (keyfiles
, ",");
12860 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12862 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12867 data
.digests_cnt
= digests_cnt
;
12868 data
.digests_done
= digests_done
;
12869 data
.digests_buf
= digests_buf
;
12870 data
.digests_shown
= digests_shown
;
12871 data
.digests_shown_tmp
= digests_shown_tmp
;
12873 data
.salts_cnt
= salts_cnt
;
12874 data
.salts_done
= salts_done
;
12875 data
.salts_buf
= salts_buf
;
12876 data
.salts_shown
= salts_shown
;
12878 data
.esalts_buf
= esalts_buf
;
12879 data
.hash_info
= hash_info
;
12882 * Automatic Optimizers
12885 if (salts_cnt
== 1)
12886 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12888 if (digests_cnt
== 1)
12889 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12891 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12892 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12894 if (attack_mode
== ATTACK_MODE_BF
)
12895 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12897 data
.opti_type
= opti_type
;
12899 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12901 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12903 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12905 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12907 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12908 opts_type
|= OPTS_TYPE_PT_ADD80
;
12911 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12913 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12914 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12917 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12919 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12920 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12927 * Some algorithm, like descrypt, can benefit from JIT compilation
12930 int force_jit_compilation
= -1;
12932 if (hash_mode
== 8900)
12934 force_jit_compilation
= 8900;
12936 else if (hash_mode
== 9300)
12938 force_jit_compilation
= 8900;
12940 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12942 force_jit_compilation
= 1500;
12946 * generate bitmap tables
12949 const uint bitmap_shift1
= 5;
12950 const uint bitmap_shift2
= 13;
12952 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12954 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12955 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12956 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12957 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12958 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12959 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12960 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12961 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12968 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12970 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12972 bitmap_nums
= 1 << bitmap_bits
;
12974 bitmap_mask
= bitmap_nums
- 1;
12976 bitmap_size
= bitmap_nums
* sizeof (uint
);
12978 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12980 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;
12981 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;
12986 bitmap_nums
= 1 << bitmap_bits
;
12988 bitmap_mask
= bitmap_nums
- 1;
12990 bitmap_size
= bitmap_nums
* sizeof (uint
);
12992 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);
12993 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);
12996 * prepare quick rule
12999 data
.rule_buf_l
= rule_buf_l
;
13000 data
.rule_buf_r
= rule_buf_r
;
13002 int rule_len_l
= (int) strlen (rule_buf_l
);
13003 int rule_len_r
= (int) strlen (rule_buf_r
);
13005 data
.rule_len_l
= rule_len_l
;
13006 data
.rule_len_r
= rule_len_r
;
13012 uint
*all_kernel_rules_cnt
= NULL
;
13014 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13018 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13020 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13023 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13027 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13029 uint kernel_rules_avail
= 0;
13031 uint kernel_rules_cnt
= 0;
13033 kernel_rule_t
*kernel_rules_buf
= NULL
;
13035 char *rp_file
= rp_files
[i
];
13037 char in
[BLOCK_SIZE
] = { 0 };
13038 char out
[BLOCK_SIZE
] = { 0 };
13042 uint rule_line
= 0;
13044 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13046 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13053 memset (rule_buf
, 0, HCBUFSIZ
);
13055 rule_len
= fgetl (fp
, rule_buf
);
13059 if (rule_len
== 0) continue;
13061 if (rule_buf
[0] == '#') continue;
13063 if (kernel_rules_avail
== kernel_rules_cnt
)
13065 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13067 kernel_rules_avail
+= INCR_RULES
;
13070 memset (in
, 0, BLOCK_SIZE
);
13071 memset (out
, 0, BLOCK_SIZE
);
13073 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13077 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13082 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13084 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13086 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13092 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13094 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13100 kernel_rules_cnt
++;
13105 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13107 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13111 * merge rules or automatic rule generator
13114 uint kernel_rules_cnt
= 0;
13116 kernel_rule_t
*kernel_rules_buf
= NULL
;
13118 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13122 kernel_rules_cnt
= 1;
13124 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13126 repeats
[0] = kernel_rules_cnt
;
13128 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13130 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13132 repeats
[i
+ 1] = kernel_rules_cnt
;
13135 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13137 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13139 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13143 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13145 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13147 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13150 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13152 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13154 if (out_pos
== RULES_MAX
- 1)
13156 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13161 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13166 local_free (repeats
);
13170 uint kernel_rules_avail
= 0;
13172 while (kernel_rules_cnt
< rp_gen
)
13174 if (kernel_rules_avail
== kernel_rules_cnt
)
13176 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13178 kernel_rules_avail
+= INCR_RULES
;
13181 memset (rule_buf
, 0, HCBUFSIZ
);
13183 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13185 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13187 kernel_rules_cnt
++;
13195 * generate NOP rules
13198 if (kernel_rules_cnt
== 0)
13200 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13202 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13204 kernel_rules_cnt
++;
13207 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13208 data
.kernel_rules_buf
= kernel_rules_buf
;
13211 * OpenCL platforms: detect
13214 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13215 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13217 cl_uint platforms_cnt
= 0;
13218 cl_uint platform_devices_cnt
= 0;
13222 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13224 if (platforms_cnt
== 0)
13227 log_info ("ATTENTION! No OpenCL compatible platform found");
13229 log_info ("You're probably missing the OpenCL runtime installation");
13230 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13231 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13232 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13238 if (opencl_platforms_filter
!= (uint
) -1)
13240 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13242 if (opencl_platforms_filter
> platform_cnt_mask
)
13244 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13252 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13255 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13257 cl_platform_id platform
= platforms
[platform_id
];
13259 char platform_vendor
[INFOSZ
] = { 0 };
13261 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13264 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13265 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13267 // make sure that we do not directly control the fan for NVidia
13269 gpu_temp_retain
= 0;
13271 data
.gpu_temp_retain
= gpu_temp_retain
;
13273 #endif // HAVE_NVML || HAVE_NVAPI
13278 * OpenCL device types:
13279 * 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.
13280 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13283 if (opencl_device_types
== NULL
)
13285 cl_device_type device_types_all
= 0;
13287 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13289 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13291 cl_platform_id platform
= platforms
[platform_id
];
13293 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13295 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13297 cl_device_id device
= platform_devices
[platform_devices_id
];
13299 cl_device_type device_type
;
13301 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13303 device_types_all
|= device_type
;
13307 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13309 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13314 * OpenCL devices: simply push all devices from all platforms into the same device array
13317 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13319 data
.devices_param
= devices_param
;
13321 uint devices_cnt
= 0;
13323 uint devices_active
= 0;
13325 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13327 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13329 cl_platform_id platform
= platforms
[platform_id
];
13331 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13333 char platform_vendor
[INFOSZ
] = { 0 };
13335 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13337 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13338 // this causes trouble with vendor id based macros
13339 // we'll assign generic to those without special optimization available
13341 cl_uint platform_vendor_id
= 0;
13343 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13345 platform_vendor_id
= VENDOR_ID_AMD
;
13347 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13349 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13351 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13353 platform_vendor_id
= VENDOR_ID_APPLE
;
13355 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13357 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13359 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13361 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13363 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13365 platform_vendor_id
= VENDOR_ID_MESA
;
13367 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13369 platform_vendor_id
= VENDOR_ID_NV
;
13371 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13373 platform_vendor_id
= VENDOR_ID_POCL
;
13377 platform_vendor_id
= VENDOR_ID_GENERIC
;
13380 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13382 size_t param_value_size
= 0;
13384 const uint device_id
= devices_cnt
;
13386 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13388 device_param
->platform_vendor_id
= platform_vendor_id
;
13390 device_param
->device
= platform_devices
[platform_devices_id
];
13392 device_param
->device_id
= device_id
;
13394 device_param
->platform_devices_id
= platform_devices_id
;
13398 cl_device_type device_type
;
13400 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13402 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13404 device_param
->device_type
= device_type
;
13408 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13410 char *device_name
= (char *) mymalloc (param_value_size
);
13412 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13414 device_param
->device_name
= device_name
;
13418 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13420 char *device_vendor
= (char *) mymalloc (param_value_size
);
13422 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13424 device_param
->device_vendor
= device_vendor
;
13426 cl_uint device_vendor_id
= 0;
13428 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13430 device_vendor_id
= VENDOR_ID_AMD
;
13432 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13434 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13436 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13438 device_vendor_id
= VENDOR_ID_APPLE
;
13440 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13442 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13444 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13446 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13448 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13450 device_vendor_id
= VENDOR_ID_MESA
;
13452 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13454 device_vendor_id
= VENDOR_ID_NV
;
13456 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13458 device_vendor_id
= VENDOR_ID_POCL
;
13462 device_vendor_id
= VENDOR_ID_GENERIC
;
13465 device_param
->device_vendor_id
= device_vendor_id
;
13469 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13473 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13475 char *device_version
= (char *) mymalloc (param_value_size
);
13477 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13479 device_param
->device_version
= device_version
;
13481 // device_opencl_version
13483 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13485 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13487 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13489 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13491 myfree (device_opencl_version
);
13495 cl_uint vector_width
;
13497 if (opencl_vector_width_chgd
== 0)
13499 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13501 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13503 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13507 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13512 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13517 vector_width
= opencl_vector_width
;
13520 if (vector_width
> 16) vector_width
= 16;
13522 device_param
->vector_width
= vector_width
;
13524 // max_compute_units
13526 cl_uint device_processors
;
13528 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13530 device_param
->device_processors
= device_processors
;
13532 // device_maxmem_alloc
13533 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13535 cl_ulong device_maxmem_alloc
;
13537 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13539 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13541 // device_global_mem
13543 cl_ulong device_global_mem
;
13545 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13547 device_param
->device_global_mem
= device_global_mem
;
13549 // max_work_group_size
13551 size_t device_maxworkgroup_size
;
13553 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13555 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13557 // max_clock_frequency
13559 cl_uint device_maxclock_frequency
;
13561 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13563 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13565 // device_endian_little
13567 cl_bool device_endian_little
;
13569 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13571 if (device_endian_little
== CL_FALSE
)
13573 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13575 device_param
->skipped
= 1;
13578 // device_available
13580 cl_bool device_available
;
13582 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13584 if (device_available
== CL_FALSE
)
13586 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13588 device_param
->skipped
= 1;
13591 // device_compiler_available
13593 cl_bool device_compiler_available
;
13595 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13597 if (device_compiler_available
== CL_FALSE
)
13599 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13601 device_param
->skipped
= 1;
13604 // device_execution_capabilities
13606 cl_device_exec_capabilities device_execution_capabilities
;
13608 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13610 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13612 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13614 device_param
->skipped
= 1;
13617 // device_extensions
13619 size_t device_extensions_size
;
13621 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13623 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13625 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13627 if (strstr (device_extensions
, "base_atomics") == 0)
13629 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13631 device_param
->skipped
= 1;
13634 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13636 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13638 device_param
->skipped
= 1;
13641 myfree (device_extensions
);
13643 // device_local_mem_size
13645 cl_ulong device_local_mem_size
;
13647 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13649 if (device_local_mem_size
< 32768)
13651 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13653 device_param
->skipped
= 1;
13656 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13657 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13658 // This results in both utilizing it for 50%
13659 // However, Intel has much better SIMD control over their own hardware
13660 // It makes sense to give them full control over their own hardware
13662 if (device_type
& CL_DEVICE_TYPE_CPU
)
13664 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13666 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13668 device_param
->skipped
= 1;
13674 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13675 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13679 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13681 char *driver_version
= (char *) mymalloc (param_value_size
);
13683 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13685 device_param
->driver_version
= driver_version
;
13687 // device_name_chksum
13689 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13692 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
);
13694 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
);
13697 uint device_name_digest
[4] = { 0 };
13699 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13701 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13703 device_param
->device_name_chksum
= device_name_chksum
;
13705 // device_processor_cores
13707 if (device_type
& CL_DEVICE_TYPE_CPU
)
13709 cl_uint device_processor_cores
= 1;
13711 device_param
->device_processor_cores
= device_processor_cores
;
13714 if (device_type
& CL_DEVICE_TYPE_GPU
)
13716 if (device_vendor_id
== VENDOR_ID_AMD
)
13718 cl_uint device_processor_cores
= 0;
13720 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13722 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13724 device_param
->device_processor_cores
= device_processor_cores
;
13726 else if (device_vendor_id
== VENDOR_ID_NV
)
13728 cl_uint kernel_exec_timeout
= 0;
13730 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13732 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13734 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13736 cl_uint device_processor_cores
= 0;
13738 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13740 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13742 device_param
->device_processor_cores
= device_processor_cores
;
13744 cl_uint sm_minor
= 0;
13745 cl_uint sm_major
= 0;
13747 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13748 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13750 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13751 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13753 device_param
->sm_minor
= sm_minor
;
13754 device_param
->sm_major
= sm_major
;
13758 cl_uint device_processor_cores
= 1;
13760 device_param
->device_processor_cores
= device_processor_cores
;
13766 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13768 if (machine_readable
== 0)
13770 if (device_param
->skipped
== 0)
13772 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13775 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13776 (unsigned int) (device_global_mem
/ 1024 / 1024),
13777 (unsigned int) device_processors
);
13781 log_info ("Device #%u: %s, skipped",
13788 // common driver check
13790 if (device_param
->skipped
== 0)
13792 if (device_type
& CL_DEVICE_TYPE_GPU
)
13794 if (platform_vendor_id
== VENDOR_ID_AMD
)
13796 int catalyst_check
= (force
== 1) ? 0 : 1;
13798 int catalyst_warn
= 0;
13800 int catalyst_broken
= 0;
13802 if (catalyst_check
== 1)
13806 // v14.9 and higher
13807 if (atoi (device_param
->driver_version
) >= 1573)
13812 catalyst_check
= 0;
13815 if (catalyst_broken
== 1)
13818 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13819 log_info ("It will pass over cracked hashes and does not report them as cracked");
13820 log_info ("You are STRONGLY encouraged not to use it");
13821 log_info ("You can use --force to override this but do not post error reports if you do so");
13827 if (catalyst_warn
== 1)
13830 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13831 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13832 log_info ("See hashcat's homepage for official supported catalyst drivers");
13834 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13836 log_info ("You can use --force to override this but do not post error reports if you do so");
13842 else if (platform_vendor_id
== VENDOR_ID_NV
)
13844 if (device_param
->kernel_exec_timeout
!= 0)
13846 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);
13847 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13852 /* turns out pocl still creates segfaults (because of llvm)
13853 if (device_type & CL_DEVICE_TYPE_CPU)
13855 if (platform_vendor_id == VENDOR_ID_AMD)
13860 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13861 log_info ("You are STRONGLY encouraged not to use it");
13862 log_info ("You can use --force to override this but do not post error reports if you do so");
13863 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13873 * kernel accel and loops tuning db adjustment
13876 device_param
->kernel_accel_min
= 1;
13877 device_param
->kernel_accel_max
= 1024;
13879 device_param
->kernel_loops_min
= 1;
13880 device_param
->kernel_loops_max
= 1024;
13882 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13884 if (tuningdb_entry
)
13886 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13887 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13891 device_param
->kernel_accel_min
= _kernel_accel
;
13892 device_param
->kernel_accel_max
= _kernel_accel
;
13897 if (workload_profile
== 1)
13899 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13901 else if (workload_profile
== 2)
13903 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13906 device_param
->kernel_loops_min
= _kernel_loops
;
13907 device_param
->kernel_loops_max
= _kernel_loops
;
13911 // commandline parameters overwrite tuningdb entries
13915 device_param
->kernel_accel_min
= kernel_accel
;
13916 device_param
->kernel_accel_max
= kernel_accel
;
13921 device_param
->kernel_loops_min
= kernel_loops
;
13922 device_param
->kernel_loops_max
= kernel_loops
;
13938 if (keyspace
== 0 && devices_active
== 0)
13940 log_error ("ERROR: No devices found/left");
13945 // 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)
13947 if (devices_filter
!= (uint
) -1)
13949 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13951 if (devices_filter
> devices_cnt_mask
)
13953 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13959 data
.devices_cnt
= devices_cnt
;
13961 data
.devices_active
= devices_active
;
13963 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13965 if (machine_readable
== 0)
13976 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13977 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
13981 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
13984 if (gpu_temp_disable
== 0)
13986 #if defined(WIN) && defined(HAVE_NVAPI)
13987 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
13989 if (nvapi_init (nvapi
) == 0)
13990 data
.hm_nv
= nvapi
;
13994 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
13996 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13998 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14002 for (int i
= 0; i
< tmp_in
; i
++)
14004 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14007 for (int i
= 0; i
< tmp_out
; i
++)
14009 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
14011 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
14013 if (hm_NvAPI_GPU_GetCoolerSettings (data
.hm_nv
, hm_adapters_nv
[i
].adapter_index
.nv
, 0, &pCoolerSettings
) != NVAPI_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
14017 #endif // WIN && HAVE_NVAPI
14019 #if defined(LINUX) && defined(HAVE_NVML)
14020 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14022 if (nvml_init (nvml
) == 0)
14027 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
14029 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14031 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14035 for (int i
= 0; i
< tmp_in
; i
++)
14037 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14040 for (int i
= 0; i
< tmp_out
; i
++)
14042 unsigned int speed
;
14044 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nv
, 1, hm_adapters_nv
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
14048 #endif // LINUX && HAVE_NVML
14050 data
.hm_amd
= NULL
;
14053 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14055 if (adl_init (adl
) == 0)
14060 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14062 // total number of adapters
14064 int hm_adapters_num
;
14066 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14070 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14072 if (lpAdapterInfo
== NULL
) return (-1);
14074 // get a list (of ids of) valid/usable adapters
14076 int num_adl_adapters
= 0;
14078 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14080 if (num_adl_adapters
> 0)
14082 hc_thread_mutex_lock (mux_adl
);
14084 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14086 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14088 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14089 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14091 hc_thread_mutex_unlock (mux_adl
);
14094 myfree (valid_adl_device_list
);
14095 myfree (lpAdapterInfo
);
14100 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14102 gpu_temp_disable
= 1;
14107 * OpenCL devices: allocate buffer for device specific information
14111 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14114 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14116 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14121 * enable custom signal handler(s)
14124 if (benchmark
== 0)
14126 hc_signal (sigHandler_default
);
14130 hc_signal (sigHandler_benchmark
);
14134 * User-defined GPU temp handling
14138 if (gpu_temp_disable
== 1)
14140 gpu_temp_abort
= 0;
14141 gpu_temp_retain
= 0;
14144 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14146 if (gpu_temp_abort
< gpu_temp_retain
)
14148 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14154 data
.gpu_temp_disable
= gpu_temp_disable
;
14155 data
.gpu_temp_abort
= gpu_temp_abort
;
14156 data
.gpu_temp_retain
= gpu_temp_retain
;
14163 if (data
.quiet
== 0)
14165 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14167 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
);
14169 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14171 log_info ("Rules: %u", kernel_rules_cnt
);
14176 log_info ("Applicable Optimizers:");
14178 for (uint i
= 0; i
< 32; i
++)
14180 const uint opti_bit
= 1u << i
;
14182 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14187 * Watchdog and Temperature balance
14191 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14193 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14196 if (gpu_temp_abort
== 0)
14198 log_info ("Watchdog: Temperature abort trigger disabled");
14202 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14205 if (gpu_temp_retain
== 0)
14207 log_info ("Watchdog: Temperature retain trigger disabled");
14211 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14214 if (data
.quiet
== 0) log_info ("");
14222 if (gpu_temp_disable
== 0)
14224 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14226 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14228 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14230 if (device_param
->skipped
) continue;
14232 const uint platform_devices_id
= device_param
->platform_devices_id
;
14234 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14235 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14237 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14242 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14244 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14252 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14253 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14254 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14255 * Driver / ADL bug?
14259 if (powertune_enable
== 1)
14261 hc_thread_mutex_lock (mux_adl
);
14263 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14265 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14267 if (device_param
->skipped
) continue;
14269 if (data
.hm_device
[device_id
].od_version
== 6)
14271 // set powertune value only
14273 int powertune_supported
= 0;
14277 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14279 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14284 if (powertune_supported
!= 0)
14287 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14289 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14291 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14296 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14298 log_error ("ERROR: Failed to set new ADL PowerControl values");
14306 hc_thread_mutex_unlock (mux_adl
);
14309 #endif // HAVE_HWMON
14312 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14315 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14317 uint kernel_power_all
= 0;
14319 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14325 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14327 if (device_param
->skipped
) continue;
14330 * device properties
14333 const char *device_name_chksum
= device_param
->device_name_chksum
;
14334 const u32 device_processors
= device_param
->device_processors
;
14335 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14338 * create context for each device
14341 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14344 * create command-queue
14347 // not supported with NV
14348 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14350 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14353 * kernel threads: some algorithms need a fixed kernel-threads count
14354 * because of shared memory usage or bitslice
14355 * there needs to be some upper limit, otherwise there's too much overhead
14358 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14360 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14362 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14365 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14366 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14367 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14368 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14369 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14370 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14371 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14372 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14373 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14374 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14375 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14376 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14377 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14380 * create input buffers on device : calculate size of fixed memory buffers
14383 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14384 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14386 device_param
->size_root_css
= size_root_css
;
14387 device_param
->size_markov_css
= size_markov_css
;
14389 size_t size_results
= sizeof (uint
);
14391 device_param
->size_results
= size_results
;
14393 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14394 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14396 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14397 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14398 size_t size_esalts
= salts_cnt
* esalt_size
;
14400 device_param
->size_plains
= size_plains
;
14401 device_param
->size_digests
= size_digests
;
14402 device_param
->size_shown
= size_shown
;
14403 device_param
->size_salts
= size_salts
;
14405 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14406 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14407 size_t size_tm
= 32 * sizeof (bs_word_t
);
14411 size_t size_scryptV
= 1;
14413 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14415 uint tmto_start
= 0;
14416 uint tmto_stop
= 10;
14420 tmto_start
= scrypt_tmto
;
14424 // in case the user did not specify the tmto manually
14425 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14426 // but set the lower end only in case the user has a device with too less memory
14428 if (hash_mode
== 8900)
14430 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14434 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14439 else if (hash_mode
== 9300)
14441 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14445 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14452 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14454 // TODO: in theory the following calculation needs to be done per salt, not global
14455 // we assume all hashes have the same scrypt settings
14457 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14459 size_scryptV
/= 1 << tmto
;
14461 size_scryptV
*= device_processors
* device_processor_cores
;
14463 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14465 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14470 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14472 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14473 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14479 if (data
.salts_buf
[0].scrypt_phy
== 0)
14481 log_error ("ERROR: can't allocate enough device memory");
14486 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14490 * some algorithms need a fixed kernel-loops count
14493 if (hash_mode
== 1500)
14495 const u32 kernel_loops_fixed
= 1024;
14497 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14498 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14501 if (hash_mode
== 3000)
14503 const u32 kernel_loops_fixed
= 1024;
14505 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14506 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14509 if (hash_mode
== 8900)
14511 const u32 kernel_loops_fixed
= 1;
14513 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14514 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14517 if (hash_mode
== 9300)
14519 const u32 kernel_loops_fixed
= 1;
14521 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14522 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14525 if (hash_mode
== 12500)
14527 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14529 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14530 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14534 * some algorithms have a maximum kernel-loops count
14537 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14539 u32 innerloop_cnt
= 0;
14541 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14543 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14544 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14545 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14549 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14552 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14553 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14555 device_param
->kernel_loops_max
= innerloop_cnt
;
14559 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14560 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14562 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14564 size_t size_pws
= 4;
14565 size_t size_tmps
= 4;
14566 size_t size_hooks
= 4;
14568 while (kernel_accel_max
>= kernel_accel_min
)
14570 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14574 size_pws
= kernel_power_max
* sizeof (pw_t
);
14580 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14581 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14582 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14583 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14584 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14585 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14586 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14587 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14588 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14589 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14590 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14591 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14592 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14593 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14594 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14595 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14596 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14597 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14598 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14599 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14600 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14601 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14602 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14603 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14604 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14605 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14606 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14607 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14608 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14609 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14610 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14611 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14612 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14613 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14614 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14615 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14616 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14617 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14618 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14619 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14620 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14621 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14622 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14623 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14624 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14625 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14626 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14627 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14628 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14629 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14630 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14631 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14632 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14633 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14634 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14635 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14636 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14637 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14638 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14639 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14640 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14641 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14642 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14643 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14644 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14645 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14646 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14647 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14648 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14649 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14650 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14651 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14652 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14653 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14654 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14655 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14656 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14657 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14658 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14659 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14660 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14661 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14666 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14671 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14672 // if not, decrease amplifier and try again
14676 const u64 size_total
14693 + size_pws
// not a bug
14704 // Don't ask me, ask AMD!
14706 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14707 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14711 kernel_accel_max
--;
14720 if (kernel_accel_max == 0)
14722 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14728 device_param
->kernel_accel_min
= kernel_accel_min
;
14729 device_param
->kernel_accel_max
= kernel_accel_max
;
14732 if (kernel_accel_max < kernel_accel)
14734 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14736 device_param->kernel_accel = kernel_accel_max;
14740 device_param
->size_bfs
= size_bfs
;
14741 device_param
->size_combs
= size_combs
;
14742 device_param
->size_rules
= size_rules
;
14743 device_param
->size_rules_c
= size_rules_c
;
14744 device_param
->size_pws
= size_pws
;
14745 device_param
->size_tmps
= size_tmps
;
14746 device_param
->size_hooks
= size_hooks
;
14748 // do not confuse kernel_accel_max with kernel_accel here
14750 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14752 device_param
->kernel_threads
= kernel_threads
;
14753 device_param
->kernel_power_user
= kernel_power
;
14755 kernel_power_all
+= kernel_power
;
14758 * default building options
14761 char build_opts
[1024] = { 0 };
14763 // we don't have sm_* on vendors not NV but it doesn't matter
14766 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
);
14768 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
);
14771 char build_opts_new
[1024] = { 0 };
14773 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
);
14775 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14778 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14780 // we do vectorizing much better than the auto-vectorizer
14782 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14784 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14789 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14798 * kernel source filename
14801 char source_file
[256] = { 0 };
14803 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14807 if (stat (source_file
, &sst
) == -1)
14809 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14815 * kernel cached filename
14818 char cached_file
[256] = { 0 };
14820 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14826 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14832 * kernel compile or load
14835 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14837 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14839 if (force_jit_compilation
== -1)
14843 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14845 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14847 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14849 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14852 size_t build_log_size
= 0;
14854 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14856 if (build_log_size
> 1)
14858 char *build_log
= (char *) malloc (build_log_size
+ 1);
14860 memset (build_log
, 0, build_log_size
+ 1);
14862 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14872 device_param
->skipped
= true;
14874 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14879 size_t binary_size
;
14881 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14883 u8
*binary
= (u8
*) mymalloc (binary_size
);
14885 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14887 writeProgramBin (cached_file
, binary
, binary_size
);
14889 local_free (binary
);
14894 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14897 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14899 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14901 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14907 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14910 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14912 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14914 char build_opts_update
[1024] = { 0 };
14916 if (force_jit_compilation
== 1500)
14918 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14920 else if (force_jit_compilation
== 8900)
14922 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
);
14926 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14929 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14932 size_t build_log_size
= 0;
14934 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14936 if (build_log_size
> 1)
14938 char *build_log
= (char *) malloc (build_log_size
+ 1);
14940 memset (build_log
, 0, build_log_size
+ 1);
14942 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14952 device_param
->skipped
= true;
14954 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14958 local_free (kernel_lengths
);
14959 local_free (kernel_sources
[0]);
14960 local_free (kernel_sources
);
14964 * word generator kernel
14967 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14970 * kernel mp source filename
14973 char source_file
[256] = { 0 };
14975 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14979 if (stat (source_file
, &sst
) == -1)
14981 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14987 * kernel mp cached filename
14990 char cached_file
[256] = { 0 };
14992 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
14998 if (stat (cached_file
, &cst
) == -1)
15004 * kernel compile or load
15007 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15009 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15013 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15014 if (quiet
== 0) log_info ("");
15016 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15018 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15020 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15024 device_param
->skipped
= true;
15026 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15031 size_t binary_size
;
15033 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15035 u8
*binary
= (u8
*) mymalloc (binary_size
);
15037 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15039 writeProgramBin (cached_file
, binary
, binary_size
);
15041 local_free (binary
);
15046 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15049 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15051 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15053 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15056 local_free (kernel_lengths
);
15057 local_free (kernel_sources
[0]);
15058 local_free (kernel_sources
);
15065 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15072 * kernel amp source filename
15075 char source_file
[256] = { 0 };
15077 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15081 if (stat (source_file
, &sst
) == -1)
15083 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15089 * kernel amp cached filename
15092 char cached_file
[256] = { 0 };
15094 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15100 if (stat (cached_file
, &cst
) == -1)
15106 * kernel compile or load
15109 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15111 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15115 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15116 if (quiet
== 0) log_info ("");
15118 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15120 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15122 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15126 device_param
->skipped
= true;
15128 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15133 size_t binary_size
;
15135 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15137 u8
*binary
= (u8
*) mymalloc (binary_size
);
15139 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15141 writeProgramBin (cached_file
, binary
, binary_size
);
15143 local_free (binary
);
15148 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15151 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15153 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15155 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15158 local_free (kernel_lengths
);
15159 local_free (kernel_sources
[0]);
15160 local_free (kernel_sources
);
15163 // some algorithm collide too fast, make that impossible
15165 if (benchmark
== 1)
15167 ((uint
*) digests_buf
)[0] = -1;
15168 ((uint
*) digests_buf
)[1] = -1;
15169 ((uint
*) digests_buf
)[2] = -1;
15170 ((uint
*) digests_buf
)[3] = -1;
15177 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15178 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15179 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15180 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15181 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15182 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15183 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15184 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15185 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15186 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15187 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15188 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15189 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15190 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15191 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15192 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15193 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15194 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15196 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
);
15197 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
);
15198 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
);
15199 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
);
15200 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
);
15201 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
);
15202 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
);
15203 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
);
15204 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15205 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15206 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15212 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15214 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15215 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15217 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15219 else if (attack_kern
== ATTACK_KERN_COMBI
)
15221 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15222 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15223 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15224 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15226 else if (attack_kern
== ATTACK_KERN_BF
)
15228 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15229 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15230 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15231 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15232 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15237 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15239 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15246 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15248 device_param
->pws_buf
= pws_buf
;
15250 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15252 device_param
->combs_buf
= combs_buf
;
15254 void *hooks_buf
= mymalloc (size_hooks
);
15256 device_param
->hooks_buf
= hooks_buf
;
15262 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15263 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15264 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15265 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15266 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15267 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15268 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15269 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15270 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15271 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15272 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15274 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15275 ? &device_param
->d_pws_buf
15276 : &device_param
->d_pws_amp_buf
;
15277 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15278 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15279 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15280 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15281 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15282 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15283 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15284 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15285 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15286 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15287 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15288 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15289 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15290 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15291 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15292 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15293 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15294 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15295 device_param
->kernel_params
[19] = &device_param
->d_result
;
15296 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15297 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15298 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15299 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15300 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15301 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15302 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15303 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15304 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15305 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15306 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15307 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15309 device_param
->kernel_params_mp_buf64
[3] = 0;
15310 device_param
->kernel_params_mp_buf32
[4] = 0;
15311 device_param
->kernel_params_mp_buf32
[5] = 0;
15312 device_param
->kernel_params_mp_buf32
[6] = 0;
15313 device_param
->kernel_params_mp_buf32
[7] = 0;
15314 device_param
->kernel_params_mp_buf32
[8] = 0;
15316 device_param
->kernel_params_mp
[0] = NULL
;
15317 device_param
->kernel_params_mp
[1] = NULL
;
15318 device_param
->kernel_params_mp
[2] = NULL
;
15319 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15320 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15321 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15322 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15323 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15324 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15326 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15327 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15328 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15329 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15330 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15331 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15332 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15334 device_param
->kernel_params_mp_l
[0] = NULL
;
15335 device_param
->kernel_params_mp_l
[1] = NULL
;
15336 device_param
->kernel_params_mp_l
[2] = NULL
;
15337 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15338 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15339 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15340 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15341 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15342 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15343 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15345 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15346 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15347 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15348 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15349 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15350 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15352 device_param
->kernel_params_mp_r
[0] = NULL
;
15353 device_param
->kernel_params_mp_r
[1] = NULL
;
15354 device_param
->kernel_params_mp_r
[2] = NULL
;
15355 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15356 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15357 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15358 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15359 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15360 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15362 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15363 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15365 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15366 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15367 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15368 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15369 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15370 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15371 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15373 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15374 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15376 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15377 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15379 device_param
->kernel_params_memset
[0] = NULL
;
15380 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15381 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15387 size_t kernel_wgs_tmp
;
15389 char kernel_name
[64] = { 0 };
15391 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15393 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15395 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15397 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15399 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15401 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15403 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15405 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15409 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15411 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15413 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15415 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15417 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15419 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15422 if (data
.attack_mode
== ATTACK_MODE_BF
)
15424 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15426 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15428 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15430 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
);
15436 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15438 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15440 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15442 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15444 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15446 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15448 if (opts_type
& OPTS_TYPE_HOOK12
)
15450 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15452 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15454 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
);
15457 if (opts_type
& OPTS_TYPE_HOOK23
)
15459 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15461 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15463 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
);
15467 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
);
15468 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
);
15469 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
);
15471 for (uint i
= 0; i
<= 20; i
++)
15473 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15474 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15475 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15477 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15478 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15481 for (uint i
= 21; i
<= 31; i
++)
15483 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15484 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15485 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15487 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15488 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15493 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15495 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
);
15497 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15498 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15499 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15503 if (attack_mode
== ATTACK_MODE_BF
)
15505 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15506 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15508 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
);
15509 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
);
15511 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15513 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15514 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15517 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15519 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15521 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
);
15523 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15525 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15527 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
);
15530 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15536 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15538 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
);
15541 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15547 for (uint i
= 0; i
< 5; i
++)
15549 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15552 for (uint i
= 5; i
< 7; i
++)
15554 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15558 // maybe this has been updated by clGetKernelWorkGroupInfo()
15559 // value can only be decreased, so we don't need to reallocate buffers
15561 device_param
->kernel_threads
= kernel_threads
;
15563 // zero some data buffers
15565 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15566 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15567 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15568 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15569 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15570 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15576 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15578 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15580 else if (attack_kern
== ATTACK_KERN_COMBI
)
15582 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15583 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15584 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15585 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15587 else if (attack_kern
== ATTACK_KERN_BF
)
15589 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15590 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15591 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15592 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15593 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15597 * Store thermal target temperature so we can send a notice to user
15600 #if defined(HAVE_HWMON)
15601 if (gpu_temp_disable
== 0)
15603 const int gpu_temp_threshold_slowdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15605 data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
= (gpu_temp_threshold_slowdown
== -1) ? 100000 : gpu_temp_threshold_slowdown
;
15610 * Store initial fanspeed if gpu_temp_retain is enabled
15613 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15614 int gpu_temp_retain_set
= 0;
15616 if (gpu_temp_disable
== 0)
15618 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15620 hc_thread_mutex_lock (mux_adl
);
15622 if (data
.hm_device
[device_id
].fan_supported
== 1)
15624 if (gpu_temp_retain_chgd
== 0)
15627 uint default_temp
= 0;
15629 int ADL_rc
= hm_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
15631 if (ADL_rc
== ADL_OK
)
15633 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15635 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15637 // special case with multi gpu setups: always use minimum retain
15639 if (gpu_temp_retain_set
== 0)
15641 gpu_temp_retain
= gpu_temp_retain_target
;
15642 gpu_temp_retain_set
= 1;
15646 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15649 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15653 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15655 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15657 if (fan_speed
== -1)
15659 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15661 temp_retain_fanspeed_value
[device_id
] = 0;
15665 hc_thread_mutex_unlock (mux_adl
);
15670 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15673 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15675 hc_thread_mutex_lock (mux_adl
);
15677 if (data
.hm_device
[device_id
].od_version
== 6)
15681 // check powertune capabilities first, if not available then skip device
15683 int powertune_supported
= 0;
15685 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15687 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15692 if (powertune_supported
!= 0)
15694 // powercontrol settings
15696 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15698 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15700 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15703 if (ADL_rc
!= ADL_OK
)
15705 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15710 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15712 log_error ("ERROR: Failed to set new ADL PowerControl values");
15719 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15721 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15723 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15725 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15730 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15732 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15734 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15736 log_error ("ERROR: Failed to get ADL device capabilities");
15741 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15742 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15744 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15745 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15747 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15748 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15750 // warning if profile has too low max values
15752 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15754 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15757 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15759 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15762 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15764 performance_state
->iNumberOfPerformanceLevels
= 2;
15766 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15767 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15768 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15769 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15771 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15773 log_info ("ERROR: Failed to set ADL performance state");
15778 local_free (performance_state
);
15782 hc_thread_mutex_unlock (mux_adl
);
15784 #endif // HAVE_HWMON && HAVE_ADL
15787 data
.kernel_power_all
= kernel_power_all
;
15789 if (data
.quiet
== 0) log_info_nn ("");
15792 * In benchmark-mode, inform user which algorithm is checked
15795 if (benchmark
== 1)
15797 if (machine_readable
== 0)
15801 data
.quiet
= quiet
;
15803 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15805 log_info ("Hashtype: %s", hash_type
);
15811 * keep track of the progress
15814 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15815 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15816 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15823 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15825 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15830 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15832 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15837 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15839 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15849 segment_size
*= (1024 * 1024);
15851 data
.segment_size
= segment_size
;
15853 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15855 wl_data
->buf
= (char *) mymalloc (segment_size
);
15856 wl_data
->avail
= segment_size
;
15857 wl_data
->incr
= segment_size
;
15861 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15863 data
.wordlist_mode
= wordlist_mode
;
15865 cs_t
*css_buf
= NULL
;
15869 char **masks
= NULL
;
15870 char **dictfiles
= NULL
;
15872 uint mask_from_file
= 0;
15874 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15876 if (wordlist_mode
== WL_MODE_FILE
)
15878 int wls_left
= myargc
- (optind
+ 1);
15880 for (int i
= 0; i
< wls_left
; i
++)
15882 char *l0_filename
= myargv
[optind
+ 1 + i
];
15884 struct stat l0_stat
;
15886 if (stat (l0_filename
, &l0_stat
) == -1)
15888 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15893 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15897 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15901 dictfiles
[dictcnt
- 1] = l0_filename
;
15905 // do not allow --keyspace w/ a directory
15909 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15914 char **dictionary_files
= NULL
;
15916 dictionary_files
= scan_directory (l0_filename
);
15918 if (dictionary_files
!= NULL
)
15920 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15922 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15924 char *l1_filename
= dictionary_files
[d
];
15926 struct stat l1_stat
;
15928 if (stat (l1_filename
, &l1_stat
) == -1)
15930 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15935 if (S_ISREG (l1_stat
.st_mode
))
15937 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15941 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15946 local_free (dictionary_files
);
15952 log_error ("ERROR: No usable dictionary file found.");
15957 else if (wordlist_mode
== WL_MODE_STDIN
)
15962 else if (attack_mode
== ATTACK_MODE_COMBI
)
15966 char *dictfile1
= myargv
[optind
+ 1 + 0];
15967 char *dictfile2
= myargv
[optind
+ 1 + 1];
15969 // find the bigger dictionary and use as base
15974 struct stat tmp_stat
;
15976 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15978 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15983 if (stat (dictfile1
, &tmp_stat
) == -1)
15985 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15992 if (S_ISDIR (tmp_stat
.st_mode
))
15994 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16001 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16003 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16010 if (stat (dictfile2
, &tmp_stat
) == -1)
16012 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16020 if (S_ISDIR (tmp_stat
.st_mode
))
16022 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16030 data
.combs_cnt
= 1;
16034 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16036 data
.quiet
= quiet
;
16038 if (words1_cnt
== 0)
16040 log_error ("ERROR: %s: empty file", dictfile1
);
16048 data
.combs_cnt
= 1;
16052 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16054 data
.quiet
= quiet
;
16056 if (words2_cnt
== 0)
16058 log_error ("ERROR: %s: empty file", dictfile2
);
16069 data
.dictfile
= dictfile1
;
16070 data
.dictfile2
= dictfile2
;
16072 if (words1_cnt
>= words2_cnt
)
16074 data
.combs_cnt
= words2_cnt
;
16075 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16077 dictfiles
= &data
.dictfile
;
16083 data
.combs_cnt
= words1_cnt
;
16084 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16086 dictfiles
= &data
.dictfile2
;
16090 // we also have to switch wordlist related rules!
16092 char *tmpc
= data
.rule_buf_l
;
16094 data
.rule_buf_l
= data
.rule_buf_r
;
16095 data
.rule_buf_r
= tmpc
;
16097 int tmpi
= data
.rule_len_l
;
16099 data
.rule_len_l
= data
.rule_len_r
;
16100 data
.rule_len_r
= tmpi
;
16103 else if (attack_mode
== ATTACK_MODE_BF
)
16109 if (benchmark
== 0)
16111 mask
= myargv
[optind
+ 1];
16113 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16115 if ((optind
+ 2) <= myargc
)
16117 struct stat file_stat
;
16119 if (stat (mask
, &file_stat
) == -1)
16123 masks
[maskcnt
- 1] = mystrdup (mask
);
16127 int wls_left
= myargc
- (optind
+ 1);
16129 uint masks_avail
= INCR_MASKS
;
16131 for (int i
= 0; i
< wls_left
; i
++)
16135 mask
= myargv
[optind
+ 1 + i
];
16137 if (stat (mask
, &file_stat
) == -1)
16139 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16145 uint is_file
= S_ISREG (file_stat
.st_mode
);
16151 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16153 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16158 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16160 while (!feof (mask_fp
))
16162 memset (line_buf
, 0, HCBUFSIZ
);
16164 int line_len
= fgetl (mask_fp
, line_buf
);
16166 if (line_len
== 0) continue;
16168 if (line_buf
[0] == '#') continue;
16170 if (masks_avail
== maskcnt
)
16172 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16174 masks_avail
+= INCR_MASKS
;
16177 masks
[maskcnt
] = mystrdup (line_buf
);
16188 log_error ("ERROR: %s: unsupported file-type", mask
);
16194 mask_from_file
= 1;
16199 custom_charset_1
= (char *) "?l?d?u";
16200 custom_charset_2
= (char *) "?l?d";
16201 custom_charset_3
= (char *) "?l?d*!$@_";
16203 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16204 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16205 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16207 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16209 wordlist_mode
= WL_MODE_MASK
;
16211 data
.wordlist_mode
= wordlist_mode
;
16221 * generate full masks and charsets
16224 masks
= (char **) mymalloc (sizeof (char *));
16228 case 1731: pw_min
= 5;
16230 mask
= mystrdup ("?b?b?b?b?b");
16232 case 12500: pw_min
= 5;
16234 mask
= mystrdup ("?b?b?b?b?b");
16236 default: pw_min
= 7;
16238 mask
= mystrdup ("?b?b?b?b?b?b?b");
16244 masks
[maskcnt
- 1] = mystrdup (mask
);
16246 wordlist_mode
= WL_MODE_MASK
;
16248 data
.wordlist_mode
= wordlist_mode
;
16253 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16257 if (increment_min
> pw_min
) pw_min
= increment_min
;
16259 if (increment_max
< pw_max
) pw_max
= increment_max
;
16262 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16264 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16268 char *mask
= myargv
[myargc
- 1];
16272 masks
= (char **) mymalloc (1 * sizeof (char *));
16276 struct stat file_stat
;
16278 if (stat (mask
, &file_stat
) == -1)
16282 masks
[maskcnt
- 1] = mystrdup (mask
);
16286 uint is_file
= S_ISREG (file_stat
.st_mode
);
16292 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16294 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16299 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16301 uint masks_avail
= 1;
16303 while (!feof (mask_fp
))
16305 memset (line_buf
, 0, HCBUFSIZ
);
16307 int line_len
= fgetl (mask_fp
, line_buf
);
16309 if (line_len
== 0) continue;
16311 if (line_buf
[0] == '#') continue;
16313 if (masks_avail
== maskcnt
)
16315 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16317 masks_avail
+= INCR_MASKS
;
16320 masks
[maskcnt
] = mystrdup (line_buf
);
16329 mask_from_file
= 1;
16335 masks
[maskcnt
- 1] = mystrdup (mask
);
16341 int wls_left
= myargc
- (optind
+ 2);
16343 for (int i
= 0; i
< wls_left
; i
++)
16345 char *filename
= myargv
[optind
+ 1 + i
];
16347 struct stat file_stat
;
16349 if (stat (filename
, &file_stat
) == -1)
16351 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16356 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16360 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16364 dictfiles
[dictcnt
- 1] = filename
;
16368 // do not allow --keyspace w/ a directory
16372 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16377 char **dictionary_files
= NULL
;
16379 dictionary_files
= scan_directory (filename
);
16381 if (dictionary_files
!= NULL
)
16383 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16385 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16387 char *l1_filename
= dictionary_files
[d
];
16389 struct stat l1_stat
;
16391 if (stat (l1_filename
, &l1_stat
) == -1)
16393 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16398 if (S_ISREG (l1_stat
.st_mode
))
16400 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16404 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16409 local_free (dictionary_files
);
16415 log_error ("ERROR: No usable dictionary file found.");
16424 uint mask_min
= increment_min
; // we can't reject smaller masks here
16425 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16427 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16429 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16431 if (cur_mask
== NULL
) break;
16433 masks
[maskcnt
] = cur_mask
;
16437 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16441 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16443 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16447 char *mask
= myargv
[optind
+ 1 + 0];
16451 masks
= (char **) mymalloc (1 * sizeof (char *));
16455 struct stat file_stat
;
16457 if (stat (mask
, &file_stat
) == -1)
16461 masks
[maskcnt
- 1] = mystrdup (mask
);
16465 uint is_file
= S_ISREG (file_stat
.st_mode
);
16471 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16473 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16478 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16480 uint masks_avail
= 1;
16482 while (!feof (mask_fp
))
16484 memset (line_buf
, 0, HCBUFSIZ
);
16486 int line_len
= fgetl (mask_fp
, line_buf
);
16488 if (line_len
== 0) continue;
16490 if (line_buf
[0] == '#') continue;
16492 if (masks_avail
== maskcnt
)
16494 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16496 masks_avail
+= INCR_MASKS
;
16499 masks
[maskcnt
] = mystrdup (line_buf
);
16508 mask_from_file
= 1;
16514 masks
[maskcnt
- 1] = mystrdup (mask
);
16520 int wls_left
= myargc
- (optind
+ 2);
16522 for (int i
= 0; i
< wls_left
; i
++)
16524 char *filename
= myargv
[optind
+ 2 + i
];
16526 struct stat file_stat
;
16528 if (stat (filename
, &file_stat
) == -1)
16530 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16535 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16539 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16543 dictfiles
[dictcnt
- 1] = filename
;
16547 // do not allow --keyspace w/ a directory
16551 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16556 char **dictionary_files
= NULL
;
16558 dictionary_files
= scan_directory (filename
);
16560 if (dictionary_files
!= NULL
)
16562 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16564 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16566 char *l1_filename
= dictionary_files
[d
];
16568 struct stat l1_stat
;
16570 if (stat (l1_filename
, &l1_stat
) == -1)
16572 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16577 if (S_ISREG (l1_stat
.st_mode
))
16579 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16583 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16588 local_free (dictionary_files
);
16594 log_error ("ERROR: No usable dictionary file found.");
16603 uint mask_min
= increment_min
; // we can't reject smaller masks here
16604 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16606 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16608 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16610 if (cur_mask
== NULL
) break;
16612 masks
[maskcnt
] = cur_mask
;
16616 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16621 data
.pw_min
= pw_min
;
16622 data
.pw_max
= pw_max
;
16628 if (weak_hash_threshold
>= salts_cnt
)
16630 hc_device_param_t
*device_param
= NULL
;
16632 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16634 device_param
= &data
.devices_param
[device_id
];
16636 if (device_param
->skipped
) continue;
16641 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16643 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16645 weak_hash_check (device_param
, salt_pos
);
16648 // Display hack, guarantee that there is at least one \r before real start
16650 //if (data.quiet == 0) log_info ("");
16654 * status and monitor threads
16657 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16659 hc_thread_t i_thread
= 0;
16661 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16663 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16666 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16668 uint ni_threads_cnt
= 0;
16670 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16672 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16682 if (outfile_check_timer
!= 0)
16684 if (data
.outfile_check_directory
!= NULL
)
16686 if ((hash_mode
!= 5200) &&
16687 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16688 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16689 (hash_mode
!= 9000))
16691 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16697 outfile_check_timer
= 0;
16702 outfile_check_timer
= 0;
16708 * Inform the user if we got some hashes remove because of the pot file remove feature
16711 if (data
.quiet
== 0)
16713 if (potfile_remove_cracks
> 0)
16715 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16716 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16720 data
.outfile_check_timer
= outfile_check_timer
;
16726 char **induction_dictionaries
= NULL
;
16728 int induction_dictionaries_cnt
= 0;
16730 hcstat_table_t
*root_table_buf
= NULL
;
16731 hcstat_table_t
*markov_table_buf
= NULL
;
16733 uint initial_restore_done
= 0;
16735 data
.maskcnt
= maskcnt
;
16737 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16739 if (data
.devices_status
== STATUS_CRACKED
) break;
16741 data
.devices_status
= STATUS_INIT
;
16743 if (maskpos
> rd
->maskpos
)
16748 rd
->maskpos
= maskpos
;
16749 data
.maskpos
= maskpos
;
16751 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16753 char *mask
= masks
[maskpos
];
16755 if (mask_from_file
== 1)
16757 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16762 uint mask_offset
= 0;
16764 uint separator_cnt
;
16766 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16768 str_ptr
= strstr (mask
+ mask_offset
, ",");
16770 if (str_ptr
== NULL
) break;
16772 str_pos
= str_ptr
- mask
;
16774 // escaped separator, i.e. "\,"
16778 if (mask
[str_pos
- 1] == '\\')
16782 mask_offset
= str_pos
+ 1;
16788 // reset the offset
16792 mask
[str_pos
] = '\0';
16794 switch (separator_cnt
)
16797 mp_reset_usr (mp_usr
, 0);
16799 custom_charset_1
= mask
;
16800 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16804 mp_reset_usr (mp_usr
, 1);
16806 custom_charset_2
= mask
;
16807 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16811 mp_reset_usr (mp_usr
, 2);
16813 custom_charset_3
= mask
;
16814 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16818 mp_reset_usr (mp_usr
, 3);
16820 custom_charset_4
= mask
;
16821 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16825 mask
= mask
+ str_pos
+ 1;
16829 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16833 local_free (css_buf
);
16834 local_free (data
.root_css_buf
);
16835 local_free (data
.markov_css_buf
);
16837 local_free (masks
[maskpos
- 1]);
16840 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16843 data
.css_cnt
= css_cnt
;
16844 data
.css_buf
= css_buf
;
16846 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16848 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16850 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16851 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16853 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16855 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16857 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16858 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16860 data
.root_css_buf
= root_css_buf
;
16861 data
.markov_css_buf
= markov_css_buf
;
16863 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16865 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16867 local_free (root_table_buf
);
16868 local_free (markov_table_buf
);
16872 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16874 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16876 if (device_param
->skipped
) continue;
16878 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16879 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16880 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16882 device_param
->kernel_params_mp_buf64
[3] = 0;
16883 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16884 device_param
->kernel_params_mp_buf32
[5] = 0;
16885 device_param
->kernel_params_mp_buf32
[6] = 0;
16886 device_param
->kernel_params_mp_buf32
[7] = 0;
16888 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16890 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16891 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16892 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16893 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16895 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16897 device_param
->kernel_params_mp_buf32
[5] = 0;
16898 device_param
->kernel_params_mp_buf32
[6] = 0;
16899 device_param
->kernel_params_mp_buf32
[7] = 0;
16902 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
]);
16903 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
]);
16904 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
]);
16906 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
);
16907 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
);
16910 else if (attack_mode
== ATTACK_MODE_BF
)
16912 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16916 for (uint i
= 0; i
< dictcnt
; i
++)
16918 local_free (dictfiles
[i
]);
16921 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16923 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16925 if (l1_filename
== NULL
) break;
16929 dictfiles
[dictcnt
- 1] = l1_filename
;
16936 dictfiles
[dictcnt
- 1] = mask
;
16941 log_error ("ERROR: Mask is too small");
16948 free (induction_dictionaries
);
16950 // induction_dictionaries_cnt = 0; // implied
16952 if (attack_mode
!= ATTACK_MODE_BF
)
16956 induction_dictionaries
= scan_directory (induction_directory
);
16958 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16962 if (induction_dictionaries_cnt
)
16964 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16968 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16972 if ((maskcnt
> 1) || (dictcnt
> 1))
16974 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16980 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
16982 char *subid
= logfile_generate_subid ();
16984 data
.subid
= subid
;
16986 logfile_sub_msg ("START");
16988 data
.devices_status
= STATUS_INIT
;
16990 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
16991 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
16992 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
16994 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
16998 data
.cpt_start
= time (NULL
);
17000 data
.cpt_total
= 0;
17002 if (data
.restore
== 0)
17004 rd
->words_cur
= skip
;
17011 data
.ms_paused
= 0;
17013 data
.words_cur
= rd
->words_cur
;
17015 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17017 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17019 if (device_param
->skipped
) continue;
17021 device_param
->speed_pos
= 0;
17023 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17024 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17026 device_param
->exec_pos
= 0;
17028 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17030 device_param
->kernel_power
= device_param
->kernel_power_user
;
17032 device_param
->outerloop_pos
= 0;
17033 device_param
->outerloop_left
= 0;
17034 device_param
->innerloop_pos
= 0;
17035 device_param
->innerloop_left
= 0;
17037 // some more resets:
17039 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17041 device_param
->pws_cnt
= 0;
17043 device_param
->words_off
= 0;
17044 device_param
->words_done
= 0;
17047 data
.kernel_power_div
= 0;
17049 // figure out some workload
17051 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17053 if (data
.wordlist_mode
== WL_MODE_FILE
)
17055 char *dictfile
= NULL
;
17057 if (induction_dictionaries_cnt
)
17059 dictfile
= induction_dictionaries
[0];
17063 dictfile
= dictfiles
[dictpos
];
17066 data
.dictfile
= dictfile
;
17068 logfile_sub_string (dictfile
);
17070 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17072 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17075 FILE *fd2
= fopen (dictfile
, "rb");
17079 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17084 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17088 if (data
.words_cnt
== 0)
17090 if (data
.devices_status
== STATUS_CRACKED
) break;
17091 if (data
.devices_status
== STATUS_ABORTED
) break;
17099 else if (attack_mode
== ATTACK_MODE_COMBI
)
17101 char *dictfile
= data
.dictfile
;
17102 char *dictfile2
= data
.dictfile2
;
17104 logfile_sub_string (dictfile
);
17105 logfile_sub_string (dictfile2
);
17107 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17109 FILE *fd2
= fopen (dictfile
, "rb");
17113 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17118 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17122 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17124 FILE *fd2
= fopen (dictfile2
, "rb");
17128 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17133 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17138 if (data
.words_cnt
== 0)
17140 if (data
.devices_status
== STATUS_CRACKED
) break;
17141 if (data
.devices_status
== STATUS_ABORTED
) break;
17148 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17150 char *dictfile
= NULL
;
17152 if (induction_dictionaries_cnt
)
17154 dictfile
= induction_dictionaries
[0];
17158 dictfile
= dictfiles
[dictpos
];
17161 data
.dictfile
= dictfile
;
17163 char *mask
= data
.mask
;
17165 logfile_sub_string (dictfile
);
17166 logfile_sub_string (mask
);
17168 FILE *fd2
= fopen (dictfile
, "rb");
17172 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17177 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17181 if (data
.words_cnt
== 0)
17183 if (data
.devices_status
== STATUS_CRACKED
) break;
17184 if (data
.devices_status
== STATUS_ABORTED
) break;
17191 else if (attack_mode
== ATTACK_MODE_BF
)
17193 local_free (css_buf
);
17194 local_free (data
.root_css_buf
);
17195 local_free (data
.markov_css_buf
);
17197 char *mask
= dictfiles
[dictpos
];
17199 logfile_sub_string (mask
);
17203 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17205 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17207 uint css_cnt_unicode
= css_cnt
* 2;
17209 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17211 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17213 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17215 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17216 css_buf_unicode
[j
+ 1].cs_len
= 1;
17221 css_buf
= css_buf_unicode
;
17222 css_cnt
= css_cnt_unicode
;
17225 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17227 uint mask_min
= pw_min
;
17228 uint mask_max
= pw_max
;
17230 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17236 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17238 if (css_cnt
< mask_min
)
17240 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17243 if (css_cnt
> mask_max
)
17245 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17248 // skip to next mask
17252 rd
->dictpos
= dictpos
;
17254 logfile_sub_msg ("STOP");
17259 uint save_css_cnt
= css_cnt
;
17261 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17263 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17265 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17266 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17268 uint css_cnt_salt
= css_cnt
+ salt_len
;
17270 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17272 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17274 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17276 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17277 css_buf_salt
[j
].cs_len
= 1;
17282 css_buf
= css_buf_salt
;
17283 css_cnt
= css_cnt_salt
;
17288 data
.css_cnt
= css_cnt
;
17289 data
.css_buf
= css_buf
;
17291 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17293 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17295 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17297 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17298 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17300 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17302 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17304 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17305 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17307 data
.root_css_buf
= root_css_buf
;
17308 data
.markov_css_buf
= markov_css_buf
;
17310 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17312 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17314 local_free (root_table_buf
);
17315 local_free (markov_table_buf
);
17319 uint css_cnt_l
= css_cnt
;
17322 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17324 if (save_css_cnt
< 6)
17328 else if (save_css_cnt
== 6)
17334 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17336 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17347 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17362 /* unfinished code?
17363 int sum = css_buf[css_cnt_r - 1].cs_len;
17365 for (uint i = 1; i < 4 && i < css_cnt; i++)
17367 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17371 sum *= css_buf[css_cnt_r - 1].cs_len;
17376 css_cnt_l
-= css_cnt_r
;
17378 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17380 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17382 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17384 if (device_param
->skipped
) continue;
17386 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17387 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17388 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17390 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17391 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17392 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17393 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17394 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17395 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17397 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17398 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17399 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17400 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17402 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17403 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17404 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17406 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17407 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17408 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17409 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17410 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17412 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
]);
17413 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
]);
17414 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
]);
17416 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
]);
17417 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
]);
17418 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
]);
17420 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
);
17421 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
);
17425 u64 words_base
= data
.words_cnt
;
17427 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17429 if (data
.kernel_rules_cnt
)
17431 words_base
/= data
.kernel_rules_cnt
;
17434 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17436 if (data
.combs_cnt
)
17438 words_base
/= data
.combs_cnt
;
17441 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17445 words_base
/= data
.bfs_cnt
;
17449 data
.words_base
= words_base
;
17453 log_info ("%llu", (unsigned long long int) words_base
);
17458 if (data
.words_cur
> data
.words_base
)
17460 log_error ("ERROR: restore value greater keyspace");
17465 if (data
.words_cur
)
17467 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17469 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17471 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17474 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17476 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17478 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17481 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17483 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17485 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17491 * Inform user about possible slow speeds
17494 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17496 if (data
.words_base
< kernel_power_all
)
17500 log_info ("ATTENTION!");
17501 log_info (" The wordlist or mask you are using is too small.");
17502 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17503 log_info (" The cracking speed will drop.");
17504 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17511 * Update loopback file
17520 uint random_num
= get_random_num (0, 9999);
17522 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17524 data
.loopback_file
= loopback_file
;
17528 * Update dictionary statistic
17533 dictstat_fp
= fopen (dictstat
, "wb");
17537 lock_file (dictstat_fp
);
17539 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17541 fclose (dictstat_fp
);
17545 data
.devices_status
= STATUS_RUNNING
;
17547 if (initial_restore_done
== 0)
17549 if (data
.restore_disable
== 0) cycle_restore ();
17551 initial_restore_done
= 1;
17554 hc_timer_set (&data
.timer_running
);
17556 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17558 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17560 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17561 if (quiet
== 0) fflush (stdout
);
17564 else if (wordlist_mode
== WL_MODE_STDIN
)
17566 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17567 if (data
.quiet
== 0) log_info ("");
17570 time_t runtime_start
;
17572 time (&runtime_start
);
17574 data
.runtime_start
= runtime_start
;
17577 * create cracker threads
17580 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17582 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17584 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17586 if (wordlist_mode
== WL_MODE_STDIN
)
17588 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17592 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17596 // wait for crack threads to exit
17598 hc_thread_wait (data
.devices_cnt
, c_threads
);
17600 local_free (c_threads
);
17606 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17608 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17610 if (data
.devices_status
== STATUS_CRACKED
) break;
17611 if (data
.devices_status
== STATUS_ABORTED
) break;
17613 if (data
.devices_status
== STATUS_BYPASS
)
17615 data
.devices_status
= STATUS_RUNNING
;
17618 if (induction_dictionaries_cnt
)
17620 unlink (induction_dictionaries
[0]);
17623 free (induction_dictionaries
);
17625 if (attack_mode
!= ATTACK_MODE_BF
)
17627 induction_dictionaries
= scan_directory (induction_directory
);
17629 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17632 if (benchmark
== 0)
17634 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17636 if (quiet
== 0) clear_prompt ();
17638 if (quiet
== 0) log_info ("");
17646 if (quiet
== 0) status_display ();
17649 if (quiet
== 0) log_info ("");
17653 if (attack_mode
== ATTACK_MODE_BF
)
17657 rd
->dictpos
= dictpos
;
17661 if (induction_dictionaries_cnt
)
17663 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17669 rd
->dictpos
= dictpos
;
17673 time_t runtime_stop
;
17675 time (&runtime_stop
);
17677 data
.runtime_stop
= runtime_stop
;
17679 logfile_sub_uint (runtime_start
);
17680 logfile_sub_uint (runtime_stop
);
17682 logfile_sub_msg ("STOP");
17684 global_free (subid
);
17687 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17689 if (data
.devices_status
== STATUS_CRACKED
) break;
17690 if (data
.devices_status
== STATUS_ABORTED
) break;
17691 if (data
.devices_status
== STATUS_QUIT
) break;
17693 if (data
.devices_status
== STATUS_BYPASS
)
17695 data
.devices_status
= STATUS_RUNNING
;
17699 // 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
17701 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17703 if (data
.wordlist_mode
== WL_MODE_FILE
)
17705 if (data
.dictfile
== NULL
)
17707 if (dictfiles
!= NULL
)
17709 data
.dictfile
= dictfiles
[0];
17711 hc_timer_set (&data
.timer_running
);
17716 // NOTE: combi is okay because it is already set beforehand
17717 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17719 if (data
.dictfile
== NULL
)
17721 if (dictfiles
!= NULL
)
17723 hc_timer_set (&data
.timer_running
);
17725 data
.dictfile
= dictfiles
[0];
17729 else if (attack_mode
== ATTACK_MODE_BF
)
17731 if (data
.mask
== NULL
)
17733 hc_timer_set (&data
.timer_running
);
17735 data
.mask
= masks
[0];
17739 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17741 data
.devices_status
= STATUS_EXHAUSTED
;
17744 // if cracked / aborted remove last induction dictionary
17746 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17748 struct stat induct_stat
;
17750 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17752 unlink (induction_dictionaries
[file_pos
]);
17756 // wait for non-interactive threads
17758 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17760 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17763 local_free (ni_threads
);
17765 // wait for interactive threads
17767 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17769 hc_thread_wait (1, &i_thread
);
17772 // we dont need restore file anymore
17773 if (data
.restore_disable
== 0)
17775 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17777 unlink (eff_restore_file
);
17778 unlink (new_restore_file
);
17786 // finally save left hashes
17788 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17797 if (benchmark
== 1)
17799 status_benchmark ();
17801 if (machine_readable
== 0)
17808 if (quiet
== 0) clear_prompt ();
17810 if (quiet
== 0) log_info ("");
17818 if (quiet
== 0) status_display ();
17821 if (quiet
== 0) log_info ("");
17824 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17826 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17828 if (device_param
->skipped
) continue;
17830 local_free (device_param
->combs_buf
);
17832 local_free (device_param
->hooks_buf
);
17834 local_free (device_param
->device_name
);
17836 local_free (device_param
->device_name_chksum
);
17838 local_free (device_param
->device_version
);
17840 local_free (device_param
->driver_version
);
17842 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17843 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17844 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17845 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17846 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17847 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17848 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17849 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17850 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17851 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17852 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17853 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17854 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17855 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17856 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17857 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17858 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17859 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17860 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17861 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17862 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17863 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17864 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17865 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17866 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17867 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17868 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17869 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17870 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17872 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17873 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17874 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17875 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17876 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17877 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17878 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17879 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17880 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17881 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17882 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17884 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17885 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17886 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17888 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17889 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17892 // reset default fan speed
17895 if (gpu_temp_disable
== 0)
17898 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17900 hc_thread_mutex_lock (mux_adl
);
17902 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17904 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17906 if (device_param
->skipped
) continue;
17908 if (data
.hm_device
[device_id
].fan_supported
== 1)
17910 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17912 if (fanspeed
== -1) continue;
17914 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17916 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17920 hc_thread_mutex_unlock (mux_adl
);
17926 // reset power tuning
17928 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17930 hc_thread_mutex_lock (mux_adl
);
17932 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17934 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17936 if (device_param
->skipped
) continue;
17938 if (data
.hm_device
[device_id
].od_version
== 6)
17940 // check powertune capabilities first, if not available then skip device
17942 int powertune_supported
= 0;
17944 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17946 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17951 if (powertune_supported
!= 0)
17953 // powercontrol settings
17955 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, od_power_control_status
[device_id
])) != ADL_OK
)
17957 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17964 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17966 performance_state
->iNumberOfPerformanceLevels
= 2;
17968 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17969 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17970 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17971 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17973 if ((hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
17975 log_info ("ERROR: Failed to restore ADL performance state");
17980 local_free (performance_state
);
17985 hc_thread_mutex_unlock (mux_adl
);
17989 if (gpu_temp_disable
== 0)
17991 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
17994 #if defined(LINUX) && defined(HAVE_NVML)
17996 hm_NVML_nvmlShutdown (data
.hm_nv
);
17998 nvml_close (data
.hm_nv
);
18000 #elif defined(WIN) && (HAVE_NVAPI)
18002 hm_NvAPI_Unload (data
.hm_nv
);
18004 nvapi_close (data
.hm_nv
);
18015 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
18017 adl_close (data
.hm_amd
);
18018 data
.hm_amd
= NULL
;
18022 #endif // HAVE_HWMON
18026 local_free (masks
);
18028 local_free (dictstat_base
);
18030 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18032 pot_t
*pot_ptr
= &pot
[pot_pos
];
18034 hash_t
*hash
= &pot_ptr
->hash
;
18036 local_free (hash
->digest
);
18040 local_free (hash
->salt
);
18046 local_free (all_kernel_rules_cnt
);
18047 local_free (all_kernel_rules_buf
);
18049 local_free (wl_data
->buf
);
18050 local_free (wl_data
);
18052 local_free (bitmap_s1_a
);
18053 local_free (bitmap_s1_b
);
18054 local_free (bitmap_s1_c
);
18055 local_free (bitmap_s1_d
);
18056 local_free (bitmap_s2_a
);
18057 local_free (bitmap_s2_b
);
18058 local_free (bitmap_s2_c
);
18059 local_free (bitmap_s2_d
);
18062 local_free (temp_retain_fanspeed_value
);
18064 local_free (od_clock_mem_status
);
18065 local_free (od_power_control_status
);
18069 global_free (devices_param
);
18071 global_free (kernel_rules_buf
);
18073 global_free (root_css_buf
);
18074 global_free (markov_css_buf
);
18076 global_free (digests_buf
);
18077 global_free (digests_shown
);
18078 global_free (digests_shown_tmp
);
18080 global_free (salts_buf
);
18081 global_free (salts_shown
);
18083 global_free (esalts_buf
);
18085 global_free (words_progress_done
);
18086 global_free (words_progress_rejected
);
18087 global_free (words_progress_restored
);
18089 if (pot_fp
) fclose (pot_fp
);
18091 if (data
.devices_status
== STATUS_QUIT
) break;
18094 // destroy others mutex
18096 hc_thread_mutex_delete (mux_dispatcher
);
18097 hc_thread_mutex_delete (mux_counter
);
18098 hc_thread_mutex_delete (mux_display
);
18099 hc_thread_mutex_delete (mux_adl
);
18103 local_free (eff_restore_file
);
18104 local_free (new_restore_file
);
18110 tuning_db_destroy (tuning_db
);
18114 local_free (loopback_file
);
18116 if (loopback
== 1) unlink (loopback_file
);
18118 // induction directory
18120 if (induction_dir
== NULL
)
18122 if (attack_mode
!= ATTACK_MODE_BF
)
18124 if (rmdir (induction_directory
) == -1)
18126 if (errno
== ENOENT
)
18128 // good, we can ignore
18130 else if (errno
== ENOTEMPTY
)
18132 // good, we can ignore
18136 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18142 local_free (induction_directory
);
18146 // outfile-check directory
18148 if (outfile_check_dir
== NULL
)
18150 if (rmdir (outfile_check_directory
) == -1)
18152 if (errno
== ENOENT
)
18154 // good, we can ignore
18156 else if (errno
== ENOTEMPTY
)
18158 // good, we can ignore
18162 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18168 local_free (outfile_check_directory
);
18175 logfile_top_uint (proc_start
);
18176 logfile_top_uint (proc_stop
);
18178 logfile_top_msg ("STOP");
18180 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18181 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18183 if (data
.ocl
) ocl_close (data
.ocl
);
18185 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18186 if (data
.devices_status
== STATUS_QUIT
) return 2;
18187 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18188 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18189 if (data
.devices_status
== STATUS_CRACKED
) return 0;