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 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1547 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1548 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1549 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1550 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1551 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1553 char output_buf
[256] = { 0 };
1557 if (num_temperature
>= 0)
1559 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%uc", num_temperature
);
1561 output_len
= strlen (output_buf
);
1564 if (num_fanspeed
>= 0)
1566 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%u%%", num_fanspeed
);
1568 output_len
= strlen (output_buf
);
1571 if (num_utilization
>= 0)
1573 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%u%%", num_utilization
);
1575 output_len
= strlen (output_buf
);
1578 if (num_corespeed
>= 0)
1580 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%uMhz", num_corespeed
);
1582 output_len
= strlen (output_buf
);
1585 if (num_memoryspeed
>= 0)
1587 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%uMhz", num_memoryspeed
);
1589 output_len
= strlen (output_buf
);
1592 if (num_buslanes
>= 0)
1594 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1596 output_len
= strlen (output_buf
);
1599 if (output_len
== 0)
1601 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1603 output_len
= strlen (output_buf
);
1606 log_info ("HWMon.GPU.#%d...:%s", device_id
+ 1, output_buf
);
1609 hc_thread_mutex_unlock (mux_adl
);
1611 #endif // HAVE_HWMON
1614 static void status_benchmark_automate ()
1616 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1617 double speed_ms
[DEVICES_MAX
] = { 0 };
1619 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1621 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1623 if (device_param
->skipped
) continue;
1625 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1626 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1629 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1631 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1633 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1635 if (device_param
->skipped
) continue;
1637 hashes_dev_ms
[device_id
] = 0;
1639 if (speed_ms
[device_id
])
1641 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1645 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1647 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1649 if (device_param
->skipped
) continue;
1651 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1655 static void status_benchmark ()
1657 if (data
.devices_status
== STATUS_INIT
) return;
1658 if (data
.devices_status
== STATUS_STARTING
) return;
1659 if (data
.devices_status
== STATUS_BYPASS
) return;
1661 if (data
.machine_readable
== 1)
1663 status_benchmark_automate ();
1668 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1669 double speed_ms
[DEVICES_MAX
] = { 0 };
1671 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1673 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1675 if (device_param
->skipped
) continue;
1677 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1678 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1681 double hashes_all_ms
= 0;
1683 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1685 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1687 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1689 if (device_param
->skipped
) continue;
1691 hashes_dev_ms
[device_id
] = 0;
1693 if (speed_ms
[device_id
])
1695 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1697 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1705 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1707 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1709 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1711 if (device_param
->skipped
) continue;
1713 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1715 exec_all_ms
[device_id
] = exec_ms_avg
;
1718 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1720 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1722 if (device_param
->skipped
) continue;
1724 char display_dev_cur
[16] = { 0 };
1726 strncpy (display_dev_cur
, "0.00", 4);
1728 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1730 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1733 char display_all_cur
[16] = { 0 };
1735 strncpy (display_all_cur
, "0.00", 4);
1737 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1739 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1743 * hashcat -only- functions
1746 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1748 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1750 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1751 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1752 else if (attack_kern
== ATTACK_KERN_COMBI
)
1753 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1754 else if (attack_kern
== ATTACK_KERN_BF
)
1755 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1758 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1761 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
)
1763 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1765 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1766 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1767 else if (attack_kern
== ATTACK_KERN_COMBI
)
1768 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1769 else if (attack_kern
== ATTACK_KERN_BF
)
1770 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1774 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1778 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1780 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1782 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1786 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1790 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
)
1792 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1794 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1798 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1802 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1804 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1807 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1809 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1812 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1814 if (line_len
& 1) return (line_len
); // not in hex
1816 if (data
.hex_wordlist
== 1)
1821 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1823 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1826 memset (line_buf
+ i
, 0, line_len
- i
);
1830 else if (line_len
>= 6) // $HEX[] = 6
1832 if (line_buf
[0] != '$') return (line_len
);
1833 if (line_buf
[1] != 'H') return (line_len
);
1834 if (line_buf
[2] != 'E') return (line_len
);
1835 if (line_buf
[3] != 'X') return (line_len
);
1836 if (line_buf
[4] != '[') return (line_len
);
1837 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1842 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1844 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1847 memset (line_buf
+ i
, 0, line_len
- i
);
1855 static void clear_prompt ()
1857 fputc ('\r', stdout
);
1859 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1861 fputc (' ', stdout
);
1864 fputc ('\r', stdout
);
1869 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1871 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
);
1874 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1876 char *outfile
= data
.outfile
;
1877 uint quiet
= data
.quiet
;
1878 FILE *pot_fp
= data
.pot_fp
;
1879 uint loopback
= data
.loopback
;
1880 uint debug_mode
= data
.debug_mode
;
1881 char *debug_file
= data
.debug_file
;
1883 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1884 int debug_rule_len
= 0; // -1 error
1885 uint debug_plain_len
= 0;
1887 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1891 char out_buf
[HCBUFSIZ
] = { 0 };
1893 const u32 salt_pos
= plain
->salt_pos
;
1894 const u32 digest_pos
= plain
->digest_pos
; // relative
1895 const u32 gidvid
= plain
->gidvid
;
1896 const u32 il_pos
= plain
->il_pos
;
1898 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1902 u64 crackpos
= device_param
->words_off
;
1904 uint plain_buf
[16] = { 0 };
1906 u8
*plain_ptr
= (u8
*) plain_buf
;
1908 unsigned int plain_len
= 0;
1910 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1914 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1916 for (int i
= 0; i
< 16; i
++)
1918 plain_buf
[i
] = pw
.i
[i
];
1921 plain_len
= pw
.pw_len
;
1923 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1930 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1932 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1934 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1938 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1940 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1942 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1944 debug_plain_len
= plain_len
;
1948 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1951 crackpos
*= data
.kernel_rules_cnt
;
1952 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1954 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1956 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1960 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1962 for (int i
= 0; i
< 16; i
++)
1964 plain_buf
[i
] = pw
.i
[i
];
1967 plain_len
= pw
.pw_len
;
1969 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1970 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1972 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1974 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1978 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1980 memcpy (plain_ptr
, comb_buf
, comb_len
);
1983 plain_len
+= comb_len
;
1986 crackpos
*= data
.combs_cnt
;
1987 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1989 if (data
.pw_max
!= PW_DICTMAX1
)
1991 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1994 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1996 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1997 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1999 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2000 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2002 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2003 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2005 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2006 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2008 plain_len
= data
.css_cnt
;
2011 crackpos
*= data
.bfs_cnt
;
2012 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2014 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2018 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2020 for (int i
= 0; i
< 16; i
++)
2022 plain_buf
[i
] = pw
.i
[i
];
2025 plain_len
= pw
.pw_len
;
2027 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2030 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2032 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2034 plain_len
+= start
+ stop
;
2037 crackpos
*= data
.combs_cnt
;
2038 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2040 if (data
.pw_max
!= PW_DICTMAX1
)
2042 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2045 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2049 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2051 for (int i
= 0; i
< 16; i
++)
2053 plain_buf
[i
] = pw
.i
[i
];
2056 plain_len
= pw
.pw_len
;
2058 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2061 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2063 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2065 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2067 plain_len
+= start
+ stop
;
2070 crackpos
*= data
.combs_cnt
;
2071 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2073 if (data
.pw_max
!= PW_DICTMAX1
)
2075 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2079 if (data
.attack_mode
== ATTACK_MODE_BF
)
2081 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2083 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2085 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2087 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2091 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2093 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2095 plain_ptr
[j
] = plain_ptr
[i
];
2098 plain_len
= plain_len
/ 2;
2103 // if enabled, update also the potfile
2109 fprintf (pot_fp
, "%s:", out_buf
);
2111 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2113 fputc ('\n', pot_fp
);
2117 unlock_file (pot_fp
);
2122 FILE *out_fp
= NULL
;
2124 if (outfile
!= NULL
)
2126 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2128 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2139 if (quiet
== 0) clear_prompt ();
2142 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2144 if (outfile
!= NULL
)
2146 if (out_fp
!= stdout
)
2153 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2155 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2157 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2158 if (quiet
== 0) fflush (stdout
);
2167 char *loopback_file
= data
.loopback_file
;
2171 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2175 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2177 fputc ('\n', fb_fp
);
2183 // (rule) debug mode
2185 // the next check implies that:
2186 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2189 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2191 if (debug_rule_len
< 0) debug_rule_len
= 0;
2193 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2195 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2197 if ((quiet
== 0) && (debug_file
== NULL
))
2199 fprintf (stdout
, "%s", PROMPT
);
2206 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2208 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2212 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2216 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2220 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2222 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
);
2224 uint cpt_cracked
= 0;
2226 for (uint i
= 0; i
< num_cracked
; i
++)
2228 const uint hash_pos
= cracked
[i
].hash_pos
;
2230 if (data
.digests_shown
[hash_pos
] == 1) continue;
2232 hc_thread_mutex_lock (mux_display
);
2234 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2236 data
.digests_shown
[hash_pos
] = 1;
2238 data
.digests_done
++;
2242 salt_buf
->digests_done
++;
2244 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2246 data
.salts_shown
[salt_pos
] = 1;
2252 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2254 hc_thread_mutex_unlock (mux_display
);
2256 check_hash (device_param
, &cracked
[i
]);
2261 if (cpt_cracked
> 0)
2263 hc_thread_mutex_lock (mux_display
);
2265 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2266 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2270 data
.cpt_total
+= cpt_cracked
;
2272 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2274 hc_thread_mutex_unlock (mux_display
);
2277 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2279 // we need to reset cracked state on the device
2280 // otherwise host thinks again and again the hash was cracked
2281 // and returns invalid password each time
2283 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2285 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
);
2290 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2294 static void save_hash ()
2296 char *hashfile
= data
.hashfile
;
2298 char new_hashfile
[256] = { 0 };
2299 char old_hashfile
[256] = { 0 };
2301 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2302 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2304 unlink (new_hashfile
);
2306 char separator
= data
.separator
;
2308 FILE *fp
= fopen (new_hashfile
, "wb");
2312 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2317 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2319 if (data
.salts_shown
[salt_pos
] == 1) continue;
2321 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2323 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2325 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2327 if (data
.digests_shown
[idx
] == 1) continue;
2329 if (data
.hash_mode
!= 2500)
2331 char out_buf
[HCBUFSIZ
] = { 0 };
2333 if (data
.username
== 1)
2335 user_t
*user
= data
.hash_info
[idx
]->user
;
2339 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2341 fputc (separator
, fp
);
2344 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2346 fputs (out_buf
, fp
);
2354 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2356 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2365 unlink (old_hashfile
);
2367 if (rename (hashfile
, old_hashfile
) != 0)
2369 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2376 if (rename (new_hashfile
, hashfile
) != 0)
2378 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2383 unlink (old_hashfile
);
2386 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2388 // function called only in case kernel_power_all > words_left
2390 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2392 kernel_power_div
+= kernel_power_div
/ 100;
2394 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2396 while (kernel_power_new
< total_left
)
2398 kernel_power_div
+= kernel_power_div
/ 100;
2400 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2403 if (data
.quiet
== 0)
2409 log_info ("INFO: approaching final keyspace, workload adjusted");
2412 fprintf (stdout
, "%s", PROMPT
);
2417 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2419 return kernel_power_div
;
2422 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2424 uint num_elements
= num
;
2426 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2427 device_param
->kernel_params_buf32
[31] = num
;
2429 uint kernel_threads
= device_param
->kernel_threads
;
2431 while (num_elements
% kernel_threads
) num_elements
++;
2433 cl_kernel kernel
= NULL
;
2437 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2438 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2439 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2440 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2441 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2444 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2445 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2446 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2447 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2448 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2449 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2450 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2451 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2452 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2453 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2454 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2458 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2460 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2461 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2463 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2467 if (kern_run
== KERN_RUN_2
)
2469 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2471 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2475 while (num_elements
% kernel_threads
) num_elements
++;
2477 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2478 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2480 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2483 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2485 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2489 cl_ulong time_start
;
2492 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2493 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2495 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2497 uint exec_pos
= device_param
->exec_pos
;
2499 device_param
->exec_ms
[exec_pos
] = exec_time
;
2503 if (exec_pos
== EXEC_CACHE
)
2508 device_param
->exec_pos
= exec_pos
;
2511 hc_clReleaseEvent (data
.ocl
, event
);
2513 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2516 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2518 uint num_elements
= num
;
2522 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2523 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2524 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2527 // causes problems with special threads like in bcrypt
2528 // const uint kernel_threads = device_param->kernel_threads;
2530 uint kernel_threads
= device_param
->kernel_threads
;
2532 while (num_elements
% kernel_threads
) num_elements
++;
2534 cl_kernel kernel
= NULL
;
2538 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2539 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2540 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2545 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2546 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2547 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2548 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2549 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2550 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2552 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2553 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2554 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2555 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2556 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2557 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2559 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2560 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2561 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2562 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2563 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2564 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2565 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2569 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2570 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2572 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2574 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2576 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2579 static void run_kernel_tm (hc_device_param_t
*device_param
)
2581 const uint num_elements
= 1024; // fixed
2583 uint kernel_threads
= 32;
2585 cl_kernel kernel
= device_param
->kernel_tm
;
2587 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2588 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2590 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2592 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2594 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2597 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2599 uint num_elements
= num
;
2601 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2602 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2604 // causes problems with special threads like in bcrypt
2605 // const uint kernel_threads = device_param->kernel_threads;
2607 uint kernel_threads
= device_param
->kernel_threads
;
2609 while (num_elements
% kernel_threads
) num_elements
++;
2611 cl_kernel kernel
= device_param
->kernel_amp
;
2613 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2614 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2616 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2617 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2619 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2621 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2623 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2626 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2628 const u32 num16d
= num
/ 16;
2629 const u32 num16m
= num
% 16;
2633 device_param
->kernel_params_memset_buf32
[1] = value
;
2634 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2636 uint kernel_threads
= device_param
->kernel_threads
;
2638 uint num_elements
= num16d
;
2640 while (num_elements
% kernel_threads
) num_elements
++;
2642 cl_kernel kernel
= device_param
->kernel_memset
;
2644 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2645 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2646 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2648 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2649 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2651 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2653 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2655 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2667 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2671 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2673 run_kernel_memset (device_param
, buf
, 0, size
);
2678 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2680 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2682 const cl_uchar zero = 0;
2684 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2689 // NOTE: clEnqueueFillBuffer () always fails with -59
2690 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2691 // How's that possible, OpenCL 1.2 support is advertised??
2692 // We need to workaround...
2694 #define FILLSZ 0x100000
2696 char *tmp = (char *) mymalloc (FILLSZ);
2698 for (size_t i = 0; i < size; i += FILLSZ)
2700 const size_t left = size - i;
2702 const size_t fillsz = MIN (FILLSZ, left);
2704 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2712 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
)
2714 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2716 if (attack_mode
== ATTACK_MODE_BF
)
2718 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2720 const uint size_tm
= 32 * sizeof (bs_word_t
);
2722 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2724 run_kernel_tm (device_param
);
2726 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
);
2730 if (highest_pw_len
< 16)
2732 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2734 else if (highest_pw_len
< 32)
2736 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2740 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2745 run_kernel_amp (device_param
, pws_cnt
);
2747 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2749 if (opts_type
& OPTS_TYPE_HOOK12
)
2751 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2754 uint iter
= salt_buf
->salt_iter
;
2756 uint loop_step
= device_param
->kernel_loops
;
2758 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2760 uint loop_left
= iter
- loop_pos
;
2762 loop_left
= MIN (loop_left
, loop_step
);
2764 device_param
->kernel_params_buf32
[25] = loop_pos
;
2765 device_param
->kernel_params_buf32
[26] = loop_left
;
2767 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2769 if (data
.devices_status
== STATUS_CRACKED
) break;
2770 if (data
.devices_status
== STATUS_ABORTED
) break;
2771 if (data
.devices_status
== STATUS_QUIT
) break;
2777 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2779 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2783 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2785 const u32 speed_pos
= device_param
->speed_pos
;
2787 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2789 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2791 if (data
.benchmark
== 1)
2793 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2797 if (opts_type
& OPTS_TYPE_HOOK23
)
2799 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2801 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
);
2803 // do something with data
2805 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
);
2808 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2812 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2818 else if (rule_len
== 1)
2820 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2826 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2828 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2830 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
);
2832 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2834 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2836 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2838 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2840 for (u32 i
= 0; i
< pws_cnt
; i
++)
2842 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2844 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2849 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2851 for (u32 i
= 0; i
< pws_cnt
; i
++)
2853 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2855 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2862 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2864 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2866 for (u32 i
= 0; i
< pws_cnt
; i
++)
2868 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2870 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2875 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2877 for (u32 i
= 0; i
< pws_cnt
; i
++)
2879 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2881 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2888 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
);
2890 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2892 const u64 off
= device_param
->words_off
;
2894 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2896 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2900 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2902 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2904 device_param
->kernel_params_buf32
[25] = 0;
2905 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2906 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2908 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2910 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2914 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2917 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2919 return exec_ms_prev
;
2922 static void autotune (hc_device_param_t
*device_param
)
2924 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2926 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2927 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2929 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2930 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2932 u32 kernel_accel
= kernel_accel_min
;
2933 u32 kernel_loops
= kernel_loops_min
;
2935 // in this case the user specified a fixed -u and -n on the commandline
2936 // no way to tune anything
2937 // but we need to run a few caching rounds
2939 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2941 try_run (device_param
, kernel_accel
, kernel_loops
);
2942 try_run (device_param
, kernel_accel
, kernel_loops
);
2943 try_run (device_param
, kernel_accel
, kernel_loops
);
2944 try_run (device_param
, kernel_accel
, kernel_loops
);
2946 device_param
->kernel_accel
= kernel_accel
;
2947 device_param
->kernel_loops
= kernel_loops
;
2949 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2951 device_param
->kernel_power
= kernel_power
;
2956 // from here it's clear we are allowed to autotune
2957 // so let's init some fake words
2959 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2961 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2963 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2965 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2969 for (u32 i = 0; i < kernel_power_max; i++)
2971 device_param->pws_buf[i].i[0] = i;
2972 device_param->pws_buf[i].i[1] = 0x01234567;
2973 device_param->pws_buf[i].pw_len = 7;
2976 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);
2978 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2980 run_kernel_amp (device_param, kernel_power_max);
2984 #define VERIFIER_CNT 1
2986 // first find out highest kernel-loops that stays below target_ms
2988 if (kernel_loops_min
< kernel_loops_max
)
2990 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2992 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2994 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2996 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2998 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3001 if (exec_ms
< target_ms
) break;
3005 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3007 #define STEPS_CNT 10
3009 if (kernel_accel_min
< kernel_accel_max
)
3011 for (int i
= 0; i
< STEPS_CNT
; i
++)
3013 const u32 kernel_accel_try
= 1 << i
;
3015 if (kernel_accel_try
< kernel_accel_min
) continue;
3016 if (kernel_accel_try
> kernel_accel_max
) break;
3018 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3020 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3022 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3024 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3027 if (exec_ms
> target_ms
) break;
3029 kernel_accel
= kernel_accel_try
;
3033 // at this point we want to know the actual runtime for the following reason:
3034 // we need a reference for the balancing loop following up, and this
3035 // the balancing loop can have an effect that the creates a new opportunity, for example:
3036 // if the target is 95 ms and the current runtime is 48ms the above loop
3037 // stopped the execution because the previous exec_ms was > 95ms
3038 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3039 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3041 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3043 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3045 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3047 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3050 u32 diff
= kernel_loops
- kernel_accel
;
3052 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3054 u32 kernel_accel_orig
= kernel_accel
;
3055 u32 kernel_loops_orig
= kernel_loops
;
3057 for (u32 f
= 1; f
< 1024; f
++)
3059 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3060 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3062 if (kernel_accel_try
> kernel_accel_max
) break;
3063 if (kernel_loops_try
< kernel_loops_min
) break;
3065 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3067 if (diff_new
> diff
) break;
3071 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3073 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3075 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3077 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3080 if (exec_ms
< exec_ms_pre_final
)
3082 exec_ms_pre_final
= exec_ms
;
3084 kernel_accel
= kernel_accel_try
;
3085 kernel_loops
= kernel_loops_try
;
3090 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3092 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3094 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3096 if (exec_accel_min
>= 1.0)
3098 // this is safe to not overflow kernel_accel_max because of accel_left
3100 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3103 // reset them fake words
3106 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3108 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);
3109 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);
3112 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3114 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3116 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3121 device_param
->exec_pos
= 0;
3123 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3127 device_param
->kernel_accel
= kernel_accel
;
3128 device_param
->kernel_loops
= kernel_loops
;
3130 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3132 device_param
->kernel_power
= kernel_power
;
3136 if (data
.quiet
== 0)
3140 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3141 "Device #%u: autotuned kernel-loops to %u\n",
3142 device_param
->device_id
+ 1, kernel_accel
,
3143 device_param
->device_id
+ 1, kernel_loops
);
3145 fprintf (stdout
, "%s", PROMPT
);
3153 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3155 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3159 uint speed_pos
= device_param
->speed_pos
;
3162 if (device_param
->timer_speed
.tv_sec
== 0)
3164 hc_timer_set (&device_param
->timer_speed
);
3169 if (device_param
->timer_speed
.QuadPart
== 0)
3171 hc_timer_set (&device_param
->timer_speed
);
3175 // find higest password length, this is for optimization stuff
3177 uint highest_pw_len
= 0;
3179 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3182 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3185 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3187 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3188 + device_param
->kernel_params_mp_l_buf32
[5];
3193 uint innerloop_step
= 0;
3194 uint innerloop_cnt
= 0;
3196 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3197 else innerloop_step
= 1;
3199 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3200 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3201 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3203 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3205 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3207 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3209 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3211 if (data
.devices_status
== STATUS_CRACKED
) break;
3212 if (data
.devices_status
== STATUS_ABORTED
) break;
3213 if (data
.devices_status
== STATUS_QUIT
) break;
3214 if (data
.devices_status
== STATUS_BYPASS
) break;
3216 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3218 device_param
->kernel_params_buf32
[24] = salt_pos
;
3219 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3220 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3222 FILE *combs_fp
= device_param
->combs_fp
;
3224 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3231 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3233 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3235 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3237 if (data
.devices_status
== STATUS_CRACKED
) break;
3238 if (data
.devices_status
== STATUS_ABORTED
) break;
3239 if (data
.devices_status
== STATUS_QUIT
) break;
3240 if (data
.devices_status
== STATUS_BYPASS
) break;
3242 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3244 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3246 device_param
->innerloop_pos
= innerloop_pos
;
3247 device_param
->innerloop_left
= innerloop_left
;
3249 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3251 // i think we can get rid of this
3252 if (innerloop_left
== 0)
3254 puts ("bug, how should this happen????\n");
3259 if (data
.salts_shown
[salt_pos
] == 1)
3261 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3266 // initialize amplifiers
3268 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3272 while (i
< innerloop_left
)
3274 if (feof (combs_fp
)) break;
3276 int line_len
= fgetl (combs_fp
, line_buf
);
3278 if (line_len
>= PW_MAX1
) continue;
3280 line_len
= convert_from_hex (line_buf
, line_len
);
3282 char *line_buf_new
= line_buf
;
3284 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3286 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3288 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3290 if (rule_len_out
< 0)
3292 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3297 line_len
= rule_len_out
;
3299 line_buf_new
= rule_buf_out
;
3302 line_len
= MIN (line_len
, PW_DICTMAX
);
3304 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3306 memcpy (ptr
, line_buf_new
, line_len
);
3308 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3310 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3312 uppercase (ptr
, line_len
);
3315 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3317 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3319 ptr
[line_len
] = 0x80;
3322 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3324 ptr
[line_len
] = 0x01;
3328 device_param
->combs_buf
[i
].pw_len
= line_len
;
3333 for (uint j
= i
; j
< innerloop_left
; j
++)
3335 device_param
->combs_buf
[j
].i
[0] = 0;
3336 device_param
->combs_buf
[j
].i
[1] = 0;
3337 device_param
->combs_buf
[j
].i
[2] = 0;
3338 device_param
->combs_buf
[j
].i
[3] = 0;
3339 device_param
->combs_buf
[j
].i
[4] = 0;
3340 device_param
->combs_buf
[j
].i
[5] = 0;
3341 device_param
->combs_buf
[j
].i
[6] = 0;
3342 device_param
->combs_buf
[j
].i
[7] = 0;
3344 device_param
->combs_buf
[j
].pw_len
= 0;
3349 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3351 u64 off
= innerloop_pos
;
3353 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3355 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3357 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3359 u64 off
= innerloop_pos
;
3361 device_param
->kernel_params_mp_buf64
[3] = off
;
3363 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3365 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3367 u64 off
= innerloop_pos
;
3369 device_param
->kernel_params_mp_buf64
[3] = off
;
3371 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3376 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3378 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
);
3380 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3382 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
);
3384 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3386 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
);
3388 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3390 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
);
3392 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3394 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
);
3397 if (data
.benchmark
== 1)
3399 hc_timer_set (&device_param
->timer_speed
);
3402 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3404 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3406 if (data
.devices_status
== STATUS_CRACKED
) break;
3407 if (data
.devices_status
== STATUS_ABORTED
) break;
3408 if (data
.devices_status
== STATUS_QUIT
) break;
3414 check_cracked (device_param
, salt_pos
);
3420 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3422 hc_thread_mutex_lock (mux_counter
);
3424 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3426 hc_thread_mutex_unlock (mux_counter
);
3434 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3436 hc_timer_set (&device_param
->timer_speed
);
3440 //hc_thread_mutex_lock (mux_display);
3442 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3444 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3446 //hc_thread_mutex_unlock (mux_display);
3450 if (speed_pos
== SPEED_CACHE
)
3459 if (data
.benchmark
== 1) break;
3463 device_param
->speed_pos
= speed_pos
;
3468 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3470 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3474 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3476 wl_data
->buf
[wl_data
->cnt
] = 0;
3478 if (wl_data
->cnt
== 0) return;
3480 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3484 if (wl_data
->cnt
== wl_data
->avail
)
3486 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3488 wl_data
->avail
+= wl_data
->incr
;
3491 const int c
= fgetc (fd
);
3493 if (c
== EOF
) break;
3495 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3499 if (c
== '\n') break;
3502 // ensure stream ends with a newline
3504 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3508 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3514 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3518 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3520 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3530 if (*ptr
!= '\n') continue;
3534 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3545 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3549 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3551 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3553 if (*ptr
!= '\n') continue;
3557 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3568 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3572 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3574 if (*ptr
!= '\n') continue;
3578 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3589 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3591 while (wl_data
->pos
< wl_data
->cnt
)
3596 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3598 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3600 wl_data
->pos
+= off
;
3602 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3604 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3606 int rule_len_out
= -1;
3608 if (len
< BLOCK_SIZE
)
3610 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3613 if (rule_len_out
< 0)
3618 if (rule_len_out
> PW_MAX
)
3639 fprintf (stderr
, "BUG feof()!!\n");
3644 load_segment (wl_data
, fd
);
3646 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3650 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3654 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3664 fstat (fileno (fd
), &d
.stat
);
3668 _fstat64 (fileno (fd
), &d
.stat
);
3672 d
.stat
.st_nlink
= 0;
3676 d
.stat
.st_atime
= 0;
3679 d
.stat
.st_blksize
= 0;
3680 d
.stat
.st_blocks
= 0;
3683 if (d
.stat
.st_size
== 0) return 0;
3685 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3687 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3691 u64 cnt
= d_cache
->cnt
;
3695 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3697 keyspace
*= data
.kernel_rules_cnt
;
3699 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3701 keyspace
*= data
.combs_cnt
;
3704 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
);
3705 if (data
.quiet
== 0) log_info ("");
3707 hc_signal (sigHandler_default
);
3722 load_segment (wl_data
, fd
);
3724 comp
+= wl_data
->cnt
;
3728 while (i
< wl_data
->cnt
)
3733 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3735 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3737 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3739 int rule_len_out
= -1;
3741 if (len
< BLOCK_SIZE
)
3743 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3746 if (rule_len_out
< 0)
3758 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3760 cnt
+= data
.kernel_rules_cnt
;
3762 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3764 cnt
+= data
.combs_cnt
;
3777 if ((now
- prev
) == 0) continue;
3779 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3781 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
);
3786 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
);
3787 if (data
.quiet
== 0) log_info ("");
3789 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3791 hc_signal (sigHandler_default
);
3796 static void *thread_monitor (void *p
)
3798 uint runtime_check
= 0;
3799 uint remove_check
= 0;
3800 uint status_check
= 0;
3801 uint restore_check
= 0;
3803 uint restore_left
= data
.restore_timer
;
3804 uint remove_left
= data
.remove_timer
;
3805 uint status_left
= data
.status_timer
;
3808 uint hwmon_check
= 0;
3810 int slowdown_warnings
= 0;
3812 // these variables are mainly used for fan control (AMD only)
3814 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3816 // temperature controller "loopback" values
3818 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3819 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3822 int temp_threshold
= 1; // degrees celcius
3824 int fan_speed_min
= 15; // in percentage
3825 int fan_speed_max
= 100;
3828 time_t last_temp_check_time
;
3829 #endif // HAVE_HWMON
3831 uint sleep_time
= 1;
3838 if (data
.restore_timer
)
3843 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3848 if (data
.status
== 1)
3854 if (data
.gpu_temp_disable
== 0)
3856 time (&last_temp_check_time
);
3862 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3865 if (hwmon_check
== 0)
3870 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3872 hc_sleep (sleep_time
);
3874 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3880 hc_thread_mutex_lock (mux_adl
);
3882 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3884 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3886 if (device_param
->skipped
) continue;
3888 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3890 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3892 const int threshold
= data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
;
3894 if (temperature
>= threshold
)
3896 if (slowdown_warnings
< 3)
3898 if (data
.quiet
== 0) clear_prompt ();
3900 log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold
, device_id
+ 1);
3902 if (slowdown_warnings
== 2)
3907 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3908 if (data
.quiet
== 0) fflush (stdout
);
3910 slowdown_warnings
++;
3915 slowdown_warnings
= 0;
3919 hc_thread_mutex_unlock (mux_adl
);
3922 if (hwmon_check
== 1)
3924 hc_thread_mutex_lock (mux_adl
);
3926 time_t temp_check_time
;
3928 time (&temp_check_time
);
3930 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3932 if (Ta
== 0) Ta
= 1;
3934 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3936 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3938 if (device_param
->skipped
) continue;
3940 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3942 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3944 if (temperature
> (int) data
.gpu_temp_abort
)
3946 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3948 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3954 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3956 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3958 if (data
.hm_device
[device_id
].fan_supported
== 1)
3960 int temp_cur
= temperature
;
3962 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3964 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3966 // calculate Ta value (time difference in seconds between the last check and this check)
3968 last_temp_check_time
= temp_check_time
;
3974 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3976 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
);
3978 if (abs (fan_diff_required
) >= temp_threshold
)
3980 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3982 int fan_speed_level
= fan_speed_cur
;
3984 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3986 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3988 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3989 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3991 if (fan_speed_new
!= fan_speed_cur
)
3993 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3994 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3996 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3998 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
4000 fan_speed_chgd
[device_id
] = 1;
4003 temp_diff_old
[device_id
] = temp_diff_new
;
4011 hc_thread_mutex_unlock (mux_adl
);
4013 #endif // HAVE_HWMON
4015 if (restore_check
== 1)
4019 if (restore_left
== 0)
4021 if (data
.restore_disable
== 0) cycle_restore ();
4023 restore_left
= data
.restore_timer
;
4027 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4031 time (&runtime_cur
);
4033 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4035 if (runtime_left
<= 0)
4037 if (data
.benchmark
== 0)
4039 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4042 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4046 if (remove_check
== 1)
4050 if (remove_left
== 0)
4052 if (data
.digests_saved
!= data
.digests_done
)
4054 data
.digests_saved
= data
.digests_done
;
4059 remove_left
= data
.remove_timer
;
4063 if (status_check
== 1)
4067 if (status_left
== 0)
4069 //hc_thread_mutex_lock (mux_display);
4071 if (data
.quiet
== 0) clear_prompt ();
4073 if (data
.quiet
== 0) log_info ("");
4077 if (data
.quiet
== 0) log_info ("");
4079 //hc_thread_mutex_unlock (mux_display);
4081 status_left
= data
.status_timer
;
4087 myfree (fan_speed_chgd
);
4089 myfree (temp_diff_old
);
4090 myfree (temp_diff_sum
);
4098 static void *thread_outfile_remove (void *p
)
4100 // some hash-dependent constants
4101 char *outfile_dir
= data
.outfile_check_directory
;
4102 uint dgst_size
= data
.dgst_size
;
4103 uint isSalted
= data
.isSalted
;
4104 uint esalt_size
= data
.esalt_size
;
4105 uint hash_mode
= data
.hash_mode
;
4107 uint outfile_check_timer
= data
.outfile_check_timer
;
4109 char separator
= data
.separator
;
4111 // some hash-dependent functions
4112 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4113 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4116 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4118 hash_buf
.digest
= mymalloc (dgst_size
);
4120 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4122 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4124 uint digest_buf
[64] = { 0 };
4126 outfile_data_t
*out_info
= NULL
;
4128 char **out_files
= NULL
;
4130 time_t folder_mtime
= 0;
4134 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4136 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4140 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4144 if (check_left
== 0)
4146 struct stat outfile_check_stat
;
4148 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4150 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4154 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4156 char **out_files_new
= scan_directory (outfile_dir
);
4158 int out_cnt_new
= count_dictionaries (out_files_new
);
4160 outfile_data_t
*out_info_new
= NULL
;
4162 if (out_cnt_new
> 0)
4164 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4166 for (int i
= 0; i
< out_cnt_new
; i
++)
4168 out_info_new
[i
].file_name
= out_files_new
[i
];
4170 // check if there are files that we have seen/checked before (and not changed)
4172 for (int j
= 0; j
< out_cnt
; j
++)
4174 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4176 struct stat outfile_stat
;
4178 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4180 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4182 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4183 out_info_new
[i
].seek
= out_info
[j
].seek
;
4191 local_free (out_info
);
4192 local_free (out_files
);
4194 out_files
= out_files_new
;
4195 out_cnt
= out_cnt_new
;
4196 out_info
= out_info_new
;
4198 folder_mtime
= outfile_check_stat
.st_mtime
;
4201 for (int j
= 0; j
< out_cnt
; j
++)
4203 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4207 //hc_thread_mutex_lock (mux_display);
4210 struct stat outfile_stat
;
4212 fstat (fileno (fp
), &outfile_stat
);
4216 struct stat64 outfile_stat
;
4218 _fstat64 (fileno (fp
), &outfile_stat
);
4221 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4223 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4224 out_info
[j
].seek
= 0;
4227 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4229 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4233 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4235 if (ptr
== NULL
) break;
4237 int line_len
= strlen (line_buf
);
4239 if (line_len
<= 0) continue;
4241 int iter
= MAX_CUT_TRIES
;
4243 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4245 if (line_buf
[i
] != separator
) continue;
4247 int parser_status
= PARSER_OK
;
4249 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4251 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4256 if (parser_status
== PARSER_OK
)
4258 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4260 if (data
.salts_shown
[salt_pos
] == 1) continue;
4262 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4264 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4266 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4268 if (data
.digests_shown
[idx
] == 1) continue;
4272 if (hash_mode
== 6800)
4274 if (i
== salt_buf
->salt_len
)
4276 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4279 else if (hash_mode
== 2500)
4281 // BSSID : MAC1 : MAC2 (:plain)
4282 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4284 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4286 if (!cracked
) continue;
4288 // now compare MAC1 and MAC2 too, since we have this additional info
4289 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4290 char *mac2_pos
= mac1_pos
+ 12 + 1;
4292 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4293 wpa_t
*wpa
= &wpas
[salt_pos
];
4295 // compare hex string(s) vs binary MAC address(es)
4297 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4299 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4308 if (!cracked
) continue;
4310 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4312 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4323 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4325 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4327 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4334 data
.digests_shown
[idx
] = 1;
4336 data
.digests_done
++;
4338 salt_buf
->digests_done
++;
4340 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4342 data
.salts_shown
[salt_pos
] = 1;
4346 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4351 if (data
.devices_status
== STATUS_CRACKED
) break;
4357 if (data
.devices_status
== STATUS_CRACKED
) break;
4362 if (data
.devices_status
== STATUS_CRACKED
) break;
4367 out_info
[j
].seek
= ftell (fp
);
4369 //hc_thread_mutex_unlock (mux_display);
4377 check_left
= outfile_check_timer
;
4381 if (esalt_size
) local_free (hash_buf
.esalt
);
4383 if (isSalted
) local_free (hash_buf
.salt
);
4385 local_free (hash_buf
.digest
);
4387 local_free (out_info
);
4389 local_free (out_files
);
4396 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4398 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4400 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4402 u8
*ptr
= (u8
*) pw
->i
;
4404 memcpy (ptr
, pw_buf
, pw_len
);
4406 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4408 pw
->pw_len
= pw_len
;
4410 device_param
->pws_cnt
++;
4414 fprintf (stderr
, "BUG pw_add()!!\n");
4420 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4422 hc_thread_mutex_lock (mux_dispatcher
);
4424 const u64 words_cur
= data
.words_cur
;
4425 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4427 device_param
->words_off
= words_cur
;
4429 const u64 words_left
= words_base
- words_cur
;
4433 if (data
.kernel_power_all
> words_left
)
4435 if (data
.kernel_power_div
== 0)
4437 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4441 if (data
.kernel_power_div
)
4443 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4445 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4447 if (kernel_power_new
< device_param
->kernel_power
)
4449 device_param
->kernel_power
= kernel_power_new
;
4455 const uint kernel_power
= device_param
->kernel_power
;
4457 uint work
= MIN (words_left
, kernel_power
);
4459 work
= MIN (work
, max
);
4461 data
.words_cur
+= work
;
4463 hc_thread_mutex_unlock (mux_dispatcher
);
4468 static void *thread_calc_stdin (void *p
)
4470 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4472 if (device_param
->skipped
) return NULL
;
4474 autotune (device_param
);
4476 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4478 const uint attack_kern
= data
.attack_kern
;
4480 const uint kernel_power
= device_param
->kernel_power
;
4482 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4484 hc_thread_mutex_lock (mux_dispatcher
);
4486 if (feof (stdin
) != 0)
4488 hc_thread_mutex_unlock (mux_dispatcher
);
4495 while (words_cur
< kernel_power
)
4497 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4499 if (line_buf
== NULL
) break;
4501 uint line_len
= in_superchop (line_buf
);
4503 line_len
= convert_from_hex (line_buf
, line_len
);
4505 // post-process rule engine
4507 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4509 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4511 int rule_len_out
= -1;
4513 if (line_len
< BLOCK_SIZE
)
4515 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4518 if (rule_len_out
< 0) continue;
4520 line_buf
= rule_buf_out
;
4521 line_len
= rule_len_out
;
4524 if (line_len
> PW_MAX
)
4529 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4531 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4533 hc_thread_mutex_lock (mux_counter
);
4535 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4537 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4540 hc_thread_mutex_unlock (mux_counter
);
4545 else if (attack_kern
== ATTACK_KERN_COMBI
)
4547 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4548 // since we still need to combine the plains
4550 if (line_len
> data
.pw_max
)
4552 hc_thread_mutex_lock (mux_counter
);
4554 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4556 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4559 hc_thread_mutex_unlock (mux_counter
);
4565 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4569 if (data
.devices_status
== STATUS_CRACKED
) break;
4570 if (data
.devices_status
== STATUS_ABORTED
) break;
4571 if (data
.devices_status
== STATUS_QUIT
) break;
4572 if (data
.devices_status
== STATUS_BYPASS
) break;
4575 hc_thread_mutex_unlock (mux_dispatcher
);
4577 if (data
.devices_status
== STATUS_CRACKED
) break;
4578 if (data
.devices_status
== STATUS_ABORTED
) break;
4579 if (data
.devices_status
== STATUS_QUIT
) break;
4580 if (data
.devices_status
== STATUS_BYPASS
) break;
4584 const uint pws_cnt
= device_param
->pws_cnt
;
4588 run_copy (device_param
, pws_cnt
);
4590 run_cracker (device_param
, pws_cnt
);
4592 device_param
->pws_cnt
= 0;
4596 if (attack_kern == ATTACK_KERN_STRAIGHT)
4598 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4600 else if (attack_kern == ATTACK_KERN_COMBI)
4602 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4608 device_param
->kernel_accel
= 0;
4609 device_param
->kernel_loops
= 0;
4616 static void *thread_calc (void *p
)
4618 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4620 if (device_param
->skipped
) return NULL
;
4622 autotune (device_param
);
4624 const uint attack_mode
= data
.attack_mode
;
4625 const uint attack_kern
= data
.attack_kern
;
4627 if (attack_mode
== ATTACK_MODE_BF
)
4629 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4631 const uint work
= get_work (device_param
, -1, true);
4633 if (work
== 0) break;
4635 const u64 words_off
= device_param
->words_off
;
4636 const u64 words_fin
= words_off
+ work
;
4638 const uint pws_cnt
= work
;
4640 device_param
->pws_cnt
= pws_cnt
;
4644 run_copy (device_param
, pws_cnt
);
4646 run_cracker (device_param
, pws_cnt
);
4648 device_param
->pws_cnt
= 0;
4652 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4656 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4658 if (data
.devices_status
== STATUS_CRACKED
) break;
4659 if (data
.devices_status
== STATUS_ABORTED
) break;
4660 if (data
.devices_status
== STATUS_QUIT
) break;
4661 if (data
.devices_status
== STATUS_BYPASS
) break;
4663 if (data
.benchmark
== 1) break;
4665 device_param
->words_done
= words_fin
;
4670 const uint segment_size
= data
.segment_size
;
4672 char *dictfile
= data
.dictfile
;
4674 if (attack_mode
== ATTACK_MODE_COMBI
)
4676 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4678 dictfile
= data
.dictfile2
;
4682 FILE *fd
= fopen (dictfile
, "rb");
4686 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4691 if (attack_mode
== ATTACK_MODE_COMBI
)
4693 const uint combs_mode
= data
.combs_mode
;
4695 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4697 const char *dictfilec
= data
.dictfile2
;
4699 FILE *combs_fp
= fopen (dictfilec
, "rb");
4701 if (combs_fp
== NULL
)
4703 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4710 device_param
->combs_fp
= combs_fp
;
4712 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4714 const char *dictfilec
= data
.dictfile
;
4716 FILE *combs_fp
= fopen (dictfilec
, "rb");
4718 if (combs_fp
== NULL
)
4720 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4727 device_param
->combs_fp
= combs_fp
;
4731 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4733 wl_data
->buf
= (char *) mymalloc (segment_size
);
4734 wl_data
->avail
= segment_size
;
4735 wl_data
->incr
= segment_size
;
4741 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4746 bool allow_div
= true;
4752 const uint work
= get_work (device_param
, max
, allow_div
);
4756 if (work
== 0) break;
4758 words_off
= device_param
->words_off
;
4759 words_fin
= words_off
+ work
;
4764 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4768 for ( ; words_cur
< words_fin
; words_cur
++)
4770 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4772 line_len
= convert_from_hex (line_buf
, line_len
);
4774 // post-process rule engine
4776 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4778 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4780 int rule_len_out
= -1;
4782 if (line_len
< BLOCK_SIZE
)
4784 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4787 if (rule_len_out
< 0) continue;
4789 line_buf
= rule_buf_out
;
4790 line_len
= rule_len_out
;
4793 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4795 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4799 hc_thread_mutex_lock (mux_counter
);
4801 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4803 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4806 hc_thread_mutex_unlock (mux_counter
);
4811 else if (attack_kern
== ATTACK_KERN_COMBI
)
4813 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4814 // since we still need to combine the plains
4816 if (line_len
> data
.pw_max
)
4820 hc_thread_mutex_lock (mux_counter
);
4822 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4824 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4827 hc_thread_mutex_unlock (mux_counter
);
4833 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4835 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4837 if (data
.devices_status
== STATUS_CRACKED
) break;
4838 if (data
.devices_status
== STATUS_ABORTED
) break;
4839 if (data
.devices_status
== STATUS_QUIT
) break;
4840 if (data
.devices_status
== STATUS_BYPASS
) break;
4843 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4845 if (data
.devices_status
== STATUS_CRACKED
) break;
4846 if (data
.devices_status
== STATUS_ABORTED
) break;
4847 if (data
.devices_status
== STATUS_QUIT
) break;
4848 if (data
.devices_status
== STATUS_BYPASS
) break;
4851 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4853 if (data
.devices_status
== STATUS_CRACKED
) break;
4854 if (data
.devices_status
== STATUS_ABORTED
) break;
4855 if (data
.devices_status
== STATUS_QUIT
) break;
4856 if (data
.devices_status
== STATUS_BYPASS
) break;
4862 const uint pws_cnt
= device_param
->pws_cnt
;
4866 run_copy (device_param
, pws_cnt
);
4868 run_cracker (device_param
, pws_cnt
);
4870 device_param
->pws_cnt
= 0;
4874 if (attack_kern == ATTACK_KERN_STRAIGHT)
4876 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4878 else if (attack_kern == ATTACK_KERN_COMBI)
4880 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4885 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4887 if (data
.devices_status
== STATUS_CRACKED
) break;
4888 if (data
.devices_status
== STATUS_ABORTED
) break;
4889 if (data
.devices_status
== STATUS_QUIT
) break;
4890 if (data
.devices_status
== STATUS_BYPASS
) break;
4892 if (words_fin
== 0) break;
4894 device_param
->words_done
= words_fin
;
4897 if (attack_mode
== ATTACK_MODE_COMBI
)
4899 fclose (device_param
->combs_fp
);
4902 free (wl_data
->buf
);
4908 device_param
->kernel_accel
= 0;
4909 device_param
->kernel_loops
= 0;
4914 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4918 log_error ("ERROR: %s : Invalid argument", __func__
);
4923 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4925 device_param
->kernel_params_buf32
[24] = salt_pos
;
4926 device_param
->kernel_params_buf32
[27] = 1;
4927 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4928 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4929 device_param
->kernel_params_buf32
[30] = 0;
4930 device_param
->kernel_params_buf32
[31] = 1;
4932 char *dictfile_old
= data
.dictfile
;
4934 const char *weak_hash_check
= "weak-hash-check";
4936 data
.dictfile
= (char *) weak_hash_check
;
4938 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4940 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4946 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4948 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4952 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4954 uint loop_step
= 16;
4956 const uint iter
= salt_buf
->salt_iter
;
4958 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4960 uint loop_left
= iter
- loop_pos
;
4962 loop_left
= MIN (loop_left
, loop_step
);
4964 device_param
->kernel_params_buf32
[25] = loop_pos
;
4965 device_param
->kernel_params_buf32
[26] = loop_left
;
4967 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4970 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4977 check_cracked (device_param
, salt_pos
);
4983 device_param
->kernel_params_buf32
[24] = 0;
4984 device_param
->kernel_params_buf32
[25] = 0;
4985 device_param
->kernel_params_buf32
[26] = 0;
4986 device_param
->kernel_params_buf32
[27] = 0;
4987 device_param
->kernel_params_buf32
[28] = 0;
4988 device_param
->kernel_params_buf32
[29] = 0;
4989 device_param
->kernel_params_buf32
[30] = 0;
4990 device_param
->kernel_params_buf32
[31] = 0;
4992 data
.dictfile
= dictfile_old
;
4994 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4999 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5001 if (data
.username
== 0)
5003 *hashbuf_pos
= line_buf
;
5004 *hashbuf_len
= line_len
;
5008 char *pos
= line_buf
;
5011 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5013 if (line_buf
[i
] == data
.separator
)
5028 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5035 for (int i
= 0; i
< line_len
; i
++)
5037 if (line_buf
[i
] == data
.separator
)
5046 if (pos
== NULL
) pos
= line_buf
+ i
;
5058 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5065 for (int i
= 0; i
< line_len
; i
++)
5067 if (line_buf
[i
] == ':')
5074 if (sep_cnt
== 2) sep2_len
++;
5075 if (sep_cnt
== 3) sep3_len
++;
5078 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5083 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5090 for (int i
= 0; i
< line_len
; i
++)
5092 if (line_buf
[i
] == ':')
5099 if (data
.hash_mode
== 1000)
5103 if (pos
== NULL
) pos
= line_buf
+ i
;
5108 else if (data
.hash_mode
== 3000)
5112 if (pos
== NULL
) pos
= line_buf
+ i
;
5123 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5130 for (int i
= 0; i
< line_len
; i
++)
5132 if (line_buf
[i
] == ':')
5141 if (pos
== NULL
) pos
= line_buf
+ i
;
5153 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5157 char sep5_first
= 0;
5158 char sep6_first
= 0;
5160 for (int i
= 0; i
< line_len
; i
++)
5162 if (line_buf
[i
] == ':')
5169 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5170 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5173 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5178 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5185 for (int i
= 0; i
< line_len
; i
++)
5187 if (line_buf
[i
] == ':')
5196 if (pos
== NULL
) pos
= line_buf
+ i
;
5206 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5213 for (int i
= 0; i
< line_len
; i
++)
5215 if (line_buf
[i
] == ':')
5224 if (pos
== NULL
) pos
= line_buf
+ i
;
5236 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5240 for (int i
= 0; i
< line_len
; i
++)
5242 if (line_buf
[i
] == ':') sep_cnt
++;
5245 if (sep_cnt
== 8) return 1;
5250 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5252 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5255 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5257 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5262 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5264 switch (hashfile_format
)
5266 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5267 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5268 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5269 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5273 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5275 switch (hashfile_format
)
5277 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5278 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5279 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5280 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5284 char *strhlfmt (const uint hashfile_format
)
5286 switch (hashfile_format
)
5288 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5289 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5290 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5291 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5292 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5293 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5294 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5295 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5296 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5297 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5300 return ((char *) "Unknown");
5303 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5305 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5307 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5308 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5310 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5314 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5318 int line_len
= fgetl (fp
, line_buf
);
5320 if (line_len
== 0) continue;
5322 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5323 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5324 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5326 if (num_check
== max_check
) break;
5333 uint hashlist_format
= HLFMT_HASHCAT
;
5335 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5337 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5339 hashlist_format
= i
;
5344 return hashlist_format
;
5348 * some further helper function
5351 // wrapper around mymalloc for ADL
5353 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5354 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5356 return mymalloc (iSize
);
5360 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
)
5364 const uint dgst_pos0
= data
.dgst_pos0
;
5365 const uint dgst_pos1
= data
.dgst_pos1
;
5366 const uint dgst_pos2
= data
.dgst_pos2
;
5367 const uint dgst_pos3
= data
.dgst_pos3
;
5369 memset (bitmap_a
, 0, bitmap_size
);
5370 memset (bitmap_b
, 0, bitmap_size
);
5371 memset (bitmap_c
, 0, bitmap_size
);
5372 memset (bitmap_d
, 0, bitmap_size
);
5374 for (uint i
= 0; i
< digests_cnt
; i
++)
5376 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5378 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5380 digests_buf_ptr
+= dgst_size
;
5382 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5383 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5384 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5385 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5387 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5388 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5389 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5390 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5392 if (bitmap_a
[idx0
] & val0
) collisions
++;
5393 if (bitmap_b
[idx1
] & val1
) collisions
++;
5394 if (bitmap_c
[idx2
] & val2
) collisions
++;
5395 if (bitmap_d
[idx3
] & val3
) collisions
++;
5397 bitmap_a
[idx0
] |= val0
;
5398 bitmap_b
[idx1
] |= val1
;
5399 bitmap_c
[idx2
] |= val2
;
5400 bitmap_d
[idx3
] |= val3
;
5402 if (collisions
>= collisions_max
) return 0x7fffffff;
5413 void SetConsoleWindowSize (const int x
)
5415 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5417 if (h
== INVALID_HANDLE_VALUE
) return;
5419 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5421 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5423 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5425 sr
->Right
= MAX (sr
->Right
, x
- 1);
5429 co
.X
= sr
->Right
+ 1;
5430 co
.Y
= sr
->Bottom
+ 1;
5432 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5434 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5438 int main (int argc
, char **argv
)
5441 SetConsoleWindowSize (132);
5445 * To help users a bit
5448 char *compute
= getenv ("COMPUTE");
5452 static char display
[100];
5454 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5460 if (getenv ("DISPLAY") == NULL
)
5461 putenv ((char *) "DISPLAY=:0");
5464 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5465 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5467 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5468 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5470 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5471 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5473 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5474 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5476 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5477 putenv ((char *) "POCL_KERNEL_CACHE=0");
5485 memset (&data
, 0, sizeof (hc_global_data_t
));
5491 data
.proc_start
= proc_start
;
5494 char **myargv
= argv
;
5496 hc_thread_mutex_init (mux_dispatcher
);
5497 hc_thread_mutex_init (mux_counter
);
5498 hc_thread_mutex_init (mux_display
);
5499 hc_thread_mutex_init (mux_adl
);
5502 * commandline parameters
5506 uint version
= VERSION
;
5508 uint benchmark
= BENCHMARK
;
5511 uint username
= USERNAME
;
5512 uint remove
= REMOVE
;
5513 uint remove_timer
= REMOVE_TIMER
;
5516 uint keyspace
= KEYSPACE
;
5517 uint potfile_disable
= POTFILE_DISABLE
;
5518 char *potfile_path
= NULL
;
5519 uint debug_mode
= DEBUG_MODE
;
5520 char *debug_file
= NULL
;
5521 char *induction_dir
= NULL
;
5522 char *outfile_check_dir
= NULL
;
5524 uint runtime
= RUNTIME
;
5525 uint hash_mode
= HASH_MODE
;
5526 uint attack_mode
= ATTACK_MODE
;
5527 uint markov_disable
= MARKOV_DISABLE
;
5528 uint markov_classic
= MARKOV_CLASSIC
;
5529 uint markov_threshold
= MARKOV_THRESHOLD
;
5530 char *markov_hcstat
= NULL
;
5531 char *outfile
= NULL
;
5532 uint outfile_format
= OUTFILE_FORMAT
;
5533 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5534 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5535 uint restore
= RESTORE
;
5536 uint restore_timer
= RESTORE_TIMER
;
5537 uint restore_disable
= RESTORE_DISABLE
;
5538 uint status
= STATUS
;
5539 uint status_timer
= STATUS_TIMER
;
5540 uint machine_readable
= MACHINE_READABLE
;
5541 uint loopback
= LOOPBACK
;
5542 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5543 char *session
= NULL
;
5544 uint hex_charset
= HEX_CHARSET
;
5545 uint hex_salt
= HEX_SALT
;
5546 uint hex_wordlist
= HEX_WORDLIST
;
5547 uint rp_gen
= RP_GEN
;
5548 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5549 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5550 uint rp_gen_seed
= RP_GEN_SEED
;
5551 char *rule_buf_l
= (char *) RULE_BUF_L
;
5552 char *rule_buf_r
= (char *) RULE_BUF_R
;
5553 uint increment
= INCREMENT
;
5554 uint increment_min
= INCREMENT_MIN
;
5555 uint increment_max
= INCREMENT_MAX
;
5556 char *cpu_affinity
= NULL
;
5557 OCL_PTR
*ocl
= NULL
;
5558 char *opencl_devices
= NULL
;
5559 char *opencl_platforms
= NULL
;
5560 char *opencl_device_types
= NULL
;
5561 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5562 char *truecrypt_keyfiles
= NULL
;
5563 char *veracrypt_keyfiles
= NULL
;
5564 uint veracrypt_pim
= 0;
5565 uint workload_profile
= WORKLOAD_PROFILE
;
5566 uint kernel_accel
= KERNEL_ACCEL
;
5567 uint kernel_loops
= KERNEL_LOOPS
;
5568 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5570 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5571 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5573 uint powertune_enable
= POWERTUNE_ENABLE
;
5576 uint logfile_disable
= LOGFILE_DISABLE
;
5577 uint segment_size
= SEGMENT_SIZE
;
5578 uint scrypt_tmto
= SCRYPT_TMTO
;
5579 char separator
= SEPARATOR
;
5580 uint bitmap_min
= BITMAP_MIN
;
5581 uint bitmap_max
= BITMAP_MAX
;
5582 char *custom_charset_1
= NULL
;
5583 char *custom_charset_2
= NULL
;
5584 char *custom_charset_3
= NULL
;
5585 char *custom_charset_4
= NULL
;
5587 #define IDX_HELP 'h'
5588 #define IDX_VERSION 'V'
5589 #define IDX_VERSION_LOWER 'v'
5590 #define IDX_QUIET 0xff02
5591 #define IDX_SHOW 0xff03
5592 #define IDX_LEFT 0xff04
5593 #define IDX_REMOVE 0xff05
5594 #define IDX_REMOVE_TIMER 0xff37
5595 #define IDX_SKIP 's'
5596 #define IDX_LIMIT 'l'
5597 #define IDX_KEYSPACE 0xff35
5598 #define IDX_POTFILE_DISABLE 0xff06
5599 #define IDX_POTFILE_PATH 0xffe0
5600 #define IDX_DEBUG_MODE 0xff43
5601 #define IDX_DEBUG_FILE 0xff44
5602 #define IDX_INDUCTION_DIR 0xff46
5603 #define IDX_OUTFILE_CHECK_DIR 0xff47
5604 #define IDX_USERNAME 0xff07
5605 #define IDX_FORCE 0xff08
5606 #define IDX_RUNTIME 0xff09
5607 #define IDX_BENCHMARK 'b'
5608 #define IDX_HASH_MODE 'm'
5609 #define IDX_ATTACK_MODE 'a'
5610 #define IDX_RP_FILE 'r'
5611 #define IDX_RP_GEN 'g'
5612 #define IDX_RP_GEN_FUNC_MIN 0xff10
5613 #define IDX_RP_GEN_FUNC_MAX 0xff11
5614 #define IDX_RP_GEN_SEED 0xff34
5615 #define IDX_RULE_BUF_L 'j'
5616 #define IDX_RULE_BUF_R 'k'
5617 #define IDX_INCREMENT 'i'
5618 #define IDX_INCREMENT_MIN 0xff12
5619 #define IDX_INCREMENT_MAX 0xff13
5620 #define IDX_OUTFILE 'o'
5621 #define IDX_OUTFILE_FORMAT 0xff14
5622 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5623 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5624 #define IDX_RESTORE 0xff15
5625 #define IDX_RESTORE_DISABLE 0xff27
5626 #define IDX_STATUS 0xff17
5627 #define IDX_STATUS_TIMER 0xff18
5628 #define IDX_MACHINE_READABLE 0xff50
5629 #define IDX_LOOPBACK 0xff38
5630 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5631 #define IDX_SESSION 0xff19
5632 #define IDX_HEX_CHARSET 0xff20
5633 #define IDX_HEX_SALT 0xff21
5634 #define IDX_HEX_WORDLIST 0xff40
5635 #define IDX_MARKOV_DISABLE 0xff22
5636 #define IDX_MARKOV_CLASSIC 0xff23
5637 #define IDX_MARKOV_THRESHOLD 't'
5638 #define IDX_MARKOV_HCSTAT 0xff24
5639 #define IDX_CPU_AFFINITY 0xff25
5640 #define IDX_OPENCL_DEVICES 'd'
5641 #define IDX_OPENCL_PLATFORMS 0xff72
5642 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5643 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5644 #define IDX_WORKLOAD_PROFILE 'w'
5645 #define IDX_KERNEL_ACCEL 'n'
5646 #define IDX_KERNEL_LOOPS 'u'
5647 #define IDX_GPU_TEMP_DISABLE 0xff29
5648 #define IDX_GPU_TEMP_ABORT 0xff30
5649 #define IDX_GPU_TEMP_RETAIN 0xff31
5650 #define IDX_POWERTUNE_ENABLE 0xff41
5651 #define IDX_LOGFILE_DISABLE 0xff51
5652 #define IDX_TRUECRYPT_KEYFILES 0xff52
5653 #define IDX_VERACRYPT_KEYFILES 0xff53
5654 #define IDX_VERACRYPT_PIM 0xff54
5655 #define IDX_SCRYPT_TMTO 0xff61
5656 #define IDX_SEGMENT_SIZE 'c'
5657 #define IDX_SEPARATOR 'p'
5658 #define IDX_BITMAP_MIN 0xff70
5659 #define IDX_BITMAP_MAX 0xff71
5660 #define IDX_CUSTOM_CHARSET_1 '1'
5661 #define IDX_CUSTOM_CHARSET_2 '2'
5662 #define IDX_CUSTOM_CHARSET_3 '3'
5663 #define IDX_CUSTOM_CHARSET_4 '4'
5665 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5667 struct option long_options
[] =
5669 {"help", no_argument
, 0, IDX_HELP
},
5670 {"version", no_argument
, 0, IDX_VERSION
},
5671 {"quiet", no_argument
, 0, IDX_QUIET
},
5672 {"show", no_argument
, 0, IDX_SHOW
},
5673 {"left", no_argument
, 0, IDX_LEFT
},
5674 {"username", no_argument
, 0, IDX_USERNAME
},
5675 {"remove", no_argument
, 0, IDX_REMOVE
},
5676 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5677 {"skip", required_argument
, 0, IDX_SKIP
},
5678 {"limit", required_argument
, 0, IDX_LIMIT
},
5679 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5680 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5681 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5682 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5683 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5684 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5685 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5686 {"force", no_argument
, 0, IDX_FORCE
},
5687 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5688 {"restore", no_argument
, 0, IDX_RESTORE
},
5689 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5690 {"status", no_argument
, 0, IDX_STATUS
},
5691 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5692 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5693 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5694 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5695 {"session", required_argument
, 0, IDX_SESSION
},
5696 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5697 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5698 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5699 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5700 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5701 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5702 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5703 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5704 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5705 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5706 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5707 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5708 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5709 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5710 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5711 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5712 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5713 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5714 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5715 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5716 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5717 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5718 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5719 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5720 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5721 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5722 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5723 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5724 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5725 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5727 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5728 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5730 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5732 #endif // HAVE_HWMON
5733 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5734 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5735 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5736 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5737 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5738 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5739 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5740 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5741 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5742 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5743 {"increment", no_argument
, 0, IDX_INCREMENT
},
5744 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5745 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5746 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5747 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5748 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5749 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5753 uint rp_files_cnt
= 0;
5755 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5757 int option_index
= 0;
5763 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5767 case IDX_HELP
: usage
= 1; break;
5769 case IDX_VERSION_LOWER
: version
= 1; break;
5770 case IDX_RESTORE
: restore
= 1; break;
5771 case IDX_SESSION
: session
= optarg
; break;
5772 case IDX_SHOW
: show
= 1; break;
5773 case IDX_LEFT
: left
= 1; break;
5774 case '?': return (-1);
5780 log_error ("ERROR: Invalid argument specified");
5791 log_info ("%s", VERSION_TAG
);
5798 usage_big_print (PROGNAME
);
5804 * session needs to be set, always!
5807 if (session
== NULL
) session
= (char *) PROGNAME
;
5810 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5813 char *exec_path
= get_exec_path ();
5817 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5818 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5820 char *install_dir
= get_install_dir (resolved_exec_path
);
5821 char *profile_dir
= NULL
;
5822 char *session_dir
= NULL
;
5823 char *shared_dir
= NULL
;
5825 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5827 struct passwd
*pw
= getpwuid (getuid ());
5829 const char *homedir
= pw
->pw_dir
;
5831 profile_dir
= get_profile_dir (homedir
);
5832 session_dir
= get_session_dir (profile_dir
);
5833 shared_dir
= strdup (SHARED_FOLDER
);
5835 mkdir (profile_dir
, 0700);
5836 mkdir (session_dir
, 0700);
5840 profile_dir
= install_dir
;
5841 session_dir
= install_dir
;
5842 shared_dir
= install_dir
;
5845 myfree (resolved_install_folder
);
5846 myfree (resolved_exec_path
);
5850 char *install_dir
= get_install_dir (exec_path
);
5851 char *profile_dir
= install_dir
;
5852 char *session_dir
= install_dir
;
5853 char *shared_dir
= install_dir
;
5857 data
.install_dir
= install_dir
;
5858 data
.profile_dir
= profile_dir
;
5859 data
.session_dir
= session_dir
;
5860 data
.shared_dir
= shared_dir
;
5865 * kernel cache, we need to make sure folder exist
5868 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5870 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5872 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5874 mkdir (kernels_folder
, 0700);
5876 myfree (kernels_folder
);
5882 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5884 data
.session
= session
;
5886 char *eff_restore_file
= (char *) mymalloc (session_size
);
5887 char *new_restore_file
= (char *) mymalloc (session_size
);
5889 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5890 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5892 data
.eff_restore_file
= eff_restore_file
;
5893 data
.new_restore_file
= new_restore_file
;
5895 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5897 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5898 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5903 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5904 if ((show
== 1) || (left
== 1))
5906 restore_disable
= 1;
5911 data
.restore_disable
= restore_disable
;
5913 restore_data_t
*rd
= init_restore (argc
, argv
);
5923 read_restore (eff_restore_file
, rd
);
5925 if (rd
->version_bin
< RESTORE_MIN
)
5927 log_error ("ERROR: Incompatible restore-file version");
5936 rd
->pid
= getpid ();
5938 rd
->pid
= GetCurrentProcessId ();
5942 uint hash_mode_chgd
= 0;
5943 uint runtime_chgd
= 0;
5944 uint kernel_loops_chgd
= 0;
5945 uint kernel_accel_chgd
= 0;
5946 uint attack_mode_chgd
= 0;
5947 uint outfile_format_chgd
= 0;
5948 uint rp_gen_seed_chgd
= 0;
5949 uint remove_timer_chgd
= 0;
5950 uint increment_min_chgd
= 0;
5951 uint increment_max_chgd
= 0;
5952 uint workload_profile_chgd
= 0;
5953 uint opencl_vector_width_chgd
= 0;
5955 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5956 uint gpu_temp_retain_chgd
= 0;
5957 uint gpu_temp_abort_chgd
= 0;
5964 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5968 //case IDX_HELP: usage = 1; break;
5969 //case IDX_VERSION: version = 1; break;
5970 //case IDX_RESTORE: restore = 1; break;
5971 case IDX_QUIET
: quiet
= 1; break;
5972 //case IDX_SHOW: show = 1; break;
5973 case IDX_SHOW
: break;
5974 //case IDX_LEFT: left = 1; break;
5975 case IDX_LEFT
: break;
5976 case IDX_USERNAME
: username
= 1; break;
5977 case IDX_REMOVE
: remove
= 1; break;
5978 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5979 remove_timer_chgd
= 1; break;
5980 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5981 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5982 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5983 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5984 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5985 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5986 case IDX_FORCE
: force
= 1; break;
5987 case IDX_SKIP
: skip
= atoll (optarg
); break;
5988 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5989 case IDX_KEYSPACE
: keyspace
= 1; break;
5990 case IDX_BENCHMARK
: benchmark
= 1; break;
5991 case IDX_RESTORE
: break;
5992 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5993 case IDX_STATUS
: status
= 1; break;
5994 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5995 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5996 case IDX_LOOPBACK
: loopback
= 1; break;
5997 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5998 //case IDX_SESSION: session = optarg; break;
5999 case IDX_SESSION
: break;
6000 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6001 hash_mode_chgd
= 1; break;
6002 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6003 runtime_chgd
= 1; break;
6004 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6005 attack_mode_chgd
= 1; break;
6006 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6007 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6008 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6009 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6010 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6011 rp_gen_seed_chgd
= 1; break;
6012 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6013 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6014 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6015 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6016 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6017 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6018 case IDX_OUTFILE
: outfile
= optarg
; break;
6019 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6020 outfile_format_chgd
= 1; break;
6021 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6022 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6023 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6024 case IDX_HEX_SALT
: hex_salt
= 1; break;
6025 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6026 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6027 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6028 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6029 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6030 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6031 opencl_vector_width_chgd
= 1; break;
6032 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6033 workload_profile_chgd
= 1; break;
6034 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6035 kernel_accel_chgd
= 1; break;
6036 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6037 kernel_loops_chgd
= 1; break;
6038 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6040 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
6042 gpu_temp_abort_chgd
= 1;
6045 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
6047 gpu_temp_retain_chgd
= 1;
6051 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6053 #endif // HAVE_HWMON
6054 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6055 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6056 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6057 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6058 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6059 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6060 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6061 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6062 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6063 case IDX_INCREMENT
: increment
= 1; break;
6064 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6065 increment_min_chgd
= 1; break;
6066 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6067 increment_max_chgd
= 1; break;
6068 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6069 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6070 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6071 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6074 log_error ("ERROR: Invalid argument specified");
6081 log_error ("ERROR: Invalid argument specified");
6087 * Inform user things getting started,
6088 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6089 * - we do not need to check algorithm_pos
6096 if (machine_readable
== 0)
6098 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6103 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6106 else if (restore
== 1)
6108 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6113 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6122 if (attack_mode
> 7)
6124 log_error ("ERROR: Invalid attack-mode specified");
6129 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6131 log_error ("ERROR: Invalid runtime specified");
6136 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6138 log_error ("ERROR: Invalid hash-type specified");
6143 // renamed hash modes
6157 log_error ("Old -m specified, use -m %d instead", n
);
6165 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6167 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6173 if (outfile_format
> 16)
6175 log_error ("ERROR: Invalid outfile-format specified");
6182 if (outfile_format_chgd
== 1)
6184 if (outfile_format
> 1)
6186 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6193 outfile_format
= OUTFILE_FMT_HASH
;
6199 if (outfile_format_chgd
== 1)
6201 if ((outfile_format
> 7) && (outfile_format
< 16))
6203 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6210 if (increment_min
< INCREMENT_MIN
)
6212 log_error ("ERROR: Invalid increment-min specified");
6217 if (increment_max
> INCREMENT_MAX
)
6219 log_error ("ERROR: Invalid increment-max specified");
6224 if (increment_min
> increment_max
)
6226 log_error ("ERROR: Invalid increment-min specified");
6231 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6233 log_error ("ERROR: increment is not allowed in attack-mode 0");
6238 if ((increment
== 0) && (increment_min_chgd
== 1))
6240 log_error ("ERROR: increment-min is only supported together with increment switch");
6245 if ((increment
== 0) && (increment_max_chgd
== 1))
6247 log_error ("ERROR: increment-max is only supported together with increment switch");
6252 if (rp_files_cnt
&& rp_gen
)
6254 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6259 if (rp_files_cnt
|| rp_gen
)
6261 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6263 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6269 if (rp_gen_func_min
> rp_gen_func_max
)
6271 log_error ("ERROR: Invalid rp-gen-func-min specified");
6276 if (kernel_accel_chgd
== 1)
6280 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6281 log_info ("Please consider using the option -w instead");
6282 log_info ("You can use --force to override this but do not post error reports if you do so");
6288 if (kernel_accel
< 1)
6290 log_error ("ERROR: Invalid kernel-accel specified");
6295 if (kernel_accel
> 1024)
6297 log_error ("ERROR: Invalid kernel-accel specified");
6303 if (kernel_loops_chgd
== 1)
6307 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6308 log_info ("Please consider using the option -w instead");
6309 log_info ("You can use --force to override this but do not post error reports if you do so");
6315 if (kernel_loops
< 1)
6317 log_error ("ERROR: Invalid kernel-loops specified");
6322 if (kernel_loops
> 1024)
6324 log_error ("ERROR: Invalid kernel-loops specified");
6330 if ((workload_profile
< 1) || (workload_profile
> 4))
6332 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6337 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6339 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6344 if (show
== 1 || left
== 1)
6346 attack_mode
= ATTACK_MODE_NONE
;
6350 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6355 if (potfile_disable
== 1)
6357 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6363 uint attack_kern
= ATTACK_KERN_NONE
;
6365 switch (attack_mode
)
6367 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6368 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6369 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6370 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6371 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6378 int num_additional_params
= 1;
6380 if (attack_kern
== ATTACK_KERN_COMBI
)
6382 num_additional_params
= 2;
6385 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6387 if (keyspace_wordlist_specified
== 0) optind
--;
6390 if (attack_kern
== ATTACK_KERN_NONE
)
6392 if ((optind
+ 1) != myargc
)
6394 usage_mini_print (myargv
[0]);
6399 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6401 if ((optind
+ 1) > myargc
)
6403 usage_mini_print (myargv
[0]);
6408 else if (attack_kern
== ATTACK_KERN_COMBI
)
6410 if ((optind
+ 3) != myargc
)
6412 usage_mini_print (myargv
[0]);
6417 else if (attack_kern
== ATTACK_KERN_BF
)
6419 if ((optind
+ 1) > myargc
)
6421 usage_mini_print (myargv
[0]);
6428 usage_mini_print (myargv
[0]);
6435 if (myargv
[optind
] != 0)
6437 log_error ("ERROR: Invalid argument for benchmark mode specified");
6442 if (attack_mode_chgd
== 1)
6444 if (attack_mode
!= ATTACK_MODE_BF
)
6446 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6453 if (skip
!= 0 && limit
!= 0)
6462 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6468 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6473 potfile_disable
= 1;
6475 restore_disable
= 1;
6479 weak_hash_threshold
= 0;
6484 if (remove_timer_chgd
== 1)
6488 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6493 if (remove_timer
< 1)
6495 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6503 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6505 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6507 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6514 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6522 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6524 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6529 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6531 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6539 log_error ("ERROR: Invalid debug-mode specified");
6544 if (debug_file
!= NULL
)
6548 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6554 if (induction_dir
!= NULL
)
6556 if (attack_mode
== ATTACK_MODE_BF
)
6558 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6564 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6566 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6568 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6573 weak_hash_threshold
= 0;
6577 * induction directory
6580 char *induction_directory
= NULL
;
6582 if (attack_mode
!= ATTACK_MODE_BF
)
6584 if (induction_dir
== NULL
)
6586 induction_directory
= (char *) mymalloc (session_size
);
6588 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6590 // create induction folder if it does not already exist
6594 if (rmdir (induction_directory
) == -1)
6596 if (errno
== ENOENT
)
6598 // good, we can ignore
6600 else if (errno
== ENOTEMPTY
)
6602 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6604 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6606 if (rename (induction_directory
, induction_directory_mv
) != 0)
6608 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6615 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6621 if (mkdir (induction_directory
, 0700) == -1)
6623 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6631 induction_directory
= induction_dir
;
6635 data
.induction_directory
= induction_directory
;
6641 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6643 char *loopback_file
= (char *) mymalloc (loopback_size
);
6649 char tuning_db_file
[256] = { 0 };
6651 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6653 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6656 * outfile-check directory
6659 char *outfile_check_directory
= NULL
;
6661 if (outfile_check_dir
== NULL
)
6663 outfile_check_directory
= (char *) mymalloc (session_size
);
6665 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6669 outfile_check_directory
= outfile_check_dir
;
6672 data
.outfile_check_directory
= outfile_check_directory
;
6676 struct stat outfile_check_stat
;
6678 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6680 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6684 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6689 else if (outfile_check_dir
== NULL
)
6691 if (mkdir (outfile_check_directory
, 0700) == -1)
6693 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6701 * special other stuff
6704 if (hash_mode
== 9710)
6707 outfile_format_chgd
= 1;
6710 if (hash_mode
== 9810)
6713 outfile_format_chgd
= 1;
6716 if (hash_mode
== 10410)
6719 outfile_format_chgd
= 1;
6726 data
.hash_mode
= hash_mode
;
6727 data
.restore
= restore
;
6728 data
.restore_timer
= restore_timer
;
6729 data
.restore_disable
= restore_disable
;
6730 data
.status
= status
;
6731 data
.status_timer
= status_timer
;
6732 data
.machine_readable
= machine_readable
;
6733 data
.loopback
= loopback
;
6734 data
.runtime
= runtime
;
6735 data
.remove
= remove
;
6736 data
.remove_timer
= remove_timer
;
6737 data
.debug_mode
= debug_mode
;
6738 data
.debug_file
= debug_file
;
6739 data
.username
= username
;
6741 data
.outfile
= outfile
;
6742 data
.outfile_format
= outfile_format
;
6743 data
.outfile_autohex
= outfile_autohex
;
6744 data
.hex_charset
= hex_charset
;
6745 data
.hex_salt
= hex_salt
;
6746 data
.hex_wordlist
= hex_wordlist
;
6747 data
.separator
= separator
;
6748 data
.rp_files
= rp_files
;
6749 data
.rp_files_cnt
= rp_files_cnt
;
6750 data
.rp_gen
= rp_gen
;
6751 data
.rp_gen_seed
= rp_gen_seed
;
6753 data
.benchmark
= benchmark
;
6758 data
.powertune_enable
= powertune_enable
;
6761 data
.logfile_disable
= logfile_disable
;
6762 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6763 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6764 data
.veracrypt_pim
= veracrypt_pim
;
6765 data
.scrypt_tmto
= scrypt_tmto
;
6766 data
.workload_profile
= workload_profile
;
6774 set_cpu_affinity (cpu_affinity
);
6777 if (rp_gen_seed_chgd
== 0)
6783 srand (rp_gen_seed
);
6790 if (logfile_disable
== 0)
6792 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6794 char *logfile
= (char *) mymalloc (logfile_size
);
6796 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6798 data
.logfile
= logfile
;
6800 char *topid
= logfile_generate_topid ();
6805 // logfile_append() checks for logfile_disable internally to make it easier from here
6807 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6808 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6809 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6810 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6811 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6812 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6813 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6814 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6815 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6816 #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));
6818 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6819 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6820 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6821 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6822 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6823 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6824 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6825 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6827 logfile_top_msg ("START");
6829 logfile_top_uint (attack_mode
);
6830 logfile_top_uint (attack_kern
);
6831 logfile_top_uint (benchmark
);
6832 logfile_top_uint (bitmap_min
);
6833 logfile_top_uint (bitmap_max
);
6834 logfile_top_uint (debug_mode
);
6835 logfile_top_uint (force
);
6836 logfile_top_uint (kernel_accel
);
6837 logfile_top_uint (kernel_loops
);
6838 logfile_top_uint (gpu_temp_disable
);
6840 logfile_top_uint (gpu_temp_abort
);
6841 logfile_top_uint (gpu_temp_retain
);
6843 logfile_top_uint (hash_mode
);
6844 logfile_top_uint (hex_charset
);
6845 logfile_top_uint (hex_salt
);
6846 logfile_top_uint (hex_wordlist
);
6847 logfile_top_uint (increment
);
6848 logfile_top_uint (increment_max
);
6849 logfile_top_uint (increment_min
);
6850 logfile_top_uint (keyspace
);
6851 logfile_top_uint (left
);
6852 logfile_top_uint (logfile_disable
);
6853 logfile_top_uint (loopback
);
6854 logfile_top_uint (markov_classic
);
6855 logfile_top_uint (markov_disable
);
6856 logfile_top_uint (markov_threshold
);
6857 logfile_top_uint (outfile_autohex
);
6858 logfile_top_uint (outfile_check_timer
);
6859 logfile_top_uint (outfile_format
);
6860 logfile_top_uint (potfile_disable
);
6861 logfile_top_string (potfile_path
);
6862 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6863 logfile_top_uint (powertune_enable
);
6865 logfile_top_uint (scrypt_tmto
);
6866 logfile_top_uint (quiet
);
6867 logfile_top_uint (remove
);
6868 logfile_top_uint (remove_timer
);
6869 logfile_top_uint (restore
);
6870 logfile_top_uint (restore_disable
);
6871 logfile_top_uint (restore_timer
);
6872 logfile_top_uint (rp_gen
);
6873 logfile_top_uint (rp_gen_func_max
);
6874 logfile_top_uint (rp_gen_func_min
);
6875 logfile_top_uint (rp_gen_seed
);
6876 logfile_top_uint (runtime
);
6877 logfile_top_uint (segment_size
);
6878 logfile_top_uint (show
);
6879 logfile_top_uint (status
);
6880 logfile_top_uint (machine_readable
);
6881 logfile_top_uint (status_timer
);
6882 logfile_top_uint (usage
);
6883 logfile_top_uint (username
);
6884 logfile_top_uint (version
);
6885 logfile_top_uint (weak_hash_threshold
);
6886 logfile_top_uint (workload_profile
);
6887 logfile_top_uint64 (limit
);
6888 logfile_top_uint64 (skip
);
6889 logfile_top_char (separator
);
6890 logfile_top_string (cpu_affinity
);
6891 logfile_top_string (custom_charset_1
);
6892 logfile_top_string (custom_charset_2
);
6893 logfile_top_string (custom_charset_3
);
6894 logfile_top_string (custom_charset_4
);
6895 logfile_top_string (debug_file
);
6896 logfile_top_string (opencl_devices
);
6897 logfile_top_string (opencl_platforms
);
6898 logfile_top_string (opencl_device_types
);
6899 logfile_top_uint (opencl_vector_width
);
6900 logfile_top_string (induction_dir
);
6901 logfile_top_string (markov_hcstat
);
6902 logfile_top_string (outfile
);
6903 logfile_top_string (outfile_check_dir
);
6904 logfile_top_string (rule_buf_l
);
6905 logfile_top_string (rule_buf_r
);
6906 logfile_top_string (session
);
6907 logfile_top_string (truecrypt_keyfiles
);
6908 logfile_top_string (veracrypt_keyfiles
);
6909 logfile_top_uint (veracrypt_pim
);
6912 * Init OpenCL library loader
6917 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6925 * OpenCL platform selection
6928 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6931 * OpenCL device selection
6934 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6937 * OpenCL device type selection
6940 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6949 * disable useless stuff for benchmark
6954 restore_disable
= 1;
6955 potfile_disable
= 1;
6956 weak_hash_threshold
= 0;
6957 gpu_temp_disable
= 1;
6961 powertune_enable
= 1;
6965 data
.status_timer
= status_timer
;
6966 data
.restore_timer
= restore_timer
;
6967 data
.restore_disable
= restore_disable
;
6970 * force attack mode to be bruteforce
6973 attack_mode
= ATTACK_MODE_BF
;
6974 attack_kern
= ATTACK_KERN_BF
;
6976 if (workload_profile_chgd
== 0)
6978 workload_profile
= 3;
6980 data
.workload_profile
= workload_profile
;
6990 uint attack_exec
= 0;
6994 uint esalt_size
= 0;
6996 uint dgst_pos0
= -1;
6997 uint dgst_pos1
= -1;
6998 uint dgst_pos2
= -1;
6999 uint dgst_pos3
= -1;
7001 int (*parse_func
) (char *, uint
, hash_t
*);
7002 int (*sort_by_digest
) (const void *, const void *);
7004 uint algorithm_pos
= 0;
7005 uint algorithm_max
= 1;
7007 uint
*algorithms
= default_benchmark_algorithms
;
7009 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7011 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7014 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7015 * the following algos are skipped entirely
7018 if (algorithm_pos
> 0)
7022 rd
= init_restore (argc
, argv
);
7028 * update hash_mode in case of multihash benchmark
7033 if (hash_mode_chgd
== 0)
7035 hash_mode
= algorithms
[algorithm_pos
];
7037 data
.hash_mode
= hash_mode
;
7047 case 0: hash_type
= HASH_TYPE_MD5
;
7048 salt_type
= SALT_TYPE_NONE
;
7049 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7050 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7051 | OPTS_TYPE_PT_ADD80
7052 | OPTS_TYPE_PT_ADDBITS14
;
7053 kern_type
= KERN_TYPE_MD5
;
7054 dgst_size
= DGST_SIZE_4_4
;
7055 parse_func
= md5_parse_hash
;
7056 sort_by_digest
= sort_by_digest_4_4
;
7057 opti_type
= OPTI_TYPE_ZERO_BYTE
7058 | OPTI_TYPE_PRECOMPUTE_INIT
7059 | OPTI_TYPE_PRECOMPUTE_MERKLE
7060 | OPTI_TYPE_MEET_IN_MIDDLE
7061 | OPTI_TYPE_EARLY_SKIP
7062 | OPTI_TYPE_NOT_ITERATED
7063 | OPTI_TYPE_NOT_SALTED
7064 | OPTI_TYPE_RAW_HASH
;
7071 case 10: hash_type
= HASH_TYPE_MD5
;
7072 salt_type
= SALT_TYPE_INTERN
;
7073 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7074 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7075 | OPTS_TYPE_ST_ADD80
7076 | OPTS_TYPE_ST_ADDBITS14
;
7077 kern_type
= KERN_TYPE_MD5_PWSLT
;
7078 dgst_size
= DGST_SIZE_4_4
;
7079 parse_func
= md5s_parse_hash
;
7080 sort_by_digest
= sort_by_digest_4_4
;
7081 opti_type
= OPTI_TYPE_ZERO_BYTE
7082 | OPTI_TYPE_PRECOMPUTE_INIT
7083 | OPTI_TYPE_PRECOMPUTE_MERKLE
7084 | OPTI_TYPE_MEET_IN_MIDDLE
7085 | OPTI_TYPE_EARLY_SKIP
7086 | OPTI_TYPE_NOT_ITERATED
7087 | OPTI_TYPE_APPENDED_SALT
7088 | OPTI_TYPE_RAW_HASH
;
7095 case 11: hash_type
= HASH_TYPE_MD5
;
7096 salt_type
= SALT_TYPE_INTERN
;
7097 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7099 | OPTS_TYPE_ST_ADD80
7100 | OPTS_TYPE_ST_ADDBITS14
;
7101 kern_type
= KERN_TYPE_MD5_PWSLT
;
7102 dgst_size
= DGST_SIZE_4_4
;
7103 parse_func
= joomla_parse_hash
;
7104 sort_by_digest
= sort_by_digest_4_4
;
7105 opti_type
= OPTI_TYPE_ZERO_BYTE
7106 | OPTI_TYPE_PRECOMPUTE_INIT
7107 | OPTI_TYPE_PRECOMPUTE_MERKLE
7108 | OPTI_TYPE_MEET_IN_MIDDLE
7109 | OPTI_TYPE_EARLY_SKIP
7110 | OPTI_TYPE_NOT_ITERATED
7111 | OPTI_TYPE_APPENDED_SALT
7112 | OPTI_TYPE_RAW_HASH
;
7119 case 12: hash_type
= HASH_TYPE_MD5
;
7120 salt_type
= SALT_TYPE_INTERN
;
7121 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7122 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7123 | OPTS_TYPE_ST_ADD80
7124 | OPTS_TYPE_ST_ADDBITS14
;
7125 kern_type
= KERN_TYPE_MD5_PWSLT
;
7126 dgst_size
= DGST_SIZE_4_4
;
7127 parse_func
= postgresql_parse_hash
;
7128 sort_by_digest
= sort_by_digest_4_4
;
7129 opti_type
= OPTI_TYPE_ZERO_BYTE
7130 | OPTI_TYPE_PRECOMPUTE_INIT
7131 | OPTI_TYPE_PRECOMPUTE_MERKLE
7132 | OPTI_TYPE_MEET_IN_MIDDLE
7133 | OPTI_TYPE_EARLY_SKIP
7134 | OPTI_TYPE_NOT_ITERATED
7135 | OPTI_TYPE_APPENDED_SALT
7136 | OPTI_TYPE_RAW_HASH
;
7143 case 20: hash_type
= HASH_TYPE_MD5
;
7144 salt_type
= SALT_TYPE_INTERN
;
7145 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7146 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7147 | OPTS_TYPE_PT_ADD80
7148 | OPTS_TYPE_PT_ADDBITS14
;
7149 kern_type
= KERN_TYPE_MD5_SLTPW
;
7150 dgst_size
= DGST_SIZE_4_4
;
7151 parse_func
= md5s_parse_hash
;
7152 sort_by_digest
= sort_by_digest_4_4
;
7153 opti_type
= OPTI_TYPE_ZERO_BYTE
7154 | OPTI_TYPE_PRECOMPUTE_INIT
7155 | OPTI_TYPE_PRECOMPUTE_MERKLE
7156 | OPTI_TYPE_EARLY_SKIP
7157 | OPTI_TYPE_NOT_ITERATED
7158 | OPTI_TYPE_PREPENDED_SALT
7159 | OPTI_TYPE_RAW_HASH
;
7166 case 21: hash_type
= HASH_TYPE_MD5
;
7167 salt_type
= SALT_TYPE_INTERN
;
7168 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7169 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7170 | OPTS_TYPE_PT_ADD80
7171 | OPTS_TYPE_PT_ADDBITS14
;
7172 kern_type
= KERN_TYPE_MD5_SLTPW
;
7173 dgst_size
= DGST_SIZE_4_4
;
7174 parse_func
= osc_parse_hash
;
7175 sort_by_digest
= sort_by_digest_4_4
;
7176 opti_type
= OPTI_TYPE_ZERO_BYTE
7177 | OPTI_TYPE_PRECOMPUTE_INIT
7178 | OPTI_TYPE_PRECOMPUTE_MERKLE
7179 | OPTI_TYPE_EARLY_SKIP
7180 | OPTI_TYPE_NOT_ITERATED
7181 | OPTI_TYPE_PREPENDED_SALT
7182 | OPTI_TYPE_RAW_HASH
;
7189 case 22: hash_type
= HASH_TYPE_MD5
;
7190 salt_type
= SALT_TYPE_EMBEDDED
;
7191 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7192 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7193 | OPTS_TYPE_PT_ADD80
7194 | OPTS_TYPE_PT_ADDBITS14
;
7195 kern_type
= KERN_TYPE_MD5_SLTPW
;
7196 dgst_size
= DGST_SIZE_4_4
;
7197 parse_func
= netscreen_parse_hash
;
7198 sort_by_digest
= sort_by_digest_4_4
;
7199 opti_type
= OPTI_TYPE_ZERO_BYTE
7200 | OPTI_TYPE_PRECOMPUTE_INIT
7201 | OPTI_TYPE_PRECOMPUTE_MERKLE
7202 | OPTI_TYPE_EARLY_SKIP
7203 | OPTI_TYPE_NOT_ITERATED
7204 | OPTI_TYPE_PREPENDED_SALT
7205 | OPTI_TYPE_RAW_HASH
;
7212 case 23: hash_type
= HASH_TYPE_MD5
;
7213 salt_type
= SALT_TYPE_EMBEDDED
;
7214 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7216 | OPTS_TYPE_PT_ADD80
7217 | OPTS_TYPE_PT_ADDBITS14
;
7218 kern_type
= KERN_TYPE_MD5_SLTPW
;
7219 dgst_size
= DGST_SIZE_4_4
;
7220 parse_func
= skype_parse_hash
;
7221 sort_by_digest
= sort_by_digest_4_4
;
7222 opti_type
= OPTI_TYPE_ZERO_BYTE
7223 | OPTI_TYPE_PRECOMPUTE_INIT
7224 | OPTI_TYPE_PRECOMPUTE_MERKLE
7225 | OPTI_TYPE_EARLY_SKIP
7226 | OPTI_TYPE_NOT_ITERATED
7227 | OPTI_TYPE_PREPENDED_SALT
7228 | OPTI_TYPE_RAW_HASH
;
7235 case 30: hash_type
= HASH_TYPE_MD5
;
7236 salt_type
= SALT_TYPE_INTERN
;
7237 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7238 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7239 | OPTS_TYPE_PT_UNICODE
7240 | OPTS_TYPE_ST_ADD80
7241 | OPTS_TYPE_ST_ADDBITS14
;
7242 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7243 dgst_size
= DGST_SIZE_4_4
;
7244 parse_func
= md5s_parse_hash
;
7245 sort_by_digest
= sort_by_digest_4_4
;
7246 opti_type
= OPTI_TYPE_ZERO_BYTE
7247 | OPTI_TYPE_PRECOMPUTE_INIT
7248 | OPTI_TYPE_PRECOMPUTE_MERKLE
7249 | OPTI_TYPE_MEET_IN_MIDDLE
7250 | OPTI_TYPE_EARLY_SKIP
7251 | OPTI_TYPE_NOT_ITERATED
7252 | OPTI_TYPE_APPENDED_SALT
7253 | OPTI_TYPE_RAW_HASH
;
7260 case 40: hash_type
= HASH_TYPE_MD5
;
7261 salt_type
= SALT_TYPE_INTERN
;
7262 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7263 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7264 | OPTS_TYPE_PT_ADD80
7265 | OPTS_TYPE_PT_ADDBITS14
7266 | OPTS_TYPE_PT_UNICODE
;
7267 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7268 dgst_size
= DGST_SIZE_4_4
;
7269 parse_func
= md5s_parse_hash
;
7270 sort_by_digest
= sort_by_digest_4_4
;
7271 opti_type
= OPTI_TYPE_ZERO_BYTE
7272 | OPTI_TYPE_PRECOMPUTE_INIT
7273 | OPTI_TYPE_PRECOMPUTE_MERKLE
7274 | OPTI_TYPE_EARLY_SKIP
7275 | OPTI_TYPE_NOT_ITERATED
7276 | OPTI_TYPE_PREPENDED_SALT
7277 | OPTI_TYPE_RAW_HASH
;
7284 case 50: hash_type
= HASH_TYPE_MD5
;
7285 salt_type
= SALT_TYPE_INTERN
;
7286 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7287 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7288 | OPTS_TYPE_ST_ADD80
7289 | OPTS_TYPE_ST_ADDBITS14
;
7290 kern_type
= KERN_TYPE_HMACMD5_PW
;
7291 dgst_size
= DGST_SIZE_4_4
;
7292 parse_func
= hmacmd5_parse_hash
;
7293 sort_by_digest
= sort_by_digest_4_4
;
7294 opti_type
= OPTI_TYPE_ZERO_BYTE
7295 | OPTI_TYPE_NOT_ITERATED
;
7302 case 60: hash_type
= HASH_TYPE_MD5
;
7303 salt_type
= SALT_TYPE_INTERN
;
7304 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7305 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7306 | OPTS_TYPE_PT_ADD80
7307 | OPTS_TYPE_PT_ADDBITS14
;
7308 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7309 dgst_size
= DGST_SIZE_4_4
;
7310 parse_func
= hmacmd5_parse_hash
;
7311 sort_by_digest
= sort_by_digest_4_4
;
7312 opti_type
= OPTI_TYPE_ZERO_BYTE
7313 | OPTI_TYPE_NOT_ITERATED
;
7320 case 100: hash_type
= HASH_TYPE_SHA1
;
7321 salt_type
= SALT_TYPE_NONE
;
7322 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7323 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7324 | OPTS_TYPE_PT_ADD80
7325 | OPTS_TYPE_PT_ADDBITS15
;
7326 kern_type
= KERN_TYPE_SHA1
;
7327 dgst_size
= DGST_SIZE_4_5
;
7328 parse_func
= sha1_parse_hash
;
7329 sort_by_digest
= sort_by_digest_4_5
;
7330 opti_type
= OPTI_TYPE_ZERO_BYTE
7331 | OPTI_TYPE_PRECOMPUTE_INIT
7332 | OPTI_TYPE_PRECOMPUTE_MERKLE
7333 | OPTI_TYPE_EARLY_SKIP
7334 | OPTI_TYPE_NOT_ITERATED
7335 | OPTI_TYPE_NOT_SALTED
7336 | OPTI_TYPE_RAW_HASH
;
7343 case 101: hash_type
= HASH_TYPE_SHA1
;
7344 salt_type
= SALT_TYPE_NONE
;
7345 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7346 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7347 | OPTS_TYPE_PT_ADD80
7348 | OPTS_TYPE_PT_ADDBITS15
;
7349 kern_type
= KERN_TYPE_SHA1
;
7350 dgst_size
= DGST_SIZE_4_5
;
7351 parse_func
= sha1b64_parse_hash
;
7352 sort_by_digest
= sort_by_digest_4_5
;
7353 opti_type
= OPTI_TYPE_ZERO_BYTE
7354 | OPTI_TYPE_PRECOMPUTE_INIT
7355 | OPTI_TYPE_PRECOMPUTE_MERKLE
7356 | OPTI_TYPE_EARLY_SKIP
7357 | OPTI_TYPE_NOT_ITERATED
7358 | OPTI_TYPE_NOT_SALTED
7359 | OPTI_TYPE_RAW_HASH
;
7366 case 110: hash_type
= HASH_TYPE_SHA1
;
7367 salt_type
= SALT_TYPE_INTERN
;
7368 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7369 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7370 | OPTS_TYPE_ST_ADD80
7371 | OPTS_TYPE_ST_ADDBITS15
;
7372 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7373 dgst_size
= DGST_SIZE_4_5
;
7374 parse_func
= sha1s_parse_hash
;
7375 sort_by_digest
= sort_by_digest_4_5
;
7376 opti_type
= OPTI_TYPE_ZERO_BYTE
7377 | OPTI_TYPE_PRECOMPUTE_INIT
7378 | OPTI_TYPE_PRECOMPUTE_MERKLE
7379 | OPTI_TYPE_EARLY_SKIP
7380 | OPTI_TYPE_NOT_ITERATED
7381 | OPTI_TYPE_APPENDED_SALT
7382 | OPTI_TYPE_RAW_HASH
;
7389 case 111: hash_type
= HASH_TYPE_SHA1
;
7390 salt_type
= SALT_TYPE_EMBEDDED
;
7391 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7392 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7393 | OPTS_TYPE_ST_ADD80
7394 | OPTS_TYPE_ST_ADDBITS15
;
7395 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7396 dgst_size
= DGST_SIZE_4_5
;
7397 parse_func
= sha1b64s_parse_hash
;
7398 sort_by_digest
= sort_by_digest_4_5
;
7399 opti_type
= OPTI_TYPE_ZERO_BYTE
7400 | OPTI_TYPE_PRECOMPUTE_INIT
7401 | OPTI_TYPE_PRECOMPUTE_MERKLE
7402 | OPTI_TYPE_EARLY_SKIP
7403 | OPTI_TYPE_NOT_ITERATED
7404 | OPTI_TYPE_APPENDED_SALT
7405 | OPTI_TYPE_RAW_HASH
;
7412 case 112: hash_type
= HASH_TYPE_SHA1
;
7413 salt_type
= SALT_TYPE_INTERN
;
7414 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7415 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7416 | OPTS_TYPE_ST_ADD80
7417 | OPTS_TYPE_ST_ADDBITS15
7419 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7420 dgst_size
= DGST_SIZE_4_5
;
7421 parse_func
= oracles_parse_hash
;
7422 sort_by_digest
= sort_by_digest_4_5
;
7423 opti_type
= OPTI_TYPE_ZERO_BYTE
7424 | OPTI_TYPE_PRECOMPUTE_INIT
7425 | OPTI_TYPE_PRECOMPUTE_MERKLE
7426 | OPTI_TYPE_EARLY_SKIP
7427 | OPTI_TYPE_NOT_ITERATED
7428 | OPTI_TYPE_APPENDED_SALT
7429 | OPTI_TYPE_RAW_HASH
;
7436 case 120: hash_type
= HASH_TYPE_SHA1
;
7437 salt_type
= SALT_TYPE_INTERN
;
7438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7439 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7440 | OPTS_TYPE_PT_ADD80
7441 | OPTS_TYPE_PT_ADDBITS15
;
7442 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7443 dgst_size
= DGST_SIZE_4_5
;
7444 parse_func
= sha1s_parse_hash
;
7445 sort_by_digest
= sort_by_digest_4_5
;
7446 opti_type
= OPTI_TYPE_ZERO_BYTE
7447 | OPTI_TYPE_PRECOMPUTE_INIT
7448 | OPTI_TYPE_PRECOMPUTE_MERKLE
7449 | OPTI_TYPE_EARLY_SKIP
7450 | OPTI_TYPE_NOT_ITERATED
7451 | OPTI_TYPE_PREPENDED_SALT
7452 | OPTI_TYPE_RAW_HASH
;
7459 case 121: hash_type
= HASH_TYPE_SHA1
;
7460 salt_type
= SALT_TYPE_INTERN
;
7461 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7462 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7463 | OPTS_TYPE_PT_ADD80
7464 | OPTS_TYPE_PT_ADDBITS15
7465 | OPTS_TYPE_ST_LOWER
;
7466 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7467 dgst_size
= DGST_SIZE_4_5
;
7468 parse_func
= smf_parse_hash
;
7469 sort_by_digest
= sort_by_digest_4_5
;
7470 opti_type
= OPTI_TYPE_ZERO_BYTE
7471 | OPTI_TYPE_PRECOMPUTE_INIT
7472 | OPTI_TYPE_PRECOMPUTE_MERKLE
7473 | OPTI_TYPE_EARLY_SKIP
7474 | OPTI_TYPE_NOT_ITERATED
7475 | OPTI_TYPE_PREPENDED_SALT
7476 | OPTI_TYPE_RAW_HASH
;
7483 case 122: hash_type
= HASH_TYPE_SHA1
;
7484 salt_type
= SALT_TYPE_EMBEDDED
;
7485 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7486 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7487 | OPTS_TYPE_PT_ADD80
7488 | OPTS_TYPE_PT_ADDBITS15
7490 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7491 dgst_size
= DGST_SIZE_4_5
;
7492 parse_func
= osx1_parse_hash
;
7493 sort_by_digest
= sort_by_digest_4_5
;
7494 opti_type
= OPTI_TYPE_ZERO_BYTE
7495 | OPTI_TYPE_PRECOMPUTE_INIT
7496 | OPTI_TYPE_PRECOMPUTE_MERKLE
7497 | OPTI_TYPE_EARLY_SKIP
7498 | OPTI_TYPE_NOT_ITERATED
7499 | OPTI_TYPE_PREPENDED_SALT
7500 | OPTI_TYPE_RAW_HASH
;
7507 case 124: hash_type
= HASH_TYPE_SHA1
;
7508 salt_type
= SALT_TYPE_EMBEDDED
;
7509 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7510 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7511 | OPTS_TYPE_PT_ADD80
7512 | OPTS_TYPE_PT_ADDBITS15
;
7513 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7514 dgst_size
= DGST_SIZE_4_5
;
7515 parse_func
= djangosha1_parse_hash
;
7516 sort_by_digest
= sort_by_digest_4_5
;
7517 opti_type
= OPTI_TYPE_ZERO_BYTE
7518 | OPTI_TYPE_PRECOMPUTE_INIT
7519 | OPTI_TYPE_PRECOMPUTE_MERKLE
7520 | OPTI_TYPE_EARLY_SKIP
7521 | OPTI_TYPE_NOT_ITERATED
7522 | OPTI_TYPE_PREPENDED_SALT
7523 | OPTI_TYPE_RAW_HASH
;
7530 case 125: hash_type
= HASH_TYPE_SHA1
;
7531 salt_type
= SALT_TYPE_EMBEDDED
;
7532 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7533 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7534 | OPTS_TYPE_PT_ADD80
7535 | OPTS_TYPE_PT_ADDBITS15
7537 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7538 dgst_size
= DGST_SIZE_4_5
;
7539 parse_func
= arubaos_parse_hash
;
7540 sort_by_digest
= sort_by_digest_4_5
;
7541 opti_type
= OPTI_TYPE_ZERO_BYTE
7542 | OPTI_TYPE_PRECOMPUTE_INIT
7543 | OPTI_TYPE_PRECOMPUTE_MERKLE
7544 | OPTI_TYPE_EARLY_SKIP
7545 | OPTI_TYPE_NOT_ITERATED
7546 | OPTI_TYPE_PREPENDED_SALT
7547 | OPTI_TYPE_RAW_HASH
;
7554 case 130: hash_type
= HASH_TYPE_SHA1
;
7555 salt_type
= SALT_TYPE_INTERN
;
7556 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7557 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7558 | OPTS_TYPE_PT_UNICODE
7559 | OPTS_TYPE_ST_ADD80
7560 | OPTS_TYPE_ST_ADDBITS15
;
7561 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7562 dgst_size
= DGST_SIZE_4_5
;
7563 parse_func
= sha1s_parse_hash
;
7564 sort_by_digest
= sort_by_digest_4_5
;
7565 opti_type
= OPTI_TYPE_ZERO_BYTE
7566 | OPTI_TYPE_PRECOMPUTE_INIT
7567 | OPTI_TYPE_PRECOMPUTE_MERKLE
7568 | OPTI_TYPE_EARLY_SKIP
7569 | OPTI_TYPE_NOT_ITERATED
7570 | OPTI_TYPE_APPENDED_SALT
7571 | OPTI_TYPE_RAW_HASH
;
7578 case 131: hash_type
= HASH_TYPE_SHA1
;
7579 salt_type
= SALT_TYPE_EMBEDDED
;
7580 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7581 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7582 | OPTS_TYPE_PT_UNICODE
7583 | OPTS_TYPE_PT_UPPER
7584 | OPTS_TYPE_ST_ADD80
7585 | OPTS_TYPE_ST_ADDBITS15
7587 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7588 dgst_size
= DGST_SIZE_4_5
;
7589 parse_func
= mssql2000_parse_hash
;
7590 sort_by_digest
= sort_by_digest_4_5
;
7591 opti_type
= OPTI_TYPE_ZERO_BYTE
7592 | OPTI_TYPE_PRECOMPUTE_INIT
7593 | OPTI_TYPE_PRECOMPUTE_MERKLE
7594 | OPTI_TYPE_EARLY_SKIP
7595 | OPTI_TYPE_NOT_ITERATED
7596 | OPTI_TYPE_APPENDED_SALT
7597 | OPTI_TYPE_RAW_HASH
;
7604 case 132: hash_type
= HASH_TYPE_SHA1
;
7605 salt_type
= SALT_TYPE_EMBEDDED
;
7606 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7607 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7608 | OPTS_TYPE_PT_UNICODE
7609 | OPTS_TYPE_ST_ADD80
7610 | OPTS_TYPE_ST_ADDBITS15
7612 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7613 dgst_size
= DGST_SIZE_4_5
;
7614 parse_func
= mssql2005_parse_hash
;
7615 sort_by_digest
= sort_by_digest_4_5
;
7616 opti_type
= OPTI_TYPE_ZERO_BYTE
7617 | OPTI_TYPE_PRECOMPUTE_INIT
7618 | OPTI_TYPE_PRECOMPUTE_MERKLE
7619 | OPTI_TYPE_EARLY_SKIP
7620 | OPTI_TYPE_NOT_ITERATED
7621 | OPTI_TYPE_APPENDED_SALT
7622 | OPTI_TYPE_RAW_HASH
;
7629 case 133: hash_type
= HASH_TYPE_SHA1
;
7630 salt_type
= SALT_TYPE_EMBEDDED
;
7631 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7632 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7633 | OPTS_TYPE_PT_UNICODE
7634 | OPTS_TYPE_ST_ADD80
7635 | OPTS_TYPE_ST_ADDBITS15
;
7636 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7637 dgst_size
= DGST_SIZE_4_5
;
7638 parse_func
= peoplesoft_parse_hash
;
7639 sort_by_digest
= sort_by_digest_4_5
;
7640 opti_type
= OPTI_TYPE_ZERO_BYTE
7641 | OPTI_TYPE_PRECOMPUTE_INIT
7642 | OPTI_TYPE_PRECOMPUTE_MERKLE
7643 | OPTI_TYPE_EARLY_SKIP
7644 | OPTI_TYPE_NOT_ITERATED
7645 | OPTI_TYPE_APPENDED_SALT
7646 | OPTI_TYPE_RAW_HASH
;
7653 case 140: hash_type
= HASH_TYPE_SHA1
;
7654 salt_type
= SALT_TYPE_INTERN
;
7655 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7656 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7657 | OPTS_TYPE_PT_ADD80
7658 | OPTS_TYPE_PT_ADDBITS15
7659 | OPTS_TYPE_PT_UNICODE
;
7660 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7661 dgst_size
= DGST_SIZE_4_5
;
7662 parse_func
= sha1s_parse_hash
;
7663 sort_by_digest
= sort_by_digest_4_5
;
7664 opti_type
= OPTI_TYPE_ZERO_BYTE
7665 | OPTI_TYPE_PRECOMPUTE_INIT
7666 | OPTI_TYPE_PRECOMPUTE_MERKLE
7667 | OPTI_TYPE_EARLY_SKIP
7668 | OPTI_TYPE_NOT_ITERATED
7669 | OPTI_TYPE_PREPENDED_SALT
7670 | OPTI_TYPE_RAW_HASH
;
7677 case 141: hash_type
= HASH_TYPE_SHA1
;
7678 salt_type
= SALT_TYPE_EMBEDDED
;
7679 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7680 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7681 | OPTS_TYPE_PT_ADD80
7682 | OPTS_TYPE_PT_ADDBITS15
7683 | OPTS_TYPE_PT_UNICODE
7684 | OPTS_TYPE_ST_BASE64
;
7685 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7686 dgst_size
= DGST_SIZE_4_5
;
7687 parse_func
= episerver_parse_hash
;
7688 sort_by_digest
= sort_by_digest_4_5
;
7689 opti_type
= OPTI_TYPE_ZERO_BYTE
7690 | OPTI_TYPE_PRECOMPUTE_INIT
7691 | OPTI_TYPE_PRECOMPUTE_MERKLE
7692 | OPTI_TYPE_EARLY_SKIP
7693 | OPTI_TYPE_NOT_ITERATED
7694 | OPTI_TYPE_PREPENDED_SALT
7695 | OPTI_TYPE_RAW_HASH
;
7702 case 150: hash_type
= HASH_TYPE_SHA1
;
7703 salt_type
= SALT_TYPE_INTERN
;
7704 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7705 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7706 | OPTS_TYPE_ST_ADD80
7707 | OPTS_TYPE_ST_ADDBITS15
;
7708 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7709 dgst_size
= DGST_SIZE_4_5
;
7710 parse_func
= hmacsha1_parse_hash
;
7711 sort_by_digest
= sort_by_digest_4_5
;
7712 opti_type
= OPTI_TYPE_ZERO_BYTE
7713 | OPTI_TYPE_NOT_ITERATED
;
7720 case 160: hash_type
= HASH_TYPE_SHA1
;
7721 salt_type
= SALT_TYPE_INTERN
;
7722 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7723 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7724 | OPTS_TYPE_PT_ADD80
7725 | OPTS_TYPE_PT_ADDBITS15
;
7726 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7727 dgst_size
= DGST_SIZE_4_5
;
7728 parse_func
= hmacsha1_parse_hash
;
7729 sort_by_digest
= sort_by_digest_4_5
;
7730 opti_type
= OPTI_TYPE_ZERO_BYTE
7731 | OPTI_TYPE_NOT_ITERATED
;
7738 case 190: hash_type
= HASH_TYPE_SHA1
;
7739 salt_type
= SALT_TYPE_NONE
;
7740 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7741 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7742 | OPTS_TYPE_PT_ADD80
7743 | OPTS_TYPE_PT_ADDBITS15
;
7744 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7745 dgst_size
= DGST_SIZE_4_5
;
7746 parse_func
= sha1linkedin_parse_hash
;
7747 sort_by_digest
= sort_by_digest_4_5
;
7748 opti_type
= OPTI_TYPE_ZERO_BYTE
7749 | OPTI_TYPE_PRECOMPUTE_INIT
7750 | OPTI_TYPE_EARLY_SKIP
7751 | OPTI_TYPE_NOT_ITERATED
7752 | OPTI_TYPE_NOT_SALTED
;
7759 case 200: hash_type
= HASH_TYPE_MYSQL
;
7760 salt_type
= SALT_TYPE_NONE
;
7761 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7763 kern_type
= KERN_TYPE_MYSQL
;
7764 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7765 parse_func
= mysql323_parse_hash
;
7766 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7767 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7774 case 300: hash_type
= HASH_TYPE_SHA1
;
7775 salt_type
= SALT_TYPE_NONE
;
7776 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7777 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7778 | OPTS_TYPE_PT_ADD80
7779 | OPTS_TYPE_PT_ADDBITS15
;
7780 kern_type
= KERN_TYPE_MYSQL41
;
7781 dgst_size
= DGST_SIZE_4_5
;
7782 parse_func
= sha1_parse_hash
;
7783 sort_by_digest
= sort_by_digest_4_5
;
7784 opti_type
= OPTI_TYPE_ZERO_BYTE
7785 | OPTI_TYPE_PRECOMPUTE_INIT
7786 | OPTI_TYPE_PRECOMPUTE_MERKLE
7787 | OPTI_TYPE_EARLY_SKIP
7788 | OPTI_TYPE_NOT_ITERATED
7789 | OPTI_TYPE_NOT_SALTED
;
7796 case 400: hash_type
= HASH_TYPE_MD5
;
7797 salt_type
= SALT_TYPE_EMBEDDED
;
7798 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7799 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7800 kern_type
= KERN_TYPE_PHPASS
;
7801 dgst_size
= DGST_SIZE_4_4
;
7802 parse_func
= phpass_parse_hash
;
7803 sort_by_digest
= sort_by_digest_4_4
;
7804 opti_type
= OPTI_TYPE_ZERO_BYTE
7805 | OPTI_TYPE_SLOW_HASH_SIMD
;
7812 case 500: hash_type
= HASH_TYPE_MD5
;
7813 salt_type
= SALT_TYPE_EMBEDDED
;
7814 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7815 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7816 kern_type
= KERN_TYPE_MD5CRYPT
;
7817 dgst_size
= DGST_SIZE_4_4
;
7818 parse_func
= md5crypt_parse_hash
;
7819 sort_by_digest
= sort_by_digest_4_4
;
7820 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7827 case 501: hash_type
= HASH_TYPE_MD5
;
7828 salt_type
= SALT_TYPE_EMBEDDED
;
7829 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7830 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7831 | OPTS_TYPE_HASH_COPY
;
7832 kern_type
= KERN_TYPE_MD5CRYPT
;
7833 dgst_size
= DGST_SIZE_4_4
;
7834 parse_func
= juniper_parse_hash
;
7835 sort_by_digest
= sort_by_digest_4_4
;
7836 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7843 case 900: hash_type
= HASH_TYPE_MD4
;
7844 salt_type
= SALT_TYPE_NONE
;
7845 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7846 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7847 | OPTS_TYPE_PT_ADD80
7848 | OPTS_TYPE_PT_ADDBITS14
;
7849 kern_type
= KERN_TYPE_MD4
;
7850 dgst_size
= DGST_SIZE_4_4
;
7851 parse_func
= md4_parse_hash
;
7852 sort_by_digest
= sort_by_digest_4_4
;
7853 opti_type
= OPTI_TYPE_ZERO_BYTE
7854 | OPTI_TYPE_PRECOMPUTE_INIT
7855 | OPTI_TYPE_PRECOMPUTE_MERKLE
7856 | OPTI_TYPE_MEET_IN_MIDDLE
7857 | OPTI_TYPE_EARLY_SKIP
7858 | OPTI_TYPE_NOT_ITERATED
7859 | OPTI_TYPE_NOT_SALTED
7860 | OPTI_TYPE_RAW_HASH
;
7867 case 1000: hash_type
= HASH_TYPE_MD4
;
7868 salt_type
= SALT_TYPE_NONE
;
7869 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7871 | OPTS_TYPE_PT_ADD80
7872 | OPTS_TYPE_PT_ADDBITS14
7873 | OPTS_TYPE_PT_UNICODE
;
7874 kern_type
= KERN_TYPE_MD4_PWU
;
7875 dgst_size
= DGST_SIZE_4_4
;
7876 parse_func
= md4_parse_hash
;
7877 sort_by_digest
= sort_by_digest_4_4
;
7878 opti_type
= OPTI_TYPE_ZERO_BYTE
7879 | OPTI_TYPE_PRECOMPUTE_INIT
7880 | OPTI_TYPE_PRECOMPUTE_MERKLE
7881 | OPTI_TYPE_MEET_IN_MIDDLE
7882 | OPTI_TYPE_EARLY_SKIP
7883 | OPTI_TYPE_NOT_ITERATED
7884 | OPTI_TYPE_NOT_SALTED
7885 | OPTI_TYPE_RAW_HASH
;
7892 case 1100: hash_type
= HASH_TYPE_MD4
;
7893 salt_type
= SALT_TYPE_INTERN
;
7894 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7895 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7896 | OPTS_TYPE_PT_ADD80
7897 | OPTS_TYPE_PT_ADDBITS14
7898 | OPTS_TYPE_PT_UNICODE
7899 | OPTS_TYPE_ST_ADD80
7900 | OPTS_TYPE_ST_UNICODE
7901 | OPTS_TYPE_ST_LOWER
;
7902 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7903 dgst_size
= DGST_SIZE_4_4
;
7904 parse_func
= dcc_parse_hash
;
7905 sort_by_digest
= sort_by_digest_4_4
;
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
;
7917 case 1400: hash_type
= HASH_TYPE_SHA256
;
7918 salt_type
= SALT_TYPE_NONE
;
7919 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7920 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7921 | OPTS_TYPE_PT_ADD80
7922 | OPTS_TYPE_PT_ADDBITS15
;
7923 kern_type
= KERN_TYPE_SHA256
;
7924 dgst_size
= DGST_SIZE_4_8
;
7925 parse_func
= sha256_parse_hash
;
7926 sort_by_digest
= sort_by_digest_4_8
;
7927 opti_type
= OPTI_TYPE_ZERO_BYTE
7928 | OPTI_TYPE_PRECOMPUTE_INIT
7929 | OPTI_TYPE_PRECOMPUTE_MERKLE
7930 | OPTI_TYPE_EARLY_SKIP
7931 | OPTI_TYPE_NOT_ITERATED
7932 | OPTI_TYPE_NOT_SALTED
7933 | OPTI_TYPE_RAW_HASH
;
7940 case 1410: hash_type
= HASH_TYPE_SHA256
;
7941 salt_type
= SALT_TYPE_INTERN
;
7942 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7943 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7944 | OPTS_TYPE_ST_ADD80
7945 | OPTS_TYPE_ST_ADDBITS15
;
7946 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7947 dgst_size
= DGST_SIZE_4_8
;
7948 parse_func
= sha256s_parse_hash
;
7949 sort_by_digest
= sort_by_digest_4_8
;
7950 opti_type
= OPTI_TYPE_ZERO_BYTE
7951 | OPTI_TYPE_PRECOMPUTE_INIT
7952 | OPTI_TYPE_PRECOMPUTE_MERKLE
7953 | OPTI_TYPE_EARLY_SKIP
7954 | OPTI_TYPE_NOT_ITERATED
7955 | OPTI_TYPE_APPENDED_SALT
7956 | OPTI_TYPE_RAW_HASH
;
7963 case 1420: hash_type
= HASH_TYPE_SHA256
;
7964 salt_type
= SALT_TYPE_INTERN
;
7965 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7966 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7967 | OPTS_TYPE_PT_ADD80
7968 | OPTS_TYPE_PT_ADDBITS15
;
7969 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7970 dgst_size
= DGST_SIZE_4_8
;
7971 parse_func
= sha256s_parse_hash
;
7972 sort_by_digest
= sort_by_digest_4_8
;
7973 opti_type
= OPTI_TYPE_ZERO_BYTE
7974 | OPTI_TYPE_PRECOMPUTE_INIT
7975 | OPTI_TYPE_PRECOMPUTE_MERKLE
7976 | OPTI_TYPE_EARLY_SKIP
7977 | OPTI_TYPE_NOT_ITERATED
7978 | OPTI_TYPE_PREPENDED_SALT
7979 | OPTI_TYPE_RAW_HASH
;
7986 case 1421: hash_type
= HASH_TYPE_SHA256
;
7987 salt_type
= SALT_TYPE_EMBEDDED
;
7988 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7989 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7990 | OPTS_TYPE_PT_ADD80
7991 | OPTS_TYPE_PT_ADDBITS15
;
7992 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7993 dgst_size
= DGST_SIZE_4_8
;
7994 parse_func
= hmailserver_parse_hash
;
7995 sort_by_digest
= sort_by_digest_4_8
;
7996 opti_type
= OPTI_TYPE_ZERO_BYTE
7997 | OPTI_TYPE_PRECOMPUTE_INIT
7998 | OPTI_TYPE_PRECOMPUTE_MERKLE
7999 | OPTI_TYPE_EARLY_SKIP
8000 | OPTI_TYPE_NOT_ITERATED
8001 | OPTI_TYPE_PREPENDED_SALT
8002 | OPTI_TYPE_RAW_HASH
;
8009 case 1430: hash_type
= HASH_TYPE_SHA256
;
8010 salt_type
= SALT_TYPE_INTERN
;
8011 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8012 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8013 | OPTS_TYPE_PT_UNICODE
8014 | OPTS_TYPE_ST_ADD80
8015 | OPTS_TYPE_ST_ADDBITS15
;
8016 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8017 dgst_size
= DGST_SIZE_4_8
;
8018 parse_func
= sha256s_parse_hash
;
8019 sort_by_digest
= sort_by_digest_4_8
;
8020 opti_type
= OPTI_TYPE_ZERO_BYTE
8021 | OPTI_TYPE_PRECOMPUTE_INIT
8022 | OPTI_TYPE_PRECOMPUTE_MERKLE
8023 | OPTI_TYPE_EARLY_SKIP
8024 | OPTI_TYPE_NOT_ITERATED
8025 | OPTI_TYPE_APPENDED_SALT
8026 | OPTI_TYPE_RAW_HASH
;
8033 case 1440: hash_type
= HASH_TYPE_SHA256
;
8034 salt_type
= SALT_TYPE_INTERN
;
8035 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8036 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8037 | OPTS_TYPE_PT_ADD80
8038 | OPTS_TYPE_PT_ADDBITS15
8039 | OPTS_TYPE_PT_UNICODE
;
8040 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8041 dgst_size
= DGST_SIZE_4_8
;
8042 parse_func
= sha256s_parse_hash
;
8043 sort_by_digest
= sort_by_digest_4_8
;
8044 opti_type
= OPTI_TYPE_ZERO_BYTE
8045 | OPTI_TYPE_PRECOMPUTE_INIT
8046 | OPTI_TYPE_PRECOMPUTE_MERKLE
8047 | OPTI_TYPE_EARLY_SKIP
8048 | OPTI_TYPE_NOT_ITERATED
8049 | OPTI_TYPE_PREPENDED_SALT
8050 | OPTI_TYPE_RAW_HASH
;
8057 case 1441: hash_type
= HASH_TYPE_SHA256
;
8058 salt_type
= SALT_TYPE_EMBEDDED
;
8059 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8060 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8061 | OPTS_TYPE_PT_ADD80
8062 | OPTS_TYPE_PT_ADDBITS15
8063 | OPTS_TYPE_PT_UNICODE
8064 | OPTS_TYPE_ST_BASE64
;
8065 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8066 dgst_size
= DGST_SIZE_4_8
;
8067 parse_func
= episerver4_parse_hash
;
8068 sort_by_digest
= sort_by_digest_4_8
;
8069 opti_type
= OPTI_TYPE_ZERO_BYTE
8070 | OPTI_TYPE_PRECOMPUTE_INIT
8071 | OPTI_TYPE_PRECOMPUTE_MERKLE
8072 | OPTI_TYPE_EARLY_SKIP
8073 | OPTI_TYPE_NOT_ITERATED
8074 | OPTI_TYPE_PREPENDED_SALT
8075 | OPTI_TYPE_RAW_HASH
;
8082 case 1450: hash_type
= HASH_TYPE_SHA256
;
8083 salt_type
= SALT_TYPE_INTERN
;
8084 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8085 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8086 | OPTS_TYPE_ST_ADD80
;
8087 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8088 dgst_size
= DGST_SIZE_4_8
;
8089 parse_func
= hmacsha256_parse_hash
;
8090 sort_by_digest
= sort_by_digest_4_8
;
8091 opti_type
= OPTI_TYPE_ZERO_BYTE
8092 | OPTI_TYPE_NOT_ITERATED
;
8099 case 1460: hash_type
= HASH_TYPE_SHA256
;
8100 salt_type
= SALT_TYPE_INTERN
;
8101 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8102 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8103 | OPTS_TYPE_PT_ADD80
8104 | OPTS_TYPE_PT_ADDBITS15
;
8105 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8106 dgst_size
= DGST_SIZE_4_8
;
8107 parse_func
= hmacsha256_parse_hash
;
8108 sort_by_digest
= sort_by_digest_4_8
;
8109 opti_type
= OPTI_TYPE_ZERO_BYTE
8110 | OPTI_TYPE_NOT_ITERATED
;
8117 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8118 salt_type
= SALT_TYPE_EMBEDDED
;
8119 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8120 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8121 | OPTS_TYPE_PT_BITSLICE
;
8122 kern_type
= KERN_TYPE_DESCRYPT
;
8123 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8124 parse_func
= descrypt_parse_hash
;
8125 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8126 opti_type
= OPTI_TYPE_ZERO_BYTE
8127 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8134 case 1600: hash_type
= HASH_TYPE_MD5
;
8135 salt_type
= SALT_TYPE_EMBEDDED
;
8136 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8137 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8138 kern_type
= KERN_TYPE_APR1CRYPT
;
8139 dgst_size
= DGST_SIZE_4_4
;
8140 parse_func
= md5apr1_parse_hash
;
8141 sort_by_digest
= sort_by_digest_4_4
;
8142 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8149 case 1700: hash_type
= HASH_TYPE_SHA512
;
8150 salt_type
= SALT_TYPE_NONE
;
8151 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8152 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8153 | OPTS_TYPE_PT_ADD80
8154 | OPTS_TYPE_PT_ADDBITS15
;
8155 kern_type
= KERN_TYPE_SHA512
;
8156 dgst_size
= DGST_SIZE_8_8
;
8157 parse_func
= sha512_parse_hash
;
8158 sort_by_digest
= sort_by_digest_8_8
;
8159 opti_type
= OPTI_TYPE_ZERO_BYTE
8160 | OPTI_TYPE_PRECOMPUTE_INIT
8161 | OPTI_TYPE_PRECOMPUTE_MERKLE
8162 | OPTI_TYPE_EARLY_SKIP
8163 | OPTI_TYPE_NOT_ITERATED
8164 | OPTI_TYPE_NOT_SALTED
8165 | OPTI_TYPE_USES_BITS_64
8166 | OPTI_TYPE_RAW_HASH
;
8173 case 1710: hash_type
= HASH_TYPE_SHA512
;
8174 salt_type
= SALT_TYPE_INTERN
;
8175 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8176 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8177 | OPTS_TYPE_ST_ADD80
8178 | OPTS_TYPE_ST_ADDBITS15
;
8179 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8180 dgst_size
= DGST_SIZE_8_8
;
8181 parse_func
= sha512s_parse_hash
;
8182 sort_by_digest
= sort_by_digest_8_8
;
8183 opti_type
= OPTI_TYPE_ZERO_BYTE
8184 | OPTI_TYPE_PRECOMPUTE_INIT
8185 | OPTI_TYPE_PRECOMPUTE_MERKLE
8186 | OPTI_TYPE_EARLY_SKIP
8187 | OPTI_TYPE_NOT_ITERATED
8188 | OPTI_TYPE_APPENDED_SALT
8189 | OPTI_TYPE_USES_BITS_64
8190 | OPTI_TYPE_RAW_HASH
;
8197 case 1711: hash_type
= HASH_TYPE_SHA512
;
8198 salt_type
= SALT_TYPE_EMBEDDED
;
8199 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8200 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8201 | OPTS_TYPE_ST_ADD80
8202 | OPTS_TYPE_ST_ADDBITS15
;
8203 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8204 dgst_size
= DGST_SIZE_8_8
;
8205 parse_func
= sha512b64s_parse_hash
;
8206 sort_by_digest
= sort_by_digest_8_8
;
8207 opti_type
= OPTI_TYPE_ZERO_BYTE
8208 | OPTI_TYPE_PRECOMPUTE_INIT
8209 | OPTI_TYPE_PRECOMPUTE_MERKLE
8210 | OPTI_TYPE_EARLY_SKIP
8211 | OPTI_TYPE_NOT_ITERATED
8212 | OPTI_TYPE_APPENDED_SALT
8213 | OPTI_TYPE_USES_BITS_64
8214 | OPTI_TYPE_RAW_HASH
;
8221 case 1720: hash_type
= HASH_TYPE_SHA512
;
8222 salt_type
= SALT_TYPE_INTERN
;
8223 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8224 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8225 | OPTS_TYPE_PT_ADD80
8226 | OPTS_TYPE_PT_ADDBITS15
;
8227 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8228 dgst_size
= DGST_SIZE_8_8
;
8229 parse_func
= sha512s_parse_hash
;
8230 sort_by_digest
= sort_by_digest_8_8
;
8231 opti_type
= OPTI_TYPE_ZERO_BYTE
8232 | OPTI_TYPE_PRECOMPUTE_INIT
8233 | OPTI_TYPE_PRECOMPUTE_MERKLE
8234 | OPTI_TYPE_EARLY_SKIP
8235 | OPTI_TYPE_NOT_ITERATED
8236 | OPTI_TYPE_PREPENDED_SALT
8237 | OPTI_TYPE_USES_BITS_64
8238 | OPTI_TYPE_RAW_HASH
;
8245 case 1722: hash_type
= HASH_TYPE_SHA512
;
8246 salt_type
= SALT_TYPE_EMBEDDED
;
8247 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8248 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8249 | OPTS_TYPE_PT_ADD80
8250 | OPTS_TYPE_PT_ADDBITS15
8252 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8253 dgst_size
= DGST_SIZE_8_8
;
8254 parse_func
= osx512_parse_hash
;
8255 sort_by_digest
= sort_by_digest_8_8
;
8256 opti_type
= OPTI_TYPE_ZERO_BYTE
8257 | OPTI_TYPE_PRECOMPUTE_INIT
8258 | OPTI_TYPE_PRECOMPUTE_MERKLE
8259 | OPTI_TYPE_EARLY_SKIP
8260 | OPTI_TYPE_NOT_ITERATED
8261 | OPTI_TYPE_PREPENDED_SALT
8262 | OPTI_TYPE_USES_BITS_64
8263 | OPTI_TYPE_RAW_HASH
;
8270 case 1730: hash_type
= HASH_TYPE_SHA512
;
8271 salt_type
= SALT_TYPE_INTERN
;
8272 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8273 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8274 | OPTS_TYPE_PT_UNICODE
8275 | OPTS_TYPE_ST_ADD80
8276 | OPTS_TYPE_ST_ADDBITS15
;
8277 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8278 dgst_size
= DGST_SIZE_8_8
;
8279 parse_func
= sha512s_parse_hash
;
8280 sort_by_digest
= sort_by_digest_8_8
;
8281 opti_type
= OPTI_TYPE_ZERO_BYTE
8282 | OPTI_TYPE_PRECOMPUTE_INIT
8283 | OPTI_TYPE_PRECOMPUTE_MERKLE
8284 | OPTI_TYPE_EARLY_SKIP
8285 | OPTI_TYPE_NOT_ITERATED
8286 | OPTI_TYPE_APPENDED_SALT
8287 | OPTI_TYPE_USES_BITS_64
8288 | OPTI_TYPE_RAW_HASH
;
8295 case 1731: hash_type
= HASH_TYPE_SHA512
;
8296 salt_type
= SALT_TYPE_EMBEDDED
;
8297 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8298 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8299 | OPTS_TYPE_PT_UNICODE
8300 | OPTS_TYPE_ST_ADD80
8301 | OPTS_TYPE_ST_ADDBITS15
8303 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8304 dgst_size
= DGST_SIZE_8_8
;
8305 parse_func
= mssql2012_parse_hash
;
8306 sort_by_digest
= sort_by_digest_8_8
;
8307 opti_type
= OPTI_TYPE_ZERO_BYTE
8308 | OPTI_TYPE_PRECOMPUTE_INIT
8309 | OPTI_TYPE_PRECOMPUTE_MERKLE
8310 | OPTI_TYPE_EARLY_SKIP
8311 | OPTI_TYPE_NOT_ITERATED
8312 | OPTI_TYPE_APPENDED_SALT
8313 | OPTI_TYPE_USES_BITS_64
8314 | OPTI_TYPE_RAW_HASH
;
8321 case 1740: hash_type
= HASH_TYPE_SHA512
;
8322 salt_type
= SALT_TYPE_INTERN
;
8323 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8325 | OPTS_TYPE_PT_ADD80
8326 | OPTS_TYPE_PT_ADDBITS15
8327 | OPTS_TYPE_PT_UNICODE
;
8328 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8329 dgst_size
= DGST_SIZE_8_8
;
8330 parse_func
= sha512s_parse_hash
;
8331 sort_by_digest
= sort_by_digest_8_8
;
8332 opti_type
= OPTI_TYPE_ZERO_BYTE
8333 | OPTI_TYPE_PRECOMPUTE_INIT
8334 | OPTI_TYPE_PRECOMPUTE_MERKLE
8335 | OPTI_TYPE_EARLY_SKIP
8336 | OPTI_TYPE_NOT_ITERATED
8337 | OPTI_TYPE_PREPENDED_SALT
8338 | OPTI_TYPE_USES_BITS_64
8339 | OPTI_TYPE_RAW_HASH
;
8346 case 1750: hash_type
= HASH_TYPE_SHA512
;
8347 salt_type
= SALT_TYPE_INTERN
;
8348 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8349 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8350 | OPTS_TYPE_ST_ADD80
;
8351 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8352 dgst_size
= DGST_SIZE_8_8
;
8353 parse_func
= hmacsha512_parse_hash
;
8354 sort_by_digest
= sort_by_digest_8_8
;
8355 opti_type
= OPTI_TYPE_ZERO_BYTE
8356 | OPTI_TYPE_USES_BITS_64
8357 | OPTI_TYPE_NOT_ITERATED
;
8364 case 1760: hash_type
= HASH_TYPE_SHA512
;
8365 salt_type
= SALT_TYPE_INTERN
;
8366 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8367 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8368 | OPTS_TYPE_PT_ADD80
8369 | OPTS_TYPE_PT_ADDBITS15
;
8370 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8371 dgst_size
= DGST_SIZE_8_8
;
8372 parse_func
= hmacsha512_parse_hash
;
8373 sort_by_digest
= sort_by_digest_8_8
;
8374 opti_type
= OPTI_TYPE_ZERO_BYTE
8375 | OPTI_TYPE_USES_BITS_64
8376 | OPTI_TYPE_NOT_ITERATED
;
8383 case 1800: hash_type
= HASH_TYPE_SHA512
;
8384 salt_type
= SALT_TYPE_EMBEDDED
;
8385 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8386 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8387 kern_type
= KERN_TYPE_SHA512CRYPT
;
8388 dgst_size
= DGST_SIZE_8_8
;
8389 parse_func
= sha512crypt_parse_hash
;
8390 sort_by_digest
= sort_by_digest_8_8
;
8391 opti_type
= OPTI_TYPE_ZERO_BYTE
8392 | OPTI_TYPE_USES_BITS_64
;
8399 case 2100: hash_type
= HASH_TYPE_DCC2
;
8400 salt_type
= SALT_TYPE_EMBEDDED
;
8401 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8402 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8403 | OPTS_TYPE_ST_LOWER
8404 | OPTS_TYPE_ST_UNICODE
;
8405 kern_type
= KERN_TYPE_DCC2
;
8406 dgst_size
= DGST_SIZE_4_4
;
8407 parse_func
= dcc2_parse_hash
;
8408 sort_by_digest
= sort_by_digest_4_4
;
8409 opti_type
= OPTI_TYPE_ZERO_BYTE
8410 | OPTI_TYPE_SLOW_HASH_SIMD
;
8417 case 2400: hash_type
= HASH_TYPE_MD5
;
8418 salt_type
= SALT_TYPE_NONE
;
8419 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8420 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8421 kern_type
= KERN_TYPE_MD5PIX
;
8422 dgst_size
= DGST_SIZE_4_4
;
8423 parse_func
= md5pix_parse_hash
;
8424 sort_by_digest
= sort_by_digest_4_4
;
8425 opti_type
= OPTI_TYPE_ZERO_BYTE
8426 | OPTI_TYPE_PRECOMPUTE_INIT
8427 | OPTI_TYPE_PRECOMPUTE_MERKLE
8428 | OPTI_TYPE_EARLY_SKIP
8429 | OPTI_TYPE_NOT_ITERATED
8430 | OPTI_TYPE_NOT_SALTED
;
8437 case 2410: hash_type
= HASH_TYPE_MD5
;
8438 salt_type
= SALT_TYPE_INTERN
;
8439 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8440 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8441 kern_type
= KERN_TYPE_MD5ASA
;
8442 dgst_size
= DGST_SIZE_4_4
;
8443 parse_func
= md5asa_parse_hash
;
8444 sort_by_digest
= sort_by_digest_4_4
;
8445 opti_type
= OPTI_TYPE_ZERO_BYTE
8446 | OPTI_TYPE_PRECOMPUTE_INIT
8447 | OPTI_TYPE_PRECOMPUTE_MERKLE
8448 | OPTI_TYPE_EARLY_SKIP
8449 | OPTI_TYPE_NOT_ITERATED
;
8456 case 2500: hash_type
= HASH_TYPE_WPA
;
8457 salt_type
= SALT_TYPE_EMBEDDED
;
8458 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8459 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8460 kern_type
= KERN_TYPE_WPA
;
8461 dgst_size
= DGST_SIZE_4_4
;
8462 parse_func
= wpa_parse_hash
;
8463 sort_by_digest
= sort_by_digest_4_4
;
8464 opti_type
= OPTI_TYPE_ZERO_BYTE
8465 | OPTI_TYPE_SLOW_HASH_SIMD
;
8472 case 2600: hash_type
= HASH_TYPE_MD5
;
8473 salt_type
= SALT_TYPE_VIRTUAL
;
8474 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8476 | OPTS_TYPE_PT_ADD80
8477 | OPTS_TYPE_PT_ADDBITS14
8478 | OPTS_TYPE_ST_ADD80
;
8479 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8480 dgst_size
= DGST_SIZE_4_4
;
8481 parse_func
= md5md5_parse_hash
;
8482 sort_by_digest
= sort_by_digest_4_4
;
8483 opti_type
= OPTI_TYPE_ZERO_BYTE
8484 | OPTI_TYPE_PRECOMPUTE_INIT
8485 | OPTI_TYPE_PRECOMPUTE_MERKLE
8486 | OPTI_TYPE_EARLY_SKIP
;
8493 case 2611: hash_type
= HASH_TYPE_MD5
;
8494 salt_type
= SALT_TYPE_INTERN
;
8495 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8496 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8497 | OPTS_TYPE_PT_ADD80
8498 | OPTS_TYPE_PT_ADDBITS14
8499 | OPTS_TYPE_ST_ADD80
;
8500 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8501 dgst_size
= DGST_SIZE_4_4
;
8502 parse_func
= vb3_parse_hash
;
8503 sort_by_digest
= sort_by_digest_4_4
;
8504 opti_type
= OPTI_TYPE_ZERO_BYTE
8505 | OPTI_TYPE_PRECOMPUTE_INIT
8506 | OPTI_TYPE_PRECOMPUTE_MERKLE
8507 | OPTI_TYPE_EARLY_SKIP
;
8514 case 2612: hash_type
= HASH_TYPE_MD5
;
8515 salt_type
= SALT_TYPE_EMBEDDED
;
8516 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8518 | OPTS_TYPE_PT_ADD80
8519 | OPTS_TYPE_PT_ADDBITS14
8520 | OPTS_TYPE_ST_ADD80
8522 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8523 dgst_size
= DGST_SIZE_4_4
;
8524 parse_func
= phps_parse_hash
;
8525 sort_by_digest
= sort_by_digest_4_4
;
8526 opti_type
= OPTI_TYPE_ZERO_BYTE
8527 | OPTI_TYPE_PRECOMPUTE_INIT
8528 | OPTI_TYPE_PRECOMPUTE_MERKLE
8529 | OPTI_TYPE_EARLY_SKIP
;
8536 case 2711: hash_type
= HASH_TYPE_MD5
;
8537 salt_type
= SALT_TYPE_INTERN
;
8538 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8540 | OPTS_TYPE_PT_ADD80
8541 | OPTS_TYPE_PT_ADDBITS14
8542 | OPTS_TYPE_ST_ADD80
;
8543 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8544 dgst_size
= DGST_SIZE_4_4
;
8545 parse_func
= vb30_parse_hash
;
8546 sort_by_digest
= sort_by_digest_4_4
;
8547 opti_type
= OPTI_TYPE_ZERO_BYTE
8548 | OPTI_TYPE_PRECOMPUTE_INIT
8549 | OPTI_TYPE_EARLY_SKIP
;
8556 case 2811: hash_type
= HASH_TYPE_MD5
;
8557 salt_type
= SALT_TYPE_INTERN
;
8558 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8559 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8560 | OPTS_TYPE_PT_ADD80
8561 | OPTS_TYPE_PT_ADDBITS14
;
8562 kern_type
= KERN_TYPE_MD55_SLTPW
;
8563 dgst_size
= DGST_SIZE_4_4
;
8564 parse_func
= ipb2_parse_hash
;
8565 sort_by_digest
= sort_by_digest_4_4
;
8566 opti_type
= OPTI_TYPE_ZERO_BYTE
8567 | OPTI_TYPE_PRECOMPUTE_INIT
8568 | OPTI_TYPE_EARLY_SKIP
;
8575 case 3000: hash_type
= HASH_TYPE_LM
;
8576 salt_type
= SALT_TYPE_NONE
;
8577 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8578 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8579 | OPTS_TYPE_PT_UPPER
8580 | OPTS_TYPE_PT_BITSLICE
;
8581 kern_type
= KERN_TYPE_LM
;
8582 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8583 parse_func
= lm_parse_hash
;
8584 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8585 opti_type
= OPTI_TYPE_ZERO_BYTE
8586 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8593 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8594 salt_type
= SALT_TYPE_INTERN
;
8595 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8597 | OPTS_TYPE_PT_UPPER
8598 | OPTS_TYPE_ST_UPPER
;
8599 kern_type
= KERN_TYPE_ORACLEH
;
8600 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8601 parse_func
= oracleh_parse_hash
;
8602 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8603 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8610 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8611 salt_type
= SALT_TYPE_EMBEDDED
;
8612 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8613 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8614 | OPTS_TYPE_ST_GENERATE_LE
;
8615 kern_type
= KERN_TYPE_BCRYPT
;
8616 dgst_size
= DGST_SIZE_4_6
;
8617 parse_func
= bcrypt_parse_hash
;
8618 sort_by_digest
= sort_by_digest_4_6
;
8619 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8626 case 3710: hash_type
= HASH_TYPE_MD5
;
8627 salt_type
= SALT_TYPE_INTERN
;
8628 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8629 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8630 | OPTS_TYPE_PT_ADD80
8631 | OPTS_TYPE_PT_ADDBITS14
;
8632 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8633 dgst_size
= DGST_SIZE_4_4
;
8634 parse_func
= md5s_parse_hash
;
8635 sort_by_digest
= sort_by_digest_4_4
;
8636 opti_type
= OPTI_TYPE_ZERO_BYTE
8637 | OPTI_TYPE_PRECOMPUTE_INIT
8638 | OPTI_TYPE_PRECOMPUTE_MERKLE
8639 | OPTI_TYPE_EARLY_SKIP
;
8646 case 3711: hash_type
= HASH_TYPE_MD5
;
8647 salt_type
= SALT_TYPE_EMBEDDED
;
8648 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8649 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8650 | OPTS_TYPE_PT_ADD80
8651 | OPTS_TYPE_PT_ADDBITS14
;
8652 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8653 dgst_size
= DGST_SIZE_4_4
;
8654 parse_func
= mediawiki_b_parse_hash
;
8655 sort_by_digest
= sort_by_digest_4_4
;
8656 opti_type
= OPTI_TYPE_ZERO_BYTE
8657 | OPTI_TYPE_PRECOMPUTE_INIT
8658 | OPTI_TYPE_PRECOMPUTE_MERKLE
8659 | OPTI_TYPE_EARLY_SKIP
;
8666 case 3800: hash_type
= HASH_TYPE_MD5
;
8667 salt_type
= SALT_TYPE_INTERN
;
8668 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8669 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8670 | OPTS_TYPE_ST_ADDBITS14
;
8671 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8672 dgst_size
= DGST_SIZE_4_4
;
8673 parse_func
= md5s_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_RAW_HASH
;
8687 case 4300: hash_type
= HASH_TYPE_MD5
;
8688 salt_type
= SALT_TYPE_VIRTUAL
;
8689 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8690 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8691 | OPTS_TYPE_PT_ADD80
8692 | OPTS_TYPE_PT_ADDBITS14
8693 | OPTS_TYPE_ST_ADD80
;
8694 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8695 dgst_size
= DGST_SIZE_4_4
;
8696 parse_func
= md5md5_parse_hash
;
8697 sort_by_digest
= sort_by_digest_4_4
;
8698 opti_type
= OPTI_TYPE_ZERO_BYTE
8699 | OPTI_TYPE_PRECOMPUTE_INIT
8700 | OPTI_TYPE_PRECOMPUTE_MERKLE
8701 | OPTI_TYPE_EARLY_SKIP
;
8709 case 4400: hash_type
= HASH_TYPE_MD5
;
8710 salt_type
= SALT_TYPE_NONE
;
8711 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8712 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8713 | OPTS_TYPE_PT_ADD80
8714 | OPTS_TYPE_PT_ADDBITS15
;
8715 kern_type
= KERN_TYPE_MD5_SHA1
;
8716 dgst_size
= DGST_SIZE_4_4
;
8717 parse_func
= md5_parse_hash
;
8718 sort_by_digest
= sort_by_digest_4_4
;
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 4500: hash_type
= HASH_TYPE_SHA1
;
8733 salt_type
= SALT_TYPE_NONE
;
8734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8735 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8736 | OPTS_TYPE_PT_ADD80
8737 | OPTS_TYPE_PT_ADDBITS15
;
8738 kern_type
= KERN_TYPE_SHA11
;
8739 dgst_size
= DGST_SIZE_4_5
;
8740 parse_func
= sha1_parse_hash
;
8741 sort_by_digest
= sort_by_digest_4_5
;
8742 opti_type
= OPTI_TYPE_ZERO_BYTE
8743 | OPTI_TYPE_PRECOMPUTE_INIT
8744 | OPTI_TYPE_PRECOMPUTE_MERKLE
8745 | OPTI_TYPE_EARLY_SKIP
8746 | OPTI_TYPE_NOT_SALTED
;
8753 case 4700: hash_type
= HASH_TYPE_SHA1
;
8754 salt_type
= SALT_TYPE_NONE
;
8755 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8756 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8757 | OPTS_TYPE_PT_ADD80
8758 | OPTS_TYPE_PT_ADDBITS14
;
8759 kern_type
= KERN_TYPE_SHA1_MD5
;
8760 dgst_size
= DGST_SIZE_4_5
;
8761 parse_func
= sha1_parse_hash
;
8762 sort_by_digest
= sort_by_digest_4_5
;
8763 opti_type
= OPTI_TYPE_ZERO_BYTE
8764 | OPTI_TYPE_PRECOMPUTE_INIT
8765 | OPTI_TYPE_PRECOMPUTE_MERKLE
8766 | OPTI_TYPE_EARLY_SKIP
8767 | OPTI_TYPE_NOT_ITERATED
8768 | OPTI_TYPE_NOT_SALTED
8769 | OPTI_TYPE_RAW_HASH
;
8776 case 4800: hash_type
= HASH_TYPE_MD5
;
8777 salt_type
= SALT_TYPE_EMBEDDED
;
8778 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8779 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8780 | OPTS_TYPE_PT_ADDBITS14
;
8781 kern_type
= KERN_TYPE_MD5_CHAP
;
8782 dgst_size
= DGST_SIZE_4_4
;
8783 parse_func
= chap_parse_hash
;
8784 sort_by_digest
= sort_by_digest_4_4
;
8785 opti_type
= OPTI_TYPE_ZERO_BYTE
8786 | OPTI_TYPE_PRECOMPUTE_INIT
8787 | OPTI_TYPE_PRECOMPUTE_MERKLE
8788 | OPTI_TYPE_MEET_IN_MIDDLE
8789 | OPTI_TYPE_EARLY_SKIP
8790 | OPTI_TYPE_NOT_ITERATED
8791 | OPTI_TYPE_RAW_HASH
;
8798 case 4900: hash_type
= HASH_TYPE_SHA1
;
8799 salt_type
= SALT_TYPE_INTERN
;
8800 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8801 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8802 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8803 dgst_size
= DGST_SIZE_4_5
;
8804 parse_func
= sha1s_parse_hash
;
8805 sort_by_digest
= sort_by_digest_4_5
;
8806 opti_type
= OPTI_TYPE_ZERO_BYTE
8807 | OPTI_TYPE_PRECOMPUTE_INIT
8808 | OPTI_TYPE_PRECOMPUTE_MERKLE
8809 | OPTI_TYPE_EARLY_SKIP
;
8816 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8817 salt_type
= SALT_TYPE_EMBEDDED
;
8818 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8819 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8820 | OPTS_TYPE_PT_ADD01
;
8821 kern_type
= KERN_TYPE_KECCAK
;
8822 dgst_size
= DGST_SIZE_8_25
;
8823 parse_func
= keccak_parse_hash
;
8824 sort_by_digest
= sort_by_digest_8_25
;
8825 opti_type
= OPTI_TYPE_ZERO_BYTE
8826 | OPTI_TYPE_USES_BITS_64
8827 | OPTI_TYPE_RAW_HASH
;
8834 case 5100: hash_type
= HASH_TYPE_MD5H
;
8835 salt_type
= SALT_TYPE_NONE
;
8836 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8837 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8838 | OPTS_TYPE_PT_ADD80
8839 | OPTS_TYPE_PT_ADDBITS14
;
8840 kern_type
= KERN_TYPE_MD5H
;
8841 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8842 parse_func
= md5half_parse_hash
;
8843 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8844 opti_type
= OPTI_TYPE_ZERO_BYTE
8845 | OPTI_TYPE_RAW_HASH
;
8852 case 5200: hash_type
= HASH_TYPE_SHA256
;
8853 salt_type
= SALT_TYPE_EMBEDDED
;
8854 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8855 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8856 kern_type
= KERN_TYPE_PSAFE3
;
8857 dgst_size
= DGST_SIZE_4_8
;
8858 parse_func
= psafe3_parse_hash
;
8859 sort_by_digest
= sort_by_digest_4_8
;
8860 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8867 case 5300: hash_type
= HASH_TYPE_MD5
;
8868 salt_type
= SALT_TYPE_EMBEDDED
;
8869 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8871 | OPTS_TYPE_ST_ADD80
;
8872 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8873 dgst_size
= DGST_SIZE_4_4
;
8874 parse_func
= ikepsk_md5_parse_hash
;
8875 sort_by_digest
= sort_by_digest_4_4
;
8876 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8883 case 5400: hash_type
= HASH_TYPE_SHA1
;
8884 salt_type
= SALT_TYPE_EMBEDDED
;
8885 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8886 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8887 | OPTS_TYPE_ST_ADD80
;
8888 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8889 dgst_size
= DGST_SIZE_4_5
;
8890 parse_func
= ikepsk_sha1_parse_hash
;
8891 sort_by_digest
= sort_by_digest_4_5
;
8892 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8899 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8900 salt_type
= SALT_TYPE_EMBEDDED
;
8901 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8902 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8903 | OPTS_TYPE_PT_ADD80
8904 | OPTS_TYPE_PT_ADDBITS14
8905 | OPTS_TYPE_PT_UNICODE
8907 kern_type
= KERN_TYPE_NETNTLMv1
;
8908 dgst_size
= DGST_SIZE_4_4
;
8909 parse_func
= netntlmv1_parse_hash
;
8910 sort_by_digest
= sort_by_digest_4_4
;
8911 opti_type
= OPTI_TYPE_ZERO_BYTE
8912 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8919 case 5600: hash_type
= HASH_TYPE_MD5
;
8920 salt_type
= SALT_TYPE_EMBEDDED
;
8921 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8922 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8923 | OPTS_TYPE_PT_ADD80
8924 | OPTS_TYPE_PT_ADDBITS14
8925 | OPTS_TYPE_PT_UNICODE
;
8926 kern_type
= KERN_TYPE_NETNTLMv2
;
8927 dgst_size
= DGST_SIZE_4_4
;
8928 parse_func
= netntlmv2_parse_hash
;
8929 sort_by_digest
= sort_by_digest_4_4
;
8930 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8937 case 5700: hash_type
= HASH_TYPE_SHA256
;
8938 salt_type
= SALT_TYPE_NONE
;
8939 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8940 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8941 | OPTS_TYPE_PT_ADD80
8942 | OPTS_TYPE_PT_ADDBITS15
;
8943 kern_type
= KERN_TYPE_SHA256
;
8944 dgst_size
= DGST_SIZE_4_8
;
8945 parse_func
= cisco4_parse_hash
;
8946 sort_by_digest
= sort_by_digest_4_8
;
8947 opti_type
= OPTI_TYPE_ZERO_BYTE
8948 | OPTI_TYPE_PRECOMPUTE_INIT
8949 | OPTI_TYPE_PRECOMPUTE_MERKLE
8950 | OPTI_TYPE_EARLY_SKIP
8951 | OPTI_TYPE_NOT_ITERATED
8952 | OPTI_TYPE_NOT_SALTED
8953 | OPTI_TYPE_RAW_HASH
;
8960 case 5800: hash_type
= HASH_TYPE_SHA1
;
8961 salt_type
= SALT_TYPE_INTERN
;
8962 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8964 | OPTS_TYPE_ST_ADD80
;
8965 kern_type
= KERN_TYPE_ANDROIDPIN
;
8966 dgst_size
= DGST_SIZE_4_5
;
8967 parse_func
= androidpin_parse_hash
;
8968 sort_by_digest
= sort_by_digest_4_5
;
8969 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8976 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8977 salt_type
= SALT_TYPE_NONE
;
8978 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8979 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8980 | OPTS_TYPE_PT_ADD80
;
8981 kern_type
= KERN_TYPE_RIPEMD160
;
8982 dgst_size
= DGST_SIZE_4_5
;
8983 parse_func
= ripemd160_parse_hash
;
8984 sort_by_digest
= sort_by_digest_4_5
;
8985 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8992 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8993 salt_type
= SALT_TYPE_NONE
;
8994 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8995 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8996 | OPTS_TYPE_PT_ADD80
;
8997 kern_type
= KERN_TYPE_WHIRLPOOL
;
8998 dgst_size
= DGST_SIZE_4_16
;
8999 parse_func
= whirlpool_parse_hash
;
9000 sort_by_digest
= sort_by_digest_4_16
;
9001 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9008 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9009 salt_type
= SALT_TYPE_EMBEDDED
;
9010 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9011 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9012 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9013 dgst_size
= DGST_SIZE_4_5
;
9014 parse_func
= truecrypt_parse_hash_2k
;
9015 sort_by_digest
= sort_by_digest_4_5
;
9016 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9023 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9024 salt_type
= SALT_TYPE_EMBEDDED
;
9025 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9026 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9027 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9028 dgst_size
= DGST_SIZE_4_5
;
9029 parse_func
= truecrypt_parse_hash_2k
;
9030 sort_by_digest
= sort_by_digest_4_5
;
9031 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9038 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9039 salt_type
= SALT_TYPE_EMBEDDED
;
9040 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9041 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9042 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9043 dgst_size
= DGST_SIZE_4_5
;
9044 parse_func
= truecrypt_parse_hash_2k
;
9045 sort_by_digest
= sort_by_digest_4_5
;
9046 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9053 case 6221: hash_type
= HASH_TYPE_SHA512
;
9054 salt_type
= SALT_TYPE_EMBEDDED
;
9055 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9056 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9057 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9058 dgst_size
= DGST_SIZE_8_8
;
9059 parse_func
= truecrypt_parse_hash_1k
;
9060 sort_by_digest
= sort_by_digest_8_8
;
9061 opti_type
= OPTI_TYPE_ZERO_BYTE
9062 | OPTI_TYPE_USES_BITS_64
;
9069 case 6222: hash_type
= HASH_TYPE_SHA512
;
9070 salt_type
= SALT_TYPE_EMBEDDED
;
9071 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9072 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9073 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9074 dgst_size
= DGST_SIZE_8_8
;
9075 parse_func
= truecrypt_parse_hash_1k
;
9076 sort_by_digest
= sort_by_digest_8_8
;
9077 opti_type
= OPTI_TYPE_ZERO_BYTE
9078 | OPTI_TYPE_USES_BITS_64
;
9085 case 6223: hash_type
= HASH_TYPE_SHA512
;
9086 salt_type
= SALT_TYPE_EMBEDDED
;
9087 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9088 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9089 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9090 dgst_size
= DGST_SIZE_8_8
;
9091 parse_func
= truecrypt_parse_hash_1k
;
9092 sort_by_digest
= sort_by_digest_8_8
;
9093 opti_type
= OPTI_TYPE_ZERO_BYTE
9094 | OPTI_TYPE_USES_BITS_64
;
9101 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9102 salt_type
= SALT_TYPE_EMBEDDED
;
9103 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9104 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9105 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9106 dgst_size
= DGST_SIZE_4_8
;
9107 parse_func
= truecrypt_parse_hash_1k
;
9108 sort_by_digest
= sort_by_digest_4_8
;
9109 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9116 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9117 salt_type
= SALT_TYPE_EMBEDDED
;
9118 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9119 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9120 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9121 dgst_size
= DGST_SIZE_4_8
;
9122 parse_func
= truecrypt_parse_hash_1k
;
9123 sort_by_digest
= sort_by_digest_4_8
;
9124 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9131 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9132 salt_type
= SALT_TYPE_EMBEDDED
;
9133 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9134 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9135 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9136 dgst_size
= DGST_SIZE_4_8
;
9137 parse_func
= truecrypt_parse_hash_1k
;
9138 sort_by_digest
= sort_by_digest_4_8
;
9139 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9146 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9147 salt_type
= SALT_TYPE_EMBEDDED
;
9148 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9149 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9150 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9151 dgst_size
= DGST_SIZE_4_5
;
9152 parse_func
= truecrypt_parse_hash_1k
;
9153 sort_by_digest
= sort_by_digest_4_5
;
9154 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9161 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9162 salt_type
= SALT_TYPE_EMBEDDED
;
9163 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9164 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9165 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9166 dgst_size
= DGST_SIZE_4_5
;
9167 parse_func
= truecrypt_parse_hash_1k
;
9168 sort_by_digest
= sort_by_digest_4_5
;
9169 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9176 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9177 salt_type
= SALT_TYPE_EMBEDDED
;
9178 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9179 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9180 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9181 dgst_size
= DGST_SIZE_4_5
;
9182 parse_func
= truecrypt_parse_hash_1k
;
9183 sort_by_digest
= sort_by_digest_4_5
;
9184 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9191 case 6300: hash_type
= HASH_TYPE_MD5
;
9192 salt_type
= SALT_TYPE_EMBEDDED
;
9193 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9194 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9195 kern_type
= KERN_TYPE_MD5AIX
;
9196 dgst_size
= DGST_SIZE_4_4
;
9197 parse_func
= md5aix_parse_hash
;
9198 sort_by_digest
= sort_by_digest_4_4
;
9199 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9206 case 6400: hash_type
= HASH_TYPE_SHA256
;
9207 salt_type
= SALT_TYPE_EMBEDDED
;
9208 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9210 kern_type
= KERN_TYPE_SHA256AIX
;
9211 dgst_size
= DGST_SIZE_4_8
;
9212 parse_func
= sha256aix_parse_hash
;
9213 sort_by_digest
= sort_by_digest_4_8
;
9214 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9221 case 6500: hash_type
= HASH_TYPE_SHA512
;
9222 salt_type
= SALT_TYPE_EMBEDDED
;
9223 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9224 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9225 kern_type
= KERN_TYPE_SHA512AIX
;
9226 dgst_size
= DGST_SIZE_8_8
;
9227 parse_func
= sha512aix_parse_hash
;
9228 sort_by_digest
= sort_by_digest_8_8
;
9229 opti_type
= OPTI_TYPE_ZERO_BYTE
9230 | OPTI_TYPE_USES_BITS_64
;
9237 case 6600: hash_type
= HASH_TYPE_AES
;
9238 salt_type
= SALT_TYPE_EMBEDDED
;
9239 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9240 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9241 kern_type
= KERN_TYPE_AGILEKEY
;
9242 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9243 parse_func
= agilekey_parse_hash
;
9244 sort_by_digest
= sort_by_digest_4_5
;
9245 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9252 case 6700: hash_type
= HASH_TYPE_SHA1
;
9253 salt_type
= SALT_TYPE_EMBEDDED
;
9254 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9255 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9256 kern_type
= KERN_TYPE_SHA1AIX
;
9257 dgst_size
= DGST_SIZE_4_5
;
9258 parse_func
= sha1aix_parse_hash
;
9259 sort_by_digest
= sort_by_digest_4_5
;
9260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9267 case 6800: hash_type
= HASH_TYPE_AES
;
9268 salt_type
= SALT_TYPE_EMBEDDED
;
9269 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9270 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9271 kern_type
= KERN_TYPE_LASTPASS
;
9272 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9273 parse_func
= lastpass_parse_hash
;
9274 sort_by_digest
= sort_by_digest_4_8
;
9275 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9282 case 6900: hash_type
= HASH_TYPE_GOST
;
9283 salt_type
= SALT_TYPE_NONE
;
9284 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9285 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9286 kern_type
= KERN_TYPE_GOST
;
9287 dgst_size
= DGST_SIZE_4_8
;
9288 parse_func
= gost_parse_hash
;
9289 sort_by_digest
= sort_by_digest_4_8
;
9290 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9297 case 7100: hash_type
= HASH_TYPE_SHA512
;
9298 salt_type
= SALT_TYPE_EMBEDDED
;
9299 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9301 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9302 dgst_size
= DGST_SIZE_8_16
;
9303 parse_func
= sha512osx_parse_hash
;
9304 sort_by_digest
= sort_by_digest_8_16
;
9305 opti_type
= OPTI_TYPE_ZERO_BYTE
9306 | OPTI_TYPE_USES_BITS_64
9307 | OPTI_TYPE_SLOW_HASH_SIMD
;
9314 case 7200: hash_type
= HASH_TYPE_SHA512
;
9315 salt_type
= SALT_TYPE_EMBEDDED
;
9316 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9317 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9318 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9319 dgst_size
= DGST_SIZE_8_16
;
9320 parse_func
= sha512grub_parse_hash
;
9321 sort_by_digest
= sort_by_digest_8_16
;
9322 opti_type
= OPTI_TYPE_ZERO_BYTE
9323 | OPTI_TYPE_USES_BITS_64
9324 | OPTI_TYPE_SLOW_HASH_SIMD
;
9331 case 7300: hash_type
= HASH_TYPE_SHA1
;
9332 salt_type
= SALT_TYPE_EMBEDDED
;
9333 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9334 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9335 | OPTS_TYPE_ST_ADD80
9336 | OPTS_TYPE_ST_ADDBITS15
;
9337 kern_type
= KERN_TYPE_RAKP
;
9338 dgst_size
= DGST_SIZE_4_5
;
9339 parse_func
= rakp_parse_hash
;
9340 sort_by_digest
= sort_by_digest_4_5
;
9341 opti_type
= OPTI_TYPE_ZERO_BYTE
9342 | OPTI_TYPE_NOT_ITERATED
;
9349 case 7400: hash_type
= HASH_TYPE_SHA256
;
9350 salt_type
= SALT_TYPE_EMBEDDED
;
9351 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9352 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9353 kern_type
= KERN_TYPE_SHA256CRYPT
;
9354 dgst_size
= DGST_SIZE_4_8
;
9355 parse_func
= sha256crypt_parse_hash
;
9356 sort_by_digest
= sort_by_digest_4_8
;
9357 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9364 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9365 salt_type
= SALT_TYPE_EMBEDDED
;
9366 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9367 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9368 kern_type
= KERN_TYPE_KRB5PA
;
9369 dgst_size
= DGST_SIZE_4_4
;
9370 parse_func
= krb5pa_parse_hash
;
9371 sort_by_digest
= sort_by_digest_4_4
;
9372 opti_type
= OPTI_TYPE_ZERO_BYTE
9373 | OPTI_TYPE_NOT_ITERATED
;
9380 case 7600: hash_type
= HASH_TYPE_SHA1
;
9381 salt_type
= SALT_TYPE_INTERN
;
9382 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9383 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9384 | OPTS_TYPE_PT_ADD80
9385 | OPTS_TYPE_PT_ADDBITS15
;
9386 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9387 dgst_size
= DGST_SIZE_4_5
;
9388 parse_func
= redmine_parse_hash
;
9389 sort_by_digest
= sort_by_digest_4_5
;
9390 opti_type
= OPTI_TYPE_ZERO_BYTE
9391 | OPTI_TYPE_PRECOMPUTE_INIT
9392 | OPTI_TYPE_EARLY_SKIP
9393 | OPTI_TYPE_NOT_ITERATED
9394 | OPTI_TYPE_PREPENDED_SALT
;
9401 case 7700: hash_type
= HASH_TYPE_SAPB
;
9402 salt_type
= SALT_TYPE_EMBEDDED
;
9403 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9404 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9405 | OPTS_TYPE_PT_UPPER
9406 | OPTS_TYPE_ST_UPPER
;
9407 kern_type
= KERN_TYPE_SAPB
;
9408 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9409 parse_func
= sapb_parse_hash
;
9410 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9411 opti_type
= OPTI_TYPE_ZERO_BYTE
9412 | OPTI_TYPE_PRECOMPUTE_INIT
9413 | OPTI_TYPE_NOT_ITERATED
;
9420 case 7800: hash_type
= HASH_TYPE_SAPG
;
9421 salt_type
= SALT_TYPE_EMBEDDED
;
9422 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9423 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9424 | OPTS_TYPE_ST_ADD80
9425 | OPTS_TYPE_ST_UPPER
;
9426 kern_type
= KERN_TYPE_SAPG
;
9427 dgst_size
= DGST_SIZE_4_5
;
9428 parse_func
= sapg_parse_hash
;
9429 sort_by_digest
= sort_by_digest_4_5
;
9430 opti_type
= OPTI_TYPE_ZERO_BYTE
9431 | OPTI_TYPE_PRECOMPUTE_INIT
9432 | OPTI_TYPE_NOT_ITERATED
;
9439 case 7900: hash_type
= HASH_TYPE_SHA512
;
9440 salt_type
= SALT_TYPE_EMBEDDED
;
9441 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9443 kern_type
= KERN_TYPE_DRUPAL7
;
9444 dgst_size
= DGST_SIZE_8_8
;
9445 parse_func
= drupal7_parse_hash
;
9446 sort_by_digest
= sort_by_digest_8_8
;
9447 opti_type
= OPTI_TYPE_ZERO_BYTE
9448 | OPTI_TYPE_USES_BITS_64
;
9455 case 8000: hash_type
= HASH_TYPE_SHA256
;
9456 salt_type
= SALT_TYPE_EMBEDDED
;
9457 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9458 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9459 | OPTS_TYPE_PT_UNICODE
9460 | OPTS_TYPE_ST_ADD80
9462 kern_type
= KERN_TYPE_SYBASEASE
;
9463 dgst_size
= DGST_SIZE_4_8
;
9464 parse_func
= sybasease_parse_hash
;
9465 sort_by_digest
= sort_by_digest_4_8
;
9466 opti_type
= OPTI_TYPE_ZERO_BYTE
9467 | OPTI_TYPE_PRECOMPUTE_INIT
9468 | OPTI_TYPE_EARLY_SKIP
9469 | OPTI_TYPE_NOT_ITERATED
9470 | OPTI_TYPE_RAW_HASH
;
9477 case 8100: hash_type
= HASH_TYPE_SHA1
;
9478 salt_type
= SALT_TYPE_EMBEDDED
;
9479 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9480 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9481 kern_type
= KERN_TYPE_NETSCALER
;
9482 dgst_size
= DGST_SIZE_4_5
;
9483 parse_func
= netscaler_parse_hash
;
9484 sort_by_digest
= sort_by_digest_4_5
;
9485 opti_type
= OPTI_TYPE_ZERO_BYTE
9486 | OPTI_TYPE_PRECOMPUTE_INIT
9487 | OPTI_TYPE_PRECOMPUTE_MERKLE
9488 | OPTI_TYPE_EARLY_SKIP
9489 | OPTI_TYPE_NOT_ITERATED
9490 | OPTI_TYPE_PREPENDED_SALT
9491 | OPTI_TYPE_RAW_HASH
;
9498 case 8200: hash_type
= HASH_TYPE_SHA256
;
9499 salt_type
= SALT_TYPE_EMBEDDED
;
9500 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9501 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9502 kern_type
= KERN_TYPE_CLOUDKEY
;
9503 dgst_size
= DGST_SIZE_4_8
;
9504 parse_func
= cloudkey_parse_hash
;
9505 sort_by_digest
= sort_by_digest_4_8
;
9506 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9513 case 8300: hash_type
= HASH_TYPE_SHA1
;
9514 salt_type
= SALT_TYPE_EMBEDDED
;
9515 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9516 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9518 | OPTS_TYPE_ST_ADD80
;
9519 kern_type
= KERN_TYPE_NSEC3
;
9520 dgst_size
= DGST_SIZE_4_5
;
9521 parse_func
= nsec3_parse_hash
;
9522 sort_by_digest
= sort_by_digest_4_5
;
9523 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9530 case 8400: hash_type
= HASH_TYPE_SHA1
;
9531 salt_type
= SALT_TYPE_INTERN
;
9532 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9533 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9534 | OPTS_TYPE_PT_ADD80
9535 | OPTS_TYPE_PT_ADDBITS15
;
9536 kern_type
= KERN_TYPE_WBB3
;
9537 dgst_size
= DGST_SIZE_4_5
;
9538 parse_func
= wbb3_parse_hash
;
9539 sort_by_digest
= sort_by_digest_4_5
;
9540 opti_type
= OPTI_TYPE_ZERO_BYTE
9541 | OPTI_TYPE_PRECOMPUTE_INIT
9542 | OPTI_TYPE_NOT_ITERATED
;
9549 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9550 salt_type
= SALT_TYPE_EMBEDDED
;
9551 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9553 | OPTS_TYPE_ST_UPPER
;
9554 kern_type
= KERN_TYPE_RACF
;
9555 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9556 parse_func
= racf_parse_hash
;
9557 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9558 opti_type
= OPTI_TYPE_ZERO_BYTE
9559 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9566 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9567 salt_type
= SALT_TYPE_NONE
;
9568 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9569 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9570 kern_type
= KERN_TYPE_LOTUS5
;
9571 dgst_size
= DGST_SIZE_4_4
;
9572 parse_func
= lotus5_parse_hash
;
9573 sort_by_digest
= sort_by_digest_4_4
;
9574 opti_type
= OPTI_TYPE_EARLY_SKIP
9575 | OPTI_TYPE_NOT_ITERATED
9576 | OPTI_TYPE_NOT_SALTED
9577 | OPTI_TYPE_RAW_HASH
;
9584 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9585 salt_type
= SALT_TYPE_EMBEDDED
;
9586 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9587 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9588 kern_type
= KERN_TYPE_LOTUS6
;
9589 dgst_size
= DGST_SIZE_4_4
;
9590 parse_func
= lotus6_parse_hash
;
9591 sort_by_digest
= sort_by_digest_4_4
;
9592 opti_type
= OPTI_TYPE_EARLY_SKIP
9593 | OPTI_TYPE_NOT_ITERATED
9594 | OPTI_TYPE_RAW_HASH
;
9601 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9602 salt_type
= SALT_TYPE_EMBEDDED
;
9603 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9605 kern_type
= KERN_TYPE_ANDROIDFDE
;
9606 dgst_size
= DGST_SIZE_4_4
;
9607 parse_func
= androidfde_parse_hash
;
9608 sort_by_digest
= sort_by_digest_4_4
;
9609 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9616 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9617 salt_type
= SALT_TYPE_EMBEDDED
;
9618 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9619 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9620 kern_type
= KERN_TYPE_SCRYPT
;
9621 dgst_size
= DGST_SIZE_4_8
;
9622 parse_func
= scrypt_parse_hash
;
9623 sort_by_digest
= sort_by_digest_4_8
;
9624 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9631 case 9000: hash_type
= HASH_TYPE_SHA1
;
9632 salt_type
= SALT_TYPE_EMBEDDED
;
9633 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9634 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9635 | OPTS_TYPE_ST_GENERATE_LE
;
9636 kern_type
= KERN_TYPE_PSAFE2
;
9637 dgst_size
= DGST_SIZE_4_5
;
9638 parse_func
= psafe2_parse_hash
;
9639 sort_by_digest
= sort_by_digest_4_5
;
9640 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9647 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9648 salt_type
= SALT_TYPE_EMBEDDED
;
9649 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9651 kern_type
= KERN_TYPE_LOTUS8
;
9652 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9653 parse_func
= lotus8_parse_hash
;
9654 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9655 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9662 case 9200: hash_type
= HASH_TYPE_SHA256
;
9663 salt_type
= SALT_TYPE_EMBEDDED
;
9664 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9666 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9667 dgst_size
= DGST_SIZE_4_32
;
9668 parse_func
= cisco8_parse_hash
;
9669 sort_by_digest
= sort_by_digest_4_32
;
9670 opti_type
= OPTI_TYPE_ZERO_BYTE
9671 | OPTI_TYPE_SLOW_HASH_SIMD
;
9678 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9679 salt_type
= SALT_TYPE_EMBEDDED
;
9680 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9682 kern_type
= KERN_TYPE_SCRYPT
;
9683 dgst_size
= DGST_SIZE_4_8
;
9684 parse_func
= cisco9_parse_hash
;
9685 sort_by_digest
= sort_by_digest_4_8
;
9686 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9693 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9694 salt_type
= SALT_TYPE_EMBEDDED
;
9695 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9697 kern_type
= KERN_TYPE_OFFICE2007
;
9698 dgst_size
= DGST_SIZE_4_4
;
9699 parse_func
= office2007_parse_hash
;
9700 sort_by_digest
= sort_by_digest_4_4
;
9701 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9708 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9709 salt_type
= SALT_TYPE_EMBEDDED
;
9710 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9711 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9712 kern_type
= KERN_TYPE_OFFICE2010
;
9713 dgst_size
= DGST_SIZE_4_4
;
9714 parse_func
= office2010_parse_hash
;
9715 sort_by_digest
= sort_by_digest_4_4
;
9716 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9723 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9724 salt_type
= SALT_TYPE_EMBEDDED
;
9725 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9726 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9727 kern_type
= KERN_TYPE_OFFICE2013
;
9728 dgst_size
= DGST_SIZE_4_4
;
9729 parse_func
= office2013_parse_hash
;
9730 sort_by_digest
= sort_by_digest_4_4
;
9731 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9738 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9739 salt_type
= SALT_TYPE_EMBEDDED
;
9740 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9742 | OPTS_TYPE_PT_ADD80
9743 | OPTS_TYPE_PT_UNICODE
;
9744 kern_type
= KERN_TYPE_OLDOFFICE01
;
9745 dgst_size
= DGST_SIZE_4_4
;
9746 parse_func
= oldoffice01_parse_hash
;
9747 sort_by_digest
= sort_by_digest_4_4
;
9748 opti_type
= OPTI_TYPE_ZERO_BYTE
9749 | OPTI_TYPE_PRECOMPUTE_INIT
9750 | OPTI_TYPE_NOT_ITERATED
;
9757 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9758 salt_type
= SALT_TYPE_EMBEDDED
;
9759 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9760 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9761 | OPTS_TYPE_PT_ADD80
;
9762 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9763 dgst_size
= DGST_SIZE_4_4
;
9764 parse_func
= oldoffice01cm1_parse_hash
;
9765 sort_by_digest
= sort_by_digest_4_4
;
9766 opti_type
= OPTI_TYPE_ZERO_BYTE
9767 | OPTI_TYPE_PRECOMPUTE_INIT
9768 | OPTI_TYPE_NOT_ITERATED
;
9775 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9776 salt_type
= SALT_TYPE_EMBEDDED
;
9777 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9778 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9779 | OPTS_TYPE_PT_ADD80
9780 | OPTS_TYPE_PT_UNICODE
9781 | OPTS_TYPE_PT_NEVERCRACK
;
9782 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9783 dgst_size
= DGST_SIZE_4_4
;
9784 parse_func
= oldoffice01cm2_parse_hash
;
9785 sort_by_digest
= sort_by_digest_4_4
;
9786 opti_type
= OPTI_TYPE_ZERO_BYTE
9787 | OPTI_TYPE_PRECOMPUTE_INIT
9788 | OPTI_TYPE_NOT_ITERATED
;
9795 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9796 salt_type
= SALT_TYPE_EMBEDDED
;
9797 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9798 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9799 | OPTS_TYPE_PT_ADD80
9800 | OPTS_TYPE_PT_UNICODE
;
9801 kern_type
= KERN_TYPE_OLDOFFICE34
;
9802 dgst_size
= DGST_SIZE_4_4
;
9803 parse_func
= oldoffice34_parse_hash
;
9804 sort_by_digest
= sort_by_digest_4_4
;
9805 opti_type
= OPTI_TYPE_ZERO_BYTE
9806 | OPTI_TYPE_PRECOMPUTE_INIT
9807 | OPTI_TYPE_NOT_ITERATED
;
9814 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9815 salt_type
= SALT_TYPE_EMBEDDED
;
9816 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9817 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9818 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9819 dgst_size
= DGST_SIZE_4_4
;
9820 parse_func
= oldoffice34cm1_parse_hash
;
9821 sort_by_digest
= sort_by_digest_4_4
;
9822 opti_type
= OPTI_TYPE_ZERO_BYTE
9823 | OPTI_TYPE_PRECOMPUTE_INIT
9824 | OPTI_TYPE_NOT_ITERATED
;
9831 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9832 salt_type
= SALT_TYPE_EMBEDDED
;
9833 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9834 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9835 | OPTS_TYPE_PT_ADD80
9836 | OPTS_TYPE_PT_UNICODE
9837 | OPTS_TYPE_PT_NEVERCRACK
;
9838 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9839 dgst_size
= DGST_SIZE_4_4
;
9840 parse_func
= oldoffice34cm2_parse_hash
;
9841 sort_by_digest
= sort_by_digest_4_4
;
9842 opti_type
= OPTI_TYPE_ZERO_BYTE
9843 | OPTI_TYPE_PRECOMPUTE_INIT
9844 | OPTI_TYPE_NOT_ITERATED
;
9851 case 9900: hash_type
= HASH_TYPE_MD5
;
9852 salt_type
= SALT_TYPE_NONE
;
9853 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9854 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9855 kern_type
= KERN_TYPE_RADMIN2
;
9856 dgst_size
= DGST_SIZE_4_4
;
9857 parse_func
= radmin2_parse_hash
;
9858 sort_by_digest
= sort_by_digest_4_4
;
9859 opti_type
= OPTI_TYPE_ZERO_BYTE
9860 | OPTI_TYPE_PRECOMPUTE_INIT
9861 | OPTI_TYPE_EARLY_SKIP
9862 | OPTI_TYPE_NOT_ITERATED
9863 | OPTI_TYPE_NOT_SALTED
;
9870 case 10000: hash_type
= HASH_TYPE_SHA256
;
9871 salt_type
= SALT_TYPE_EMBEDDED
;
9872 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9873 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9874 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9875 dgst_size
= DGST_SIZE_4_32
;
9876 parse_func
= djangopbkdf2_parse_hash
;
9877 sort_by_digest
= sort_by_digest_4_32
;
9878 opti_type
= OPTI_TYPE_ZERO_BYTE
9879 | OPTI_TYPE_SLOW_HASH_SIMD
;
9886 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9887 salt_type
= SALT_TYPE_EMBEDDED
;
9888 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9889 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9890 kern_type
= KERN_TYPE_SIPHASH
;
9891 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9892 parse_func
= siphash_parse_hash
;
9893 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9894 opti_type
= OPTI_TYPE_ZERO_BYTE
9895 | OPTI_TYPE_NOT_ITERATED
9896 | OPTI_TYPE_RAW_HASH
;
9903 case 10200: hash_type
= HASH_TYPE_MD5
;
9904 salt_type
= SALT_TYPE_EMBEDDED
;
9905 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9906 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9907 | OPTS_TYPE_ST_ADD80
9908 | OPTS_TYPE_ST_ADDBITS14
;
9909 kern_type
= KERN_TYPE_HMACMD5_PW
;
9910 dgst_size
= DGST_SIZE_4_4
;
9911 parse_func
= crammd5_parse_hash
;
9912 sort_by_digest
= sort_by_digest_4_4
;
9913 opti_type
= OPTI_TYPE_ZERO_BYTE
9914 | OPTI_TYPE_NOT_ITERATED
;
9921 case 10300: hash_type
= HASH_TYPE_SHA1
;
9922 salt_type
= SALT_TYPE_EMBEDDED
;
9923 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9924 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9925 kern_type
= KERN_TYPE_SAPH_SHA1
;
9926 dgst_size
= DGST_SIZE_4_5
;
9927 parse_func
= saph_sha1_parse_hash
;
9928 sort_by_digest
= sort_by_digest_4_5
;
9929 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9936 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9937 salt_type
= SALT_TYPE_EMBEDDED
;
9938 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9939 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9940 kern_type
= KERN_TYPE_PDF11
;
9941 dgst_size
= DGST_SIZE_4_4
;
9942 parse_func
= pdf11_parse_hash
;
9943 sort_by_digest
= sort_by_digest_4_4
;
9944 opti_type
= OPTI_TYPE_ZERO_BYTE
9945 | OPTI_TYPE_NOT_ITERATED
;
9952 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9953 salt_type
= SALT_TYPE_EMBEDDED
;
9954 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9955 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9956 kern_type
= KERN_TYPE_PDF11CM1
;
9957 dgst_size
= DGST_SIZE_4_4
;
9958 parse_func
= pdf11cm1_parse_hash
;
9959 sort_by_digest
= sort_by_digest_4_4
;
9960 opti_type
= OPTI_TYPE_ZERO_BYTE
9961 | OPTI_TYPE_NOT_ITERATED
;
9968 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9969 salt_type
= SALT_TYPE_EMBEDDED
;
9970 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9971 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9972 kern_type
= KERN_TYPE_PDF11CM2
;
9973 dgst_size
= DGST_SIZE_4_4
;
9974 parse_func
= pdf11cm2_parse_hash
;
9975 sort_by_digest
= sort_by_digest_4_4
;
9976 opti_type
= OPTI_TYPE_ZERO_BYTE
9977 | OPTI_TYPE_NOT_ITERATED
;
9984 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9985 salt_type
= SALT_TYPE_EMBEDDED
;
9986 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9987 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9988 kern_type
= KERN_TYPE_PDF14
;
9989 dgst_size
= DGST_SIZE_4_4
;
9990 parse_func
= pdf14_parse_hash
;
9991 sort_by_digest
= sort_by_digest_4_4
;
9992 opti_type
= OPTI_TYPE_ZERO_BYTE
9993 | OPTI_TYPE_NOT_ITERATED
;
10000 case 10600: hash_type
= HASH_TYPE_SHA256
;
10001 salt_type
= SALT_TYPE_EMBEDDED
;
10002 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10003 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10004 | OPTS_TYPE_ST_ADD80
10005 | OPTS_TYPE_ST_ADDBITS15
10006 | OPTS_TYPE_HASH_COPY
;
10007 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10008 dgst_size
= DGST_SIZE_4_8
;
10009 parse_func
= pdf17l3_parse_hash
;
10010 sort_by_digest
= sort_by_digest_4_8
;
10011 opti_type
= OPTI_TYPE_ZERO_BYTE
10012 | OPTI_TYPE_PRECOMPUTE_INIT
10013 | OPTI_TYPE_PRECOMPUTE_MERKLE
10014 | OPTI_TYPE_EARLY_SKIP
10015 | OPTI_TYPE_NOT_ITERATED
10016 | OPTI_TYPE_APPENDED_SALT
10017 | OPTI_TYPE_RAW_HASH
;
10024 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10025 salt_type
= SALT_TYPE_EMBEDDED
;
10026 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10027 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10028 | OPTS_TYPE_HASH_COPY
;
10029 kern_type
= KERN_TYPE_PDF17L8
;
10030 dgst_size
= DGST_SIZE_4_8
;
10031 parse_func
= pdf17l8_parse_hash
;
10032 sort_by_digest
= sort_by_digest_4_8
;
10033 opti_type
= OPTI_TYPE_ZERO_BYTE
10034 | OPTI_TYPE_NOT_ITERATED
;
10041 case 10800: hash_type
= HASH_TYPE_SHA384
;
10042 salt_type
= SALT_TYPE_NONE
;
10043 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10044 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10045 | OPTS_TYPE_PT_ADD80
10046 | OPTS_TYPE_PT_ADDBITS15
;
10047 kern_type
= KERN_TYPE_SHA384
;
10048 dgst_size
= DGST_SIZE_8_8
;
10049 parse_func
= sha384_parse_hash
;
10050 sort_by_digest
= sort_by_digest_8_8
;
10051 opti_type
= OPTI_TYPE_ZERO_BYTE
10052 | OPTI_TYPE_PRECOMPUTE_INIT
10053 | OPTI_TYPE_PRECOMPUTE_MERKLE
10054 | OPTI_TYPE_EARLY_SKIP
10055 | OPTI_TYPE_NOT_ITERATED
10056 | OPTI_TYPE_NOT_SALTED
10057 | OPTI_TYPE_USES_BITS_64
10058 | OPTI_TYPE_RAW_HASH
;
10065 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10066 salt_type
= SALT_TYPE_EMBEDDED
;
10067 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10069 | OPTS_TYPE_ST_BASE64
10070 | OPTS_TYPE_HASH_COPY
;
10071 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10072 dgst_size
= DGST_SIZE_4_32
;
10073 parse_func
= pbkdf2_sha256_parse_hash
;
10074 sort_by_digest
= sort_by_digest_4_32
;
10075 opti_type
= OPTI_TYPE_ZERO_BYTE
10076 | OPTI_TYPE_SLOW_HASH_SIMD
;
10083 case 11000: hash_type
= HASH_TYPE_MD5
;
10084 salt_type
= SALT_TYPE_INTERN
;
10085 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10086 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10087 | OPTS_TYPE_PT_ADD80
;
10088 kern_type
= KERN_TYPE_PRESTASHOP
;
10089 dgst_size
= DGST_SIZE_4_4
;
10090 parse_func
= prestashop_parse_hash
;
10091 sort_by_digest
= sort_by_digest_4_4
;
10092 opti_type
= OPTI_TYPE_ZERO_BYTE
10093 | OPTI_TYPE_PRECOMPUTE_INIT
10094 | OPTI_TYPE_NOT_ITERATED
10095 | OPTI_TYPE_PREPENDED_SALT
;
10102 case 11100: hash_type
= HASH_TYPE_MD5
;
10103 salt_type
= SALT_TYPE_EMBEDDED
;
10104 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10106 | OPTS_TYPE_ST_ADD80
;
10107 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10108 dgst_size
= DGST_SIZE_4_4
;
10109 parse_func
= postgresql_auth_parse_hash
;
10110 sort_by_digest
= sort_by_digest_4_4
;
10111 opti_type
= OPTI_TYPE_ZERO_BYTE
10112 | OPTI_TYPE_PRECOMPUTE_INIT
10113 | OPTI_TYPE_PRECOMPUTE_MERKLE
10114 | OPTI_TYPE_EARLY_SKIP
;
10121 case 11200: hash_type
= HASH_TYPE_SHA1
;
10122 salt_type
= SALT_TYPE_EMBEDDED
;
10123 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10124 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10125 | OPTS_TYPE_PT_ADD80
10126 | OPTS_TYPE_ST_HEX
;
10127 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10128 dgst_size
= DGST_SIZE_4_5
;
10129 parse_func
= mysql_auth_parse_hash
;
10130 sort_by_digest
= sort_by_digest_4_5
;
10131 opti_type
= OPTI_TYPE_ZERO_BYTE
10132 | OPTI_TYPE_EARLY_SKIP
;
10139 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10140 salt_type
= SALT_TYPE_EMBEDDED
;
10141 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10142 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10144 | OPTS_TYPE_ST_ADD80
;
10145 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10146 dgst_size
= DGST_SIZE_4_4
;
10147 parse_func
= bitcoin_wallet_parse_hash
;
10148 sort_by_digest
= sort_by_digest_4_4
;
10149 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10156 case 11400: hash_type
= HASH_TYPE_MD5
;
10157 salt_type
= SALT_TYPE_EMBEDDED
;
10158 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10159 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10160 | OPTS_TYPE_PT_ADD80
10161 | OPTS_TYPE_HASH_COPY
;
10162 kern_type
= KERN_TYPE_SIP_AUTH
;
10163 dgst_size
= DGST_SIZE_4_4
;
10164 parse_func
= sip_auth_parse_hash
;
10165 sort_by_digest
= sort_by_digest_4_4
;
10166 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10173 case 11500: hash_type
= HASH_TYPE_CRC32
;
10174 salt_type
= SALT_TYPE_INTERN
;
10175 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10176 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10177 | OPTS_TYPE_ST_GENERATE_LE
10178 | OPTS_TYPE_ST_HEX
;
10179 kern_type
= KERN_TYPE_CRC32
;
10180 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10181 parse_func
= crc32_parse_hash
;
10182 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10183 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10190 case 11600: hash_type
= HASH_TYPE_AES
;
10191 salt_type
= SALT_TYPE_EMBEDDED
;
10192 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10193 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10194 | OPTS_TYPE_PT_NEVERCRACK
;
10195 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10196 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10197 parse_func
= seven_zip_parse_hash
;
10198 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10199 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10206 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10207 salt_type
= SALT_TYPE_NONE
;
10208 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10210 | OPTS_TYPE_PT_ADD01
;
10211 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10212 dgst_size
= DGST_SIZE_4_8
;
10213 parse_func
= gost2012sbog_256_parse_hash
;
10214 sort_by_digest
= sort_by_digest_4_8
;
10215 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10222 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10223 salt_type
= SALT_TYPE_NONE
;
10224 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10225 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10226 | OPTS_TYPE_PT_ADD01
;
10227 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10228 dgst_size
= DGST_SIZE_4_16
;
10229 parse_func
= gost2012sbog_512_parse_hash
;
10230 sort_by_digest
= sort_by_digest_4_16
;
10231 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10238 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10239 salt_type
= SALT_TYPE_EMBEDDED
;
10240 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10242 | OPTS_TYPE_ST_BASE64
10243 | OPTS_TYPE_HASH_COPY
;
10244 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10245 dgst_size
= DGST_SIZE_4_32
;
10246 parse_func
= pbkdf2_md5_parse_hash
;
10247 sort_by_digest
= sort_by_digest_4_32
;
10248 opti_type
= OPTI_TYPE_ZERO_BYTE
10249 | OPTI_TYPE_SLOW_HASH_SIMD
;
10256 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10257 salt_type
= SALT_TYPE_EMBEDDED
;
10258 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10259 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10260 | OPTS_TYPE_ST_BASE64
10261 | OPTS_TYPE_HASH_COPY
;
10262 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10263 dgst_size
= DGST_SIZE_4_32
;
10264 parse_func
= pbkdf2_sha1_parse_hash
;
10265 sort_by_digest
= sort_by_digest_4_32
;
10266 opti_type
= OPTI_TYPE_ZERO_BYTE
10267 | OPTI_TYPE_SLOW_HASH_SIMD
;
10274 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10275 salt_type
= SALT_TYPE_EMBEDDED
;
10276 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10277 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10278 | OPTS_TYPE_ST_BASE64
10279 | OPTS_TYPE_HASH_COPY
;
10280 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10281 dgst_size
= DGST_SIZE_8_16
;
10282 parse_func
= pbkdf2_sha512_parse_hash
;
10283 sort_by_digest
= sort_by_digest_8_16
;
10284 opti_type
= OPTI_TYPE_ZERO_BYTE
10285 | OPTI_TYPE_USES_BITS_64
10286 | OPTI_TYPE_SLOW_HASH_SIMD
;
10293 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10294 salt_type
= SALT_TYPE_EMBEDDED
;
10295 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10296 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10297 kern_type
= KERN_TYPE_ECRYPTFS
;
10298 dgst_size
= DGST_SIZE_8_8
;
10299 parse_func
= ecryptfs_parse_hash
;
10300 sort_by_digest
= sort_by_digest_8_8
;
10301 opti_type
= OPTI_TYPE_ZERO_BYTE
10302 | OPTI_TYPE_USES_BITS_64
;
10309 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10310 salt_type
= SALT_TYPE_EMBEDDED
;
10311 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10313 kern_type
= KERN_TYPE_ORACLET
;
10314 dgst_size
= DGST_SIZE_8_16
;
10315 parse_func
= oraclet_parse_hash
;
10316 sort_by_digest
= sort_by_digest_8_16
;
10317 opti_type
= OPTI_TYPE_ZERO_BYTE
10318 | OPTI_TYPE_USES_BITS_64
;
10325 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10326 salt_type
= SALT_TYPE_EMBEDDED
;
10327 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10328 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10329 kern_type
= KERN_TYPE_BSDICRYPT
;
10330 dgst_size
= DGST_SIZE_4_4
;
10331 parse_func
= bsdicrypt_parse_hash
;
10332 sort_by_digest
= sort_by_digest_4_4
;
10333 opti_type
= OPTI_TYPE_ZERO_BYTE
10334 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10341 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10342 salt_type
= SALT_TYPE_EMBEDDED
;
10343 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10344 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10345 kern_type
= KERN_TYPE_RAR3
;
10346 dgst_size
= DGST_SIZE_4_4
;
10347 parse_func
= rar3hp_parse_hash
;
10348 sort_by_digest
= sort_by_digest_4_4
;
10349 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10356 case 12600: hash_type
= HASH_TYPE_SHA256
;
10357 salt_type
= SALT_TYPE_INTERN
;
10358 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10359 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10360 | OPTS_TYPE_PT_ADD80
;
10361 kern_type
= KERN_TYPE_CF10
;
10362 dgst_size
= DGST_SIZE_4_8
;
10363 parse_func
= cf10_parse_hash
;
10364 sort_by_digest
= sort_by_digest_4_8
;
10365 opti_type
= OPTI_TYPE_ZERO_BYTE
10366 | OPTI_TYPE_PRECOMPUTE_INIT
10367 | OPTI_TYPE_EARLY_SKIP
10368 | OPTI_TYPE_NOT_ITERATED
;
10375 case 12700: hash_type
= HASH_TYPE_AES
;
10376 salt_type
= SALT_TYPE_EMBEDDED
;
10377 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10378 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10379 | OPTS_TYPE_HASH_COPY
;
10380 kern_type
= KERN_TYPE_MYWALLET
;
10381 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10382 parse_func
= mywallet_parse_hash
;
10383 sort_by_digest
= sort_by_digest_4_5
;
10384 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10391 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10392 salt_type
= SALT_TYPE_EMBEDDED
;
10393 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10395 kern_type
= KERN_TYPE_MS_DRSR
;
10396 dgst_size
= DGST_SIZE_4_8
;
10397 parse_func
= ms_drsr_parse_hash
;
10398 sort_by_digest
= sort_by_digest_4_8
;
10399 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10406 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10407 salt_type
= SALT_TYPE_EMBEDDED
;
10408 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10409 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10410 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10411 dgst_size
= DGST_SIZE_4_8
;
10412 parse_func
= androidfde_samsung_parse_hash
;
10413 sort_by_digest
= sort_by_digest_4_8
;
10414 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10421 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10422 salt_type
= SALT_TYPE_EMBEDDED
;
10423 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10424 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10425 kern_type
= KERN_TYPE_RAR5
;
10426 dgst_size
= DGST_SIZE_4_4
;
10427 parse_func
= rar5_parse_hash
;
10428 sort_by_digest
= sort_by_digest_4_4
;
10429 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10436 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10437 salt_type
= SALT_TYPE_EMBEDDED
;
10438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10440 kern_type
= KERN_TYPE_KRB5TGS
;
10441 dgst_size
= DGST_SIZE_4_4
;
10442 parse_func
= krb5tgs_parse_hash
;
10443 sort_by_digest
= sort_by_digest_4_4
;
10444 opti_type
= OPTI_TYPE_ZERO_BYTE
10445 | OPTI_TYPE_NOT_ITERATED
;
10452 case 13200: hash_type
= HASH_TYPE_AES
;
10453 salt_type
= SALT_TYPE_EMBEDDED
;
10454 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10455 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10456 kern_type
= KERN_TYPE_AXCRYPT
;
10457 dgst_size
= DGST_SIZE_4_4
;
10458 parse_func
= axcrypt_parse_hash
;
10459 sort_by_digest
= sort_by_digest_4_4
;
10460 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10467 case 13300: hash_type
= HASH_TYPE_SHA1
;
10468 salt_type
= SALT_TYPE_NONE
;
10469 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10470 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10471 | OPTS_TYPE_PT_ADD80
10472 | OPTS_TYPE_PT_ADDBITS15
;
10473 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10474 dgst_size
= DGST_SIZE_4_5
;
10475 parse_func
= sha1axcrypt_parse_hash
;
10476 sort_by_digest
= sort_by_digest_4_5
;
10477 opti_type
= OPTI_TYPE_ZERO_BYTE
10478 | OPTI_TYPE_PRECOMPUTE_INIT
10479 | OPTI_TYPE_EARLY_SKIP
10480 | OPTI_TYPE_NOT_ITERATED
10481 | OPTI_TYPE_NOT_SALTED
;
10488 case 13400: hash_type
= HASH_TYPE_AES
;
10489 salt_type
= SALT_TYPE_EMBEDDED
;
10490 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10492 kern_type
= KERN_TYPE_KEEPASS
;
10493 dgst_size
= DGST_SIZE_4_4
;
10494 parse_func
= keepass_parse_hash
;
10495 sort_by_digest
= sort_by_digest_4_4
;
10496 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10503 case 13500: hash_type
= HASH_TYPE_SHA1
;
10504 salt_type
= SALT_TYPE_EMBEDDED
;
10505 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10506 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10507 | OPTS_TYPE_PT_UNICODE
10508 | OPTS_TYPE_PT_ADD80
;
10509 kern_type
= KERN_TYPE_PSTOKEN
;
10510 dgst_size
= DGST_SIZE_4_5
;
10511 parse_func
= pstoken_parse_hash
;
10512 sort_by_digest
= sort_by_digest_4_5
;
10513 opti_type
= OPTI_TYPE_ZERO_BYTE
10514 | OPTI_TYPE_PRECOMPUTE_INIT
10515 | OPTI_TYPE_EARLY_SKIP
10516 | OPTI_TYPE_NOT_ITERATED
10517 | OPTI_TYPE_PREPENDED_SALT
10518 | OPTI_TYPE_RAW_HASH
;
10525 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10526 salt_type
= SALT_TYPE_EMBEDDED
;
10527 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10528 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10529 kern_type
= KERN_TYPE_ZIP2
;
10530 dgst_size
= DGST_SIZE_4_4
;
10531 parse_func
= zip2_parse_hash
;
10532 sort_by_digest
= sort_by_digest_4_4
;
10533 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10540 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10541 salt_type
= SALT_TYPE_EMBEDDED
;
10542 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10543 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10544 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10545 dgst_size
= DGST_SIZE_4_5
;
10546 parse_func
= veracrypt_parse_hash_655331
;
10547 sort_by_digest
= sort_by_digest_4_5
;
10548 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10555 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10556 salt_type
= SALT_TYPE_EMBEDDED
;
10557 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10558 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10559 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10560 dgst_size
= DGST_SIZE_4_5
;
10561 parse_func
= veracrypt_parse_hash_655331
;
10562 sort_by_digest
= sort_by_digest_4_5
;
10563 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10570 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10571 salt_type
= SALT_TYPE_EMBEDDED
;
10572 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10573 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10574 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10575 dgst_size
= DGST_SIZE_4_5
;
10576 parse_func
= veracrypt_parse_hash_655331
;
10577 sort_by_digest
= sort_by_digest_4_5
;
10578 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10585 case 13721: hash_type
= HASH_TYPE_SHA512
;
10586 salt_type
= SALT_TYPE_EMBEDDED
;
10587 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10588 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10589 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10590 dgst_size
= DGST_SIZE_8_8
;
10591 parse_func
= veracrypt_parse_hash_500000
;
10592 sort_by_digest
= sort_by_digest_8_8
;
10593 opti_type
= OPTI_TYPE_ZERO_BYTE
10594 | OPTI_TYPE_USES_BITS_64
;
10601 case 13722: hash_type
= HASH_TYPE_SHA512
;
10602 salt_type
= SALT_TYPE_EMBEDDED
;
10603 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10605 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10606 dgst_size
= DGST_SIZE_8_8
;
10607 parse_func
= veracrypt_parse_hash_500000
;
10608 sort_by_digest
= sort_by_digest_8_8
;
10609 opti_type
= OPTI_TYPE_ZERO_BYTE
10610 | OPTI_TYPE_USES_BITS_64
;
10617 case 13723: hash_type
= HASH_TYPE_SHA512
;
10618 salt_type
= SALT_TYPE_EMBEDDED
;
10619 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10620 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10621 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10622 dgst_size
= DGST_SIZE_8_8
;
10623 parse_func
= veracrypt_parse_hash_500000
;
10624 sort_by_digest
= sort_by_digest_8_8
;
10625 opti_type
= OPTI_TYPE_ZERO_BYTE
10626 | OPTI_TYPE_USES_BITS_64
;
10633 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10634 salt_type
= SALT_TYPE_EMBEDDED
;
10635 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10637 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10638 dgst_size
= DGST_SIZE_4_8
;
10639 parse_func
= veracrypt_parse_hash_500000
;
10640 sort_by_digest
= sort_by_digest_4_8
;
10641 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10648 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10649 salt_type
= SALT_TYPE_EMBEDDED
;
10650 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10651 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10652 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10653 dgst_size
= DGST_SIZE_4_8
;
10654 parse_func
= veracrypt_parse_hash_500000
;
10655 sort_by_digest
= sort_by_digest_4_8
;
10656 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10663 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10664 salt_type
= SALT_TYPE_EMBEDDED
;
10665 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10666 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10667 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10668 dgst_size
= DGST_SIZE_4_8
;
10669 parse_func
= veracrypt_parse_hash_500000
;
10670 sort_by_digest
= sort_by_digest_4_8
;
10671 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10678 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10679 salt_type
= SALT_TYPE_EMBEDDED
;
10680 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10682 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10683 dgst_size
= DGST_SIZE_4_5
;
10684 parse_func
= veracrypt_parse_hash_327661
;
10685 sort_by_digest
= sort_by_digest_4_5
;
10686 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10693 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10694 salt_type
= SALT_TYPE_EMBEDDED
;
10695 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10697 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10698 dgst_size
= DGST_SIZE_4_5
;
10699 parse_func
= veracrypt_parse_hash_327661
;
10700 sort_by_digest
= sort_by_digest_4_5
;
10701 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10708 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10709 salt_type
= SALT_TYPE_EMBEDDED
;
10710 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10711 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10712 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10713 dgst_size
= DGST_SIZE_4_5
;
10714 parse_func
= veracrypt_parse_hash_327661
;
10715 sort_by_digest
= sort_by_digest_4_5
;
10716 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10723 case 13751: hash_type
= HASH_TYPE_SHA256
;
10724 salt_type
= SALT_TYPE_EMBEDDED
;
10725 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10726 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10727 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10728 dgst_size
= DGST_SIZE_4_8
;
10729 parse_func
= veracrypt_parse_hash_500000
;
10730 sort_by_digest
= sort_by_digest_4_8
;
10731 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10738 case 13752: hash_type
= HASH_TYPE_SHA256
;
10739 salt_type
= SALT_TYPE_EMBEDDED
;
10740 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10742 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10743 dgst_size
= DGST_SIZE_4_8
;
10744 parse_func
= veracrypt_parse_hash_500000
;
10745 sort_by_digest
= sort_by_digest_4_8
;
10746 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10753 case 13753: hash_type
= HASH_TYPE_SHA256
;
10754 salt_type
= SALT_TYPE_EMBEDDED
;
10755 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10756 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10757 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10758 dgst_size
= DGST_SIZE_4_8
;
10759 parse_func
= veracrypt_parse_hash_500000
;
10760 sort_by_digest
= sort_by_digest_4_8
;
10761 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10768 case 13761: hash_type
= HASH_TYPE_SHA256
;
10769 salt_type
= SALT_TYPE_EMBEDDED
;
10770 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10771 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10772 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10773 dgst_size
= DGST_SIZE_4_8
;
10774 parse_func
= veracrypt_parse_hash_200000
;
10775 sort_by_digest
= sort_by_digest_4_8
;
10776 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10783 case 13762: hash_type
= HASH_TYPE_SHA256
;
10784 salt_type
= SALT_TYPE_EMBEDDED
;
10785 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10786 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10787 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10788 dgst_size
= DGST_SIZE_4_8
;
10789 parse_func
= veracrypt_parse_hash_200000
;
10790 sort_by_digest
= sort_by_digest_4_8
;
10791 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10798 case 13763: hash_type
= HASH_TYPE_SHA256
;
10799 salt_type
= SALT_TYPE_EMBEDDED
;
10800 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10801 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10802 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10803 dgst_size
= DGST_SIZE_4_8
;
10804 parse_func
= veracrypt_parse_hash_200000
;
10805 sort_by_digest
= sort_by_digest_4_8
;
10806 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10814 default: usage_mini_print (PROGNAME
); return (-1);
10821 data
.parse_func
= parse_func
;
10829 if (salt_type
== SALT_TYPE_INTERN
)
10831 opts_type
|= OPTS_TYPE_ST_HEX
;
10835 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10841 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10842 | (salt_type
== SALT_TYPE_EXTERN
)
10843 | (salt_type
== SALT_TYPE_EMBEDDED
)
10844 | (salt_type
== SALT_TYPE_VIRTUAL
));
10846 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10848 data
.hash_type
= hash_type
;
10849 data
.attack_mode
= attack_mode
;
10850 data
.attack_kern
= attack_kern
;
10851 data
.attack_exec
= attack_exec
;
10852 data
.kern_type
= kern_type
;
10853 data
.opts_type
= opts_type
;
10854 data
.dgst_size
= dgst_size
;
10855 data
.salt_type
= salt_type
;
10856 data
.isSalted
= isSalted
;
10857 data
.sort_by_digest
= sort_by_digest
;
10858 data
.dgst_pos0
= dgst_pos0
;
10859 data
.dgst_pos1
= dgst_pos1
;
10860 data
.dgst_pos2
= dgst_pos2
;
10861 data
.dgst_pos3
= dgst_pos3
;
10867 case 2500: esalt_size
= sizeof (wpa_t
); break;
10868 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10869 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10870 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10871 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10872 case 6211: esalt_size
= sizeof (tc_t
); break;
10873 case 6212: esalt_size
= sizeof (tc_t
); break;
10874 case 6213: esalt_size
= sizeof (tc_t
); break;
10875 case 6221: esalt_size
= sizeof (tc_t
); break;
10876 case 6222: esalt_size
= sizeof (tc_t
); break;
10877 case 6223: esalt_size
= sizeof (tc_t
); break;
10878 case 6231: esalt_size
= sizeof (tc_t
); break;
10879 case 6232: esalt_size
= sizeof (tc_t
); break;
10880 case 6233: esalt_size
= sizeof (tc_t
); break;
10881 case 6241: esalt_size
= sizeof (tc_t
); break;
10882 case 6242: esalt_size
= sizeof (tc_t
); break;
10883 case 6243: esalt_size
= sizeof (tc_t
); break;
10884 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10885 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10886 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10887 case 7300: esalt_size
= sizeof (rakp_t
); break;
10888 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10889 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10890 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10891 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10892 case 9400: esalt_size
= sizeof (office2007_t
); break;
10893 case 9500: esalt_size
= sizeof (office2010_t
); break;
10894 case 9600: esalt_size
= sizeof (office2013_t
); break;
10895 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10896 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10897 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10898 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10899 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10900 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10901 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10902 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10903 case 10400: esalt_size
= sizeof (pdf_t
); break;
10904 case 10410: esalt_size
= sizeof (pdf_t
); break;
10905 case 10420: esalt_size
= sizeof (pdf_t
); break;
10906 case 10500: esalt_size
= sizeof (pdf_t
); break;
10907 case 10600: esalt_size
= sizeof (pdf_t
); break;
10908 case 10700: esalt_size
= sizeof (pdf_t
); break;
10909 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10910 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10911 case 11400: esalt_size
= sizeof (sip_t
); break;
10912 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10913 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10914 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10915 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10916 case 13000: esalt_size
= sizeof (rar5_t
); break;
10917 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10918 case 13400: esalt_size
= sizeof (keepass_t
); break;
10919 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10920 case 13600: esalt_size
= sizeof (zip2_t
); break;
10921 case 13711: esalt_size
= sizeof (tc_t
); break;
10922 case 13712: esalt_size
= sizeof (tc_t
); break;
10923 case 13713: esalt_size
= sizeof (tc_t
); break;
10924 case 13721: esalt_size
= sizeof (tc_t
); break;
10925 case 13722: esalt_size
= sizeof (tc_t
); break;
10926 case 13723: esalt_size
= sizeof (tc_t
); break;
10927 case 13731: esalt_size
= sizeof (tc_t
); break;
10928 case 13732: esalt_size
= sizeof (tc_t
); break;
10929 case 13733: esalt_size
= sizeof (tc_t
); break;
10930 case 13741: esalt_size
= sizeof (tc_t
); break;
10931 case 13742: esalt_size
= sizeof (tc_t
); break;
10932 case 13743: esalt_size
= sizeof (tc_t
); break;
10933 case 13751: esalt_size
= sizeof (tc_t
); break;
10934 case 13752: esalt_size
= sizeof (tc_t
); break;
10935 case 13753: esalt_size
= sizeof (tc_t
); break;
10936 case 13761: esalt_size
= sizeof (tc_t
); break;
10937 case 13762: esalt_size
= sizeof (tc_t
); break;
10938 case 13763: esalt_size
= sizeof (tc_t
); break;
10941 data
.esalt_size
= esalt_size
;
10944 * choose dictionary parser
10947 if (hash_type
== HASH_TYPE_LM
)
10949 get_next_word_func
= get_next_word_lm
;
10951 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10953 get_next_word_func
= get_next_word_uc
;
10957 get_next_word_func
= get_next_word_std
;
10964 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10967 size_t dictstat_nmemb
= 0;
10971 uint dictstat_nmemb
= 0;
10974 char dictstat
[256] = { 0 };
10976 FILE *dictstat_fp
= NULL
;
10980 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10982 dictstat_fp
= fopen (dictstat
, "rb");
10987 struct stat tmpstat
;
10989 fstat (fileno (dictstat_fp
), &tmpstat
);
10993 struct stat64 tmpstat
;
10995 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10998 if (tmpstat
.st_mtime
< COMPTIME
)
11000 /* with v0.15 the format changed so we have to ensure user is using a good version
11001 since there is no version-header in the dictstat file */
11003 fclose (dictstat_fp
);
11009 while (!feof (dictstat_fp
))
11013 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11015 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11017 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11019 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11025 fclose (dictstat_fp
);
11034 char potfile
[256] = { 0 };
11036 if (potfile_path
== NULL
)
11038 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11042 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11045 data
.pot_fp
= NULL
;
11047 FILE *out_fp
= NULL
;
11048 FILE *pot_fp
= NULL
;
11050 if (show
== 1 || left
== 1)
11052 pot_fp
= fopen (potfile
, "rb");
11054 if (pot_fp
== NULL
)
11056 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11061 if (outfile
!= NULL
)
11063 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11065 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11079 if (potfile_disable
== 0)
11081 pot_fp
= fopen (potfile
, "ab");
11083 if (pot_fp
== NULL
)
11085 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11090 data
.pot_fp
= pot_fp
;
11097 uint pot_avail
= 0;
11099 if (show
== 1 || left
== 1)
11101 SUPPRESS_OUTPUT
= 1;
11103 pot_avail
= count_lines (pot_fp
);
11107 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11109 uint pot_hashes_avail
= 0;
11113 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11115 while (!feof (pot_fp
))
11119 int line_len
= fgetl (pot_fp
, line_buf
);
11121 if (line_len
== 0) continue;
11123 char *plain_buf
= line_buf
+ line_len
;
11125 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11127 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11129 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11130 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11132 if (pot_cnt
== pot_hashes_avail
)
11136 for (pos
= 0; pos
< INCR_POT
; pos
++)
11138 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11140 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11142 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11144 tmp_hash
->digest
= mymalloc (dgst_size
);
11148 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11153 tmp_hash
->esalt
= mymalloc (esalt_size
);
11156 pot_hashes_avail
++;
11164 int iter
= MAX_CUT_TRIES
;
11168 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11170 if (line_buf
[i
] == ':')
11178 if (data
.hash_mode
!= 2500)
11180 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11184 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11186 if (line_len
> max_salt_size
)
11188 parser_status
= PARSER_GLOBAL_LENGTH
;
11192 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11194 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11196 hashes_buf
->salt
->salt_len
= line_len
;
11198 parser_status
= PARSER_OK
;
11202 // if NOT parsed without error, we add the ":" to the plain
11204 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11210 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11212 if (parser_status
< PARSER_GLOBAL_ZERO
)
11214 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11219 if (plain_len
>= 255) continue;
11221 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11223 pot_ptr
->plain_len
= plain_len
;
11232 SUPPRESS_OUTPUT
= 0;
11234 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11241 uint pw_min
= PW_MIN
;
11242 uint pw_max
= PW_MAX
;
11246 case 125: if (pw_max
> 32) pw_max
= 32;
11248 case 400: if (pw_max
> 40) pw_max
= 40;
11250 case 500: if (pw_max
> 16) pw_max
= 16;
11252 case 1500: if (pw_max
> 8) pw_max
= 8;
11254 case 1600: if (pw_max
> 16) pw_max
= 16;
11256 case 1800: if (pw_max
> 16) pw_max
= 16;
11258 case 2100: if (pw_max
> 16) pw_max
= 16;
11260 case 2500: if (pw_min
< 8) pw_min
= 8;
11262 case 3000: if (pw_max
> 7) pw_max
= 7;
11264 case 5200: if (pw_max
> 24) pw_max
= 24;
11266 case 5800: if (pw_max
> 16) pw_max
= 16;
11268 case 6300: if (pw_max
> 16) pw_max
= 16;
11270 case 7400: if (pw_max
> 16) pw_max
= 16;
11272 case 7500: if (pw_max
> 8) pw_max
= 8;
11274 case 7900: if (pw_max
> 48) pw_max
= 48;
11276 case 8500: if (pw_max
> 8) pw_max
= 8;
11278 case 8600: if (pw_max
> 16) pw_max
= 16;
11280 case 9710: pw_min
= 5;
11283 case 9810: pw_min
= 5;
11286 case 10410: pw_min
= 5;
11289 case 10300: if (pw_max
< 3) pw_min
= 3;
11290 if (pw_max
> 40) pw_max
= 40;
11292 case 10500: if (pw_max
< 3) pw_min
= 3;
11293 if (pw_max
> 40) pw_max
= 40;
11295 case 10700: if (pw_max
> 16) pw_max
= 16;
11297 case 11300: if (pw_max
> 40) pw_max
= 40;
11299 case 11600: if (pw_max
> 32) pw_max
= 32;
11301 case 12500: if (pw_max
> 20) pw_max
= 20;
11303 case 12800: if (pw_max
> 24) pw_max
= 24;
11307 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11309 switch (attack_kern
)
11311 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11313 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11319 * charsets : keep them together for more easy maintainnce
11322 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11323 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11325 mp_setup_sys (mp_sys
);
11327 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11328 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11329 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11330 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11333 * load hashes, part I: find input mode, count hashes
11336 uint hashlist_mode
= 0;
11337 uint hashlist_format
= HLFMT_HASHCAT
;
11339 uint hashes_avail
= 0;
11341 if (benchmark
== 0)
11345 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11347 if ((hash_mode
== 2500) ||
11348 (hash_mode
== 5200) ||
11349 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11350 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11351 (hash_mode
== 9000))
11353 hashlist_mode
= HL_MODE_ARG
;
11355 char *hashfile
= myargv
[optind
];
11357 data
.hashfile
= hashfile
;
11359 logfile_top_var_string ("target", hashfile
);
11362 if (hashlist_mode
== HL_MODE_ARG
)
11364 if (hash_mode
== 2500)
11368 if (stat (data
.hashfile
, &st
) == -1)
11370 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11375 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11382 else if (hashlist_mode
== HL_MODE_FILE
)
11384 char *hashfile
= myargv
[optind
];
11386 data
.hashfile
= hashfile
;
11388 logfile_top_var_string ("target", hashfile
);
11392 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11394 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11399 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11401 hashes_avail
= count_lines (fp
);
11405 if (hashes_avail
== 0)
11407 log_error ("ERROR: hashfile is empty or corrupt");
11414 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11416 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11418 log_error ("ERROR: remove not supported in native hashfile-format mode");
11430 hashlist_mode
= HL_MODE_ARG
;
11435 if (hash_mode
== 3000) hashes_avail
*= 2;
11437 data
.hashlist_mode
= hashlist_mode
;
11438 data
.hashlist_format
= hashlist_format
;
11440 logfile_top_uint (hashlist_mode
);
11441 logfile_top_uint (hashlist_format
);
11444 * load hashes, part II: allocate required memory, set pointers
11447 hash_t
*hashes_buf
= NULL
;
11448 void *digests_buf
= NULL
;
11449 salt_t
*salts_buf
= NULL
;
11450 void *esalts_buf
= NULL
;
11452 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11454 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11456 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11460 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11462 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11464 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11466 if (username
&& (remove
|| show
|| left
))
11468 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11473 hash_info
->orighash
= (char *) mymalloc (256);
11480 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11484 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11489 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11492 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11494 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11498 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11502 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11507 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11512 * load hashes, part III: parse hashes or generate them if benchmark
11515 uint hashes_cnt
= 0;
11517 if (benchmark
== 0)
11521 // useless to read hash file for keyspace, cheat a little bit w/ optind
11523 else if (hashes_avail
== 0)
11526 else if (hashlist_mode
== HL_MODE_ARG
)
11528 char *input_buf
= myargv
[optind
];
11530 uint input_len
= strlen (input_buf
);
11532 logfile_top_var_string ("target", input_buf
);
11534 char *hash_buf
= NULL
;
11537 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11539 bool hash_fmt_error
= 0;
11541 if (hash_len
< 1) hash_fmt_error
= 1;
11542 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11544 if (hash_fmt_error
)
11546 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11550 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11552 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11554 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11559 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11562 int parser_status
= PARSER_OK
;
11564 if (hash_mode
== 2500)
11568 log_error ("ERROR: hccap file not specified");
11573 hashlist_mode
= HL_MODE_FILE
;
11575 data
.hashlist_mode
= hashlist_mode
;
11577 FILE *fp
= fopen (hash_buf
, "rb");
11581 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11586 if (hashes_avail
< 1)
11588 log_error ("ERROR: hccap file is empty or corrupt");
11595 uint hccap_size
= sizeof (hccap_t
);
11597 char *in
= (char *) mymalloc (hccap_size
);
11601 int n
= fread (in
, hccap_size
, 1, fp
);
11605 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11610 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11612 if (parser_status
!= PARSER_OK
)
11614 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11619 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11621 if ((show
== 1) || (left
== 1))
11623 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11625 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11627 int cur_pos
= tmp_salt
->salt_len
;
11628 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11630 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11632 // do the appending task
11634 snprintf (salt_ptr
+ cur_pos
,
11636 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11648 wpa
->orig_mac2
[5]);
11650 // memset () the remaining part of the salt
11652 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11653 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11655 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11657 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11660 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
);
11661 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
);
11670 else if (hash_mode
== 3000)
11672 if (hash_len
== 32)
11674 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11676 hash_t
*lm_hash_left
= NULL
;
11678 if (parser_status
== PARSER_OK
)
11680 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11686 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11689 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11691 hash_t
*lm_hash_right
= NULL
;
11693 if (parser_status
== PARSER_OK
)
11695 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11701 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11706 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11708 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
);
11709 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
);
11714 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11716 if (parser_status
== PARSER_OK
)
11718 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11719 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11722 if (parser_status
== PARSER_OK
)
11728 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11734 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11736 if (parser_status
== PARSER_OK
)
11738 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11739 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11742 if (parser_status
== PARSER_OK
)
11748 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11753 else if (hashlist_mode
== HL_MODE_FILE
)
11755 char *hashfile
= data
.hashfile
;
11759 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11761 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11768 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11774 int line_len
= fgetl (fp
, line_buf
);
11776 if (line_len
== 0) continue;
11778 char *hash_buf
= NULL
;
11781 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11783 bool hash_fmt_error
= 0;
11785 if (hash_len
< 1) hash_fmt_error
= 1;
11786 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11788 if (hash_fmt_error
)
11790 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11797 char *user_buf
= NULL
;
11800 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11802 if (remove
|| show
)
11804 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11806 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11808 user_t
*user_ptr
= *user
;
11810 if (user_buf
!= NULL
)
11812 user_ptr
->user_name
= mystrdup (user_buf
);
11816 user_ptr
->user_name
= mystrdup ("");
11819 user_ptr
->user_len
= user_len
;
11823 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11825 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11827 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11832 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11835 if (hash_mode
== 3000)
11837 if (hash_len
== 32)
11839 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11841 if (parser_status
< PARSER_GLOBAL_ZERO
)
11843 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11848 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11852 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11854 if (parser_status
< PARSER_GLOBAL_ZERO
)
11856 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11861 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11863 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);
11869 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
);
11870 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
);
11874 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11876 if (parser_status
< PARSER_GLOBAL_ZERO
)
11878 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11883 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);
11885 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11886 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11893 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11895 if (parser_status
< PARSER_GLOBAL_ZERO
)
11897 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11902 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);
11904 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11905 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11915 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11917 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11924 hashes_buf
[0].salt
->salt_len
= 8;
11926 // special salt handling
11930 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11931 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11933 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11935 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11937 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11939 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11941 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11943 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11945 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11947 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11949 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11951 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11952 hashes_buf
[0].salt
->scrypt_N
= 1024;
11953 hashes_buf
[0].salt
->scrypt_r
= 1;
11954 hashes_buf
[0].salt
->scrypt_p
= 1;
11956 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11958 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11959 hashes_buf
[0].salt
->scrypt_N
= 16384;
11960 hashes_buf
[0].salt
->scrypt_r
= 1;
11961 hashes_buf
[0].salt
->scrypt_p
= 1;
11963 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11965 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11967 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11969 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11971 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11973 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11975 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11977 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11979 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11981 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11983 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11985 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11987 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11989 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11991 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11995 // special esalt handling
11999 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12001 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12002 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12004 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12005 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12007 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12008 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12009 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12010 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12012 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12013 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12014 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12015 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12017 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12019 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12020 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12021 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12023 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12024 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12025 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12027 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12028 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12029 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12031 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12032 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12033 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12035 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12036 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12037 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12039 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12040 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12041 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12043 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12044 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12045 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12047 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12049 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12051 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12052 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12053 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12062 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12064 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12066 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12068 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12070 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12072 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12074 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12076 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12078 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12080 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12082 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12084 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12086 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12088 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12090 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12092 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12094 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12096 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12098 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12100 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12102 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12104 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12106 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12108 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12110 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12112 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12114 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12116 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12118 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12120 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12122 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12124 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12126 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12128 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12130 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12132 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12136 // set default iterations
12140 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12142 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12144 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12146 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12148 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12150 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12152 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12154 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12156 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12158 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12160 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12162 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12164 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12166 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12168 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12170 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12172 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12174 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12176 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12178 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12180 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12182 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12184 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12186 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12188 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12190 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12192 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12194 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12196 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12198 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12200 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12202 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12204 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12206 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12208 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12210 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12212 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12214 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12216 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12218 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12220 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12222 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12224 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12226 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12228 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12230 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12232 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12234 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12236 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12238 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12240 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12242 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12244 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12246 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12248 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12250 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12252 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12254 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12256 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12258 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12260 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12262 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12264 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12266 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12268 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12270 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12272 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12274 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12276 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12278 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12280 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12282 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12284 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12286 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12288 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12290 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12292 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12294 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12296 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12298 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12300 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12302 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12309 if (show
== 1 || left
== 1)
12311 for (uint i
= 0; i
< pot_cnt
; i
++)
12313 pot_t
*pot_ptr
= &pot
[i
];
12315 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12317 local_free (hashes_buf
->digest
);
12321 local_free (hashes_buf
->salt
);
12327 if (data
.quiet
== 0) log_info_nn ("");
12334 if (hashes_cnt
== 0)
12336 log_error ("ERROR: No hashes loaded");
12343 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12346 if (data
.outfile
!= NULL
)
12348 if (data
.hashfile
!= NULL
)
12351 struct stat tmpstat_outfile
;
12352 struct stat tmpstat_hashfile
;
12356 struct stat64 tmpstat_outfile
;
12357 struct stat64 tmpstat_hashfile
;
12360 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12362 if (tmp_outfile_fp
)
12365 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12369 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12372 fclose (tmp_outfile_fp
);
12375 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12377 if (tmp_hashfile_fp
)
12380 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12384 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12387 fclose (tmp_hashfile_fp
);
12390 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12392 tmpstat_outfile
.st_mode
= 0;
12393 tmpstat_outfile
.st_nlink
= 0;
12394 tmpstat_outfile
.st_uid
= 0;
12395 tmpstat_outfile
.st_gid
= 0;
12396 tmpstat_outfile
.st_rdev
= 0;
12397 tmpstat_outfile
.st_atime
= 0;
12399 tmpstat_hashfile
.st_mode
= 0;
12400 tmpstat_hashfile
.st_nlink
= 0;
12401 tmpstat_hashfile
.st_uid
= 0;
12402 tmpstat_hashfile
.st_gid
= 0;
12403 tmpstat_hashfile
.st_rdev
= 0;
12404 tmpstat_hashfile
.st_atime
= 0;
12407 tmpstat_outfile
.st_blksize
= 0;
12408 tmpstat_outfile
.st_blocks
= 0;
12410 tmpstat_hashfile
.st_blksize
= 0;
12411 tmpstat_hashfile
.st_blocks
= 0;
12415 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12417 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12424 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12426 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12436 * Remove duplicates
12439 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12443 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12447 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12450 uint hashes_cnt_orig
= hashes_cnt
;
12454 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12458 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12460 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12465 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12468 if (hashes_pos
> hashes_cnt
)
12470 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12480 uint potfile_remove_cracks
= 0;
12482 if (potfile_disable
== 0)
12486 hash_buf
.digest
= mymalloc (dgst_size
);
12487 hash_buf
.salt
= NULL
;
12488 hash_buf
.esalt
= NULL
;
12489 hash_buf
.hash_info
= NULL
;
12490 hash_buf
.cracked
= 0;
12494 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12499 hash_buf
.esalt
= mymalloc (esalt_size
);
12502 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12504 // no solution for these special hash types (for instane because they use hashfile in output etc)
12505 if ((hash_mode
!= 5200) &&
12506 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12507 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12508 (hash_mode
!= 9000))
12510 FILE *fp
= fopen (potfile
, "rb");
12514 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12516 // to be safe work with a copy (because of line_len loop, i etc)
12517 // moved up here because it's easier to handle continue case
12520 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12524 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12526 if (ptr
== NULL
) break;
12528 int line_len
= strlen (line_buf
);
12530 if (line_len
== 0) continue;
12532 int iter
= MAX_CUT_TRIES
;
12534 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12536 if (line_buf
[i
] != ':') continue;
12540 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12543 hash_t
*found
= NULL
;
12545 if (hash_mode
== 6800)
12547 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12549 // manipulate salt_buf
12550 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12552 hash_buf
.salt
->salt_len
= i
;
12554 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12557 else if (hash_mode
== 2500)
12559 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12561 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12562 // manipulate salt_buf
12564 memcpy (line_buf_cpy
, line_buf
, i
);
12566 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12568 if (mac2_pos
== NULL
) continue;
12573 if (strlen (mac2_pos
) != 12) continue;
12575 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12577 if (mac1_pos
== NULL
) continue;
12582 if (strlen (mac1_pos
) != 12) continue;
12584 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12586 // here we need the ESSID
12587 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12589 hash_buf
.salt
->salt_len
= essid_length
;
12591 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12595 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12597 // compare hex string(s) vs binary MAC address(es)
12599 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12601 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12610 if (!found
) continue;
12612 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12614 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12626 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12628 if (parser_status
== PARSER_OK
)
12632 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12636 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12641 if (found
== NULL
) continue;
12643 if (!found
->cracked
) potfile_remove_cracks
++;
12645 found
->cracked
= 1;
12653 myfree (line_buf_cpy
);
12663 local_free (hash_buf
.esalt
);
12668 local_free (hash_buf
.salt
);
12671 local_free (hash_buf
.digest
);
12675 * Now generate all the buffers required for later
12678 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12680 salt_t
*salts_buf_new
= NULL
;
12681 void *esalts_buf_new
= NULL
;
12685 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12689 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12694 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12697 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12699 uint digests_cnt
= hashes_cnt
;
12700 uint digests_done
= 0;
12702 size_t size_digests
= digests_cnt
* dgst_size
;
12703 size_t size_shown
= digests_cnt
* sizeof (uint
);
12705 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12706 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12708 uint salts_cnt
= 0;
12709 uint salts_done
= 0;
12711 hashinfo_t
**hash_info
= NULL
;
12713 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12715 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12717 if (username
&& (remove
|| show
))
12721 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12723 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12725 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12730 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12735 // copied from inner loop
12737 salt_buf
= &salts_buf_new
[salts_cnt
];
12739 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12743 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12746 salt_buf
->digests_cnt
= 0;
12747 salt_buf
->digests_done
= 0;
12748 salt_buf
->digests_offset
= 0;
12753 if (hashes_buf
[0].cracked
== 1)
12755 digests_shown
[0] = 1;
12759 salt_buf
->digests_done
++;
12762 salt_buf
->digests_cnt
++;
12764 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12766 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12768 hash_info
[0] = hashes_buf
[0].hash_info
;
12771 // copy from inner loop
12773 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12777 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12779 salt_buf
= &salts_buf_new
[salts_cnt
];
12781 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12785 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12788 salt_buf
->digests_cnt
= 0;
12789 salt_buf
->digests_done
= 0;
12790 salt_buf
->digests_offset
= hashes_pos
;
12796 if (hashes_buf
[hashes_pos
].cracked
== 1)
12798 digests_shown
[hashes_pos
] = 1;
12802 salt_buf
->digests_done
++;
12805 salt_buf
->digests_cnt
++;
12807 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12809 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12811 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12815 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12817 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12819 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12821 salts_shown
[salt_pos
] = 1;
12826 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12829 local_free (digests_buf
);
12830 local_free (salts_buf
);
12831 local_free (esalts_buf
);
12833 digests_buf
= digests_buf_new
;
12834 salts_buf
= salts_buf_new
;
12835 esalts_buf
= esalts_buf_new
;
12837 local_free (hashes_buf
);
12840 * special modification not set from parser
12845 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12846 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12847 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12848 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12849 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12850 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12851 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12852 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12853 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12854 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12855 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12856 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12857 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12858 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12859 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12860 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12861 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12862 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12863 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12864 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12865 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12866 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12867 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12868 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12869 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12870 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12871 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12872 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12873 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12874 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12877 if (truecrypt_keyfiles
)
12879 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12881 char *keyfiles
= strdup (truecrypt_keyfiles
);
12883 char *keyfile
= strtok (keyfiles
, ",");
12887 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12889 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12894 if (veracrypt_keyfiles
)
12896 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12898 char *keyfiles
= strdup (veracrypt_keyfiles
);
12900 char *keyfile
= strtok (keyfiles
, ",");
12904 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12906 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12911 data
.digests_cnt
= digests_cnt
;
12912 data
.digests_done
= digests_done
;
12913 data
.digests_buf
= digests_buf
;
12914 data
.digests_shown
= digests_shown
;
12915 data
.digests_shown_tmp
= digests_shown_tmp
;
12917 data
.salts_cnt
= salts_cnt
;
12918 data
.salts_done
= salts_done
;
12919 data
.salts_buf
= salts_buf
;
12920 data
.salts_shown
= salts_shown
;
12922 data
.esalts_buf
= esalts_buf
;
12923 data
.hash_info
= hash_info
;
12926 * Automatic Optimizers
12929 if (salts_cnt
== 1)
12930 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12932 if (digests_cnt
== 1)
12933 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12935 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12936 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12938 if (attack_mode
== ATTACK_MODE_BF
)
12939 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12941 data
.opti_type
= opti_type
;
12943 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12945 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12947 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12949 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12951 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12952 opts_type
|= OPTS_TYPE_PT_ADD80
;
12955 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12957 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12958 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12961 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12963 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12964 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12971 * Some algorithm, like descrypt, can benefit from JIT compilation
12974 int force_jit_compilation
= -1;
12976 if (hash_mode
== 8900)
12978 force_jit_compilation
= 8900;
12980 else if (hash_mode
== 9300)
12982 force_jit_compilation
= 8900;
12984 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12986 force_jit_compilation
= 1500;
12990 * generate bitmap tables
12993 const uint bitmap_shift1
= 5;
12994 const uint bitmap_shift2
= 13;
12996 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12998 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12999 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13000 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13001 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13002 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13003 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13004 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13005 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13012 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13014 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13016 bitmap_nums
= 1 << bitmap_bits
;
13018 bitmap_mask
= bitmap_nums
- 1;
13020 bitmap_size
= bitmap_nums
* sizeof (uint
);
13022 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13024 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;
13025 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;
13030 bitmap_nums
= 1 << bitmap_bits
;
13032 bitmap_mask
= bitmap_nums
- 1;
13034 bitmap_size
= bitmap_nums
* sizeof (uint
);
13036 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);
13037 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);
13040 * prepare quick rule
13043 data
.rule_buf_l
= rule_buf_l
;
13044 data
.rule_buf_r
= rule_buf_r
;
13046 int rule_len_l
= (int) strlen (rule_buf_l
);
13047 int rule_len_r
= (int) strlen (rule_buf_r
);
13049 data
.rule_len_l
= rule_len_l
;
13050 data
.rule_len_r
= rule_len_r
;
13056 uint
*all_kernel_rules_cnt
= NULL
;
13058 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13062 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13064 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13067 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13071 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13073 uint kernel_rules_avail
= 0;
13075 uint kernel_rules_cnt
= 0;
13077 kernel_rule_t
*kernel_rules_buf
= NULL
;
13079 char *rp_file
= rp_files
[i
];
13081 char in
[BLOCK_SIZE
] = { 0 };
13082 char out
[BLOCK_SIZE
] = { 0 };
13086 uint rule_line
= 0;
13088 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13090 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13097 memset (rule_buf
, 0, HCBUFSIZ
);
13099 rule_len
= fgetl (fp
, rule_buf
);
13103 if (rule_len
== 0) continue;
13105 if (rule_buf
[0] == '#') continue;
13107 if (kernel_rules_avail
== kernel_rules_cnt
)
13109 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13111 kernel_rules_avail
+= INCR_RULES
;
13114 memset (in
, 0, BLOCK_SIZE
);
13115 memset (out
, 0, BLOCK_SIZE
);
13117 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13121 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13126 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13128 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13130 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13136 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13138 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13144 kernel_rules_cnt
++;
13149 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13151 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13155 * merge rules or automatic rule generator
13158 uint kernel_rules_cnt
= 0;
13160 kernel_rule_t
*kernel_rules_buf
= NULL
;
13162 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13166 kernel_rules_cnt
= 1;
13168 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13170 repeats
[0] = kernel_rules_cnt
;
13172 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13174 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13176 repeats
[i
+ 1] = kernel_rules_cnt
;
13179 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13181 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13183 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13187 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13189 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13191 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13194 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13196 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13198 if (out_pos
== RULES_MAX
- 1)
13200 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13205 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13210 local_free (repeats
);
13214 uint kernel_rules_avail
= 0;
13216 while (kernel_rules_cnt
< rp_gen
)
13218 if (kernel_rules_avail
== kernel_rules_cnt
)
13220 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13222 kernel_rules_avail
+= INCR_RULES
;
13225 memset (rule_buf
, 0, HCBUFSIZ
);
13227 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13229 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13231 kernel_rules_cnt
++;
13239 * generate NOP rules
13242 if (kernel_rules_cnt
== 0)
13244 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13246 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13248 kernel_rules_cnt
++;
13251 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13252 data
.kernel_rules_buf
= kernel_rules_buf
;
13255 * OpenCL platforms: detect
13258 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13259 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13261 cl_uint platforms_cnt
= 0;
13262 cl_uint platform_devices_cnt
= 0;
13266 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13268 if (platforms_cnt
== 0)
13271 log_info ("ATTENTION! No OpenCL compatible platform found");
13273 log_info ("You're probably missing the OpenCL runtime installation");
13274 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13275 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13276 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13282 if (opencl_platforms_filter
!= (uint
) -1)
13284 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13286 if (opencl_platforms_filter
> platform_cnt_mask
)
13288 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13296 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13299 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13301 cl_platform_id platform
= platforms
[platform_id
];
13303 char platform_vendor
[INFOSZ
] = { 0 };
13305 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13308 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13309 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13311 // make sure that we do not directly control the fan for NVidia
13313 gpu_temp_retain
= 0;
13315 data
.gpu_temp_retain
= gpu_temp_retain
;
13317 #endif // HAVE_NVML || HAVE_NVAPI
13322 * OpenCL device types:
13323 * 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.
13324 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13327 if (opencl_device_types
== NULL
)
13329 cl_device_type device_types_all
= 0;
13331 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13333 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13335 cl_platform_id platform
= platforms
[platform_id
];
13337 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13339 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13341 cl_device_id device
= platform_devices
[platform_devices_id
];
13343 cl_device_type device_type
;
13345 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13347 device_types_all
|= device_type
;
13351 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13353 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13358 * OpenCL devices: simply push all devices from all platforms into the same device array
13361 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13363 data
.devices_param
= devices_param
;
13365 uint devices_cnt
= 0;
13367 uint devices_active
= 0;
13369 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13371 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13373 cl_platform_id platform
= platforms
[platform_id
];
13375 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13377 char platform_vendor
[INFOSZ
] = { 0 };
13379 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13381 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13382 // this causes trouble with vendor id based macros
13383 // we'll assign generic to those without special optimization available
13385 cl_uint platform_vendor_id
= 0;
13387 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13389 platform_vendor_id
= VENDOR_ID_AMD
;
13391 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13393 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13395 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13397 platform_vendor_id
= VENDOR_ID_APPLE
;
13399 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13401 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13403 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13405 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13407 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13409 platform_vendor_id
= VENDOR_ID_MESA
;
13411 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13413 platform_vendor_id
= VENDOR_ID_NV
;
13415 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13417 platform_vendor_id
= VENDOR_ID_POCL
;
13421 platform_vendor_id
= VENDOR_ID_GENERIC
;
13424 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13426 size_t param_value_size
= 0;
13428 const uint device_id
= devices_cnt
;
13430 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13432 device_param
->platform_vendor_id
= platform_vendor_id
;
13434 device_param
->device
= platform_devices
[platform_devices_id
];
13436 device_param
->device_id
= device_id
;
13438 device_param
->platform_devices_id
= platform_devices_id
;
13442 cl_device_type device_type
;
13444 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13446 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13448 device_param
->device_type
= device_type
;
13452 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13454 char *device_name
= (char *) mymalloc (param_value_size
);
13456 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13458 device_param
->device_name
= device_name
;
13462 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13464 char *device_vendor
= (char *) mymalloc (param_value_size
);
13466 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13468 device_param
->device_vendor
= device_vendor
;
13470 cl_uint device_vendor_id
= 0;
13472 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13474 device_vendor_id
= VENDOR_ID_AMD
;
13476 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13478 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13480 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13482 device_vendor_id
= VENDOR_ID_APPLE
;
13484 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13486 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13488 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13490 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13492 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13494 device_vendor_id
= VENDOR_ID_MESA
;
13496 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13498 device_vendor_id
= VENDOR_ID_NV
;
13500 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13502 device_vendor_id
= VENDOR_ID_POCL
;
13506 device_vendor_id
= VENDOR_ID_GENERIC
;
13509 device_param
->device_vendor_id
= device_vendor_id
;
13513 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13517 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13519 char *device_version
= (char *) mymalloc (param_value_size
);
13521 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13523 device_param
->device_version
= device_version
;
13525 // device_opencl_version
13527 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13529 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13531 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13533 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13535 myfree (device_opencl_version
);
13539 cl_uint vector_width
;
13541 if (opencl_vector_width_chgd
== 0)
13543 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13545 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13547 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13551 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13556 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13561 vector_width
= opencl_vector_width
;
13564 if (vector_width
> 16) vector_width
= 16;
13566 device_param
->vector_width
= vector_width
;
13568 // max_compute_units
13570 cl_uint device_processors
;
13572 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13574 device_param
->device_processors
= device_processors
;
13576 // device_maxmem_alloc
13577 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13579 cl_ulong device_maxmem_alloc
;
13581 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13583 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13585 // device_global_mem
13587 cl_ulong device_global_mem
;
13589 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13591 device_param
->device_global_mem
= device_global_mem
;
13593 // max_work_group_size
13595 size_t device_maxworkgroup_size
;
13597 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13599 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13601 // max_clock_frequency
13603 cl_uint device_maxclock_frequency
;
13605 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13607 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13609 // device_endian_little
13611 cl_bool device_endian_little
;
13613 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13615 if (device_endian_little
== CL_FALSE
)
13617 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13619 device_param
->skipped
= 1;
13622 // device_available
13624 cl_bool device_available
;
13626 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13628 if (device_available
== CL_FALSE
)
13630 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13632 device_param
->skipped
= 1;
13635 // device_compiler_available
13637 cl_bool device_compiler_available
;
13639 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13641 if (device_compiler_available
== CL_FALSE
)
13643 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13645 device_param
->skipped
= 1;
13648 // device_execution_capabilities
13650 cl_device_exec_capabilities device_execution_capabilities
;
13652 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13654 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13656 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13658 device_param
->skipped
= 1;
13661 // device_extensions
13663 size_t device_extensions_size
;
13665 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13667 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13669 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13671 if (strstr (device_extensions
, "base_atomics") == 0)
13673 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13675 device_param
->skipped
= 1;
13678 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13680 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13682 device_param
->skipped
= 1;
13685 myfree (device_extensions
);
13687 // device_local_mem_size
13689 cl_ulong device_local_mem_size
;
13691 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13693 if (device_local_mem_size
< 32768)
13695 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13697 device_param
->skipped
= 1;
13700 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13701 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13702 // This results in both utilizing it for 50%
13703 // However, Intel has much better SIMD control over their own hardware
13704 // It makes sense to give them full control over their own hardware
13706 if (device_type
& CL_DEVICE_TYPE_CPU
)
13708 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13710 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13712 device_param
->skipped
= 1;
13718 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13719 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13723 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13725 char *driver_version
= (char *) mymalloc (param_value_size
);
13727 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13729 device_param
->driver_version
= driver_version
;
13731 // device_name_chksum
13733 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13736 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
);
13738 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
);
13741 uint device_name_digest
[4] = { 0 };
13743 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13745 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13747 device_param
->device_name_chksum
= device_name_chksum
;
13749 // device_processor_cores
13751 if (device_type
& CL_DEVICE_TYPE_CPU
)
13753 cl_uint device_processor_cores
= 1;
13755 device_param
->device_processor_cores
= device_processor_cores
;
13758 if (device_type
& CL_DEVICE_TYPE_GPU
)
13760 if (device_vendor_id
== VENDOR_ID_AMD
)
13762 cl_uint device_processor_cores
= 0;
13764 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13766 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13768 device_param
->device_processor_cores
= device_processor_cores
;
13770 else if (device_vendor_id
== VENDOR_ID_NV
)
13772 cl_uint kernel_exec_timeout
= 0;
13774 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13776 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13778 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13780 cl_uint device_processor_cores
= 0;
13782 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13784 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13786 device_param
->device_processor_cores
= device_processor_cores
;
13788 cl_uint sm_minor
= 0;
13789 cl_uint sm_major
= 0;
13791 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13792 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13794 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13795 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13797 device_param
->sm_minor
= sm_minor
;
13798 device_param
->sm_major
= sm_major
;
13802 cl_uint device_processor_cores
= 1;
13804 device_param
->device_processor_cores
= device_processor_cores
;
13810 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13812 if (machine_readable
== 0)
13814 if (device_param
->skipped
== 0)
13816 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13819 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13820 (unsigned int) (device_global_mem
/ 1024 / 1024),
13821 (unsigned int) device_processors
);
13825 log_info ("Device #%u: %s, skipped",
13832 // common driver check
13834 if (device_param
->skipped
== 0)
13836 if (device_type
& CL_DEVICE_TYPE_GPU
)
13838 if (platform_vendor_id
== VENDOR_ID_AMD
)
13840 int catalyst_check
= (force
== 1) ? 0 : 1;
13842 int catalyst_warn
= 0;
13844 int catalyst_broken
= 0;
13846 if (catalyst_check
== 1)
13850 // v14.9 and higher
13851 if (atoi (device_param
->driver_version
) >= 1573)
13856 catalyst_check
= 0;
13859 if (catalyst_broken
== 1)
13862 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13863 log_info ("It will pass over cracked hashes and does not report them as cracked");
13864 log_info ("You are STRONGLY encouraged not to use it");
13865 log_info ("You can use --force to override this but do not post error reports if you do so");
13871 if (catalyst_warn
== 1)
13874 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13875 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13876 log_info ("See hashcat's homepage for official supported catalyst drivers");
13878 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13880 log_info ("You can use --force to override this but do not post error reports if you do so");
13886 else if (platform_vendor_id
== VENDOR_ID_NV
)
13888 if (device_param
->kernel_exec_timeout
!= 0)
13890 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);
13891 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13896 /* turns out pocl still creates segfaults (because of llvm)
13897 if (device_type & CL_DEVICE_TYPE_CPU)
13899 if (platform_vendor_id == VENDOR_ID_AMD)
13904 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13905 log_info ("You are STRONGLY encouraged not to use it");
13906 log_info ("You can use --force to override this but do not post error reports if you do so");
13907 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13917 * kernel accel and loops tuning db adjustment
13920 device_param
->kernel_accel_min
= 1;
13921 device_param
->kernel_accel_max
= 1024;
13923 device_param
->kernel_loops_min
= 1;
13924 device_param
->kernel_loops_max
= 1024;
13926 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13928 if (tuningdb_entry
)
13930 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13931 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13935 device_param
->kernel_accel_min
= _kernel_accel
;
13936 device_param
->kernel_accel_max
= _kernel_accel
;
13941 if (workload_profile
== 1)
13943 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13945 else if (workload_profile
== 2)
13947 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13950 device_param
->kernel_loops_min
= _kernel_loops
;
13951 device_param
->kernel_loops_max
= _kernel_loops
;
13955 // commandline parameters overwrite tuningdb entries
13959 device_param
->kernel_accel_min
= kernel_accel
;
13960 device_param
->kernel_accel_max
= kernel_accel
;
13965 device_param
->kernel_loops_min
= kernel_loops
;
13966 device_param
->kernel_loops_max
= kernel_loops
;
13982 if (keyspace
== 0 && devices_active
== 0)
13984 log_error ("ERROR: No devices found/left");
13989 // 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)
13991 if (devices_filter
!= (uint
) -1)
13993 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13995 if (devices_filter
> devices_cnt_mask
)
13997 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
14003 data
.devices_cnt
= devices_cnt
;
14005 data
.devices_active
= devices_active
;
14007 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14009 if (machine_readable
== 0)
14020 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14021 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
14025 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
14028 if (gpu_temp_disable
== 0)
14030 #if defined(WIN) && defined(HAVE_NVAPI)
14031 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14033 if (nvapi_init (nvapi
) == 0)
14034 data
.hm_nv
= nvapi
;
14038 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
14040 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14042 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14046 for (int i
= 0; i
< tmp_in
; i
++)
14048 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14051 for (int i
= 0; i
< tmp_out
; i
++)
14053 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
14055 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
14057 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;
14061 #endif // WIN && HAVE_NVAPI
14063 #if defined(LINUX) && defined(HAVE_NVML)
14064 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14066 if (nvml_init (nvml
) == 0)
14071 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
14073 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14075 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14079 for (int i
= 0; i
< tmp_in
; i
++)
14081 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14084 for (int i
= 0; i
< tmp_out
; i
++)
14086 unsigned int speed
;
14088 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;
14092 #endif // LINUX && HAVE_NVML
14094 data
.hm_amd
= NULL
;
14097 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14099 if (adl_init (adl
) == 0)
14104 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14106 // total number of adapters
14108 int hm_adapters_num
;
14110 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14114 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14116 if (lpAdapterInfo
== NULL
) return (-1);
14118 // get a list (of ids of) valid/usable adapters
14120 int num_adl_adapters
= 0;
14122 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14124 if (num_adl_adapters
> 0)
14126 hc_thread_mutex_lock (mux_adl
);
14128 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14130 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14132 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14133 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14135 hc_thread_mutex_unlock (mux_adl
);
14138 myfree (valid_adl_device_list
);
14139 myfree (lpAdapterInfo
);
14144 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14146 gpu_temp_disable
= 1;
14151 * OpenCL devices: allocate buffer for device specific information
14155 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14158 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14160 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14165 * enable custom signal handler(s)
14168 if (benchmark
== 0)
14170 hc_signal (sigHandler_default
);
14174 hc_signal (sigHandler_benchmark
);
14178 * User-defined GPU temp handling
14182 if (gpu_temp_disable
== 1)
14184 gpu_temp_abort
= 0;
14185 gpu_temp_retain
= 0;
14188 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14190 if (gpu_temp_abort
< gpu_temp_retain
)
14192 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14198 data
.gpu_temp_disable
= gpu_temp_disable
;
14199 data
.gpu_temp_abort
= gpu_temp_abort
;
14200 data
.gpu_temp_retain
= gpu_temp_retain
;
14207 if (data
.quiet
== 0)
14209 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14211 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
);
14213 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14215 log_info ("Rules: %u", kernel_rules_cnt
);
14220 log_info ("Applicable Optimizers:");
14222 for (uint i
= 0; i
< 32; i
++)
14224 const uint opti_bit
= 1u << i
;
14226 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14231 * Watchdog and Temperature balance
14235 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14237 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14240 if (gpu_temp_abort
== 0)
14242 log_info ("Watchdog: Temperature abort trigger disabled");
14246 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14249 if (gpu_temp_retain
== 0)
14251 log_info ("Watchdog: Temperature retain trigger disabled");
14255 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14258 if (data
.quiet
== 0) log_info ("");
14266 if (gpu_temp_disable
== 0)
14268 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14270 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14272 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14274 if (device_param
->skipped
) continue;
14276 const uint platform_devices_id
= device_param
->platform_devices_id
;
14278 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14279 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14281 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14286 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14288 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14296 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14297 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14298 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14299 * Driver / ADL bug?
14303 if (powertune_enable
== 1)
14305 hc_thread_mutex_lock (mux_adl
);
14307 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14309 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14311 if (device_param
->skipped
) continue;
14313 if (data
.hm_device
[device_id
].od_version
== 6)
14315 // set powertune value only
14317 int powertune_supported
= 0;
14321 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14323 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14328 if (powertune_supported
!= 0)
14331 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14333 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14335 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14340 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14342 log_error ("ERROR: Failed to set new ADL PowerControl values");
14350 hc_thread_mutex_unlock (mux_adl
);
14353 #endif // HAVE_HWMON
14356 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14359 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14361 uint kernel_power_all
= 0;
14363 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14369 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14371 if (device_param
->skipped
) continue;
14374 * device properties
14377 const char *device_name_chksum
= device_param
->device_name_chksum
;
14378 const u32 device_processors
= device_param
->device_processors
;
14379 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14382 * create context for each device
14385 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14388 * create command-queue
14391 // not supported with NV
14392 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14394 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14397 * kernel threads: some algorithms need a fixed kernel-threads count
14398 * because of shared memory usage or bitslice
14399 * there needs to be some upper limit, otherwise there's too much overhead
14402 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14404 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14406 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14409 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14410 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14411 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14412 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14413 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14414 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14415 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14416 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14417 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14418 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14419 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14420 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14421 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14424 * create input buffers on device : calculate size of fixed memory buffers
14427 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14428 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14430 device_param
->size_root_css
= size_root_css
;
14431 device_param
->size_markov_css
= size_markov_css
;
14433 size_t size_results
= sizeof (uint
);
14435 device_param
->size_results
= size_results
;
14437 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14438 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14440 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14441 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14442 size_t size_esalts
= salts_cnt
* esalt_size
;
14444 device_param
->size_plains
= size_plains
;
14445 device_param
->size_digests
= size_digests
;
14446 device_param
->size_shown
= size_shown
;
14447 device_param
->size_salts
= size_salts
;
14449 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14450 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14451 size_t size_tm
= 32 * sizeof (bs_word_t
);
14455 size_t size_scryptV
= 1;
14457 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14459 uint tmto_start
= 0;
14460 uint tmto_stop
= 10;
14464 tmto_start
= scrypt_tmto
;
14468 // in case the user did not specify the tmto manually
14469 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14470 // but set the lower end only in case the user has a device with too less memory
14472 if (hash_mode
== 8900)
14474 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14478 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14483 else if (hash_mode
== 9300)
14485 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14489 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14496 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14498 // TODO: in theory the following calculation needs to be done per salt, not global
14499 // we assume all hashes have the same scrypt settings
14501 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14503 size_scryptV
/= 1 << tmto
;
14505 size_scryptV
*= device_processors
* device_processor_cores
;
14507 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14509 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14514 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14516 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14517 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14523 if (data
.salts_buf
[0].scrypt_phy
== 0)
14525 log_error ("ERROR: can't allocate enough device memory");
14530 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14534 * some algorithms need a fixed kernel-loops count
14537 if (hash_mode
== 1500)
14539 const u32 kernel_loops_fixed
= 1024;
14541 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14542 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14545 if (hash_mode
== 3000)
14547 const u32 kernel_loops_fixed
= 1024;
14549 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14550 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14553 if (hash_mode
== 8900)
14555 const u32 kernel_loops_fixed
= 1;
14557 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14558 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14561 if (hash_mode
== 9300)
14563 const u32 kernel_loops_fixed
= 1;
14565 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14566 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14569 if (hash_mode
== 12500)
14571 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14573 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14574 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14578 * some algorithms have a maximum kernel-loops count
14581 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14583 u32 innerloop_cnt
= 0;
14585 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14587 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14588 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14589 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14593 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14596 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14597 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14599 device_param
->kernel_loops_max
= innerloop_cnt
;
14603 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14604 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14606 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14608 size_t size_pws
= 4;
14609 size_t size_tmps
= 4;
14610 size_t size_hooks
= 4;
14612 while (kernel_accel_max
>= kernel_accel_min
)
14614 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14618 size_pws
= kernel_power_max
* sizeof (pw_t
);
14624 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14625 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14626 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14627 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14628 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14629 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14630 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14631 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14632 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14633 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14634 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14635 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14636 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14637 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14638 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14639 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14640 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14641 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14642 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14643 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14644 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14645 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14646 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14647 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14648 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14649 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14650 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14651 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14652 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14653 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14654 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14655 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14656 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14657 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14658 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14659 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14660 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14661 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14662 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14663 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14664 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14665 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14666 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14667 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14668 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14669 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14670 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14671 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14672 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14673 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14674 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14675 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14676 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14677 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14678 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14679 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14680 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14681 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14682 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14683 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14684 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14685 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14686 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14687 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14688 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14689 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14690 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14691 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14692 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14693 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14694 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14695 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14696 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14697 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14698 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14699 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14700 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14701 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14702 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14703 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14704 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14705 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14710 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14715 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14716 // if not, decrease amplifier and try again
14720 const u64 size_total
14737 + size_pws
// not a bug
14748 // Don't ask me, ask AMD!
14750 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14751 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14755 kernel_accel_max
--;
14764 if (kernel_accel_max == 0)
14766 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14772 device_param
->kernel_accel_min
= kernel_accel_min
;
14773 device_param
->kernel_accel_max
= kernel_accel_max
;
14776 if (kernel_accel_max < kernel_accel)
14778 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14780 device_param->kernel_accel = kernel_accel_max;
14784 device_param
->size_bfs
= size_bfs
;
14785 device_param
->size_combs
= size_combs
;
14786 device_param
->size_rules
= size_rules
;
14787 device_param
->size_rules_c
= size_rules_c
;
14788 device_param
->size_pws
= size_pws
;
14789 device_param
->size_tmps
= size_tmps
;
14790 device_param
->size_hooks
= size_hooks
;
14792 // do not confuse kernel_accel_max with kernel_accel here
14794 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14796 device_param
->kernel_threads
= kernel_threads
;
14797 device_param
->kernel_power_user
= kernel_power
;
14799 kernel_power_all
+= kernel_power
;
14802 * default building options
14805 char build_opts
[1024] = { 0 };
14807 // we don't have sm_* on vendors not NV but it doesn't matter
14810 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
);
14812 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
);
14815 char build_opts_new
[1024] = { 0 };
14817 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
);
14819 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14822 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14824 // we do vectorizing much better than the auto-vectorizer
14826 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14828 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14833 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14842 * kernel source filename
14845 char source_file
[256] = { 0 };
14847 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14851 if (stat (source_file
, &sst
) == -1)
14853 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14859 * kernel cached filename
14862 char cached_file
[256] = { 0 };
14864 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14870 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14876 * kernel compile or load
14879 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14881 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14883 if (force_jit_compilation
== -1)
14887 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14889 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14891 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14893 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14896 size_t build_log_size
= 0;
14898 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14900 if (build_log_size
> 1)
14902 char *build_log
= (char *) malloc (build_log_size
+ 1);
14904 memset (build_log
, 0, build_log_size
+ 1);
14906 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14916 device_param
->skipped
= true;
14918 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14923 size_t binary_size
;
14925 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14927 u8
*binary
= (u8
*) mymalloc (binary_size
);
14929 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14931 writeProgramBin (cached_file
, binary
, binary_size
);
14933 local_free (binary
);
14938 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14941 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14943 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14945 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14951 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14954 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14956 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14958 char build_opts_update
[1024] = { 0 };
14960 if (force_jit_compilation
== 1500)
14962 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14964 else if (force_jit_compilation
== 8900)
14966 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
);
14970 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14973 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14976 size_t build_log_size
= 0;
14978 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14980 if (build_log_size
> 1)
14982 char *build_log
= (char *) malloc (build_log_size
+ 1);
14984 memset (build_log
, 0, build_log_size
+ 1);
14986 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14996 device_param
->skipped
= true;
14998 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15002 local_free (kernel_lengths
);
15003 local_free (kernel_sources
[0]);
15004 local_free (kernel_sources
);
15008 * word generator kernel
15011 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
15014 * kernel mp source filename
15017 char source_file
[256] = { 0 };
15019 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
15023 if (stat (source_file
, &sst
) == -1)
15025 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15031 * kernel mp cached filename
15034 char cached_file
[256] = { 0 };
15036 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15042 if (stat (cached_file
, &cst
) == -1)
15048 * kernel compile or load
15051 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15053 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15057 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15058 if (quiet
== 0) log_info ("");
15060 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15062 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15064 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15068 device_param
->skipped
= true;
15070 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15075 size_t binary_size
;
15077 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15079 u8
*binary
= (u8
*) mymalloc (binary_size
);
15081 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15083 writeProgramBin (cached_file
, binary
, binary_size
);
15085 local_free (binary
);
15090 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15093 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15095 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15097 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15100 local_free (kernel_lengths
);
15101 local_free (kernel_sources
[0]);
15102 local_free (kernel_sources
);
15109 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15116 * kernel amp source filename
15119 char source_file
[256] = { 0 };
15121 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15125 if (stat (source_file
, &sst
) == -1)
15127 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15133 * kernel amp cached filename
15136 char cached_file
[256] = { 0 };
15138 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15144 if (stat (cached_file
, &cst
) == -1)
15150 * kernel compile or load
15153 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15155 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15159 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15160 if (quiet
== 0) log_info ("");
15162 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15164 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15166 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15170 device_param
->skipped
= true;
15172 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15177 size_t binary_size
;
15179 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15181 u8
*binary
= (u8
*) mymalloc (binary_size
);
15183 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15185 writeProgramBin (cached_file
, binary
, binary_size
);
15187 local_free (binary
);
15192 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15195 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15197 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15199 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15202 local_free (kernel_lengths
);
15203 local_free (kernel_sources
[0]);
15204 local_free (kernel_sources
);
15207 // some algorithm collide too fast, make that impossible
15209 if (benchmark
== 1)
15211 ((uint
*) digests_buf
)[0] = -1;
15212 ((uint
*) digests_buf
)[1] = -1;
15213 ((uint
*) digests_buf
)[2] = -1;
15214 ((uint
*) digests_buf
)[3] = -1;
15221 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15222 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15223 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15224 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15225 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15226 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15227 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15228 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15229 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15230 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15231 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15232 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15233 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15234 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15235 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15236 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15237 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15238 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15240 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
);
15241 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
);
15242 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
);
15243 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
);
15244 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
);
15245 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
);
15246 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
);
15247 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
);
15248 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15249 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15250 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15256 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15258 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15259 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15261 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15263 else if (attack_kern
== ATTACK_KERN_COMBI
)
15265 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15266 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15267 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15268 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15270 else if (attack_kern
== ATTACK_KERN_BF
)
15272 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15273 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15274 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15275 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15276 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15281 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15283 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15290 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15292 device_param
->pws_buf
= pws_buf
;
15294 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15296 device_param
->combs_buf
= combs_buf
;
15298 void *hooks_buf
= mymalloc (size_hooks
);
15300 device_param
->hooks_buf
= hooks_buf
;
15306 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15307 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15308 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15309 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15310 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15311 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15312 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15313 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15314 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15315 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15316 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15318 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15319 ? &device_param
->d_pws_buf
15320 : &device_param
->d_pws_amp_buf
;
15321 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15322 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15323 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15324 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15325 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15326 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15327 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15328 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15329 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15330 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15331 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15332 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15333 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15334 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15335 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15336 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15337 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15338 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15339 device_param
->kernel_params
[19] = &device_param
->d_result
;
15340 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15341 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15342 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15343 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15344 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15345 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15346 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15347 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15348 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15349 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15350 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15351 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15353 device_param
->kernel_params_mp_buf64
[3] = 0;
15354 device_param
->kernel_params_mp_buf32
[4] = 0;
15355 device_param
->kernel_params_mp_buf32
[5] = 0;
15356 device_param
->kernel_params_mp_buf32
[6] = 0;
15357 device_param
->kernel_params_mp_buf32
[7] = 0;
15358 device_param
->kernel_params_mp_buf32
[8] = 0;
15360 device_param
->kernel_params_mp
[0] = NULL
;
15361 device_param
->kernel_params_mp
[1] = NULL
;
15362 device_param
->kernel_params_mp
[2] = NULL
;
15363 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15364 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15365 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15366 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15367 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15368 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15370 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15371 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15372 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15373 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15374 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15375 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15376 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15378 device_param
->kernel_params_mp_l
[0] = NULL
;
15379 device_param
->kernel_params_mp_l
[1] = NULL
;
15380 device_param
->kernel_params_mp_l
[2] = NULL
;
15381 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15382 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15383 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15384 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15385 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15386 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15387 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15389 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15390 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15391 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15392 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15393 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15394 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15396 device_param
->kernel_params_mp_r
[0] = NULL
;
15397 device_param
->kernel_params_mp_r
[1] = NULL
;
15398 device_param
->kernel_params_mp_r
[2] = NULL
;
15399 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15400 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15401 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15402 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15403 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15404 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15406 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15407 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15409 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15410 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15411 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15412 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15413 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15414 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15415 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15417 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15418 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15420 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15421 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15423 device_param
->kernel_params_memset
[0] = NULL
;
15424 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15425 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15431 size_t kernel_wgs_tmp
;
15433 char kernel_name
[64] = { 0 };
15435 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15437 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15439 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15441 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15443 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15445 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15447 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15449 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15453 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15455 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15457 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15459 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15461 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15463 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15466 if (data
.attack_mode
== ATTACK_MODE_BF
)
15468 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15470 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15472 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15474 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
);
15480 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15482 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15484 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15486 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15488 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15490 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15492 if (opts_type
& OPTS_TYPE_HOOK12
)
15494 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15496 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15498 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
);
15501 if (opts_type
& OPTS_TYPE_HOOK23
)
15503 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15505 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15507 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
);
15511 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
);
15512 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
);
15513 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
);
15515 for (uint i
= 0; i
<= 20; i
++)
15517 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15518 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15519 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15521 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15522 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15525 for (uint i
= 21; i
<= 31; i
++)
15527 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15528 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15529 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15531 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15532 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15537 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15539 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
);
15541 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15542 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15543 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15547 if (attack_mode
== ATTACK_MODE_BF
)
15549 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15550 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15552 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
);
15553 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
);
15555 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15557 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15558 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15561 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15563 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15565 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
);
15567 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15569 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15571 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
);
15574 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15580 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15582 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
);
15585 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15591 for (uint i
= 0; i
< 5; i
++)
15593 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15596 for (uint i
= 5; i
< 7; i
++)
15598 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15602 // maybe this has been updated by clGetKernelWorkGroupInfo()
15603 // value can only be decreased, so we don't need to reallocate buffers
15605 device_param
->kernel_threads
= kernel_threads
;
15607 // zero some data buffers
15609 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15610 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15611 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15612 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15613 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15614 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15620 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15622 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15624 else if (attack_kern
== ATTACK_KERN_COMBI
)
15626 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15627 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15628 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15629 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15631 else if (attack_kern
== ATTACK_KERN_BF
)
15633 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15634 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15635 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15636 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15637 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15641 * Store thermal target temperature so we can send a notice to user
15644 #if defined(HAVE_HWMON)
15645 if (gpu_temp_disable
== 0)
15647 const int gpu_temp_threshold_slowdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15649 data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
= (gpu_temp_threshold_slowdown
== -1) ? 100000 : gpu_temp_threshold_slowdown
;
15654 * Store initial fanspeed if gpu_temp_retain is enabled
15657 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15658 int gpu_temp_retain_set
= 0;
15660 if (gpu_temp_disable
== 0)
15662 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15664 hc_thread_mutex_lock (mux_adl
);
15666 if (data
.hm_device
[device_id
].fan_supported
== 1)
15668 if (gpu_temp_retain_chgd
== 0)
15671 uint default_temp
= 0;
15673 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
);
15675 if (ADL_rc
== ADL_OK
)
15677 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15679 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15681 // special case with multi gpu setups: always use minimum retain
15683 if (gpu_temp_retain_set
== 0)
15685 gpu_temp_retain
= gpu_temp_retain_target
;
15686 gpu_temp_retain_set
= 1;
15690 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15693 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15697 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15699 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15701 if (fan_speed
== -1)
15703 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15705 temp_retain_fanspeed_value
[device_id
] = 0;
15709 hc_thread_mutex_unlock (mux_adl
);
15714 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15717 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15719 hc_thread_mutex_lock (mux_adl
);
15721 if (data
.hm_device
[device_id
].od_version
== 6)
15725 // check powertune capabilities first, if not available then skip device
15727 int powertune_supported
= 0;
15729 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15731 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15736 if (powertune_supported
!= 0)
15738 // powercontrol settings
15740 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15742 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15744 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15747 if (ADL_rc
!= ADL_OK
)
15749 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15754 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15756 log_error ("ERROR: Failed to set new ADL PowerControl values");
15763 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15765 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15767 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
)
15769 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15774 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15776 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15778 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15780 log_error ("ERROR: Failed to get ADL device capabilities");
15785 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15786 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15788 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15789 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15791 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15792 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15794 // warning if profile has too low max values
15796 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15798 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15801 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15803 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15806 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15808 performance_state
->iNumberOfPerformanceLevels
= 2;
15810 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15811 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15812 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15813 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15815 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
)
15817 log_info ("ERROR: Failed to set ADL performance state");
15822 local_free (performance_state
);
15826 hc_thread_mutex_unlock (mux_adl
);
15828 #endif // HAVE_HWMON && HAVE_ADL
15831 data
.kernel_power_all
= kernel_power_all
;
15833 if (data
.quiet
== 0) log_info_nn ("");
15836 * In benchmark-mode, inform user which algorithm is checked
15839 if (benchmark
== 1)
15841 if (machine_readable
== 0)
15845 data
.quiet
= quiet
;
15847 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15849 log_info ("Hashtype: %s", hash_type
);
15855 * keep track of the progress
15858 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15859 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15860 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15867 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15869 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15874 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15876 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15881 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15883 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15893 segment_size
*= (1024 * 1024);
15895 data
.segment_size
= segment_size
;
15897 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15899 wl_data
->buf
= (char *) mymalloc (segment_size
);
15900 wl_data
->avail
= segment_size
;
15901 wl_data
->incr
= segment_size
;
15905 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15907 data
.wordlist_mode
= wordlist_mode
;
15909 cs_t
*css_buf
= NULL
;
15913 char **masks
= NULL
;
15914 char **dictfiles
= NULL
;
15916 uint mask_from_file
= 0;
15918 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15920 if (wordlist_mode
== WL_MODE_FILE
)
15922 int wls_left
= myargc
- (optind
+ 1);
15924 for (int i
= 0; i
< wls_left
; i
++)
15926 char *l0_filename
= myargv
[optind
+ 1 + i
];
15928 struct stat l0_stat
;
15930 if (stat (l0_filename
, &l0_stat
) == -1)
15932 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15937 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15941 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15945 dictfiles
[dictcnt
- 1] = l0_filename
;
15949 // do not allow --keyspace w/ a directory
15953 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15958 char **dictionary_files
= NULL
;
15960 dictionary_files
= scan_directory (l0_filename
);
15962 if (dictionary_files
!= NULL
)
15964 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15966 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15968 char *l1_filename
= dictionary_files
[d
];
15970 struct stat l1_stat
;
15972 if (stat (l1_filename
, &l1_stat
) == -1)
15974 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15979 if (S_ISREG (l1_stat
.st_mode
))
15981 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15985 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15990 local_free (dictionary_files
);
15996 log_error ("ERROR: No usable dictionary file found.");
16001 else if (wordlist_mode
== WL_MODE_STDIN
)
16006 else if (attack_mode
== ATTACK_MODE_COMBI
)
16010 char *dictfile1
= myargv
[optind
+ 1 + 0];
16011 char *dictfile2
= myargv
[optind
+ 1 + 1];
16013 // find the bigger dictionary and use as base
16018 struct stat tmp_stat
;
16020 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
16022 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16027 if (stat (dictfile1
, &tmp_stat
) == -1)
16029 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16036 if (S_ISDIR (tmp_stat
.st_mode
))
16038 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16045 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16047 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16054 if (stat (dictfile2
, &tmp_stat
) == -1)
16056 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16064 if (S_ISDIR (tmp_stat
.st_mode
))
16066 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16074 data
.combs_cnt
= 1;
16078 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16080 data
.quiet
= quiet
;
16082 if (words1_cnt
== 0)
16084 log_error ("ERROR: %s: empty file", dictfile1
);
16092 data
.combs_cnt
= 1;
16096 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16098 data
.quiet
= quiet
;
16100 if (words2_cnt
== 0)
16102 log_error ("ERROR: %s: empty file", dictfile2
);
16113 data
.dictfile
= dictfile1
;
16114 data
.dictfile2
= dictfile2
;
16116 if (words1_cnt
>= words2_cnt
)
16118 data
.combs_cnt
= words2_cnt
;
16119 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16121 dictfiles
= &data
.dictfile
;
16127 data
.combs_cnt
= words1_cnt
;
16128 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16130 dictfiles
= &data
.dictfile2
;
16134 // we also have to switch wordlist related rules!
16136 char *tmpc
= data
.rule_buf_l
;
16138 data
.rule_buf_l
= data
.rule_buf_r
;
16139 data
.rule_buf_r
= tmpc
;
16141 int tmpi
= data
.rule_len_l
;
16143 data
.rule_len_l
= data
.rule_len_r
;
16144 data
.rule_len_r
= tmpi
;
16147 else if (attack_mode
== ATTACK_MODE_BF
)
16153 if (benchmark
== 0)
16155 mask
= myargv
[optind
+ 1];
16157 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16159 if ((optind
+ 2) <= myargc
)
16161 struct stat file_stat
;
16163 if (stat (mask
, &file_stat
) == -1)
16167 masks
[maskcnt
- 1] = mystrdup (mask
);
16171 int wls_left
= myargc
- (optind
+ 1);
16173 uint masks_avail
= INCR_MASKS
;
16175 for (int i
= 0; i
< wls_left
; i
++)
16179 mask
= myargv
[optind
+ 1 + i
];
16181 if (stat (mask
, &file_stat
) == -1)
16183 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16189 uint is_file
= S_ISREG (file_stat
.st_mode
);
16195 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16197 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16202 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16204 while (!feof (mask_fp
))
16206 memset (line_buf
, 0, HCBUFSIZ
);
16208 int line_len
= fgetl (mask_fp
, line_buf
);
16210 if (line_len
== 0) continue;
16212 if (line_buf
[0] == '#') continue;
16214 if (masks_avail
== maskcnt
)
16216 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16218 masks_avail
+= INCR_MASKS
;
16221 masks
[maskcnt
] = mystrdup (line_buf
);
16232 log_error ("ERROR: %s: unsupported file-type", mask
);
16238 mask_from_file
= 1;
16243 custom_charset_1
= (char *) "?l?d?u";
16244 custom_charset_2
= (char *) "?l?d";
16245 custom_charset_3
= (char *) "?l?d*!$@_";
16247 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16248 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16249 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16251 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16253 wordlist_mode
= WL_MODE_MASK
;
16255 data
.wordlist_mode
= wordlist_mode
;
16265 * generate full masks and charsets
16268 masks
= (char **) mymalloc (sizeof (char *));
16272 case 1731: pw_min
= 5;
16274 mask
= mystrdup ("?b?b?b?b?b");
16276 case 12500: pw_min
= 5;
16278 mask
= mystrdup ("?b?b?b?b?b");
16280 default: pw_min
= 7;
16282 mask
= mystrdup ("?b?b?b?b?b?b?b");
16288 masks
[maskcnt
- 1] = mystrdup (mask
);
16290 wordlist_mode
= WL_MODE_MASK
;
16292 data
.wordlist_mode
= wordlist_mode
;
16297 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16301 if (increment_min
> pw_min
) pw_min
= increment_min
;
16303 if (increment_max
< pw_max
) pw_max
= increment_max
;
16306 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16308 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16312 char *mask
= myargv
[myargc
- 1];
16316 masks
= (char **) mymalloc (1 * sizeof (char *));
16320 struct stat file_stat
;
16322 if (stat (mask
, &file_stat
) == -1)
16326 masks
[maskcnt
- 1] = mystrdup (mask
);
16330 uint is_file
= S_ISREG (file_stat
.st_mode
);
16336 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16338 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16343 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16345 uint masks_avail
= 1;
16347 while (!feof (mask_fp
))
16349 memset (line_buf
, 0, HCBUFSIZ
);
16351 int line_len
= fgetl (mask_fp
, line_buf
);
16353 if (line_len
== 0) continue;
16355 if (line_buf
[0] == '#') continue;
16357 if (masks_avail
== maskcnt
)
16359 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16361 masks_avail
+= INCR_MASKS
;
16364 masks
[maskcnt
] = mystrdup (line_buf
);
16373 mask_from_file
= 1;
16379 masks
[maskcnt
- 1] = mystrdup (mask
);
16385 int wls_left
= myargc
- (optind
+ 2);
16387 for (int i
= 0; i
< wls_left
; i
++)
16389 char *filename
= myargv
[optind
+ 1 + i
];
16391 struct stat file_stat
;
16393 if (stat (filename
, &file_stat
) == -1)
16395 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16400 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16404 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16408 dictfiles
[dictcnt
- 1] = filename
;
16412 // do not allow --keyspace w/ a directory
16416 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16421 char **dictionary_files
= NULL
;
16423 dictionary_files
= scan_directory (filename
);
16425 if (dictionary_files
!= NULL
)
16427 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16429 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16431 char *l1_filename
= dictionary_files
[d
];
16433 struct stat l1_stat
;
16435 if (stat (l1_filename
, &l1_stat
) == -1)
16437 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16442 if (S_ISREG (l1_stat
.st_mode
))
16444 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16448 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16453 local_free (dictionary_files
);
16459 log_error ("ERROR: No usable dictionary file found.");
16468 uint mask_min
= increment_min
; // we can't reject smaller masks here
16469 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16471 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16473 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16475 if (cur_mask
== NULL
) break;
16477 masks
[maskcnt
] = cur_mask
;
16481 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16485 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16487 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16491 char *mask
= myargv
[optind
+ 1 + 0];
16495 masks
= (char **) mymalloc (1 * sizeof (char *));
16499 struct stat file_stat
;
16501 if (stat (mask
, &file_stat
) == -1)
16505 masks
[maskcnt
- 1] = mystrdup (mask
);
16509 uint is_file
= S_ISREG (file_stat
.st_mode
);
16515 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16517 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16522 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16524 uint masks_avail
= 1;
16526 while (!feof (mask_fp
))
16528 memset (line_buf
, 0, HCBUFSIZ
);
16530 int line_len
= fgetl (mask_fp
, line_buf
);
16532 if (line_len
== 0) continue;
16534 if (line_buf
[0] == '#') continue;
16536 if (masks_avail
== maskcnt
)
16538 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16540 masks_avail
+= INCR_MASKS
;
16543 masks
[maskcnt
] = mystrdup (line_buf
);
16552 mask_from_file
= 1;
16558 masks
[maskcnt
- 1] = mystrdup (mask
);
16564 int wls_left
= myargc
- (optind
+ 2);
16566 for (int i
= 0; i
< wls_left
; i
++)
16568 char *filename
= myargv
[optind
+ 2 + i
];
16570 struct stat file_stat
;
16572 if (stat (filename
, &file_stat
) == -1)
16574 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16579 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16583 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16587 dictfiles
[dictcnt
- 1] = filename
;
16591 // do not allow --keyspace w/ a directory
16595 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16600 char **dictionary_files
= NULL
;
16602 dictionary_files
= scan_directory (filename
);
16604 if (dictionary_files
!= NULL
)
16606 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16608 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16610 char *l1_filename
= dictionary_files
[d
];
16612 struct stat l1_stat
;
16614 if (stat (l1_filename
, &l1_stat
) == -1)
16616 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16621 if (S_ISREG (l1_stat
.st_mode
))
16623 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16627 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16632 local_free (dictionary_files
);
16638 log_error ("ERROR: No usable dictionary file found.");
16647 uint mask_min
= increment_min
; // we can't reject smaller masks here
16648 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16650 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16652 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16654 if (cur_mask
== NULL
) break;
16656 masks
[maskcnt
] = cur_mask
;
16660 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16665 data
.pw_min
= pw_min
;
16666 data
.pw_max
= pw_max
;
16672 if (weak_hash_threshold
>= salts_cnt
)
16674 hc_device_param_t
*device_param
= NULL
;
16676 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16678 device_param
= &data
.devices_param
[device_id
];
16680 if (device_param
->skipped
) continue;
16685 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16687 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16689 weak_hash_check (device_param
, salt_pos
);
16692 // Display hack, guarantee that there is at least one \r before real start
16694 //if (data.quiet == 0) log_info ("");
16698 * status and monitor threads
16701 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16703 hc_thread_t i_thread
= 0;
16705 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16707 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16710 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16712 uint ni_threads_cnt
= 0;
16714 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16716 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16726 if (outfile_check_timer
!= 0)
16728 if (data
.outfile_check_directory
!= NULL
)
16730 if ((hash_mode
!= 5200) &&
16731 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16732 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16733 (hash_mode
!= 9000))
16735 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16741 outfile_check_timer
= 0;
16746 outfile_check_timer
= 0;
16752 * Inform the user if we got some hashes remove because of the pot file remove feature
16755 if (data
.quiet
== 0)
16757 if (potfile_remove_cracks
> 0)
16759 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16760 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16764 data
.outfile_check_timer
= outfile_check_timer
;
16770 char **induction_dictionaries
= NULL
;
16772 int induction_dictionaries_cnt
= 0;
16774 hcstat_table_t
*root_table_buf
= NULL
;
16775 hcstat_table_t
*markov_table_buf
= NULL
;
16777 uint initial_restore_done
= 0;
16779 data
.maskcnt
= maskcnt
;
16781 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16783 if (data
.devices_status
== STATUS_CRACKED
) break;
16785 data
.devices_status
= STATUS_INIT
;
16787 if (maskpos
> rd
->maskpos
)
16792 rd
->maskpos
= maskpos
;
16793 data
.maskpos
= maskpos
;
16795 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16797 char *mask
= masks
[maskpos
];
16799 if (mask_from_file
== 1)
16801 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16806 uint mask_offset
= 0;
16808 uint separator_cnt
;
16810 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16812 str_ptr
= strstr (mask
+ mask_offset
, ",");
16814 if (str_ptr
== NULL
) break;
16816 str_pos
= str_ptr
- mask
;
16818 // escaped separator, i.e. "\,"
16822 if (mask
[str_pos
- 1] == '\\')
16826 mask_offset
= str_pos
+ 1;
16832 // reset the offset
16836 mask
[str_pos
] = '\0';
16838 switch (separator_cnt
)
16841 mp_reset_usr (mp_usr
, 0);
16843 custom_charset_1
= mask
;
16844 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16848 mp_reset_usr (mp_usr
, 1);
16850 custom_charset_2
= mask
;
16851 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16855 mp_reset_usr (mp_usr
, 2);
16857 custom_charset_3
= mask
;
16858 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16862 mp_reset_usr (mp_usr
, 3);
16864 custom_charset_4
= mask
;
16865 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16869 mask
= mask
+ str_pos
+ 1;
16873 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16877 local_free (css_buf
);
16878 local_free (data
.root_css_buf
);
16879 local_free (data
.markov_css_buf
);
16881 local_free (masks
[maskpos
- 1]);
16884 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16887 data
.css_cnt
= css_cnt
;
16888 data
.css_buf
= css_buf
;
16890 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16892 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16894 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16895 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16897 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16899 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16901 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16902 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16904 data
.root_css_buf
= root_css_buf
;
16905 data
.markov_css_buf
= markov_css_buf
;
16907 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16909 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16911 local_free (root_table_buf
);
16912 local_free (markov_table_buf
);
16916 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16918 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16920 if (device_param
->skipped
) continue;
16922 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16923 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16924 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16926 device_param
->kernel_params_mp_buf64
[3] = 0;
16927 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16928 device_param
->kernel_params_mp_buf32
[5] = 0;
16929 device_param
->kernel_params_mp_buf32
[6] = 0;
16930 device_param
->kernel_params_mp_buf32
[7] = 0;
16932 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16934 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16935 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16936 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16937 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16939 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16941 device_param
->kernel_params_mp_buf32
[5] = 0;
16942 device_param
->kernel_params_mp_buf32
[6] = 0;
16943 device_param
->kernel_params_mp_buf32
[7] = 0;
16946 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
]);
16947 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
]);
16948 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
]);
16950 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
);
16951 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
);
16954 else if (attack_mode
== ATTACK_MODE_BF
)
16956 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16960 for (uint i
= 0; i
< dictcnt
; i
++)
16962 local_free (dictfiles
[i
]);
16965 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16967 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16969 if (l1_filename
== NULL
) break;
16973 dictfiles
[dictcnt
- 1] = l1_filename
;
16980 dictfiles
[dictcnt
- 1] = mask
;
16985 log_error ("ERROR: Mask is too small");
16992 free (induction_dictionaries
);
16994 // induction_dictionaries_cnt = 0; // implied
16996 if (attack_mode
!= ATTACK_MODE_BF
)
17000 induction_dictionaries
= scan_directory (induction_directory
);
17002 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17006 if (induction_dictionaries_cnt
)
17008 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17012 * prevent the user from using --keyspace together w/ maskfile and or dictfile
17016 if ((maskcnt
> 1) || (dictcnt
> 1))
17018 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
17024 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
17026 char *subid
= logfile_generate_subid ();
17028 data
.subid
= subid
;
17030 logfile_sub_msg ("START");
17032 data
.devices_status
= STATUS_INIT
;
17034 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17035 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17036 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17038 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17042 data
.cpt_start
= time (NULL
);
17044 data
.cpt_total
= 0;
17046 if (data
.restore
== 0)
17048 rd
->words_cur
= skip
;
17055 data
.ms_paused
= 0;
17057 data
.words_cur
= rd
->words_cur
;
17059 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17061 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17063 if (device_param
->skipped
) continue;
17065 device_param
->speed_pos
= 0;
17067 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17068 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17070 device_param
->exec_pos
= 0;
17072 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17074 device_param
->kernel_power
= device_param
->kernel_power_user
;
17076 device_param
->outerloop_pos
= 0;
17077 device_param
->outerloop_left
= 0;
17078 device_param
->innerloop_pos
= 0;
17079 device_param
->innerloop_left
= 0;
17081 // some more resets:
17083 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17085 device_param
->pws_cnt
= 0;
17087 device_param
->words_off
= 0;
17088 device_param
->words_done
= 0;
17091 data
.kernel_power_div
= 0;
17093 // figure out some workload
17095 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17097 if (data
.wordlist_mode
== WL_MODE_FILE
)
17099 char *dictfile
= NULL
;
17101 if (induction_dictionaries_cnt
)
17103 dictfile
= induction_dictionaries
[0];
17107 dictfile
= dictfiles
[dictpos
];
17110 data
.dictfile
= dictfile
;
17112 logfile_sub_string (dictfile
);
17114 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17116 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17119 FILE *fd2
= fopen (dictfile
, "rb");
17123 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17128 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17132 if (data
.words_cnt
== 0)
17134 if (data
.devices_status
== STATUS_CRACKED
) break;
17135 if (data
.devices_status
== STATUS_ABORTED
) break;
17143 else if (attack_mode
== ATTACK_MODE_COMBI
)
17145 char *dictfile
= data
.dictfile
;
17146 char *dictfile2
= data
.dictfile2
;
17148 logfile_sub_string (dictfile
);
17149 logfile_sub_string (dictfile2
);
17151 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17153 FILE *fd2
= fopen (dictfile
, "rb");
17157 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17162 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17166 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17168 FILE *fd2
= fopen (dictfile2
, "rb");
17172 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17177 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17182 if (data
.words_cnt
== 0)
17184 if (data
.devices_status
== STATUS_CRACKED
) break;
17185 if (data
.devices_status
== STATUS_ABORTED
) break;
17192 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17194 char *dictfile
= NULL
;
17196 if (induction_dictionaries_cnt
)
17198 dictfile
= induction_dictionaries
[0];
17202 dictfile
= dictfiles
[dictpos
];
17205 data
.dictfile
= dictfile
;
17207 char *mask
= data
.mask
;
17209 logfile_sub_string (dictfile
);
17210 logfile_sub_string (mask
);
17212 FILE *fd2
= fopen (dictfile
, "rb");
17216 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17221 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17225 if (data
.words_cnt
== 0)
17227 if (data
.devices_status
== STATUS_CRACKED
) break;
17228 if (data
.devices_status
== STATUS_ABORTED
) break;
17235 else if (attack_mode
== ATTACK_MODE_BF
)
17237 local_free (css_buf
);
17238 local_free (data
.root_css_buf
);
17239 local_free (data
.markov_css_buf
);
17241 char *mask
= dictfiles
[dictpos
];
17243 logfile_sub_string (mask
);
17247 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17249 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17251 uint css_cnt_unicode
= css_cnt
* 2;
17253 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17255 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17257 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17259 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17260 css_buf_unicode
[j
+ 1].cs_len
= 1;
17265 css_buf
= css_buf_unicode
;
17266 css_cnt
= css_cnt_unicode
;
17269 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17271 uint mask_min
= pw_min
;
17272 uint mask_max
= pw_max
;
17274 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17280 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17282 if (css_cnt
< mask_min
)
17284 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17287 if (css_cnt
> mask_max
)
17289 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17292 // skip to next mask
17296 rd
->dictpos
= dictpos
;
17298 logfile_sub_msg ("STOP");
17303 uint save_css_cnt
= css_cnt
;
17305 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17307 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17309 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17310 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17312 uint css_cnt_salt
= css_cnt
+ salt_len
;
17314 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17316 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17318 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17320 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17321 css_buf_salt
[j
].cs_len
= 1;
17326 css_buf
= css_buf_salt
;
17327 css_cnt
= css_cnt_salt
;
17332 data
.css_cnt
= css_cnt
;
17333 data
.css_buf
= css_buf
;
17335 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17337 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17339 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17341 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17342 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17344 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17346 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17348 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17349 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17351 data
.root_css_buf
= root_css_buf
;
17352 data
.markov_css_buf
= markov_css_buf
;
17354 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17356 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17358 local_free (root_table_buf
);
17359 local_free (markov_table_buf
);
17363 uint css_cnt_l
= css_cnt
;
17366 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17368 if (save_css_cnt
< 6)
17372 else if (save_css_cnt
== 6)
17378 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17380 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17391 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17406 /* unfinished code?
17407 int sum = css_buf[css_cnt_r - 1].cs_len;
17409 for (uint i = 1; i < 4 && i < css_cnt; i++)
17411 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17415 sum *= css_buf[css_cnt_r - 1].cs_len;
17420 css_cnt_l
-= css_cnt_r
;
17422 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17424 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17426 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17428 if (device_param
->skipped
) continue;
17430 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17431 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17432 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17434 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17435 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17436 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17437 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17438 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17439 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17441 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17442 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17443 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17444 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17446 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17447 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17448 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17450 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17451 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17452 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17453 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17454 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17456 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
]);
17457 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
]);
17458 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
]);
17460 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
]);
17461 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
]);
17462 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
]);
17464 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
);
17465 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
);
17469 u64 words_base
= data
.words_cnt
;
17471 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17473 if (data
.kernel_rules_cnt
)
17475 words_base
/= data
.kernel_rules_cnt
;
17478 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17480 if (data
.combs_cnt
)
17482 words_base
/= data
.combs_cnt
;
17485 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17489 words_base
/= data
.bfs_cnt
;
17493 data
.words_base
= words_base
;
17497 log_info ("%llu", (unsigned long long int) words_base
);
17502 if (data
.words_cur
> data
.words_base
)
17504 log_error ("ERROR: restore value greater keyspace");
17509 if (data
.words_cur
)
17511 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17513 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17515 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17518 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17520 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17522 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17525 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17527 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17529 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17535 * Inform user about possible slow speeds
17538 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17540 if (data
.words_base
< kernel_power_all
)
17544 log_info ("ATTENTION!");
17545 log_info (" The wordlist or mask you are using is too small.");
17546 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17547 log_info (" The cracking speed will drop.");
17548 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17555 * Update loopback file
17564 uint random_num
= get_random_num (0, 9999);
17566 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17568 data
.loopback_file
= loopback_file
;
17572 * Update dictionary statistic
17577 dictstat_fp
= fopen (dictstat
, "wb");
17581 lock_file (dictstat_fp
);
17583 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17585 fclose (dictstat_fp
);
17589 data
.devices_status
= STATUS_RUNNING
;
17591 if (initial_restore_done
== 0)
17593 if (data
.restore_disable
== 0) cycle_restore ();
17595 initial_restore_done
= 1;
17598 hc_timer_set (&data
.timer_running
);
17600 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17602 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17604 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17605 if (quiet
== 0) fflush (stdout
);
17608 else if (wordlist_mode
== WL_MODE_STDIN
)
17610 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17611 if (data
.quiet
== 0) log_info ("");
17614 time_t runtime_start
;
17616 time (&runtime_start
);
17618 data
.runtime_start
= runtime_start
;
17621 * create cracker threads
17624 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17626 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17628 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17630 if (wordlist_mode
== WL_MODE_STDIN
)
17632 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17636 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17640 // wait for crack threads to exit
17642 hc_thread_wait (data
.devices_cnt
, c_threads
);
17644 local_free (c_threads
);
17650 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17652 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17654 if (data
.devices_status
== STATUS_CRACKED
) break;
17655 if (data
.devices_status
== STATUS_ABORTED
) break;
17657 if (data
.devices_status
== STATUS_BYPASS
)
17659 data
.devices_status
= STATUS_RUNNING
;
17662 if (induction_dictionaries_cnt
)
17664 unlink (induction_dictionaries
[0]);
17667 free (induction_dictionaries
);
17669 if (attack_mode
!= ATTACK_MODE_BF
)
17671 induction_dictionaries
= scan_directory (induction_directory
);
17673 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17676 if (benchmark
== 0)
17678 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17680 if (quiet
== 0) clear_prompt ();
17682 if (quiet
== 0) log_info ("");
17690 if (quiet
== 0) status_display ();
17693 if (quiet
== 0) log_info ("");
17697 if (attack_mode
== ATTACK_MODE_BF
)
17701 rd
->dictpos
= dictpos
;
17705 if (induction_dictionaries_cnt
)
17707 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17713 rd
->dictpos
= dictpos
;
17717 time_t runtime_stop
;
17719 time (&runtime_stop
);
17721 data
.runtime_stop
= runtime_stop
;
17723 logfile_sub_uint (runtime_start
);
17724 logfile_sub_uint (runtime_stop
);
17726 logfile_sub_msg ("STOP");
17728 global_free (subid
);
17731 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17733 if (data
.devices_status
== STATUS_CRACKED
) break;
17734 if (data
.devices_status
== STATUS_ABORTED
) break;
17735 if (data
.devices_status
== STATUS_QUIT
) break;
17737 if (data
.devices_status
== STATUS_BYPASS
)
17739 data
.devices_status
= STATUS_RUNNING
;
17743 // 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
17745 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17747 if (data
.wordlist_mode
== WL_MODE_FILE
)
17749 if (data
.dictfile
== NULL
)
17751 if (dictfiles
!= NULL
)
17753 data
.dictfile
= dictfiles
[0];
17755 hc_timer_set (&data
.timer_running
);
17760 // NOTE: combi is okay because it is already set beforehand
17761 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17763 if (data
.dictfile
== NULL
)
17765 if (dictfiles
!= NULL
)
17767 hc_timer_set (&data
.timer_running
);
17769 data
.dictfile
= dictfiles
[0];
17773 else if (attack_mode
== ATTACK_MODE_BF
)
17775 if (data
.mask
== NULL
)
17777 hc_timer_set (&data
.timer_running
);
17779 data
.mask
= masks
[0];
17783 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17785 data
.devices_status
= STATUS_EXHAUSTED
;
17788 // if cracked / aborted remove last induction dictionary
17790 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17792 struct stat induct_stat
;
17794 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17796 unlink (induction_dictionaries
[file_pos
]);
17800 // wait for non-interactive threads
17802 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17804 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17807 local_free (ni_threads
);
17809 // wait for interactive threads
17811 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17813 hc_thread_wait (1, &i_thread
);
17816 // we dont need restore file anymore
17817 if (data
.restore_disable
== 0)
17819 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17821 unlink (eff_restore_file
);
17822 unlink (new_restore_file
);
17830 // finally save left hashes
17832 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17841 if (benchmark
== 1)
17843 status_benchmark ();
17845 if (machine_readable
== 0)
17852 if (quiet
== 0) clear_prompt ();
17854 if (quiet
== 0) log_info ("");
17862 if (quiet
== 0) status_display ();
17865 if (quiet
== 0) log_info ("");
17868 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17870 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17872 if (device_param
->skipped
) continue;
17874 local_free (device_param
->combs_buf
);
17876 local_free (device_param
->hooks_buf
);
17878 local_free (device_param
->device_name
);
17880 local_free (device_param
->device_name_chksum
);
17882 local_free (device_param
->device_version
);
17884 local_free (device_param
->driver_version
);
17886 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17887 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17888 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17889 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17890 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17891 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17892 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17893 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17894 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17895 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17896 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17897 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17898 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17899 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17900 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17901 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17902 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17903 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17904 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17905 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17906 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17907 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17908 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17909 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17910 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17911 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17912 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17913 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17914 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17916 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17917 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17918 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17919 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17920 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17921 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17922 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17923 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17924 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17925 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17926 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17928 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17929 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17930 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17932 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17933 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17936 // reset default fan speed
17939 if (gpu_temp_disable
== 0)
17942 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17944 hc_thread_mutex_lock (mux_adl
);
17946 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17948 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17950 if (device_param
->skipped
) continue;
17952 if (data
.hm_device
[device_id
].fan_supported
== 1)
17954 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17956 if (fanspeed
== -1) continue;
17958 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17960 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17964 hc_thread_mutex_unlock (mux_adl
);
17970 // reset power tuning
17972 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17974 hc_thread_mutex_lock (mux_adl
);
17976 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17978 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17980 if (device_param
->skipped
) continue;
17982 if (data
.hm_device
[device_id
].od_version
== 6)
17984 // check powertune capabilities first, if not available then skip device
17986 int powertune_supported
= 0;
17988 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17990 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17995 if (powertune_supported
!= 0)
17997 // powercontrol settings
17999 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
)
18001 log_info ("ERROR: Failed to restore the ADL PowerControl values");
18008 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
18010 performance_state
->iNumberOfPerformanceLevels
= 2;
18012 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
18013 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
18014 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
18015 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
18017 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
)
18019 log_info ("ERROR: Failed to restore ADL performance state");
18024 local_free (performance_state
);
18029 hc_thread_mutex_unlock (mux_adl
);
18033 if (gpu_temp_disable
== 0)
18035 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
18038 #if defined(LINUX) && defined(HAVE_NVML)
18040 hm_NVML_nvmlShutdown (data
.hm_nv
);
18042 nvml_close (data
.hm_nv
);
18044 #elif defined(WIN) && (HAVE_NVAPI)
18046 hm_NvAPI_Unload (data
.hm_nv
);
18048 nvapi_close (data
.hm_nv
);
18059 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
18061 adl_close (data
.hm_amd
);
18062 data
.hm_amd
= NULL
;
18066 #endif // HAVE_HWMON
18070 local_free (masks
);
18072 local_free (dictstat_base
);
18074 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18076 pot_t
*pot_ptr
= &pot
[pot_pos
];
18078 hash_t
*hash
= &pot_ptr
->hash
;
18080 local_free (hash
->digest
);
18084 local_free (hash
->salt
);
18090 local_free (all_kernel_rules_cnt
);
18091 local_free (all_kernel_rules_buf
);
18093 local_free (wl_data
->buf
);
18094 local_free (wl_data
);
18096 local_free (bitmap_s1_a
);
18097 local_free (bitmap_s1_b
);
18098 local_free (bitmap_s1_c
);
18099 local_free (bitmap_s1_d
);
18100 local_free (bitmap_s2_a
);
18101 local_free (bitmap_s2_b
);
18102 local_free (bitmap_s2_c
);
18103 local_free (bitmap_s2_d
);
18106 local_free (temp_retain_fanspeed_value
);
18108 local_free (od_clock_mem_status
);
18109 local_free (od_power_control_status
);
18113 global_free (devices_param
);
18115 global_free (kernel_rules_buf
);
18117 global_free (root_css_buf
);
18118 global_free (markov_css_buf
);
18120 global_free (digests_buf
);
18121 global_free (digests_shown
);
18122 global_free (digests_shown_tmp
);
18124 global_free (salts_buf
);
18125 global_free (salts_shown
);
18127 global_free (esalts_buf
);
18129 global_free (words_progress_done
);
18130 global_free (words_progress_rejected
);
18131 global_free (words_progress_restored
);
18133 if (pot_fp
) fclose (pot_fp
);
18135 if (data
.devices_status
== STATUS_QUIT
) break;
18138 // destroy others mutex
18140 hc_thread_mutex_delete (mux_dispatcher
);
18141 hc_thread_mutex_delete (mux_counter
);
18142 hc_thread_mutex_delete (mux_display
);
18143 hc_thread_mutex_delete (mux_adl
);
18147 local_free (eff_restore_file
);
18148 local_free (new_restore_file
);
18154 tuning_db_destroy (tuning_db
);
18158 local_free (loopback_file
);
18160 if (loopback
== 1) unlink (loopback_file
);
18162 // induction directory
18164 if (induction_dir
== NULL
)
18166 if (attack_mode
!= ATTACK_MODE_BF
)
18168 if (rmdir (induction_directory
) == -1)
18170 if (errno
== ENOENT
)
18172 // good, we can ignore
18174 else if (errno
== ENOTEMPTY
)
18176 // good, we can ignore
18180 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18186 local_free (induction_directory
);
18190 // outfile-check directory
18192 if (outfile_check_dir
== NULL
)
18194 if (rmdir (outfile_check_directory
) == -1)
18196 if (errno
== ENOENT
)
18198 // good, we can ignore
18200 else if (errno
== ENOTEMPTY
)
18202 // good, we can ignore
18206 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18212 local_free (outfile_check_directory
);
18219 logfile_top_uint (proc_start
);
18220 logfile_top_uint (proc_stop
);
18222 logfile_top_msg ("STOP");
18224 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18225 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18227 if (data
.ocl
) ocl_close (data
.ocl
);
18229 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18230 if (data
.devices_status
== STATUS_QUIT
) return 2;
18231 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18232 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18233 if (data
.devices_status
== STATUS_CRACKED
) return 0;