2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 0
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 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",
414 " --powertune-enable | | Enable power tuning, restores settings when finished |",
416 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
417 " -s, --skip | Num | Skip X words from the start | -s 1000000",
418 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
419 " --keyspace | | Show keyspace base:mod values and quit |",
420 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
421 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
422 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
423 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
424 " --generate-rules-func-min | Num | Force min X funcs per rule |",
425 " --generate-rules-func-max | Num | Force max X funcs per rule |",
426 " --generate-rules-seed | Num | Force RNG seed set to X |",
427 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
428 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
429 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
430 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
431 " -i, --increment | | Enable mask increment mode |",
432 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
433 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
435 "- [ Hash modes ] -",
437 " # | Name | Category",
438 " ======+==================================================+======================================",
439 " 900 | MD4 | Raw Hash",
440 " 0 | MD5 | Raw Hash",
441 " 5100 | Half MD5 | Raw Hash",
442 " 100 | SHA1 | Raw Hash",
443 " 10800 | SHA-384 | Raw Hash",
444 " 1400 | SHA-256 | Raw Hash",
445 " 1700 | SHA-512 | Raw Hash",
446 " 5000 | SHA-3(Keccak) | Raw Hash",
447 " 10100 | SipHash | Raw Hash",
448 " 6000 | RipeMD160 | Raw Hash",
449 " 6100 | Whirlpool | Raw Hash",
450 " 6900 | GOST R 34.11-94 | Raw Hash",
451 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
452 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
453 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
454 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
455 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
456 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
457 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
458 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
459 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
460 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
461 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
462 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
463 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
464 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
465 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
466 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
467 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
469 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
471 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
472 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
473 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
474 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
475 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
476 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
477 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
478 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
479 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
480 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
481 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
482 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
483 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
484 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
485 " 400 | phpass | Generic KDF",
486 " 8900 | scrypt | Generic KDF",
487 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
488 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
489 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
490 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
491 " 23 | Skype | Network protocols",
492 " 2500 | WPA/WPA2 | Network protocols",
493 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
494 " 5300 | IKE-PSK MD5 | Network protocols",
495 " 5400 | IKE-PSK SHA1 | Network protocols",
496 " 5500 | NetNTLMv1 | Network protocols",
497 " 5500 | NetNTLMv1 + ESS | Network protocols",
498 " 5600 | NetNTLMv2 | Network protocols",
499 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
500 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
501 " 8300 | DNSSEC (NSEC3) | Network protocols",
502 " 10200 | Cram MD5 | Network protocols",
503 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
504 " 11200 | MySQL CRAM (SHA1) | Network protocols",
505 " 11400 | SIP digest authentication (MD5) | Network protocols",
506 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
507 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
508 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
509 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
510 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
511 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
512 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
513 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
514 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
515 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
516 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
517 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
518 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
519 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
520 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
521 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
522 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
523 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
524 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
525 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
526 " 12 | PostgreSQL | Database Server",
527 " 131 | MSSQL(2000) | Database Server",
528 " 132 | MSSQL(2005) | Database Server",
529 " 1731 | MSSQL(2012) | Database Server",
530 " 1731 | MSSQL(2014) | Database Server",
531 " 200 | MySQL323 | Database Server",
532 " 300 | MySQL4.1/MySQL5 | Database Server",
533 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
534 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
535 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
536 " 8000 | Sybase ASE | Database Server",
537 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
538 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
539 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
540 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
541 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
542 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
543 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
544 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
545 " 11500 | CRC32 | Checksums",
546 " 3000 | LM | Operating-Systems",
547 " 1000 | NTLM | Operating-Systems",
548 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
549 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
550 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
551 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
552 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
553 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
554 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
555 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
556 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
557 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
558 " 1722 | OSX v10.7 | Operating-Systems",
559 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
560 " 6300 | AIX {smd5} | Operating-Systems",
561 " 6700 | AIX {ssha1} | Operating-Systems",
562 " 6400 | AIX {ssha256} | Operating-Systems",
563 " 6500 | AIX {ssha512} | Operating-Systems",
564 " 2400 | Cisco-PIX | Operating-Systems",
565 " 2410 | Cisco-ASA | Operating-Systems",
566 " 500 | Cisco-IOS $1$ | Operating-Systems",
567 " 5700 | Cisco-IOS $4$ | Operating-Systems",
568 " 9200 | Cisco-IOS $8$ | Operating-Systems",
569 " 9300 | Cisco-IOS $9$ | Operating-Systems",
570 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
571 " 501 | Juniper IVE | Operating-Systems",
572 " 5800 | Android PIN | Operating-Systems",
573 " 8100 | Citrix Netscaler | Operating-Systems",
574 " 8500 | RACF | Operating-Systems",
575 " 7200 | GRUB 2 | Operating-Systems",
576 " 9900 | Radmin2 | Operating-Systems",
577 " 125 | ArubaOS | Operating-Systems",
578 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
579 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
580 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
581 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
582 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
583 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
584 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
585 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
586 " 11600 | 7-Zip | Archives",
587 " 12500 | RAR3-hp | Archives",
588 " 13000 | RAR5 | Archives",
589 " 13200 | AxCrypt | Archives",
590 " 13300 | AxCrypt in memory SHA1 | Archives",
591 " 13600 | WinZip | Archives",
592 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
593 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
594 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
595 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
596 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
597 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
598 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
600 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
601 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
606 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
607 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
608 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
609 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
610 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
611 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
612 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
613 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
614 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
615 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
616 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
617 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
618 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
626 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
627 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
628 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
629 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
630 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
631 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
632 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
633 " 9400 | MS Office 2007 | Documents",
634 " 9500 | MS Office 2010 | Documents",
635 " 9600 | MS Office 2013 | Documents",
636 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
637 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
638 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
639 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
640 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
641 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
642 " 9000 | Password Safe v2 | Password Managers",
643 " 5200 | Password Safe v3 | Password Managers",
644 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
645 " 6600 | 1Password, agilekeychain | Password Managers",
646 " 8200 | 1Password, cloudkeychain | Password Managers",
647 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
648 " 12700 | Blockchain, My Wallet | Password Managers",
649 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
651 "- [ Outfile Formats ] -",
657 " 3 | hash[:salt]:plain",
659 " 5 | hash[:salt]:hex_plain",
660 " 6 | plain:hex_plain",
661 " 7 | hash[:salt]:plain:hex_plain",
663 " 9 | hash[:salt]:crack_pos",
664 " 10 | plain:crack_pos",
665 " 11 | hash[:salt]:plain:crack_pos",
666 " 12 | hex_plain:crack_pos",
667 " 13 | hash[:salt]:hex_plain:crack_pos",
668 " 14 | plain:hex_plain:crack_pos",
669 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
671 "- [ Rule Debugging Modes ] -",
676 " 2 | Original-Word",
677 " 3 | Original-Word:Finding-Rule",
678 " 4 | Original-Word:Finding-Rule:Processed-Word",
680 "- [ Attack Modes ] -",
687 " 6 | Hybrid Wordlist + Mask",
688 " 7 | Hybrid Mask + Wordlist",
690 "- [ Built-in Charsets ] -",
694 " l | abcdefghijklmnopqrstuvwxyz",
695 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
697 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
701 "- [ OpenCL Device Types ] -",
704 " ===+=============",
707 " 3 | FPGA, DSP, Co-Processor",
709 "- [ Workload Profiles ] -",
711 " # | Performance | Runtime | Power Consumption | Desktop Impact",
712 " ===+=============+=========+===================+=================",
713 " 1 | Low | 2 ms | Low | Minimal",
714 " 2 | Default | 12 ms | Economic | Noticeable",
715 " 3 | High | 96 ms | High | Unresponsive",
716 " 4 | Nightmare | 480 ms | Insane | Headless",
718 "If you have no idea what just happened then visit the following pages:",
720 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
721 "* https://hashcat.net/wiki/#frequently_asked_questions",
727 * hashcat specific functions
730 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
732 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
734 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
736 double exec_ms_sum
= 0;
740 for (int i
= 0; i
< last_num_entries
; i
++)
742 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
746 exec_ms_sum
+= exec_ms
;
752 if (exec_ms_cnt
== 0) return 0;
754 return exec_ms_sum
/ exec_ms_cnt
;
757 void status_display_machine_readable ()
761 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
767 fprintf (out
, "SPEED\t");
769 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
771 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
773 if (device_param
->skipped
) continue;
778 for (int i
= 0; i
< SPEED_CACHE
; i
++)
780 speed_cnt
+= device_param
->speed_cnt
[i
];
781 speed_ms
+= device_param
->speed_ms
[i
];
784 speed_cnt
/= SPEED_CACHE
;
785 speed_ms
/= SPEED_CACHE
;
787 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
794 fprintf (out
, "EXEC_RUNTIME\t");
796 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
798 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
800 if (device_param
->skipped
) continue;
802 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
804 fprintf (out
, "%f\t", exec_ms_avg
);
811 u64 words_cur
= get_lowest_words_done ();
813 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
819 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
822 u64 all_rejected
= 0;
823 u64 all_restored
= 0;
825 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
827 all_done
+= data
.words_progress_done
[salt_pos
];
828 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
829 all_restored
+= data
.words_progress_restored
[salt_pos
];
832 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
833 u64 progress_end
= progress_total
;
835 u64 progress_skip
= 0;
839 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
841 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
842 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
843 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
848 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
850 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
851 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
852 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
855 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
856 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
858 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
864 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
865 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
872 if (data
.gpu_temp_disable
== 0)
874 fprintf (out
, "TEMP\t");
876 hc_thread_mutex_lock (mux_adl
);
878 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
880 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
882 if (device_param
->skipped
) continue;
884 int temp
= hm_get_temperature_with_device_id (device_id
);
886 fprintf (out
, "%d\t", temp
);
889 hc_thread_mutex_unlock (mux_adl
);
909 void status_display ()
911 if (data
.devices_status
== STATUS_INIT
) return;
912 if (data
.devices_status
== STATUS_STARTING
) return;
913 if (data
.devices_status
== STATUS_BYPASS
) return;
915 if (data
.machine_readable
== 1)
917 status_display_machine_readable ();
922 char tmp_buf
[1000] = { 0 };
926 log_info ("Session.Name...: %s", data
.session
);
928 char *status_type
= strstatus (data
.devices_status
);
930 uint hash_mode
= data
.hash_mode
;
932 char *hash_type
= strhashtype (hash_mode
); // not a bug
934 log_info ("Status.........: %s", status_type
);
940 if (data
.rp_files_cnt
)
944 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
946 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
949 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
951 log_info ("Rules.Type.....: %s", tmp_buf
);
958 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
960 if (data
.rp_gen_seed
)
962 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
970 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
972 if (data
.wordlist_mode
== WL_MODE_FILE
)
974 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
976 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
978 log_info ("Input.Mode.....: Pipe");
981 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
983 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
984 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
986 else if (data
.attack_mode
== ATTACK_MODE_BF
)
988 char *mask
= data
.mask
;
992 uint mask_len
= data
.css_cnt
;
994 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
998 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1000 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1002 mask_len
-= data
.salts_buf
[0].salt_len
;
1006 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1008 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1011 if (data
.maskcnt
> 1)
1013 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1015 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1018 log_info ("Input.Mode.....: %s", tmp_buf
);
1023 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1025 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1026 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1028 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1030 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1031 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1034 if (data
.digests_cnt
== 1)
1036 if (data
.hash_mode
== 2500)
1038 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1040 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1041 (char *) data
.salts_buf
[0].salt_buf
,
1055 else if (data
.hash_mode
== 5200)
1057 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1059 else if (data
.hash_mode
== 9000)
1061 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1063 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1065 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1067 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1069 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1073 char out_buf
[HCBUFSIZ
] = { 0 };
1075 ascii_digest (out_buf
, 0, 0);
1078 if (strlen (out_buf
) > 40)
1086 log_info ("Hash.Target....: %s", out_buf
);
1091 if (data
.hash_mode
== 3000)
1093 char out_buf1
[32] = { 0 };
1094 char out_buf2
[32] = { 0 };
1096 ascii_digest (out_buf1
, 0, 0);
1097 ascii_digest (out_buf2
, 0, 1);
1099 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1103 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1107 log_info ("Hash.Type......: %s", hash_type
);
1113 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1114 double speed_ms
[DEVICES_MAX
] = { 0 };
1116 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1118 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1120 if (device_param
->skipped
) continue;
1122 speed_cnt
[device_id
] = 0;
1123 speed_ms
[device_id
] = 0;
1125 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1127 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1128 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1131 speed_cnt
[device_id
] /= SPEED_CACHE
;
1132 speed_ms
[device_id
] /= SPEED_CACHE
;
1135 double hashes_all_ms
= 0;
1137 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1139 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1141 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1143 if (device_param
->skipped
) continue;
1145 hashes_dev_ms
[device_id
] = 0;
1147 if (speed_ms
[device_id
])
1149 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1151 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1159 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1161 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1163 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1165 if (device_param
->skipped
) continue;
1167 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1169 exec_all_ms
[device_id
] = exec_ms_avg
;
1176 double ms_running
= 0;
1178 hc_timer_get (data
.timer_running
, ms_running
);
1180 double ms_paused
= data
.ms_paused
;
1182 if (data
.devices_status
== STATUS_PAUSED
)
1184 double ms_paused_tmp
= 0;
1186 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1188 ms_paused
+= ms_paused_tmp
;
1193 __time64_t sec_run
= ms_running
/ 1000;
1197 time_t sec_run
= ms_running
/ 1000;
1203 char display_run
[32] = { 0 };
1207 struct tm
*tmp
= NULL
;
1211 tmp
= _gmtime64 (&sec_run
);
1215 tmp
= gmtime (&sec_run
);
1221 memset (&tm_run
, 0, sizeof (tm_run
));
1223 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1225 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1227 char *start
= ctime (&data
.proc_start
);
1229 size_t start_len
= strlen (start
);
1231 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1232 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1234 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1239 log_info ("Time.Started...: 0 secs");
1246 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1249 u64 all_rejected
= 0;
1250 u64 all_restored
= 0;
1252 u64 progress_noneed
= 0;
1254 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1256 all_done
+= data
.words_progress_done
[salt_pos
];
1257 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1258 all_restored
+= data
.words_progress_restored
[salt_pos
];
1260 // Important for ETA only
1262 if (data
.salts_shown
[salt_pos
] == 1)
1264 const u64 all
= data
.words_progress_done
[salt_pos
]
1265 + data
.words_progress_rejected
[salt_pos
]
1266 + data
.words_progress_restored
[salt_pos
];
1268 const u64 left
= data
.words_cnt
- all
;
1270 progress_noneed
+= left
;
1274 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1275 u64 progress_end
= progress_total
;
1277 u64 progress_skip
= 0;
1281 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1283 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1284 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1285 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1290 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1292 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1293 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1294 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1297 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1298 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1300 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1302 if (data
.devices_status
!= STATUS_CRACKED
)
1305 __time64_t sec_etc
= 0;
1312 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1314 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1316 sec_etc
= ms_left
/ 1000;
1321 //log_info ("Time.Estimated.: 0 secs");
1323 else if ((u64
) sec_etc
> ETC_MAX
)
1325 log_info ("Time.Estimated.: > 10 Years");
1329 char display_etc
[32] = { 0 };
1333 struct tm
*tmp
= NULL
;
1337 tmp
= _gmtime64 (&sec_etc
);
1341 tmp
= gmtime (&sec_etc
);
1347 memset (&tm_etc
, 0, sizeof (tm_etc
));
1349 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1351 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1359 char *etc
= ctime (&now
);
1361 size_t etc_len
= strlen (etc
);
1363 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1364 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1366 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1372 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1374 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1376 if (device_param
->skipped
) continue;
1378 char display_dev_cur
[16] = { 0 };
1380 strncpy (display_dev_cur
, "0.00", 4);
1382 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1384 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1387 char display_all_cur
[16] = { 0 };
1389 strncpy (display_all_cur
, "0.00", 4);
1391 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1393 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1395 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1396 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1398 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);
1402 if (data
.digests_cnt
> 100)
1404 time_t now
= time (NULL
);
1406 int cpt_cur_min
= 0;
1407 int cpt_cur_hour
= 0;
1408 int cpt_cur_day
= 0;
1410 for (int i
= 0; i
< CPT_BUF
; i
++)
1412 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1413 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1415 if ((timestamp
+ 60) > now
)
1417 cpt_cur_min
+= cracked
;
1420 if ((timestamp
+ 3600) > now
)
1422 cpt_cur_hour
+= cracked
;
1425 if ((timestamp
+ 86400) > now
)
1427 cpt_cur_day
+= cracked
;
1431 double ms_real
= ms_running
- ms_paused
;
1433 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1434 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1435 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1437 if ((data
.cpt_start
+ 86400) < now
)
1439 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1447 else if ((data
.cpt_start
+ 3600) < now
)
1449 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1456 else if ((data
.cpt_start
+ 60) < now
)
1458 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1466 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1475 u64 restore_point
= get_lowest_words_done ();
1477 u64 restore_total
= data
.words_base
;
1479 float percent_restore
= 0;
1481 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1483 if (progress_end_relative_skip
)
1485 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1487 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1488 float percent_rejected
= 0.0;
1492 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1495 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);
1496 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1498 if (data
.restore_disable
== 0)
1500 if (percent_finished
!= 1)
1502 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1509 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1511 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1512 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 if (data
.restore_disable
== 0)
1516 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1521 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1522 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1524 // --restore not allowed if stdin is used -- really? why?
1526 //if (data.restore_disable == 0)
1528 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1534 if (data
.gpu_temp_disable
== 0)
1536 hc_thread_mutex_lock (mux_adl
);
1538 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1540 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1542 if (device_param
->skipped
) continue;
1544 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1545 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1546 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1547 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1548 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1549 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1550 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1552 char output_buf
[256] = { 0 };
1556 if (num_temperature
>= 0)
1558 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1560 output_len
= strlen (output_buf
);
1563 if (num_fanspeed
>= 0)
1565 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1567 output_len
= strlen (output_buf
);
1570 if (num_utilization
>= 0)
1572 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1574 output_len
= strlen (output_buf
);
1577 if (num_corespeed
>= 0)
1579 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1581 output_len
= strlen (output_buf
);
1584 if (num_memoryspeed
>= 0)
1586 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1588 output_len
= strlen (output_buf
);
1591 if (num_buslanes
>= 0)
1593 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1595 output_len
= strlen (output_buf
);
1598 if (num_throttle
== 1)
1600 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1602 output_len
= strlen (output_buf
);
1605 if (output_len
== 0)
1607 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1609 output_len
= strlen (output_buf
);
1612 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1615 hc_thread_mutex_unlock (mux_adl
);
1617 #endif // HAVE_HWMON
1620 static void status_benchmark_automate ()
1622 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1623 double speed_ms
[DEVICES_MAX
] = { 0 };
1625 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1627 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1629 if (device_param
->skipped
) continue;
1631 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1632 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1635 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1637 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1639 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1641 if (device_param
->skipped
) continue;
1643 hashes_dev_ms
[device_id
] = 0;
1645 if (speed_ms
[device_id
])
1647 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1651 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1653 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1655 if (device_param
->skipped
) continue;
1657 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1661 static void status_benchmark ()
1663 if (data
.devices_status
== STATUS_INIT
) return;
1664 if (data
.devices_status
== STATUS_STARTING
) return;
1665 if (data
.devices_status
== STATUS_BYPASS
) return;
1667 if (data
.machine_readable
== 1)
1669 status_benchmark_automate ();
1674 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1675 double speed_ms
[DEVICES_MAX
] = { 0 };
1677 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1679 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1681 if (device_param
->skipped
) continue;
1683 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1684 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1687 double hashes_all_ms
= 0;
1689 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1691 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1693 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1695 if (device_param
->skipped
) continue;
1697 hashes_dev_ms
[device_id
] = 0;
1699 if (speed_ms
[device_id
])
1701 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1703 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1711 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1713 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1715 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1717 if (device_param
->skipped
) continue;
1719 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1721 exec_all_ms
[device_id
] = exec_ms_avg
;
1724 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1726 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1728 if (device_param
->skipped
) continue;
1730 char display_dev_cur
[16] = { 0 };
1732 strncpy (display_dev_cur
, "0.00", 4);
1734 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1736 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1739 char display_all_cur
[16] = { 0 };
1741 strncpy (display_all_cur
, "0.00", 4);
1743 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1745 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1749 * hashcat -only- functions
1752 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1754 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1756 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1757 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1758 else if (attack_kern
== ATTACK_KERN_COMBI
)
1759 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1760 else if (attack_kern
== ATTACK_KERN_BF
)
1761 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1764 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1767 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
)
1769 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1771 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1772 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1773 else if (attack_kern
== ATTACK_KERN_COMBI
)
1774 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1775 else if (attack_kern
== ATTACK_KERN_BF
)
1776 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1780 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1784 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1786 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1788 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1792 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1796 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
)
1798 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1800 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1804 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1808 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1810 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1813 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1815 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1818 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1820 if (line_len
& 1) return (line_len
); // not in hex
1822 if (data
.hex_wordlist
== 1)
1827 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1829 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1832 memset (line_buf
+ i
, 0, line_len
- i
);
1836 else if (line_len
>= 6) // $HEX[] = 6
1838 if (line_buf
[0] != '$') return (line_len
);
1839 if (line_buf
[1] != 'H') return (line_len
);
1840 if (line_buf
[2] != 'E') return (line_len
);
1841 if (line_buf
[3] != 'X') return (line_len
);
1842 if (line_buf
[4] != '[') return (line_len
);
1843 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1848 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1850 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1853 memset (line_buf
+ i
, 0, line_len
- i
);
1861 static void clear_prompt ()
1863 fputc ('\r', stdout
);
1865 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1867 fputc (' ', stdout
);
1870 fputc ('\r', stdout
);
1875 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1877 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
);
1880 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1882 char *outfile
= data
.outfile
;
1883 uint quiet
= data
.quiet
;
1884 FILE *pot_fp
= data
.pot_fp
;
1885 uint loopback
= data
.loopback
;
1886 uint debug_mode
= data
.debug_mode
;
1887 char *debug_file
= data
.debug_file
;
1889 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1890 int debug_rule_len
= 0; // -1 error
1891 uint debug_plain_len
= 0;
1893 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1897 char out_buf
[HCBUFSIZ
] = { 0 };
1899 const u32 salt_pos
= plain
->salt_pos
;
1900 const u32 digest_pos
= plain
->digest_pos
; // relative
1901 const u32 gidvid
= plain
->gidvid
;
1902 const u32 il_pos
= plain
->il_pos
;
1904 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1908 u64 crackpos
= device_param
->words_off
;
1910 uint plain_buf
[16] = { 0 };
1912 u8
*plain_ptr
= (u8
*) plain_buf
;
1914 unsigned int plain_len
= 0;
1916 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1920 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1922 for (int i
= 0; i
< 16; i
++)
1924 plain_buf
[i
] = pw
.i
[i
];
1927 plain_len
= pw
.pw_len
;
1929 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1936 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1938 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1940 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1944 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1946 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1948 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1950 debug_plain_len
= plain_len
;
1954 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1957 crackpos
*= data
.kernel_rules_cnt
;
1958 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1960 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1962 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1966 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1968 for (int i
= 0; i
< 16; i
++)
1970 plain_buf
[i
] = pw
.i
[i
];
1973 plain_len
= pw
.pw_len
;
1975 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1976 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1978 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1980 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1984 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1986 memcpy (plain_ptr
, comb_buf
, comb_len
);
1989 plain_len
+= comb_len
;
1992 crackpos
*= data
.combs_cnt
;
1993 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1995 if (data
.pw_max
!= PW_DICTMAX1
)
1997 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2000 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2002 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2003 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2005 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2006 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2008 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2009 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2011 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2012 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2014 plain_len
= data
.css_cnt
;
2017 crackpos
*= data
.bfs_cnt
;
2018 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2020 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2024 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2026 for (int i
= 0; i
< 16; i
++)
2028 plain_buf
[i
] = pw
.i
[i
];
2031 plain_len
= pw
.pw_len
;
2033 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2036 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2038 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2040 plain_len
+= start
+ stop
;
2043 crackpos
*= data
.combs_cnt
;
2044 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2046 if (data
.pw_max
!= PW_DICTMAX1
)
2048 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2051 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2055 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2057 for (int i
= 0; i
< 16; i
++)
2059 plain_buf
[i
] = pw
.i
[i
];
2062 plain_len
= pw
.pw_len
;
2064 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2067 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2069 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2071 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2073 plain_len
+= start
+ stop
;
2076 crackpos
*= data
.combs_cnt
;
2077 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2079 if (data
.pw_max
!= PW_DICTMAX1
)
2081 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2085 if (data
.attack_mode
== ATTACK_MODE_BF
)
2087 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2089 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2091 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2093 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2097 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2099 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2101 plain_ptr
[j
] = plain_ptr
[i
];
2104 plain_len
= plain_len
/ 2;
2109 // if enabled, update also the potfile
2115 fprintf (pot_fp
, "%s:", out_buf
);
2117 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2119 fputc ('\n', pot_fp
);
2123 unlock_file (pot_fp
);
2128 FILE *out_fp
= NULL
;
2130 if (outfile
!= NULL
)
2132 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2134 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2145 if (quiet
== 0) clear_prompt ();
2148 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2150 if (outfile
!= NULL
)
2152 if (out_fp
!= stdout
)
2159 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2161 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2163 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2164 if (quiet
== 0) fflush (stdout
);
2173 char *loopback_file
= data
.loopback_file
;
2177 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2181 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2183 fputc ('\n', fb_fp
);
2189 // (rule) debug mode
2191 // the next check implies that:
2192 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2195 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2197 if (debug_rule_len
< 0) debug_rule_len
= 0;
2199 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2201 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2203 if ((quiet
== 0) && (debug_file
== NULL
))
2205 fprintf (stdout
, "%s", PROMPT
);
2212 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2214 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2218 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2222 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2226 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2228 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
);
2230 uint cpt_cracked
= 0;
2232 for (uint i
= 0; i
< num_cracked
; i
++)
2234 const uint hash_pos
= cracked
[i
].hash_pos
;
2236 if (data
.digests_shown
[hash_pos
] == 1) continue;
2238 hc_thread_mutex_lock (mux_display
);
2240 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2242 data
.digests_shown
[hash_pos
] = 1;
2244 data
.digests_done
++;
2248 salt_buf
->digests_done
++;
2250 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2252 data
.salts_shown
[salt_pos
] = 1;
2258 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2260 hc_thread_mutex_unlock (mux_display
);
2262 check_hash (device_param
, &cracked
[i
]);
2267 if (cpt_cracked
> 0)
2269 hc_thread_mutex_lock (mux_display
);
2271 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2272 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2276 data
.cpt_total
+= cpt_cracked
;
2278 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2280 hc_thread_mutex_unlock (mux_display
);
2283 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2285 // we need to reset cracked state on the device
2286 // otherwise host thinks again and again the hash was cracked
2287 // and returns invalid password each time
2289 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2291 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
);
2296 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2300 static void save_hash ()
2302 char *hashfile
= data
.hashfile
;
2304 char new_hashfile
[256] = { 0 };
2305 char old_hashfile
[256] = { 0 };
2307 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2308 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2310 unlink (new_hashfile
);
2312 char separator
= data
.separator
;
2314 FILE *fp
= fopen (new_hashfile
, "wb");
2318 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2323 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2325 if (data
.salts_shown
[salt_pos
] == 1) continue;
2327 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2329 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2331 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2333 if (data
.digests_shown
[idx
] == 1) continue;
2335 if (data
.hash_mode
!= 2500)
2337 char out_buf
[HCBUFSIZ
] = { 0 };
2339 if (data
.username
== 1)
2341 user_t
*user
= data
.hash_info
[idx
]->user
;
2345 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2347 fputc (separator
, fp
);
2350 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2352 fputs (out_buf
, fp
);
2360 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2362 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2371 unlink (old_hashfile
);
2373 if (rename (hashfile
, old_hashfile
) != 0)
2375 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2382 if (rename (new_hashfile
, hashfile
) != 0)
2384 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2389 unlink (old_hashfile
);
2392 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2394 // function called only in case kernel_power_all > words_left
2396 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2398 kernel_power_div
+= kernel_power_div
/ 100;
2400 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2402 while (kernel_power_new
< total_left
)
2404 kernel_power_div
+= kernel_power_div
/ 100;
2406 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2409 if (data
.quiet
== 0)
2415 log_info ("INFO: approaching final keyspace, workload adjusted");
2418 fprintf (stdout
, "%s", PROMPT
);
2423 //if ((kernel_power_all * kernel_power_div) < 8) return 1;
2425 return kernel_power_div
;
2428 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2430 uint num_elements
= num
;
2432 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2433 device_param
->kernel_params_buf32
[31] = num
;
2435 uint kernel_threads
= device_param
->kernel_threads
;
2437 while (num_elements
% kernel_threads
) num_elements
++;
2439 cl_kernel kernel
= NULL
;
2443 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2444 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2445 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2446 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2447 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2450 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2451 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2452 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2453 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2454 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2455 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2456 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2457 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2458 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2459 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2460 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2464 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2466 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2467 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2469 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2473 if (kern_run
== KERN_RUN_2
)
2475 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2477 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2481 while (num_elements
% kernel_threads
) num_elements
++;
2483 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2484 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2486 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2489 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2491 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2495 cl_ulong time_start
;
2498 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2499 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2501 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2503 uint exec_pos
= device_param
->exec_pos
;
2505 device_param
->exec_ms
[exec_pos
] = exec_time
;
2509 if (exec_pos
== EXEC_CACHE
)
2514 device_param
->exec_pos
= exec_pos
;
2517 hc_clReleaseEvent (data
.ocl
, event
);
2519 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2522 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2524 uint num_elements
= num
;
2528 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2529 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2530 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2533 // causes problems with special threads like in bcrypt
2534 // const uint kernel_threads = device_param->kernel_threads;
2536 uint kernel_threads
= device_param
->kernel_threads
;
2538 while (num_elements
% kernel_threads
) num_elements
++;
2540 cl_kernel kernel
= NULL
;
2544 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2545 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2546 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2551 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2552 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2553 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2554 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2555 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2556 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2558 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2559 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2560 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2561 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2562 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2563 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2565 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2566 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2567 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2568 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2569 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2570 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2571 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2575 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2576 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2578 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2580 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2582 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2585 static void run_kernel_tm (hc_device_param_t
*device_param
)
2587 const uint num_elements
= 1024; // fixed
2589 uint kernel_threads
= 32;
2591 cl_kernel kernel
= device_param
->kernel_tm
;
2593 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2594 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2596 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2598 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2600 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2603 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2605 uint num_elements
= num
;
2607 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2608 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2610 // causes problems with special threads like in bcrypt
2611 // const uint kernel_threads = device_param->kernel_threads;
2613 uint kernel_threads
= device_param
->kernel_threads
;
2615 while (num_elements
% kernel_threads
) num_elements
++;
2617 cl_kernel kernel
= device_param
->kernel_amp
;
2619 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2620 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2622 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2623 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2625 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2627 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2629 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2632 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2634 const u32 num16d
= num
/ 16;
2635 const u32 num16m
= num
% 16;
2639 device_param
->kernel_params_memset_buf32
[1] = value
;
2640 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2642 uint kernel_threads
= device_param
->kernel_threads
;
2644 uint num_elements
= num16d
;
2646 while (num_elements
% kernel_threads
) num_elements
++;
2648 cl_kernel kernel
= device_param
->kernel_memset
;
2650 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2651 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2652 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2654 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2655 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2657 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2659 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2661 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2673 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2677 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2679 run_kernel_memset (device_param
, buf
, 0, size
);
2684 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2686 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2688 const cl_uchar zero = 0;
2690 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2695 // NOTE: clEnqueueFillBuffer () always fails with -59
2696 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2697 // How's that possible, OpenCL 1.2 support is advertised??
2698 // We need to workaround...
2700 #define FILLSZ 0x100000
2702 char *tmp = (char *) mymalloc (FILLSZ);
2704 for (size_t i = 0; i < size; i += FILLSZ)
2706 const size_t left = size - i;
2708 const size_t fillsz = MIN (FILLSZ, left);
2710 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2718 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
)
2720 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2722 if (attack_mode
== ATTACK_MODE_BF
)
2724 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2726 const uint size_tm
= 32 * sizeof (bs_word_t
);
2728 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2730 run_kernel_tm (device_param
);
2732 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
);
2736 if (highest_pw_len
< 16)
2738 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2740 else if (highest_pw_len
< 32)
2742 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2746 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2751 run_kernel_amp (device_param
, pws_cnt
);
2753 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2755 if (opts_type
& OPTS_TYPE_HOOK12
)
2757 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2760 uint iter
= salt_buf
->salt_iter
;
2762 uint loop_step
= device_param
->kernel_loops
;
2764 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2766 uint loop_left
= iter
- loop_pos
;
2768 loop_left
= MIN (loop_left
, loop_step
);
2770 device_param
->kernel_params_buf32
[25] = loop_pos
;
2771 device_param
->kernel_params_buf32
[26] = loop_left
;
2773 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2775 if (data
.devices_status
== STATUS_CRACKED
) break;
2776 if (data
.devices_status
== STATUS_ABORTED
) break;
2777 if (data
.devices_status
== STATUS_QUIT
) break;
2783 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2785 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2789 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2791 const u32 speed_pos
= device_param
->speed_pos
;
2793 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2795 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2797 if (data
.benchmark
== 1)
2799 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2803 if (opts_type
& OPTS_TYPE_HOOK23
)
2805 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2807 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
);
2809 // do something with data
2811 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
);
2814 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2818 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2824 else if (rule_len
== 1)
2826 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2832 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2834 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2836 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
);
2838 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2840 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2842 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2844 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2846 for (u32 i
= 0; i
< pws_cnt
; i
++)
2848 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2850 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2855 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2857 for (u32 i
= 0; i
< pws_cnt
; i
++)
2859 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2861 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2868 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2870 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2872 for (u32 i
= 0; i
< pws_cnt
; i
++)
2874 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2876 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2881 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2883 for (u32 i
= 0; i
< pws_cnt
; i
++)
2885 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2887 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2894 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
);
2896 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2898 const u64 off
= device_param
->words_off
;
2900 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2902 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2906 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2908 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2910 device_param
->kernel_params_buf32
[25] = 0;
2911 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2912 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2914 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2916 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true);
2920 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true);
2923 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2925 return exec_ms_prev
;
2928 static void autotune (hc_device_param_t
*device_param
)
2930 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2932 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2933 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2935 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2936 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2938 u32 kernel_accel
= kernel_accel_min
;
2939 u32 kernel_loops
= kernel_loops_min
;
2941 // in this case the user specified a fixed -u and -n on the commandline
2942 // no way to tune anything
2943 // but we need to run a few caching rounds
2945 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2947 try_run (device_param
, kernel_accel
, kernel_loops
);
2948 try_run (device_param
, kernel_accel
, kernel_loops
);
2949 try_run (device_param
, kernel_accel
, kernel_loops
);
2950 try_run (device_param
, kernel_accel
, kernel_loops
);
2952 device_param
->kernel_accel
= kernel_accel
;
2953 device_param
->kernel_loops
= kernel_loops
;
2955 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2957 device_param
->kernel_power
= kernel_power
;
2962 // from here it's clear we are allowed to autotune
2963 // so let's init some fake words
2965 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2967 if (data
.attack_kern
== ATTACK_KERN_BF
)
2969 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2973 for (u32 i
= 0; i
< kernel_power_max
; i
++)
2975 device_param
->pws_buf
[i
].i
[0] = i
;
2976 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
2977 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
2980 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
);
2983 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2985 if (data
.kernel_rules_cnt
> 1)
2987 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
2992 run_kernel_amp (device_param
, kernel_power_max
);
2995 #define VERIFIER_CNT 1
2997 // first find out highest kernel-loops that stays below target_ms
2999 if (kernel_loops_min
< kernel_loops_max
)
3001 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3003 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3005 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3007 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3009 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3012 if (exec_ms
< target_ms
) break;
3016 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3018 #define STEPS_CNT 10
3020 if (kernel_accel_min
< kernel_accel_max
)
3022 for (int i
= 0; i
< STEPS_CNT
; i
++)
3024 const u32 kernel_accel_try
= 1 << i
;
3026 if (kernel_accel_try
< kernel_accel_min
) continue;
3027 if (kernel_accel_try
> kernel_accel_max
) break;
3029 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3031 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3033 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3035 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3038 if (exec_ms
> target_ms
) break;
3040 kernel_accel
= kernel_accel_try
;
3044 // at this point we want to know the actual runtime for the following reason:
3045 // we need a reference for the balancing loop following up, and this
3046 // the balancing loop can have an effect that the creates a new opportunity, for example:
3047 // if the target is 95 ms and the current runtime is 48ms the above loop
3048 // stopped the execution because the previous exec_ms was > 95ms
3049 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3050 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3052 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3054 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3056 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3058 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3061 u32 diff
= kernel_loops
- kernel_accel
;
3063 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3065 u32 kernel_accel_orig
= kernel_accel
;
3066 u32 kernel_loops_orig
= kernel_loops
;
3068 for (u32 f
= 1; f
< 1024; f
++)
3070 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3071 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3073 if (kernel_accel_try
> kernel_accel_max
) break;
3074 if (kernel_loops_try
< kernel_loops_min
) break;
3076 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3078 if (diff_new
> diff
) break;
3082 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3084 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3086 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3088 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3091 if (exec_ms
< exec_ms_pre_final
)
3093 exec_ms_pre_final
= exec_ms
;
3095 kernel_accel
= kernel_accel_try
;
3096 kernel_loops
= kernel_loops_try
;
3101 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3103 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3105 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3107 if (exec_accel_min
>= 1.0)
3109 // this is safe to not overflow kernel_accel_max because of accel_left
3111 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3114 // reset them fake words
3117 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3119 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);
3120 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);
3123 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3125 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3127 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3132 device_param
->exec_pos
= 0;
3134 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3138 device_param
->kernel_accel
= kernel_accel
;
3139 device_param
->kernel_loops
= kernel_loops
;
3141 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3143 device_param
->kernel_power
= kernel_power
;
3147 if (data
.quiet
== 0)
3151 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3152 "Device #%u: autotuned kernel-loops to %u\n",
3153 device_param
->device_id
+ 1, kernel_accel
,
3154 device_param
->device_id
+ 1, kernel_loops
);
3156 fprintf (stdout
, "%s", PROMPT
);
3164 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3166 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3170 uint speed_pos
= device_param
->speed_pos
;
3173 if (device_param
->timer_speed
.tv_sec
== 0)
3175 hc_timer_set (&device_param
->timer_speed
);
3180 if (device_param
->timer_speed
.QuadPart
== 0)
3182 hc_timer_set (&device_param
->timer_speed
);
3186 // find higest password length, this is for optimization stuff
3188 uint highest_pw_len
= 0;
3190 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3193 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3196 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3198 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3199 + device_param
->kernel_params_mp_l_buf32
[5];
3204 uint innerloop_step
= 0;
3205 uint innerloop_cnt
= 0;
3207 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3208 else innerloop_step
= 1;
3210 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3211 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3212 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3214 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3216 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3218 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3220 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3222 if (data
.devices_status
== STATUS_CRACKED
) break;
3223 if (data
.devices_status
== STATUS_ABORTED
) break;
3224 if (data
.devices_status
== STATUS_QUIT
) break;
3225 if (data
.devices_status
== STATUS_BYPASS
) break;
3227 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3229 device_param
->kernel_params_buf32
[24] = salt_pos
;
3230 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3231 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3233 FILE *combs_fp
= device_param
->combs_fp
;
3235 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3242 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3244 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3246 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3248 if (data
.devices_status
== STATUS_CRACKED
) break;
3249 if (data
.devices_status
== STATUS_ABORTED
) break;
3250 if (data
.devices_status
== STATUS_QUIT
) break;
3251 if (data
.devices_status
== STATUS_BYPASS
) break;
3253 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3255 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3257 device_param
->innerloop_pos
= innerloop_pos
;
3258 device_param
->innerloop_left
= innerloop_left
;
3260 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3262 // i think we can get rid of this
3263 if (innerloop_left
== 0)
3265 puts ("bug, how should this happen????\n");
3270 if (data
.salts_shown
[salt_pos
] == 1)
3272 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3277 // initialize amplifiers
3279 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3283 while (i
< innerloop_left
)
3285 if (feof (combs_fp
)) break;
3287 int line_len
= fgetl (combs_fp
, line_buf
);
3289 if (line_len
>= PW_MAX1
) continue;
3291 line_len
= convert_from_hex (line_buf
, line_len
);
3293 char *line_buf_new
= line_buf
;
3295 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3297 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3299 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3301 if (rule_len_out
< 0)
3303 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3308 line_len
= rule_len_out
;
3310 line_buf_new
= rule_buf_out
;
3313 line_len
= MIN (line_len
, PW_DICTMAX
);
3315 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3317 memcpy (ptr
, line_buf_new
, line_len
);
3319 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3321 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3323 uppercase (ptr
, line_len
);
3326 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3328 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3330 ptr
[line_len
] = 0x80;
3333 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3335 ptr
[line_len
] = 0x01;
3339 device_param
->combs_buf
[i
].pw_len
= line_len
;
3344 for (uint j
= i
; j
< innerloop_left
; j
++)
3346 device_param
->combs_buf
[j
].i
[0] = 0;
3347 device_param
->combs_buf
[j
].i
[1] = 0;
3348 device_param
->combs_buf
[j
].i
[2] = 0;
3349 device_param
->combs_buf
[j
].i
[3] = 0;
3350 device_param
->combs_buf
[j
].i
[4] = 0;
3351 device_param
->combs_buf
[j
].i
[5] = 0;
3352 device_param
->combs_buf
[j
].i
[6] = 0;
3353 device_param
->combs_buf
[j
].i
[7] = 0;
3355 device_param
->combs_buf
[j
].pw_len
= 0;
3360 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3362 u64 off
= innerloop_pos
;
3364 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3366 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3368 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3370 u64 off
= innerloop_pos
;
3372 device_param
->kernel_params_mp_buf64
[3] = off
;
3374 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3376 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3378 u64 off
= innerloop_pos
;
3380 device_param
->kernel_params_mp_buf64
[3] = off
;
3382 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3387 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3389 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
);
3391 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3393 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
);
3395 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3397 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
);
3399 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3401 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
);
3403 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3405 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
);
3408 if (data
.benchmark
== 1)
3410 hc_timer_set (&device_param
->timer_speed
);
3413 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3415 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3417 if (data
.devices_status
== STATUS_CRACKED
) break;
3418 if (data
.devices_status
== STATUS_ABORTED
) break;
3419 if (data
.devices_status
== STATUS_QUIT
) break;
3425 check_cracked (device_param
, salt_pos
);
3431 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3433 hc_thread_mutex_lock (mux_counter
);
3435 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3437 hc_thread_mutex_unlock (mux_counter
);
3445 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3447 hc_timer_set (&device_param
->timer_speed
);
3451 //hc_thread_mutex_lock (mux_display);
3453 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3455 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3457 //hc_thread_mutex_unlock (mux_display);
3461 if (speed_pos
== SPEED_CACHE
)
3470 if (data
.benchmark
== 1) break;
3474 device_param
->speed_pos
= speed_pos
;
3479 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3481 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3485 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3487 wl_data
->buf
[wl_data
->cnt
] = 0;
3489 if (wl_data
->cnt
== 0) return;
3491 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3495 if (wl_data
->cnt
== wl_data
->avail
)
3497 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3499 wl_data
->avail
+= wl_data
->incr
;
3502 const int c
= fgetc (fd
);
3504 if (c
== EOF
) break;
3506 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3510 if (c
== '\n') break;
3513 // ensure stream ends with a newline
3515 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3519 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3525 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3529 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3531 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3541 if (*ptr
!= '\n') continue;
3545 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3556 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3560 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3562 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3564 if (*ptr
!= '\n') continue;
3568 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3579 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3583 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3585 if (*ptr
!= '\n') continue;
3589 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3600 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3602 while (wl_data
->pos
< wl_data
->cnt
)
3607 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3609 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3611 wl_data
->pos
+= off
;
3613 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3615 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3617 int rule_len_out
= -1;
3619 if (len
< BLOCK_SIZE
)
3621 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3624 if (rule_len_out
< 0)
3629 if (rule_len_out
> PW_MAX
)
3650 fprintf (stderr
, "BUG feof()!!\n");
3655 load_segment (wl_data
, fd
);
3657 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3661 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3665 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3675 fstat (fileno (fd
), &d
.stat
);
3679 _fstat64 (fileno (fd
), &d
.stat
);
3683 d
.stat
.st_nlink
= 0;
3687 d
.stat
.st_atime
= 0;
3690 d
.stat
.st_blksize
= 0;
3691 d
.stat
.st_blocks
= 0;
3694 if (d
.stat
.st_size
== 0) return 0;
3696 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3698 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3702 u64 cnt
= d_cache
->cnt
;
3706 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3708 keyspace
*= data
.kernel_rules_cnt
;
3710 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3712 keyspace
*= data
.combs_cnt
;
3715 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
);
3716 if (data
.quiet
== 0) log_info ("");
3718 hc_signal (sigHandler_default
);
3733 load_segment (wl_data
, fd
);
3735 comp
+= wl_data
->cnt
;
3739 while (i
< wl_data
->cnt
)
3744 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3746 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3748 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3750 int rule_len_out
= -1;
3752 if (len
< BLOCK_SIZE
)
3754 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3757 if (rule_len_out
< 0)
3769 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3771 cnt
+= data
.kernel_rules_cnt
;
3773 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3775 cnt
+= data
.combs_cnt
;
3788 if ((now
- prev
) == 0) continue;
3790 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3792 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
);
3797 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
);
3798 if (data
.quiet
== 0) log_info ("");
3800 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3802 hc_signal (sigHandler_default
);
3807 static void *thread_monitor (void *p
)
3809 uint runtime_check
= 0;
3810 uint remove_check
= 0;
3811 uint status_check
= 0;
3812 uint restore_check
= 0;
3814 uint restore_left
= data
.restore_timer
;
3815 uint remove_left
= data
.remove_timer
;
3816 uint status_left
= data
.status_timer
;
3819 uint hwmon_check
= 0;
3821 int slowdown_warnings
= 0;
3823 // these variables are mainly used for fan control
3825 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3827 // temperature controller "loopback" values
3829 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3830 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3832 int temp_threshold
= 1; // degrees celcius
3834 int fan_speed_min
= 15; // in percentage
3835 int fan_speed_max
= 100;
3837 time_t last_temp_check_time
;
3838 #endif // HAVE_HWMON
3840 uint sleep_time
= 1;
3847 if (data
.restore_timer
)
3852 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3857 if (data
.status
== 1)
3863 if (data
.gpu_temp_disable
== 0)
3865 time (&last_temp_check_time
);
3871 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3874 if (hwmon_check
== 0)
3879 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3881 hc_sleep (sleep_time
);
3883 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3889 hc_thread_mutex_lock (mux_adl
);
3891 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3893 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3895 if (device_param
->skipped
) continue;
3897 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3899 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3901 const int threshold
= data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
;
3903 if (temperature
>= threshold
)
3905 if (slowdown_warnings
< 3)
3907 if (data
.quiet
== 0) clear_prompt ();
3909 log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold
, device_id
+ 1);
3911 if (slowdown_warnings
== 2)
3916 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3917 if (data
.quiet
== 0) fflush (stdout
);
3919 slowdown_warnings
++;
3924 slowdown_warnings
= 0;
3928 hc_thread_mutex_unlock (mux_adl
);
3931 if (hwmon_check
== 1)
3933 hc_thread_mutex_lock (mux_adl
);
3935 time_t temp_check_time
;
3937 time (&temp_check_time
);
3939 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3941 if (Ta
== 0) Ta
= 1;
3943 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3945 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3947 if (device_param
->skipped
) continue;
3949 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3951 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3953 if (temperature
> (int) data
.gpu_temp_abort
)
3955 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3957 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3962 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3964 if (gpu_temp_retain
)
3966 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
3968 int temp_cur
= temperature
;
3970 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3972 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3974 // calculate Ta value (time difference in seconds between the last check and this check)
3976 last_temp_check_time
= temp_check_time
;
3982 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3984 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
);
3986 if (abs (fan_diff_required
) >= temp_threshold
)
3988 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3990 int fan_speed_level
= fan_speed_cur
;
3992 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3994 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3996 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3997 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3999 if (fan_speed_new
!= fan_speed_cur
)
4001 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4002 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4004 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4006 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4008 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4010 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4015 fan_speed_chgd
[device_id
] = 1;
4018 temp_diff_old
[device_id
] = temp_diff_new
;
4025 hc_thread_mutex_unlock (mux_adl
);
4027 #endif // HAVE_HWMON
4029 if (restore_check
== 1)
4033 if (restore_left
== 0)
4035 if (data
.restore_disable
== 0) cycle_restore ();
4037 restore_left
= data
.restore_timer
;
4041 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4045 time (&runtime_cur
);
4047 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4049 if (runtime_left
<= 0)
4051 if (data
.benchmark
== 0)
4053 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4056 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4060 if (remove_check
== 1)
4064 if (remove_left
== 0)
4066 if (data
.digests_saved
!= data
.digests_done
)
4068 data
.digests_saved
= data
.digests_done
;
4073 remove_left
= data
.remove_timer
;
4077 if (status_check
== 1)
4081 if (status_left
== 0)
4083 //hc_thread_mutex_lock (mux_display);
4085 if (data
.quiet
== 0) clear_prompt ();
4087 if (data
.quiet
== 0) log_info ("");
4091 if (data
.quiet
== 0) log_info ("");
4093 //hc_thread_mutex_unlock (mux_display);
4095 status_left
= data
.status_timer
;
4101 myfree (fan_speed_chgd
);
4103 myfree (temp_diff_old
);
4104 myfree (temp_diff_sum
);
4112 static void *thread_outfile_remove (void *p
)
4114 // some hash-dependent constants
4115 char *outfile_dir
= data
.outfile_check_directory
;
4116 uint dgst_size
= data
.dgst_size
;
4117 uint isSalted
= data
.isSalted
;
4118 uint esalt_size
= data
.esalt_size
;
4119 uint hash_mode
= data
.hash_mode
;
4121 uint outfile_check_timer
= data
.outfile_check_timer
;
4123 char separator
= data
.separator
;
4125 // some hash-dependent functions
4126 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4127 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4130 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4132 hash_buf
.digest
= mymalloc (dgst_size
);
4134 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4136 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4138 uint digest_buf
[64] = { 0 };
4140 outfile_data_t
*out_info
= NULL
;
4142 char **out_files
= NULL
;
4144 time_t folder_mtime
= 0;
4148 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4150 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4154 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4158 if (check_left
== 0)
4160 struct stat outfile_check_stat
;
4162 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4164 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4168 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4170 char **out_files_new
= scan_directory (outfile_dir
);
4172 int out_cnt_new
= count_dictionaries (out_files_new
);
4174 outfile_data_t
*out_info_new
= NULL
;
4176 if (out_cnt_new
> 0)
4178 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4180 for (int i
= 0; i
< out_cnt_new
; i
++)
4182 out_info_new
[i
].file_name
= out_files_new
[i
];
4184 // check if there are files that we have seen/checked before (and not changed)
4186 for (int j
= 0; j
< out_cnt
; j
++)
4188 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4190 struct stat outfile_stat
;
4192 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4194 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4196 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4197 out_info_new
[i
].seek
= out_info
[j
].seek
;
4205 local_free (out_info
);
4206 local_free (out_files
);
4208 out_files
= out_files_new
;
4209 out_cnt
= out_cnt_new
;
4210 out_info
= out_info_new
;
4212 folder_mtime
= outfile_check_stat
.st_mtime
;
4215 for (int j
= 0; j
< out_cnt
; j
++)
4217 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4221 //hc_thread_mutex_lock (mux_display);
4224 struct stat outfile_stat
;
4226 fstat (fileno (fp
), &outfile_stat
);
4230 struct stat64 outfile_stat
;
4232 _fstat64 (fileno (fp
), &outfile_stat
);
4235 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4237 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4238 out_info
[j
].seek
= 0;
4241 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4243 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4247 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4249 if (ptr
== NULL
) break;
4251 int line_len
= strlen (line_buf
);
4253 if (line_len
<= 0) continue;
4255 int iter
= MAX_CUT_TRIES
;
4257 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4259 if (line_buf
[i
] != separator
) continue;
4261 int parser_status
= PARSER_OK
;
4263 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4265 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4270 if (parser_status
== PARSER_OK
)
4272 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4274 if (data
.salts_shown
[salt_pos
] == 1) continue;
4276 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4278 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4280 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4282 if (data
.digests_shown
[idx
] == 1) continue;
4286 if (hash_mode
== 6800)
4288 if (i
== salt_buf
->salt_len
)
4290 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4293 else if (hash_mode
== 2500)
4295 // BSSID : MAC1 : MAC2 (:plain)
4296 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4298 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4300 if (!cracked
) continue;
4302 // now compare MAC1 and MAC2 too, since we have this additional info
4303 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4304 char *mac2_pos
= mac1_pos
+ 12 + 1;
4306 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4307 wpa_t
*wpa
= &wpas
[salt_pos
];
4309 // compare hex string(s) vs binary MAC address(es)
4311 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4313 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4322 if (!cracked
) continue;
4324 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4326 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4337 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4339 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4341 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4348 data
.digests_shown
[idx
] = 1;
4350 data
.digests_done
++;
4352 salt_buf
->digests_done
++;
4354 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4356 data
.salts_shown
[salt_pos
] = 1;
4360 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4365 if (data
.devices_status
== STATUS_CRACKED
) break;
4371 if (data
.devices_status
== STATUS_CRACKED
) break;
4376 if (data
.devices_status
== STATUS_CRACKED
) break;
4381 out_info
[j
].seek
= ftell (fp
);
4383 //hc_thread_mutex_unlock (mux_display);
4391 check_left
= outfile_check_timer
;
4395 if (esalt_size
) local_free (hash_buf
.esalt
);
4397 if (isSalted
) local_free (hash_buf
.salt
);
4399 local_free (hash_buf
.digest
);
4401 local_free (out_info
);
4403 local_free (out_files
);
4410 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4412 //if (device_param->pws_cnt < device_param->kernel_power)
4414 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4416 u8
*ptr
= (u8
*) pw
->i
;
4418 memcpy (ptr
, pw_buf
, pw_len
);
4420 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4422 pw
->pw_len
= pw_len
;
4424 device_param
->pws_cnt
++;
4428 // fprintf (stderr, "BUG pw_add()!!\n");
4434 static u32
get_power (const u32 kernel_power
)
4436 if (data
.kernel_power_div
)
4438 return (float) kernel_power
* data
.kernel_power_div
;
4441 return kernel_power
;
4444 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
4446 hc_thread_mutex_lock (mux_dispatcher
);
4448 const u64 words_cur
= data
.words_cur
;
4449 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4451 device_param
->words_off
= words_cur
;
4453 const u64 words_left
= words_base
- words_cur
;
4455 if (data
.kernel_power_all
> words_left
)
4457 if (data
.kernel_power_div
== 0)
4459 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4463 const u32 kernel_power
= get_power (device_param
->kernel_power
);
4465 uint work
= MIN (words_left
, kernel_power
);
4467 work
= MIN (work
, max
);
4469 data
.words_cur
+= work
;
4471 hc_thread_mutex_unlock (mux_dispatcher
);
4476 static void *thread_autotune (void *p
)
4478 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4480 if (device_param
->skipped
) return NULL
;
4482 autotune (device_param
);
4487 static void *thread_calc_stdin (void *p
)
4489 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4491 if (device_param
->skipped
) return NULL
;
4493 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4495 const uint attack_kern
= data
.attack_kern
;
4497 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4499 hc_thread_mutex_lock (mux_dispatcher
);
4501 if (feof (stdin
) != 0)
4503 hc_thread_mutex_unlock (mux_dispatcher
);
4510 while (words_cur
< get_power (device_param
->kernel_power
))
4512 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4514 if (line_buf
== NULL
) break;
4516 uint line_len
= in_superchop (line_buf
);
4518 line_len
= convert_from_hex (line_buf
, line_len
);
4520 // post-process rule engine
4522 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4524 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4526 int rule_len_out
= -1;
4528 if (line_len
< BLOCK_SIZE
)
4530 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4533 if (rule_len_out
< 0) continue;
4535 line_buf
= rule_buf_out
;
4536 line_len
= rule_len_out
;
4539 if (line_len
> PW_MAX
)
4544 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4546 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4548 hc_thread_mutex_lock (mux_counter
);
4550 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4552 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4555 hc_thread_mutex_unlock (mux_counter
);
4560 else if (attack_kern
== ATTACK_KERN_COMBI
)
4562 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4563 // since we still need to combine the plains
4565 if (line_len
> data
.pw_max
)
4567 hc_thread_mutex_lock (mux_counter
);
4569 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4571 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4574 hc_thread_mutex_unlock (mux_counter
);
4580 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4584 if (data
.devices_status
== STATUS_CRACKED
) break;
4585 if (data
.devices_status
== STATUS_ABORTED
) break;
4586 if (data
.devices_status
== STATUS_QUIT
) break;
4587 if (data
.devices_status
== STATUS_BYPASS
) break;
4590 hc_thread_mutex_unlock (mux_dispatcher
);
4592 if (data
.devices_status
== STATUS_CRACKED
) break;
4593 if (data
.devices_status
== STATUS_ABORTED
) break;
4594 if (data
.devices_status
== STATUS_QUIT
) break;
4595 if (data
.devices_status
== STATUS_BYPASS
) break;
4599 const uint pws_cnt
= device_param
->pws_cnt
;
4603 run_copy (device_param
, pws_cnt
);
4605 run_cracker (device_param
, pws_cnt
);
4607 device_param
->pws_cnt
= 0;
4611 if (attack_kern == ATTACK_KERN_STRAIGHT)
4613 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4615 else if (attack_kern == ATTACK_KERN_COMBI)
4617 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4623 device_param
->kernel_accel
= 0;
4624 device_param
->kernel_loops
= 0;
4631 static void *thread_calc (void *p
)
4633 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4635 if (device_param
->skipped
) return NULL
;
4637 const uint attack_mode
= data
.attack_mode
;
4638 const uint attack_kern
= data
.attack_kern
;
4640 if (attack_mode
== ATTACK_MODE_BF
)
4642 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4644 const uint work
= get_work (device_param
, -1);
4646 if (work
== 0) break;
4648 const u64 words_off
= device_param
->words_off
;
4649 const u64 words_fin
= words_off
+ work
;
4651 const uint pws_cnt
= work
;
4653 device_param
->pws_cnt
= pws_cnt
;
4657 run_copy (device_param
, pws_cnt
);
4659 run_cracker (device_param
, pws_cnt
);
4661 device_param
->pws_cnt
= 0;
4665 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4669 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4671 if (data
.devices_status
== STATUS_CRACKED
) break;
4672 if (data
.devices_status
== STATUS_ABORTED
) break;
4673 if (data
.devices_status
== STATUS_QUIT
) break;
4674 if (data
.devices_status
== STATUS_BYPASS
) break;
4676 if (data
.benchmark
== 1) break;
4678 device_param
->words_done
= words_fin
;
4683 const uint segment_size
= data
.segment_size
;
4685 char *dictfile
= data
.dictfile
;
4687 if (attack_mode
== ATTACK_MODE_COMBI
)
4689 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4691 dictfile
= data
.dictfile2
;
4695 FILE *fd
= fopen (dictfile
, "rb");
4699 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4704 if (attack_mode
== ATTACK_MODE_COMBI
)
4706 const uint combs_mode
= data
.combs_mode
;
4708 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4710 const char *dictfilec
= data
.dictfile2
;
4712 FILE *combs_fp
= fopen (dictfilec
, "rb");
4714 if (combs_fp
== NULL
)
4716 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4723 device_param
->combs_fp
= combs_fp
;
4725 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4727 const char *dictfilec
= data
.dictfile
;
4729 FILE *combs_fp
= fopen (dictfilec
, "rb");
4731 if (combs_fp
== NULL
)
4733 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4740 device_param
->combs_fp
= combs_fp
;
4744 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4746 wl_data
->buf
= (char *) mymalloc (segment_size
);
4747 wl_data
->avail
= segment_size
;
4748 wl_data
->incr
= segment_size
;
4754 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4763 const uint work
= get_work (device_param
, max
);
4765 if (work
== 0) break;
4769 words_off
= device_param
->words_off
;
4770 words_fin
= words_off
+ work
;
4775 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4777 for ( ; words_cur
< words_fin
; words_cur
++)
4779 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4781 line_len
= convert_from_hex (line_buf
, line_len
);
4783 // post-process rule engine
4785 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4787 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4789 int rule_len_out
= -1;
4791 if (line_len
< BLOCK_SIZE
)
4793 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4796 if (rule_len_out
< 0) continue;
4798 line_buf
= rule_buf_out
;
4799 line_len
= rule_len_out
;
4802 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4804 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4808 hc_thread_mutex_lock (mux_counter
);
4810 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4812 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4815 hc_thread_mutex_unlock (mux_counter
);
4820 else if (attack_kern
== ATTACK_KERN_COMBI
)
4822 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4823 // since we still need to combine the plains
4825 if (line_len
> data
.pw_max
)
4829 hc_thread_mutex_lock (mux_counter
);
4831 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4833 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4836 hc_thread_mutex_unlock (mux_counter
);
4842 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4844 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4846 if (data
.devices_status
== STATUS_CRACKED
) break;
4847 if (data
.devices_status
== STATUS_ABORTED
) break;
4848 if (data
.devices_status
== STATUS_QUIT
) break;
4849 if (data
.devices_status
== STATUS_BYPASS
) break;
4852 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4854 if (data
.devices_status
== STATUS_CRACKED
) break;
4855 if (data
.devices_status
== STATUS_ABORTED
) break;
4856 if (data
.devices_status
== STATUS_QUIT
) break;
4857 if (data
.devices_status
== STATUS_BYPASS
) break;
4860 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4862 if (data
.devices_status
== STATUS_CRACKED
) break;
4863 if (data
.devices_status
== STATUS_ABORTED
) break;
4864 if (data
.devices_status
== STATUS_QUIT
) break;
4865 if (data
.devices_status
== STATUS_BYPASS
) break;
4871 const uint pws_cnt
= device_param
->pws_cnt
;
4875 run_copy (device_param
, pws_cnt
);
4877 run_cracker (device_param
, pws_cnt
);
4879 device_param
->pws_cnt
= 0;
4883 if (attack_kern == ATTACK_KERN_STRAIGHT)
4885 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4887 else if (attack_kern == ATTACK_KERN_COMBI)
4889 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4894 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4896 if (data
.devices_status
== STATUS_CRACKED
) break;
4897 if (data
.devices_status
== STATUS_ABORTED
) break;
4898 if (data
.devices_status
== STATUS_QUIT
) break;
4899 if (data
.devices_status
== STATUS_BYPASS
) break;
4901 if (words_fin
== 0) break;
4903 device_param
->words_done
= words_fin
;
4906 if (attack_mode
== ATTACK_MODE_COMBI
)
4908 fclose (device_param
->combs_fp
);
4911 free (wl_data
->buf
);
4917 device_param
->kernel_accel
= 0;
4918 device_param
->kernel_loops
= 0;
4923 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4927 log_error ("ERROR: %s : Invalid argument", __func__
);
4932 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4934 device_param
->kernel_params_buf32
[24] = salt_pos
;
4935 device_param
->kernel_params_buf32
[27] = 1;
4936 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4937 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4938 device_param
->kernel_params_buf32
[30] = 0;
4939 device_param
->kernel_params_buf32
[31] = 1;
4941 char *dictfile_old
= data
.dictfile
;
4943 const char *weak_hash_check
= "weak-hash-check";
4945 data
.dictfile
= (char *) weak_hash_check
;
4947 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4949 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4955 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4957 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4961 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4963 uint loop_step
= 16;
4965 const uint iter
= salt_buf
->salt_iter
;
4967 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4969 uint loop_left
= iter
- loop_pos
;
4971 loop_left
= MIN (loop_left
, loop_step
);
4973 device_param
->kernel_params_buf32
[25] = loop_pos
;
4974 device_param
->kernel_params_buf32
[26] = loop_left
;
4976 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4979 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4986 check_cracked (device_param
, salt_pos
);
4992 device_param
->kernel_params_buf32
[24] = 0;
4993 device_param
->kernel_params_buf32
[25] = 0;
4994 device_param
->kernel_params_buf32
[26] = 0;
4995 device_param
->kernel_params_buf32
[27] = 0;
4996 device_param
->kernel_params_buf32
[28] = 0;
4997 device_param
->kernel_params_buf32
[29] = 0;
4998 device_param
->kernel_params_buf32
[30] = 0;
4999 device_param
->kernel_params_buf32
[31] = 0;
5001 data
.dictfile
= dictfile_old
;
5003 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5008 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5010 if (data
.username
== 0)
5012 *hashbuf_pos
= line_buf
;
5013 *hashbuf_len
= line_len
;
5017 char *pos
= line_buf
;
5020 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5022 if (line_buf
[i
] == data
.separator
)
5037 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5044 for (int i
= 0; i
< line_len
; i
++)
5046 if (line_buf
[i
] == data
.separator
)
5055 if (pos
== NULL
) pos
= line_buf
+ i
;
5067 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5074 for (int i
= 0; i
< line_len
; i
++)
5076 if (line_buf
[i
] == ':')
5083 if (sep_cnt
== 2) sep2_len
++;
5084 if (sep_cnt
== 3) sep3_len
++;
5087 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5092 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5099 for (int i
= 0; i
< line_len
; i
++)
5101 if (line_buf
[i
] == ':')
5108 if (data
.hash_mode
== 1000)
5112 if (pos
== NULL
) pos
= line_buf
+ i
;
5117 else if (data
.hash_mode
== 3000)
5121 if (pos
== NULL
) pos
= line_buf
+ i
;
5132 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5139 for (int i
= 0; i
< line_len
; i
++)
5141 if (line_buf
[i
] == ':')
5150 if (pos
== NULL
) pos
= line_buf
+ i
;
5162 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5166 char sep5_first
= 0;
5167 char sep6_first
= 0;
5169 for (int i
= 0; i
< line_len
; i
++)
5171 if (line_buf
[i
] == ':')
5178 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5179 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5182 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5187 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5194 for (int i
= 0; i
< line_len
; i
++)
5196 if (line_buf
[i
] == ':')
5205 if (pos
== NULL
) pos
= line_buf
+ i
;
5215 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5222 for (int i
= 0; i
< line_len
; i
++)
5224 if (line_buf
[i
] == ':')
5233 if (pos
== NULL
) pos
= line_buf
+ i
;
5245 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5249 for (int i
= 0; i
< line_len
; i
++)
5251 if (line_buf
[i
] == ':') sep_cnt
++;
5254 if (sep_cnt
== 8) return 1;
5259 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5261 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5264 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5266 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5271 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5273 switch (hashfile_format
)
5275 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5276 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5277 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5278 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5282 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5284 switch (hashfile_format
)
5286 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5287 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5288 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5289 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5293 char *strhlfmt (const uint hashfile_format
)
5295 switch (hashfile_format
)
5297 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5298 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5299 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5300 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5301 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5302 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5303 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5304 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5305 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5306 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5309 return ((char *) "Unknown");
5312 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5314 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5316 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5317 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5319 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5323 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5327 int line_len
= fgetl (fp
, line_buf
);
5329 if (line_len
== 0) continue;
5331 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5332 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5333 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5335 if (num_check
== max_check
) break;
5342 uint hashlist_format
= HLFMT_HASHCAT
;
5344 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5346 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5348 hashlist_format
= i
;
5353 return hashlist_format
;
5357 * some further helper function
5360 // wrapper around mymalloc for ADL
5362 #if defined(HAVE_HWMON)
5363 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5365 return mymalloc (iSize
);
5369 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
)
5373 const uint dgst_pos0
= data
.dgst_pos0
;
5374 const uint dgst_pos1
= data
.dgst_pos1
;
5375 const uint dgst_pos2
= data
.dgst_pos2
;
5376 const uint dgst_pos3
= data
.dgst_pos3
;
5378 memset (bitmap_a
, 0, bitmap_size
);
5379 memset (bitmap_b
, 0, bitmap_size
);
5380 memset (bitmap_c
, 0, bitmap_size
);
5381 memset (bitmap_d
, 0, bitmap_size
);
5383 for (uint i
= 0; i
< digests_cnt
; i
++)
5385 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5387 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5389 digests_buf_ptr
+= dgst_size
;
5391 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5392 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5393 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5394 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5396 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5397 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5398 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5399 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5401 if (bitmap_a
[idx0
] & val0
) collisions
++;
5402 if (bitmap_b
[idx1
] & val1
) collisions
++;
5403 if (bitmap_c
[idx2
] & val2
) collisions
++;
5404 if (bitmap_d
[idx3
] & val3
) collisions
++;
5406 bitmap_a
[idx0
] |= val0
;
5407 bitmap_b
[idx1
] |= val1
;
5408 bitmap_c
[idx2
] |= val2
;
5409 bitmap_d
[idx3
] |= val3
;
5411 if (collisions
>= collisions_max
) return 0x7fffffff;
5422 void SetConsoleWindowSize (const int x
)
5424 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5426 if (h
== INVALID_HANDLE_VALUE
) return;
5428 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5430 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5432 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5434 sr
->Right
= MAX (sr
->Right
, x
- 1);
5438 co
.X
= sr
->Right
+ 1;
5439 co
.Y
= sr
->Bottom
+ 1;
5441 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5443 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5447 int main (int argc
, char **argv
)
5450 SetConsoleWindowSize (132);
5454 * To help users a bit
5457 char *compute
= getenv ("COMPUTE");
5461 static char display
[100];
5463 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5469 if (getenv ("DISPLAY") == NULL
)
5470 putenv ((char *) "DISPLAY=:0");
5473 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5474 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5476 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5477 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5479 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5480 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5482 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5483 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5485 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5486 putenv ((char *) "POCL_KERNEL_CACHE=0");
5494 memset (&data
, 0, sizeof (hc_global_data_t
));
5500 data
.proc_start
= proc_start
;
5503 char **myargv
= argv
;
5505 hc_thread_mutex_init (mux_dispatcher
);
5506 hc_thread_mutex_init (mux_counter
);
5507 hc_thread_mutex_init (mux_display
);
5508 hc_thread_mutex_init (mux_adl
);
5511 * commandline parameters
5515 uint version
= VERSION
;
5517 uint benchmark
= BENCHMARK
;
5520 uint username
= USERNAME
;
5521 uint remove
= REMOVE
;
5522 uint remove_timer
= REMOVE_TIMER
;
5525 uint keyspace
= KEYSPACE
;
5526 uint potfile_disable
= POTFILE_DISABLE
;
5527 char *potfile_path
= NULL
;
5528 uint debug_mode
= DEBUG_MODE
;
5529 char *debug_file
= NULL
;
5530 char *induction_dir
= NULL
;
5531 char *outfile_check_dir
= NULL
;
5533 uint runtime
= RUNTIME
;
5534 uint hash_mode
= HASH_MODE
;
5535 uint attack_mode
= ATTACK_MODE
;
5536 uint markov_disable
= MARKOV_DISABLE
;
5537 uint markov_classic
= MARKOV_CLASSIC
;
5538 uint markov_threshold
= MARKOV_THRESHOLD
;
5539 char *markov_hcstat
= NULL
;
5540 char *outfile
= NULL
;
5541 uint outfile_format
= OUTFILE_FORMAT
;
5542 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5543 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5544 uint restore
= RESTORE
;
5545 uint restore_timer
= RESTORE_TIMER
;
5546 uint restore_disable
= RESTORE_DISABLE
;
5547 uint status
= STATUS
;
5548 uint status_timer
= STATUS_TIMER
;
5549 uint machine_readable
= MACHINE_READABLE
;
5550 uint loopback
= LOOPBACK
;
5551 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5552 char *session
= NULL
;
5553 uint hex_charset
= HEX_CHARSET
;
5554 uint hex_salt
= HEX_SALT
;
5555 uint hex_wordlist
= HEX_WORDLIST
;
5556 uint rp_gen
= RP_GEN
;
5557 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5558 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5559 uint rp_gen_seed
= RP_GEN_SEED
;
5560 char *rule_buf_l
= (char *) RULE_BUF_L
;
5561 char *rule_buf_r
= (char *) RULE_BUF_R
;
5562 uint increment
= INCREMENT
;
5563 uint increment_min
= INCREMENT_MIN
;
5564 uint increment_max
= INCREMENT_MAX
;
5565 char *cpu_affinity
= NULL
;
5566 OCL_PTR
*ocl
= NULL
;
5567 char *opencl_devices
= NULL
;
5568 char *opencl_platforms
= NULL
;
5569 char *opencl_device_types
= NULL
;
5570 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5571 char *truecrypt_keyfiles
= NULL
;
5572 char *veracrypt_keyfiles
= NULL
;
5573 uint veracrypt_pim
= 0;
5574 uint workload_profile
= WORKLOAD_PROFILE
;
5575 uint kernel_accel
= KERNEL_ACCEL
;
5576 uint kernel_loops
= KERNEL_LOOPS
;
5577 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5579 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5580 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5581 uint powertune_enable
= POWERTUNE_ENABLE
;
5583 uint logfile_disable
= LOGFILE_DISABLE
;
5584 uint segment_size
= SEGMENT_SIZE
;
5585 uint scrypt_tmto
= SCRYPT_TMTO
;
5586 char separator
= SEPARATOR
;
5587 uint bitmap_min
= BITMAP_MIN
;
5588 uint bitmap_max
= BITMAP_MAX
;
5589 char *custom_charset_1
= NULL
;
5590 char *custom_charset_2
= NULL
;
5591 char *custom_charset_3
= NULL
;
5592 char *custom_charset_4
= NULL
;
5594 #define IDX_HELP 'h'
5595 #define IDX_VERSION 'V'
5596 #define IDX_VERSION_LOWER 'v'
5597 #define IDX_QUIET 0xff02
5598 #define IDX_SHOW 0xff03
5599 #define IDX_LEFT 0xff04
5600 #define IDX_REMOVE 0xff05
5601 #define IDX_REMOVE_TIMER 0xff37
5602 #define IDX_SKIP 's'
5603 #define IDX_LIMIT 'l'
5604 #define IDX_KEYSPACE 0xff35
5605 #define IDX_POTFILE_DISABLE 0xff06
5606 #define IDX_POTFILE_PATH 0xffe0
5607 #define IDX_DEBUG_MODE 0xff43
5608 #define IDX_DEBUG_FILE 0xff44
5609 #define IDX_INDUCTION_DIR 0xff46
5610 #define IDX_OUTFILE_CHECK_DIR 0xff47
5611 #define IDX_USERNAME 0xff07
5612 #define IDX_FORCE 0xff08
5613 #define IDX_RUNTIME 0xff09
5614 #define IDX_BENCHMARK 'b'
5615 #define IDX_HASH_MODE 'm'
5616 #define IDX_ATTACK_MODE 'a'
5617 #define IDX_RP_FILE 'r'
5618 #define IDX_RP_GEN 'g'
5619 #define IDX_RP_GEN_FUNC_MIN 0xff10
5620 #define IDX_RP_GEN_FUNC_MAX 0xff11
5621 #define IDX_RP_GEN_SEED 0xff34
5622 #define IDX_RULE_BUF_L 'j'
5623 #define IDX_RULE_BUF_R 'k'
5624 #define IDX_INCREMENT 'i'
5625 #define IDX_INCREMENT_MIN 0xff12
5626 #define IDX_INCREMENT_MAX 0xff13
5627 #define IDX_OUTFILE 'o'
5628 #define IDX_OUTFILE_FORMAT 0xff14
5629 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5630 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5631 #define IDX_RESTORE 0xff15
5632 #define IDX_RESTORE_DISABLE 0xff27
5633 #define IDX_STATUS 0xff17
5634 #define IDX_STATUS_TIMER 0xff18
5635 #define IDX_MACHINE_READABLE 0xff50
5636 #define IDX_LOOPBACK 0xff38
5637 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5638 #define IDX_SESSION 0xff19
5639 #define IDX_HEX_CHARSET 0xff20
5640 #define IDX_HEX_SALT 0xff21
5641 #define IDX_HEX_WORDLIST 0xff40
5642 #define IDX_MARKOV_DISABLE 0xff22
5643 #define IDX_MARKOV_CLASSIC 0xff23
5644 #define IDX_MARKOV_THRESHOLD 't'
5645 #define IDX_MARKOV_HCSTAT 0xff24
5646 #define IDX_CPU_AFFINITY 0xff25
5647 #define IDX_OPENCL_DEVICES 'd'
5648 #define IDX_OPENCL_PLATFORMS 0xff72
5649 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5650 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5651 #define IDX_WORKLOAD_PROFILE 'w'
5652 #define IDX_KERNEL_ACCEL 'n'
5653 #define IDX_KERNEL_LOOPS 'u'
5654 #define IDX_GPU_TEMP_DISABLE 0xff29
5655 #define IDX_GPU_TEMP_ABORT 0xff30
5656 #define IDX_GPU_TEMP_RETAIN 0xff31
5657 #define IDX_POWERTUNE_ENABLE 0xff41
5658 #define IDX_LOGFILE_DISABLE 0xff51
5659 #define IDX_TRUECRYPT_KEYFILES 0xff52
5660 #define IDX_VERACRYPT_KEYFILES 0xff53
5661 #define IDX_VERACRYPT_PIM 0xff54
5662 #define IDX_SCRYPT_TMTO 0xff61
5663 #define IDX_SEGMENT_SIZE 'c'
5664 #define IDX_SEPARATOR 'p'
5665 #define IDX_BITMAP_MIN 0xff70
5666 #define IDX_BITMAP_MAX 0xff71
5667 #define IDX_CUSTOM_CHARSET_1 '1'
5668 #define IDX_CUSTOM_CHARSET_2 '2'
5669 #define IDX_CUSTOM_CHARSET_3 '3'
5670 #define IDX_CUSTOM_CHARSET_4 '4'
5672 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5674 struct option long_options
[] =
5676 {"help", no_argument
, 0, IDX_HELP
},
5677 {"version", no_argument
, 0, IDX_VERSION
},
5678 {"quiet", no_argument
, 0, IDX_QUIET
},
5679 {"show", no_argument
, 0, IDX_SHOW
},
5680 {"left", no_argument
, 0, IDX_LEFT
},
5681 {"username", no_argument
, 0, IDX_USERNAME
},
5682 {"remove", no_argument
, 0, IDX_REMOVE
},
5683 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5684 {"skip", required_argument
, 0, IDX_SKIP
},
5685 {"limit", required_argument
, 0, IDX_LIMIT
},
5686 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5687 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5688 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5689 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5690 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5691 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5692 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5693 {"force", no_argument
, 0, IDX_FORCE
},
5694 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5695 {"restore", no_argument
, 0, IDX_RESTORE
},
5696 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5697 {"status", no_argument
, 0, IDX_STATUS
},
5698 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5699 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5700 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5701 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5702 {"session", required_argument
, 0, IDX_SESSION
},
5703 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5704 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5705 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5706 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5707 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5708 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5709 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5710 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5711 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5712 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5713 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5714 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5715 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5716 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5717 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5718 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5719 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5720 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5721 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5722 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5723 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5724 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5725 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5726 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5727 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5728 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5729 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5730 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5731 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5732 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5734 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5735 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5736 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5737 #endif // HAVE_HWMON
5738 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5739 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5740 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5741 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5742 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5743 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5744 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5745 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5746 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5747 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5748 {"increment", no_argument
, 0, IDX_INCREMENT
},
5749 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5750 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5751 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5752 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5753 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5754 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5758 uint rp_files_cnt
= 0;
5760 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5762 int option_index
= 0;
5768 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5772 case IDX_HELP
: usage
= 1; break;
5774 case IDX_VERSION_LOWER
: version
= 1; break;
5775 case IDX_RESTORE
: restore
= 1; break;
5776 case IDX_SESSION
: session
= optarg
; break;
5777 case IDX_SHOW
: show
= 1; break;
5778 case IDX_LEFT
: left
= 1; break;
5779 case '?': return (-1);
5785 log_error ("ERROR: Invalid argument specified");
5796 log_info ("%s", VERSION_TAG
);
5803 usage_big_print (PROGNAME
);
5809 * session needs to be set, always!
5812 if (session
== NULL
) session
= (char *) PROGNAME
;
5815 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5818 char *exec_path
= get_exec_path ();
5822 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5823 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5825 char *install_dir
= get_install_dir (resolved_exec_path
);
5826 char *profile_dir
= NULL
;
5827 char *session_dir
= NULL
;
5828 char *shared_dir
= NULL
;
5830 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5832 struct passwd
*pw
= getpwuid (getuid ());
5834 const char *homedir
= pw
->pw_dir
;
5836 profile_dir
= get_profile_dir (homedir
);
5837 session_dir
= get_session_dir (profile_dir
);
5838 shared_dir
= strdup (SHARED_FOLDER
);
5840 mkdir (profile_dir
, 0700);
5841 mkdir (session_dir
, 0700);
5845 profile_dir
= install_dir
;
5846 session_dir
= install_dir
;
5847 shared_dir
= install_dir
;
5850 myfree (resolved_install_folder
);
5851 myfree (resolved_exec_path
);
5855 char *install_dir
= get_install_dir (exec_path
);
5856 char *profile_dir
= install_dir
;
5857 char *session_dir
= install_dir
;
5858 char *shared_dir
= install_dir
;
5862 data
.install_dir
= install_dir
;
5863 data
.profile_dir
= profile_dir
;
5864 data
.session_dir
= session_dir
;
5865 data
.shared_dir
= shared_dir
;
5870 * kernel cache, we need to make sure folder exist
5873 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5875 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5877 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5879 mkdir (kernels_folder
, 0700);
5881 myfree (kernels_folder
);
5887 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5889 data
.session
= session
;
5891 char *eff_restore_file
= (char *) mymalloc (session_size
);
5892 char *new_restore_file
= (char *) mymalloc (session_size
);
5894 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5895 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5897 data
.eff_restore_file
= eff_restore_file
;
5898 data
.new_restore_file
= new_restore_file
;
5900 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5902 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5903 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5908 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5909 if ((show
== 1) || (left
== 1))
5911 restore_disable
= 1;
5916 data
.restore_disable
= restore_disable
;
5918 restore_data_t
*rd
= init_restore (argc
, argv
);
5928 read_restore (eff_restore_file
, rd
);
5930 if (rd
->version_bin
< RESTORE_MIN
)
5932 log_error ("ERROR: Incompatible restore-file version");
5941 rd
->pid
= getpid ();
5943 rd
->pid
= GetCurrentProcessId ();
5947 uint hash_mode_chgd
= 0;
5948 uint runtime_chgd
= 0;
5949 uint kernel_loops_chgd
= 0;
5950 uint kernel_accel_chgd
= 0;
5951 uint attack_mode_chgd
= 0;
5952 uint outfile_format_chgd
= 0;
5953 uint rp_gen_seed_chgd
= 0;
5954 uint remove_timer_chgd
= 0;
5955 uint increment_min_chgd
= 0;
5956 uint increment_max_chgd
= 0;
5957 uint workload_profile_chgd
= 0;
5958 uint opencl_vector_width_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
); break;
6041 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6042 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6043 #endif // HAVE_HWMON
6044 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6045 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6046 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6047 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6048 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6049 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6050 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6051 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6052 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6053 case IDX_INCREMENT
: increment
= 1; break;
6054 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6055 increment_min_chgd
= 1; break;
6056 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6057 increment_max_chgd
= 1; break;
6058 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6059 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6060 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6061 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6064 log_error ("ERROR: Invalid argument specified");
6071 log_error ("ERROR: Invalid argument specified");
6077 * Inform user things getting started,
6078 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6079 * - we do not need to check algorithm_pos
6086 if (machine_readable
== 0)
6088 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6093 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6096 else if (restore
== 1)
6098 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6103 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6112 if (attack_mode
> 7)
6114 log_error ("ERROR: Invalid attack-mode specified");
6119 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6121 log_error ("ERROR: Invalid runtime specified");
6126 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6128 log_error ("ERROR: Invalid hash-type specified");
6133 // renamed hash modes
6147 log_error ("Old -m specified, use -m %d instead", n
);
6155 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6157 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6163 if (outfile_format
> 16)
6165 log_error ("ERROR: Invalid outfile-format specified");
6172 if (outfile_format_chgd
== 1)
6174 if (outfile_format
> 1)
6176 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6183 outfile_format
= OUTFILE_FMT_HASH
;
6189 if (outfile_format_chgd
== 1)
6191 if ((outfile_format
> 7) && (outfile_format
< 16))
6193 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6200 if (increment_min
< INCREMENT_MIN
)
6202 log_error ("ERROR: Invalid increment-min specified");
6207 if (increment_max
> INCREMENT_MAX
)
6209 log_error ("ERROR: Invalid increment-max specified");
6214 if (increment_min
> increment_max
)
6216 log_error ("ERROR: Invalid increment-min specified");
6221 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6223 log_error ("ERROR: increment is not allowed in attack-mode 0");
6228 if ((increment
== 0) && (increment_min_chgd
== 1))
6230 log_error ("ERROR: increment-min is only supported together with increment switch");
6235 if ((increment
== 0) && (increment_max_chgd
== 1))
6237 log_error ("ERROR: increment-max is only supported together with increment switch");
6242 if (rp_files_cnt
&& rp_gen
)
6244 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6249 if (rp_files_cnt
|| rp_gen
)
6251 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6253 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6259 if (rp_gen_func_min
> rp_gen_func_max
)
6261 log_error ("ERROR: Invalid rp-gen-func-min specified");
6266 if (kernel_accel_chgd
== 1)
6270 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6271 log_info ("Please consider using the option -w instead");
6272 log_info ("You can use --force to override this but do not post error reports if you do so");
6278 if (kernel_accel
< 1)
6280 log_error ("ERROR: Invalid kernel-accel specified");
6285 if (kernel_accel
> 1024)
6287 log_error ("ERROR: Invalid kernel-accel specified");
6293 if (kernel_loops_chgd
== 1)
6297 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6298 log_info ("Please consider using the option -w instead");
6299 log_info ("You can use --force to override this but do not post error reports if you do so");
6305 if (kernel_loops
< 1)
6307 log_error ("ERROR: Invalid kernel-loops specified");
6312 if (kernel_loops
> 1024)
6314 log_error ("ERROR: Invalid kernel-loops specified");
6320 if ((workload_profile
< 1) || (workload_profile
> 4))
6322 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6327 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6329 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6334 if (show
== 1 || left
== 1)
6336 attack_mode
= ATTACK_MODE_NONE
;
6340 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6345 if (potfile_disable
== 1)
6347 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6353 uint attack_kern
= ATTACK_KERN_NONE
;
6355 switch (attack_mode
)
6357 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6358 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6359 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6360 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6361 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6368 int num_additional_params
= 1;
6370 if (attack_kern
== ATTACK_KERN_COMBI
)
6372 num_additional_params
= 2;
6375 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6377 if (keyspace_wordlist_specified
== 0) optind
--;
6380 if (attack_kern
== ATTACK_KERN_NONE
)
6382 if ((optind
+ 1) != myargc
)
6384 usage_mini_print (myargv
[0]);
6389 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6391 if ((optind
+ 1) > myargc
)
6393 usage_mini_print (myargv
[0]);
6398 else if (attack_kern
== ATTACK_KERN_COMBI
)
6400 if ((optind
+ 3) != myargc
)
6402 usage_mini_print (myargv
[0]);
6407 else if (attack_kern
== ATTACK_KERN_BF
)
6409 if ((optind
+ 1) > myargc
)
6411 usage_mini_print (myargv
[0]);
6418 usage_mini_print (myargv
[0]);
6425 if (myargv
[optind
] != 0)
6427 log_error ("ERROR: Invalid argument for benchmark mode specified");
6432 if (attack_mode_chgd
== 1)
6434 if (attack_mode
!= ATTACK_MODE_BF
)
6436 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6443 if (skip
!= 0 && limit
!= 0)
6452 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6458 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6463 potfile_disable
= 1;
6465 restore_disable
= 1;
6469 weak_hash_threshold
= 0;
6474 if (remove_timer_chgd
== 1)
6478 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6483 if (remove_timer
< 1)
6485 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6493 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6495 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6497 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6504 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6512 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6514 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6519 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6521 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6529 log_error ("ERROR: Invalid debug-mode specified");
6534 if (debug_file
!= NULL
)
6538 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6544 if (induction_dir
!= NULL
)
6546 if (attack_mode
== ATTACK_MODE_BF
)
6548 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6554 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6556 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6558 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6563 weak_hash_threshold
= 0;
6567 * induction directory
6570 char *induction_directory
= NULL
;
6572 if (attack_mode
!= ATTACK_MODE_BF
)
6574 if (induction_dir
== NULL
)
6576 induction_directory
= (char *) mymalloc (session_size
);
6578 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6580 // create induction folder if it does not already exist
6584 if (rmdir (induction_directory
) == -1)
6586 if (errno
== ENOENT
)
6588 // good, we can ignore
6590 else if (errno
== ENOTEMPTY
)
6592 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6594 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6596 if (rename (induction_directory
, induction_directory_mv
) != 0)
6598 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6605 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6611 if (mkdir (induction_directory
, 0700) == -1)
6613 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6621 induction_directory
= induction_dir
;
6625 data
.induction_directory
= induction_directory
;
6631 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6633 char *loopback_file
= (char *) mymalloc (loopback_size
);
6639 char tuning_db_file
[256] = { 0 };
6641 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6643 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6646 * outfile-check directory
6649 char *outfile_check_directory
= NULL
;
6651 if (outfile_check_dir
== NULL
)
6653 outfile_check_directory
= (char *) mymalloc (session_size
);
6655 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6659 outfile_check_directory
= outfile_check_dir
;
6662 data
.outfile_check_directory
= outfile_check_directory
;
6666 struct stat outfile_check_stat
;
6668 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6670 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6674 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6679 else if (outfile_check_dir
== NULL
)
6681 if (mkdir (outfile_check_directory
, 0700) == -1)
6683 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6691 * special other stuff
6694 if (hash_mode
== 9710)
6697 outfile_format_chgd
= 1;
6700 if (hash_mode
== 9810)
6703 outfile_format_chgd
= 1;
6706 if (hash_mode
== 10410)
6709 outfile_format_chgd
= 1;
6716 data
.hash_mode
= hash_mode
;
6717 data
.restore
= restore
;
6718 data
.restore_timer
= restore_timer
;
6719 data
.restore_disable
= restore_disable
;
6720 data
.status
= status
;
6721 data
.status_timer
= status_timer
;
6722 data
.machine_readable
= machine_readable
;
6723 data
.loopback
= loopback
;
6724 data
.runtime
= runtime
;
6725 data
.remove
= remove
;
6726 data
.remove_timer
= remove_timer
;
6727 data
.debug_mode
= debug_mode
;
6728 data
.debug_file
= debug_file
;
6729 data
.username
= username
;
6731 data
.outfile
= outfile
;
6732 data
.outfile_format
= outfile_format
;
6733 data
.outfile_autohex
= outfile_autohex
;
6734 data
.hex_charset
= hex_charset
;
6735 data
.hex_salt
= hex_salt
;
6736 data
.hex_wordlist
= hex_wordlist
;
6737 data
.separator
= separator
;
6738 data
.rp_files
= rp_files
;
6739 data
.rp_files_cnt
= rp_files_cnt
;
6740 data
.rp_gen
= rp_gen
;
6741 data
.rp_gen_seed
= rp_gen_seed
;
6743 data
.benchmark
= benchmark
;
6747 data
.powertune_enable
= powertune_enable
;
6749 data
.logfile_disable
= logfile_disable
;
6750 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6751 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6752 data
.veracrypt_pim
= veracrypt_pim
;
6753 data
.scrypt_tmto
= scrypt_tmto
;
6754 data
.workload_profile
= workload_profile
;
6762 set_cpu_affinity (cpu_affinity
);
6765 if (rp_gen_seed_chgd
== 0)
6771 srand (rp_gen_seed
);
6778 if (logfile_disable
== 0)
6780 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6782 char *logfile
= (char *) mymalloc (logfile_size
);
6784 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6786 data
.logfile
= logfile
;
6788 char *topid
= logfile_generate_topid ();
6793 // logfile_append() checks for logfile_disable internally to make it easier from here
6795 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6796 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6797 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6798 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6799 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6800 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6801 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6802 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6803 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6804 #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));
6806 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6807 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6808 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6809 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6810 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6811 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6812 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6813 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6815 logfile_top_msg ("START");
6817 logfile_top_uint (attack_mode
);
6818 logfile_top_uint (attack_kern
);
6819 logfile_top_uint (benchmark
);
6820 logfile_top_uint (bitmap_min
);
6821 logfile_top_uint (bitmap_max
);
6822 logfile_top_uint (debug_mode
);
6823 logfile_top_uint (force
);
6824 logfile_top_uint (kernel_accel
);
6825 logfile_top_uint (kernel_loops
);
6826 logfile_top_uint (gpu_temp_disable
);
6828 logfile_top_uint (gpu_temp_abort
);
6829 logfile_top_uint (gpu_temp_retain
);
6831 logfile_top_uint (hash_mode
);
6832 logfile_top_uint (hex_charset
);
6833 logfile_top_uint (hex_salt
);
6834 logfile_top_uint (hex_wordlist
);
6835 logfile_top_uint (increment
);
6836 logfile_top_uint (increment_max
);
6837 logfile_top_uint (increment_min
);
6838 logfile_top_uint (keyspace
);
6839 logfile_top_uint (left
);
6840 logfile_top_uint (logfile_disable
);
6841 logfile_top_uint (loopback
);
6842 logfile_top_uint (markov_classic
);
6843 logfile_top_uint (markov_disable
);
6844 logfile_top_uint (markov_threshold
);
6845 logfile_top_uint (outfile_autohex
);
6846 logfile_top_uint (outfile_check_timer
);
6847 logfile_top_uint (outfile_format
);
6848 logfile_top_uint (potfile_disable
);
6849 logfile_top_string (potfile_path
);
6850 #if defined(HAVE_HWMON)
6851 logfile_top_uint (powertune_enable
);
6853 logfile_top_uint (scrypt_tmto
);
6854 logfile_top_uint (quiet
);
6855 logfile_top_uint (remove
);
6856 logfile_top_uint (remove_timer
);
6857 logfile_top_uint (restore
);
6858 logfile_top_uint (restore_disable
);
6859 logfile_top_uint (restore_timer
);
6860 logfile_top_uint (rp_gen
);
6861 logfile_top_uint (rp_gen_func_max
);
6862 logfile_top_uint (rp_gen_func_min
);
6863 logfile_top_uint (rp_gen_seed
);
6864 logfile_top_uint (runtime
);
6865 logfile_top_uint (segment_size
);
6866 logfile_top_uint (show
);
6867 logfile_top_uint (status
);
6868 logfile_top_uint (machine_readable
);
6869 logfile_top_uint (status_timer
);
6870 logfile_top_uint (usage
);
6871 logfile_top_uint (username
);
6872 logfile_top_uint (version
);
6873 logfile_top_uint (weak_hash_threshold
);
6874 logfile_top_uint (workload_profile
);
6875 logfile_top_uint64 (limit
);
6876 logfile_top_uint64 (skip
);
6877 logfile_top_char (separator
);
6878 logfile_top_string (cpu_affinity
);
6879 logfile_top_string (custom_charset_1
);
6880 logfile_top_string (custom_charset_2
);
6881 logfile_top_string (custom_charset_3
);
6882 logfile_top_string (custom_charset_4
);
6883 logfile_top_string (debug_file
);
6884 logfile_top_string (opencl_devices
);
6885 logfile_top_string (opencl_platforms
);
6886 logfile_top_string (opencl_device_types
);
6887 logfile_top_uint (opencl_vector_width
);
6888 logfile_top_string (induction_dir
);
6889 logfile_top_string (markov_hcstat
);
6890 logfile_top_string (outfile
);
6891 logfile_top_string (outfile_check_dir
);
6892 logfile_top_string (rule_buf_l
);
6893 logfile_top_string (rule_buf_r
);
6894 logfile_top_string (session
);
6895 logfile_top_string (truecrypt_keyfiles
);
6896 logfile_top_string (veracrypt_keyfiles
);
6897 logfile_top_uint (veracrypt_pim
);
6900 * Init OpenCL library loader
6905 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6913 * OpenCL platform selection
6916 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6919 * OpenCL device selection
6922 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6925 * OpenCL device type selection
6928 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6937 * disable useless stuff for benchmark
6942 restore_disable
= 1;
6943 potfile_disable
= 1;
6944 weak_hash_threshold
= 0;
6945 gpu_temp_disable
= 1;
6948 powertune_enable
= 1;
6951 data
.status_timer
= status_timer
;
6952 data
.restore_timer
= restore_timer
;
6953 data
.restore_disable
= restore_disable
;
6956 * force attack mode to be bruteforce
6959 attack_mode
= ATTACK_MODE_BF
;
6960 attack_kern
= ATTACK_KERN_BF
;
6962 if (workload_profile_chgd
== 0)
6964 workload_profile
= 3;
6966 data
.workload_profile
= workload_profile
;
6976 uint attack_exec
= 0;
6980 uint esalt_size
= 0;
6982 uint dgst_pos0
= -1;
6983 uint dgst_pos1
= -1;
6984 uint dgst_pos2
= -1;
6985 uint dgst_pos3
= -1;
6987 int (*parse_func
) (char *, uint
, hash_t
*);
6988 int (*sort_by_digest
) (const void *, const void *);
6990 uint algorithm_pos
= 0;
6991 uint algorithm_max
= 1;
6993 uint
*algorithms
= default_benchmark_algorithms
;
6995 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6997 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7000 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7001 * the following algos are skipped entirely
7004 if (algorithm_pos
> 0)
7008 rd
= init_restore (argc
, argv
);
7014 * update hash_mode in case of multihash benchmark
7019 if (hash_mode_chgd
== 0)
7021 hash_mode
= algorithms
[algorithm_pos
];
7023 data
.hash_mode
= hash_mode
;
7033 case 0: hash_type
= HASH_TYPE_MD5
;
7034 salt_type
= SALT_TYPE_NONE
;
7035 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7036 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7037 | OPTS_TYPE_PT_ADD80
7038 | OPTS_TYPE_PT_ADDBITS14
;
7039 kern_type
= KERN_TYPE_MD5
;
7040 dgst_size
= DGST_SIZE_4_4
;
7041 parse_func
= md5_parse_hash
;
7042 sort_by_digest
= sort_by_digest_4_4
;
7043 opti_type
= OPTI_TYPE_ZERO_BYTE
7044 | OPTI_TYPE_PRECOMPUTE_INIT
7045 | OPTI_TYPE_PRECOMPUTE_MERKLE
7046 | OPTI_TYPE_MEET_IN_MIDDLE
7047 | OPTI_TYPE_EARLY_SKIP
7048 | OPTI_TYPE_NOT_ITERATED
7049 | OPTI_TYPE_NOT_SALTED
7050 | OPTI_TYPE_RAW_HASH
;
7057 case 10: hash_type
= HASH_TYPE_MD5
;
7058 salt_type
= SALT_TYPE_INTERN
;
7059 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7060 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7061 | OPTS_TYPE_ST_ADD80
7062 | OPTS_TYPE_ST_ADDBITS14
;
7063 kern_type
= KERN_TYPE_MD5_PWSLT
;
7064 dgst_size
= DGST_SIZE_4_4
;
7065 parse_func
= md5s_parse_hash
;
7066 sort_by_digest
= sort_by_digest_4_4
;
7067 opti_type
= OPTI_TYPE_ZERO_BYTE
7068 | OPTI_TYPE_PRECOMPUTE_INIT
7069 | OPTI_TYPE_PRECOMPUTE_MERKLE
7070 | OPTI_TYPE_MEET_IN_MIDDLE
7071 | OPTI_TYPE_EARLY_SKIP
7072 | OPTI_TYPE_NOT_ITERATED
7073 | OPTI_TYPE_APPENDED_SALT
7074 | OPTI_TYPE_RAW_HASH
;
7081 case 11: hash_type
= HASH_TYPE_MD5
;
7082 salt_type
= SALT_TYPE_INTERN
;
7083 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7084 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7085 | OPTS_TYPE_ST_ADD80
7086 | OPTS_TYPE_ST_ADDBITS14
;
7087 kern_type
= KERN_TYPE_MD5_PWSLT
;
7088 dgst_size
= DGST_SIZE_4_4
;
7089 parse_func
= joomla_parse_hash
;
7090 sort_by_digest
= sort_by_digest_4_4
;
7091 opti_type
= OPTI_TYPE_ZERO_BYTE
7092 | OPTI_TYPE_PRECOMPUTE_INIT
7093 | OPTI_TYPE_PRECOMPUTE_MERKLE
7094 | OPTI_TYPE_MEET_IN_MIDDLE
7095 | OPTI_TYPE_EARLY_SKIP
7096 | OPTI_TYPE_NOT_ITERATED
7097 | OPTI_TYPE_APPENDED_SALT
7098 | OPTI_TYPE_RAW_HASH
;
7105 case 12: hash_type
= HASH_TYPE_MD5
;
7106 salt_type
= SALT_TYPE_INTERN
;
7107 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7108 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7109 | OPTS_TYPE_ST_ADD80
7110 | OPTS_TYPE_ST_ADDBITS14
;
7111 kern_type
= KERN_TYPE_MD5_PWSLT
;
7112 dgst_size
= DGST_SIZE_4_4
;
7113 parse_func
= postgresql_parse_hash
;
7114 sort_by_digest
= sort_by_digest_4_4
;
7115 opti_type
= OPTI_TYPE_ZERO_BYTE
7116 | OPTI_TYPE_PRECOMPUTE_INIT
7117 | OPTI_TYPE_PRECOMPUTE_MERKLE
7118 | OPTI_TYPE_MEET_IN_MIDDLE
7119 | OPTI_TYPE_EARLY_SKIP
7120 | OPTI_TYPE_NOT_ITERATED
7121 | OPTI_TYPE_APPENDED_SALT
7122 | OPTI_TYPE_RAW_HASH
;
7129 case 20: hash_type
= HASH_TYPE_MD5
;
7130 salt_type
= SALT_TYPE_INTERN
;
7131 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7132 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7133 | OPTS_TYPE_PT_ADD80
7134 | OPTS_TYPE_PT_ADDBITS14
;
7135 kern_type
= KERN_TYPE_MD5_SLTPW
;
7136 dgst_size
= DGST_SIZE_4_4
;
7137 parse_func
= md5s_parse_hash
;
7138 sort_by_digest
= sort_by_digest_4_4
;
7139 opti_type
= OPTI_TYPE_ZERO_BYTE
7140 | OPTI_TYPE_PRECOMPUTE_INIT
7141 | OPTI_TYPE_PRECOMPUTE_MERKLE
7142 | OPTI_TYPE_EARLY_SKIP
7143 | OPTI_TYPE_NOT_ITERATED
7144 | OPTI_TYPE_PREPENDED_SALT
7145 | OPTI_TYPE_RAW_HASH
;
7152 case 21: hash_type
= HASH_TYPE_MD5
;
7153 salt_type
= SALT_TYPE_INTERN
;
7154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7156 | OPTS_TYPE_PT_ADD80
7157 | OPTS_TYPE_PT_ADDBITS14
;
7158 kern_type
= KERN_TYPE_MD5_SLTPW
;
7159 dgst_size
= DGST_SIZE_4_4
;
7160 parse_func
= osc_parse_hash
;
7161 sort_by_digest
= sort_by_digest_4_4
;
7162 opti_type
= OPTI_TYPE_ZERO_BYTE
7163 | OPTI_TYPE_PRECOMPUTE_INIT
7164 | OPTI_TYPE_PRECOMPUTE_MERKLE
7165 | OPTI_TYPE_EARLY_SKIP
7166 | OPTI_TYPE_NOT_ITERATED
7167 | OPTI_TYPE_PREPENDED_SALT
7168 | OPTI_TYPE_RAW_HASH
;
7175 case 22: hash_type
= HASH_TYPE_MD5
;
7176 salt_type
= SALT_TYPE_EMBEDDED
;
7177 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7178 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7179 | OPTS_TYPE_PT_ADD80
7180 | OPTS_TYPE_PT_ADDBITS14
;
7181 kern_type
= KERN_TYPE_MD5_SLTPW
;
7182 dgst_size
= DGST_SIZE_4_4
;
7183 parse_func
= netscreen_parse_hash
;
7184 sort_by_digest
= sort_by_digest_4_4
;
7185 opti_type
= OPTI_TYPE_ZERO_BYTE
7186 | OPTI_TYPE_PRECOMPUTE_INIT
7187 | OPTI_TYPE_PRECOMPUTE_MERKLE
7188 | OPTI_TYPE_EARLY_SKIP
7189 | OPTI_TYPE_NOT_ITERATED
7190 | OPTI_TYPE_PREPENDED_SALT
7191 | OPTI_TYPE_RAW_HASH
;
7198 case 23: hash_type
= HASH_TYPE_MD5
;
7199 salt_type
= SALT_TYPE_EMBEDDED
;
7200 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7201 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7202 | OPTS_TYPE_PT_ADD80
7203 | OPTS_TYPE_PT_ADDBITS14
;
7204 kern_type
= KERN_TYPE_MD5_SLTPW
;
7205 dgst_size
= DGST_SIZE_4_4
;
7206 parse_func
= skype_parse_hash
;
7207 sort_by_digest
= sort_by_digest_4_4
;
7208 opti_type
= OPTI_TYPE_ZERO_BYTE
7209 | OPTI_TYPE_PRECOMPUTE_INIT
7210 | OPTI_TYPE_PRECOMPUTE_MERKLE
7211 | OPTI_TYPE_EARLY_SKIP
7212 | OPTI_TYPE_NOT_ITERATED
7213 | OPTI_TYPE_PREPENDED_SALT
7214 | OPTI_TYPE_RAW_HASH
;
7221 case 30: hash_type
= HASH_TYPE_MD5
;
7222 salt_type
= SALT_TYPE_INTERN
;
7223 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7224 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7225 | OPTS_TYPE_PT_UNICODE
7226 | OPTS_TYPE_ST_ADD80
7227 | OPTS_TYPE_ST_ADDBITS14
;
7228 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7229 dgst_size
= DGST_SIZE_4_4
;
7230 parse_func
= md5s_parse_hash
;
7231 sort_by_digest
= sort_by_digest_4_4
;
7232 opti_type
= OPTI_TYPE_ZERO_BYTE
7233 | OPTI_TYPE_PRECOMPUTE_INIT
7234 | OPTI_TYPE_PRECOMPUTE_MERKLE
7235 | OPTI_TYPE_MEET_IN_MIDDLE
7236 | OPTI_TYPE_EARLY_SKIP
7237 | OPTI_TYPE_NOT_ITERATED
7238 | OPTI_TYPE_APPENDED_SALT
7239 | OPTI_TYPE_RAW_HASH
;
7246 case 40: hash_type
= HASH_TYPE_MD5
;
7247 salt_type
= SALT_TYPE_INTERN
;
7248 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7249 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7250 | OPTS_TYPE_PT_ADD80
7251 | OPTS_TYPE_PT_ADDBITS14
7252 | OPTS_TYPE_PT_UNICODE
;
7253 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7254 dgst_size
= DGST_SIZE_4_4
;
7255 parse_func
= md5s_parse_hash
;
7256 sort_by_digest
= sort_by_digest_4_4
;
7257 opti_type
= OPTI_TYPE_ZERO_BYTE
7258 | OPTI_TYPE_PRECOMPUTE_INIT
7259 | OPTI_TYPE_PRECOMPUTE_MERKLE
7260 | OPTI_TYPE_EARLY_SKIP
7261 | OPTI_TYPE_NOT_ITERATED
7262 | OPTI_TYPE_PREPENDED_SALT
7263 | OPTI_TYPE_RAW_HASH
;
7270 case 50: hash_type
= HASH_TYPE_MD5
;
7271 salt_type
= SALT_TYPE_INTERN
;
7272 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7273 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7274 | OPTS_TYPE_ST_ADD80
7275 | OPTS_TYPE_ST_ADDBITS14
;
7276 kern_type
= KERN_TYPE_HMACMD5_PW
;
7277 dgst_size
= DGST_SIZE_4_4
;
7278 parse_func
= hmacmd5_parse_hash
;
7279 sort_by_digest
= sort_by_digest_4_4
;
7280 opti_type
= OPTI_TYPE_ZERO_BYTE
7281 | OPTI_TYPE_NOT_ITERATED
;
7288 case 60: hash_type
= HASH_TYPE_MD5
;
7289 salt_type
= SALT_TYPE_INTERN
;
7290 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7291 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7292 | OPTS_TYPE_PT_ADD80
7293 | OPTS_TYPE_PT_ADDBITS14
;
7294 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7295 dgst_size
= DGST_SIZE_4_4
;
7296 parse_func
= hmacmd5_parse_hash
;
7297 sort_by_digest
= sort_by_digest_4_4
;
7298 opti_type
= OPTI_TYPE_ZERO_BYTE
7299 | OPTI_TYPE_NOT_ITERATED
;
7306 case 100: hash_type
= HASH_TYPE_SHA1
;
7307 salt_type
= SALT_TYPE_NONE
;
7308 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7309 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7310 | OPTS_TYPE_PT_ADD80
7311 | OPTS_TYPE_PT_ADDBITS15
;
7312 kern_type
= KERN_TYPE_SHA1
;
7313 dgst_size
= DGST_SIZE_4_5
;
7314 parse_func
= sha1_parse_hash
;
7315 sort_by_digest
= sort_by_digest_4_5
;
7316 opti_type
= OPTI_TYPE_ZERO_BYTE
7317 | OPTI_TYPE_PRECOMPUTE_INIT
7318 | OPTI_TYPE_PRECOMPUTE_MERKLE
7319 | OPTI_TYPE_EARLY_SKIP
7320 | OPTI_TYPE_NOT_ITERATED
7321 | OPTI_TYPE_NOT_SALTED
7322 | OPTI_TYPE_RAW_HASH
;
7329 case 101: hash_type
= HASH_TYPE_SHA1
;
7330 salt_type
= SALT_TYPE_NONE
;
7331 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7332 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7333 | OPTS_TYPE_PT_ADD80
7334 | OPTS_TYPE_PT_ADDBITS15
;
7335 kern_type
= KERN_TYPE_SHA1
;
7336 dgst_size
= DGST_SIZE_4_5
;
7337 parse_func
= sha1b64_parse_hash
;
7338 sort_by_digest
= sort_by_digest_4_5
;
7339 opti_type
= OPTI_TYPE_ZERO_BYTE
7340 | OPTI_TYPE_PRECOMPUTE_INIT
7341 | OPTI_TYPE_PRECOMPUTE_MERKLE
7342 | OPTI_TYPE_EARLY_SKIP
7343 | OPTI_TYPE_NOT_ITERATED
7344 | OPTI_TYPE_NOT_SALTED
7345 | OPTI_TYPE_RAW_HASH
;
7352 case 110: hash_type
= HASH_TYPE_SHA1
;
7353 salt_type
= SALT_TYPE_INTERN
;
7354 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7355 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7356 | OPTS_TYPE_ST_ADD80
7357 | OPTS_TYPE_ST_ADDBITS15
;
7358 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7359 dgst_size
= DGST_SIZE_4_5
;
7360 parse_func
= sha1s_parse_hash
;
7361 sort_by_digest
= sort_by_digest_4_5
;
7362 opti_type
= OPTI_TYPE_ZERO_BYTE
7363 | OPTI_TYPE_PRECOMPUTE_INIT
7364 | OPTI_TYPE_PRECOMPUTE_MERKLE
7365 | OPTI_TYPE_EARLY_SKIP
7366 | OPTI_TYPE_NOT_ITERATED
7367 | OPTI_TYPE_APPENDED_SALT
7368 | OPTI_TYPE_RAW_HASH
;
7375 case 111: hash_type
= HASH_TYPE_SHA1
;
7376 salt_type
= SALT_TYPE_EMBEDDED
;
7377 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7378 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7379 | OPTS_TYPE_ST_ADD80
7380 | OPTS_TYPE_ST_ADDBITS15
;
7381 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7382 dgst_size
= DGST_SIZE_4_5
;
7383 parse_func
= sha1b64s_parse_hash
;
7384 sort_by_digest
= sort_by_digest_4_5
;
7385 opti_type
= OPTI_TYPE_ZERO_BYTE
7386 | OPTI_TYPE_PRECOMPUTE_INIT
7387 | OPTI_TYPE_PRECOMPUTE_MERKLE
7388 | OPTI_TYPE_EARLY_SKIP
7389 | OPTI_TYPE_NOT_ITERATED
7390 | OPTI_TYPE_APPENDED_SALT
7391 | OPTI_TYPE_RAW_HASH
;
7398 case 112: hash_type
= HASH_TYPE_SHA1
;
7399 salt_type
= SALT_TYPE_INTERN
;
7400 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7401 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7402 | OPTS_TYPE_ST_ADD80
7403 | OPTS_TYPE_ST_ADDBITS15
7405 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7406 dgst_size
= DGST_SIZE_4_5
;
7407 parse_func
= oracles_parse_hash
;
7408 sort_by_digest
= sort_by_digest_4_5
;
7409 opti_type
= OPTI_TYPE_ZERO_BYTE
7410 | OPTI_TYPE_PRECOMPUTE_INIT
7411 | OPTI_TYPE_PRECOMPUTE_MERKLE
7412 | OPTI_TYPE_EARLY_SKIP
7413 | OPTI_TYPE_NOT_ITERATED
7414 | OPTI_TYPE_APPENDED_SALT
7415 | OPTI_TYPE_RAW_HASH
;
7422 case 120: hash_type
= HASH_TYPE_SHA1
;
7423 salt_type
= SALT_TYPE_INTERN
;
7424 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7425 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7426 | OPTS_TYPE_PT_ADD80
7427 | OPTS_TYPE_PT_ADDBITS15
;
7428 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7429 dgst_size
= DGST_SIZE_4_5
;
7430 parse_func
= sha1s_parse_hash
;
7431 sort_by_digest
= sort_by_digest_4_5
;
7432 opti_type
= OPTI_TYPE_ZERO_BYTE
7433 | OPTI_TYPE_PRECOMPUTE_INIT
7434 | OPTI_TYPE_PRECOMPUTE_MERKLE
7435 | OPTI_TYPE_EARLY_SKIP
7436 | OPTI_TYPE_NOT_ITERATED
7437 | OPTI_TYPE_PREPENDED_SALT
7438 | OPTI_TYPE_RAW_HASH
;
7445 case 121: hash_type
= HASH_TYPE_SHA1
;
7446 salt_type
= SALT_TYPE_INTERN
;
7447 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7448 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7449 | OPTS_TYPE_PT_ADD80
7450 | OPTS_TYPE_PT_ADDBITS15
7451 | OPTS_TYPE_ST_LOWER
;
7452 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7453 dgst_size
= DGST_SIZE_4_5
;
7454 parse_func
= smf_parse_hash
;
7455 sort_by_digest
= sort_by_digest_4_5
;
7456 opti_type
= OPTI_TYPE_ZERO_BYTE
7457 | OPTI_TYPE_PRECOMPUTE_INIT
7458 | OPTI_TYPE_PRECOMPUTE_MERKLE
7459 | OPTI_TYPE_EARLY_SKIP
7460 | OPTI_TYPE_NOT_ITERATED
7461 | OPTI_TYPE_PREPENDED_SALT
7462 | OPTI_TYPE_RAW_HASH
;
7469 case 122: hash_type
= HASH_TYPE_SHA1
;
7470 salt_type
= SALT_TYPE_EMBEDDED
;
7471 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7472 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7473 | OPTS_TYPE_PT_ADD80
7474 | OPTS_TYPE_PT_ADDBITS15
7476 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7477 dgst_size
= DGST_SIZE_4_5
;
7478 parse_func
= osx1_parse_hash
;
7479 sort_by_digest
= sort_by_digest_4_5
;
7480 opti_type
= OPTI_TYPE_ZERO_BYTE
7481 | OPTI_TYPE_PRECOMPUTE_INIT
7482 | OPTI_TYPE_PRECOMPUTE_MERKLE
7483 | OPTI_TYPE_EARLY_SKIP
7484 | OPTI_TYPE_NOT_ITERATED
7485 | OPTI_TYPE_PREPENDED_SALT
7486 | OPTI_TYPE_RAW_HASH
;
7493 case 124: hash_type
= HASH_TYPE_SHA1
;
7494 salt_type
= SALT_TYPE_EMBEDDED
;
7495 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7496 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7497 | OPTS_TYPE_PT_ADD80
7498 | OPTS_TYPE_PT_ADDBITS15
;
7499 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7500 dgst_size
= DGST_SIZE_4_5
;
7501 parse_func
= djangosha1_parse_hash
;
7502 sort_by_digest
= sort_by_digest_4_5
;
7503 opti_type
= OPTI_TYPE_ZERO_BYTE
7504 | OPTI_TYPE_PRECOMPUTE_INIT
7505 | OPTI_TYPE_PRECOMPUTE_MERKLE
7506 | OPTI_TYPE_EARLY_SKIP
7507 | OPTI_TYPE_NOT_ITERATED
7508 | OPTI_TYPE_PREPENDED_SALT
7509 | OPTI_TYPE_RAW_HASH
;
7516 case 125: hash_type
= HASH_TYPE_SHA1
;
7517 salt_type
= SALT_TYPE_EMBEDDED
;
7518 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7519 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7520 | OPTS_TYPE_PT_ADD80
7521 | OPTS_TYPE_PT_ADDBITS15
7523 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7524 dgst_size
= DGST_SIZE_4_5
;
7525 parse_func
= arubaos_parse_hash
;
7526 sort_by_digest
= sort_by_digest_4_5
;
7527 opti_type
= OPTI_TYPE_ZERO_BYTE
7528 | OPTI_TYPE_PRECOMPUTE_INIT
7529 | OPTI_TYPE_PRECOMPUTE_MERKLE
7530 | OPTI_TYPE_EARLY_SKIP
7531 | OPTI_TYPE_NOT_ITERATED
7532 | OPTI_TYPE_PREPENDED_SALT
7533 | OPTI_TYPE_RAW_HASH
;
7540 case 130: hash_type
= HASH_TYPE_SHA1
;
7541 salt_type
= SALT_TYPE_INTERN
;
7542 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7543 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7544 | OPTS_TYPE_PT_UNICODE
7545 | OPTS_TYPE_ST_ADD80
7546 | OPTS_TYPE_ST_ADDBITS15
;
7547 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7548 dgst_size
= DGST_SIZE_4_5
;
7549 parse_func
= sha1s_parse_hash
;
7550 sort_by_digest
= sort_by_digest_4_5
;
7551 opti_type
= OPTI_TYPE_ZERO_BYTE
7552 | OPTI_TYPE_PRECOMPUTE_INIT
7553 | OPTI_TYPE_PRECOMPUTE_MERKLE
7554 | OPTI_TYPE_EARLY_SKIP
7555 | OPTI_TYPE_NOT_ITERATED
7556 | OPTI_TYPE_APPENDED_SALT
7557 | OPTI_TYPE_RAW_HASH
;
7564 case 131: hash_type
= HASH_TYPE_SHA1
;
7565 salt_type
= SALT_TYPE_EMBEDDED
;
7566 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7567 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7568 | OPTS_TYPE_PT_UNICODE
7569 | OPTS_TYPE_PT_UPPER
7570 | OPTS_TYPE_ST_ADD80
7571 | OPTS_TYPE_ST_ADDBITS15
7573 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7574 dgst_size
= DGST_SIZE_4_5
;
7575 parse_func
= mssql2000_parse_hash
;
7576 sort_by_digest
= sort_by_digest_4_5
;
7577 opti_type
= OPTI_TYPE_ZERO_BYTE
7578 | OPTI_TYPE_PRECOMPUTE_INIT
7579 | OPTI_TYPE_PRECOMPUTE_MERKLE
7580 | OPTI_TYPE_EARLY_SKIP
7581 | OPTI_TYPE_NOT_ITERATED
7582 | OPTI_TYPE_APPENDED_SALT
7583 | OPTI_TYPE_RAW_HASH
;
7590 case 132: hash_type
= HASH_TYPE_SHA1
;
7591 salt_type
= SALT_TYPE_EMBEDDED
;
7592 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7593 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7594 | OPTS_TYPE_PT_UNICODE
7595 | OPTS_TYPE_ST_ADD80
7596 | OPTS_TYPE_ST_ADDBITS15
7598 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7599 dgst_size
= DGST_SIZE_4_5
;
7600 parse_func
= mssql2005_parse_hash
;
7601 sort_by_digest
= sort_by_digest_4_5
;
7602 opti_type
= OPTI_TYPE_ZERO_BYTE
7603 | OPTI_TYPE_PRECOMPUTE_INIT
7604 | OPTI_TYPE_PRECOMPUTE_MERKLE
7605 | OPTI_TYPE_EARLY_SKIP
7606 | OPTI_TYPE_NOT_ITERATED
7607 | OPTI_TYPE_APPENDED_SALT
7608 | OPTI_TYPE_RAW_HASH
;
7615 case 133: hash_type
= HASH_TYPE_SHA1
;
7616 salt_type
= SALT_TYPE_EMBEDDED
;
7617 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7618 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7619 | OPTS_TYPE_PT_UNICODE
7620 | OPTS_TYPE_ST_ADD80
7621 | OPTS_TYPE_ST_ADDBITS15
;
7622 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7623 dgst_size
= DGST_SIZE_4_5
;
7624 parse_func
= peoplesoft_parse_hash
;
7625 sort_by_digest
= sort_by_digest_4_5
;
7626 opti_type
= OPTI_TYPE_ZERO_BYTE
7627 | OPTI_TYPE_PRECOMPUTE_INIT
7628 | OPTI_TYPE_PRECOMPUTE_MERKLE
7629 | OPTI_TYPE_EARLY_SKIP
7630 | OPTI_TYPE_NOT_ITERATED
7631 | OPTI_TYPE_APPENDED_SALT
7632 | OPTI_TYPE_RAW_HASH
;
7639 case 140: hash_type
= HASH_TYPE_SHA1
;
7640 salt_type
= SALT_TYPE_INTERN
;
7641 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7642 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7643 | OPTS_TYPE_PT_ADD80
7644 | OPTS_TYPE_PT_ADDBITS15
7645 | OPTS_TYPE_PT_UNICODE
;
7646 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7647 dgst_size
= DGST_SIZE_4_5
;
7648 parse_func
= sha1s_parse_hash
;
7649 sort_by_digest
= sort_by_digest_4_5
;
7650 opti_type
= OPTI_TYPE_ZERO_BYTE
7651 | OPTI_TYPE_PRECOMPUTE_INIT
7652 | OPTI_TYPE_PRECOMPUTE_MERKLE
7653 | OPTI_TYPE_EARLY_SKIP
7654 | OPTI_TYPE_NOT_ITERATED
7655 | OPTI_TYPE_PREPENDED_SALT
7656 | OPTI_TYPE_RAW_HASH
;
7663 case 141: hash_type
= HASH_TYPE_SHA1
;
7664 salt_type
= SALT_TYPE_EMBEDDED
;
7665 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7666 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7667 | OPTS_TYPE_PT_ADD80
7668 | OPTS_TYPE_PT_ADDBITS15
7669 | OPTS_TYPE_PT_UNICODE
7670 | OPTS_TYPE_ST_BASE64
;
7671 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7672 dgst_size
= DGST_SIZE_4_5
;
7673 parse_func
= episerver_parse_hash
;
7674 sort_by_digest
= sort_by_digest_4_5
;
7675 opti_type
= OPTI_TYPE_ZERO_BYTE
7676 | OPTI_TYPE_PRECOMPUTE_INIT
7677 | OPTI_TYPE_PRECOMPUTE_MERKLE
7678 | OPTI_TYPE_EARLY_SKIP
7679 | OPTI_TYPE_NOT_ITERATED
7680 | OPTI_TYPE_PREPENDED_SALT
7681 | OPTI_TYPE_RAW_HASH
;
7688 case 150: hash_type
= HASH_TYPE_SHA1
;
7689 salt_type
= SALT_TYPE_INTERN
;
7690 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7691 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7692 | OPTS_TYPE_ST_ADD80
7693 | OPTS_TYPE_ST_ADDBITS15
;
7694 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7695 dgst_size
= DGST_SIZE_4_5
;
7696 parse_func
= hmacsha1_parse_hash
;
7697 sort_by_digest
= sort_by_digest_4_5
;
7698 opti_type
= OPTI_TYPE_ZERO_BYTE
7699 | OPTI_TYPE_NOT_ITERATED
;
7706 case 160: hash_type
= HASH_TYPE_SHA1
;
7707 salt_type
= SALT_TYPE_INTERN
;
7708 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7709 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7710 | OPTS_TYPE_PT_ADD80
7711 | OPTS_TYPE_PT_ADDBITS15
;
7712 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7713 dgst_size
= DGST_SIZE_4_5
;
7714 parse_func
= hmacsha1_parse_hash
;
7715 sort_by_digest
= sort_by_digest_4_5
;
7716 opti_type
= OPTI_TYPE_ZERO_BYTE
7717 | OPTI_TYPE_NOT_ITERATED
;
7724 case 190: hash_type
= HASH_TYPE_SHA1
;
7725 salt_type
= SALT_TYPE_NONE
;
7726 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7727 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7728 | OPTS_TYPE_PT_ADD80
7729 | OPTS_TYPE_PT_ADDBITS15
;
7730 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7731 dgst_size
= DGST_SIZE_4_5
;
7732 parse_func
= sha1linkedin_parse_hash
;
7733 sort_by_digest
= sort_by_digest_4_5
;
7734 opti_type
= OPTI_TYPE_ZERO_BYTE
7735 | OPTI_TYPE_PRECOMPUTE_INIT
7736 | OPTI_TYPE_EARLY_SKIP
7737 | OPTI_TYPE_NOT_ITERATED
7738 | OPTI_TYPE_NOT_SALTED
;
7745 case 200: hash_type
= HASH_TYPE_MYSQL
;
7746 salt_type
= SALT_TYPE_NONE
;
7747 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7749 kern_type
= KERN_TYPE_MYSQL
;
7750 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7751 parse_func
= mysql323_parse_hash
;
7752 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7753 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7760 case 300: hash_type
= HASH_TYPE_SHA1
;
7761 salt_type
= SALT_TYPE_NONE
;
7762 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7763 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7764 | OPTS_TYPE_PT_ADD80
7765 | OPTS_TYPE_PT_ADDBITS15
;
7766 kern_type
= KERN_TYPE_MYSQL41
;
7767 dgst_size
= DGST_SIZE_4_5
;
7768 parse_func
= sha1_parse_hash
;
7769 sort_by_digest
= sort_by_digest_4_5
;
7770 opti_type
= OPTI_TYPE_ZERO_BYTE
7771 | OPTI_TYPE_PRECOMPUTE_INIT
7772 | OPTI_TYPE_PRECOMPUTE_MERKLE
7773 | OPTI_TYPE_EARLY_SKIP
7774 | OPTI_TYPE_NOT_ITERATED
7775 | OPTI_TYPE_NOT_SALTED
;
7782 case 400: hash_type
= HASH_TYPE_MD5
;
7783 salt_type
= SALT_TYPE_EMBEDDED
;
7784 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7785 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7786 kern_type
= KERN_TYPE_PHPASS
;
7787 dgst_size
= DGST_SIZE_4_4
;
7788 parse_func
= phpass_parse_hash
;
7789 sort_by_digest
= sort_by_digest_4_4
;
7790 opti_type
= OPTI_TYPE_ZERO_BYTE
7791 | OPTI_TYPE_SLOW_HASH_SIMD
;
7798 case 500: hash_type
= HASH_TYPE_MD5
;
7799 salt_type
= SALT_TYPE_EMBEDDED
;
7800 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7801 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7802 kern_type
= KERN_TYPE_MD5CRYPT
;
7803 dgst_size
= DGST_SIZE_4_4
;
7804 parse_func
= md5crypt_parse_hash
;
7805 sort_by_digest
= sort_by_digest_4_4
;
7806 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7813 case 501: hash_type
= HASH_TYPE_MD5
;
7814 salt_type
= SALT_TYPE_EMBEDDED
;
7815 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7816 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7817 | OPTS_TYPE_HASH_COPY
;
7818 kern_type
= KERN_TYPE_MD5CRYPT
;
7819 dgst_size
= DGST_SIZE_4_4
;
7820 parse_func
= juniper_parse_hash
;
7821 sort_by_digest
= sort_by_digest_4_4
;
7822 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7829 case 900: hash_type
= HASH_TYPE_MD4
;
7830 salt_type
= SALT_TYPE_NONE
;
7831 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7832 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7833 | OPTS_TYPE_PT_ADD80
7834 | OPTS_TYPE_PT_ADDBITS14
;
7835 kern_type
= KERN_TYPE_MD4
;
7836 dgst_size
= DGST_SIZE_4_4
;
7837 parse_func
= md4_parse_hash
;
7838 sort_by_digest
= sort_by_digest_4_4
;
7839 opti_type
= OPTI_TYPE_ZERO_BYTE
7840 | OPTI_TYPE_PRECOMPUTE_INIT
7841 | OPTI_TYPE_PRECOMPUTE_MERKLE
7842 | OPTI_TYPE_MEET_IN_MIDDLE
7843 | OPTI_TYPE_EARLY_SKIP
7844 | OPTI_TYPE_NOT_ITERATED
7845 | OPTI_TYPE_NOT_SALTED
7846 | OPTI_TYPE_RAW_HASH
;
7853 case 1000: hash_type
= HASH_TYPE_MD4
;
7854 salt_type
= SALT_TYPE_NONE
;
7855 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7856 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7857 | OPTS_TYPE_PT_ADD80
7858 | OPTS_TYPE_PT_ADDBITS14
7859 | OPTS_TYPE_PT_UNICODE
;
7860 kern_type
= KERN_TYPE_MD4_PWU
;
7861 dgst_size
= DGST_SIZE_4_4
;
7862 parse_func
= md4_parse_hash
;
7863 sort_by_digest
= sort_by_digest_4_4
;
7864 opti_type
= OPTI_TYPE_ZERO_BYTE
7865 | OPTI_TYPE_PRECOMPUTE_INIT
7866 | OPTI_TYPE_PRECOMPUTE_MERKLE
7867 | OPTI_TYPE_MEET_IN_MIDDLE
7868 | OPTI_TYPE_EARLY_SKIP
7869 | OPTI_TYPE_NOT_ITERATED
7870 | OPTI_TYPE_NOT_SALTED
7871 | OPTI_TYPE_RAW_HASH
;
7878 case 1100: hash_type
= HASH_TYPE_MD4
;
7879 salt_type
= SALT_TYPE_INTERN
;
7880 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7882 | OPTS_TYPE_PT_ADD80
7883 | OPTS_TYPE_PT_ADDBITS14
7884 | OPTS_TYPE_PT_UNICODE
7885 | OPTS_TYPE_ST_ADD80
7886 | OPTS_TYPE_ST_UNICODE
7887 | OPTS_TYPE_ST_LOWER
;
7888 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7889 dgst_size
= DGST_SIZE_4_4
;
7890 parse_func
= dcc_parse_hash
;
7891 sort_by_digest
= sort_by_digest_4_4
;
7892 opti_type
= OPTI_TYPE_ZERO_BYTE
7893 | OPTI_TYPE_PRECOMPUTE_INIT
7894 | OPTI_TYPE_PRECOMPUTE_MERKLE
7895 | OPTI_TYPE_EARLY_SKIP
7896 | OPTI_TYPE_NOT_ITERATED
;
7903 case 1400: hash_type
= HASH_TYPE_SHA256
;
7904 salt_type
= SALT_TYPE_NONE
;
7905 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7906 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7907 | OPTS_TYPE_PT_ADD80
7908 | OPTS_TYPE_PT_ADDBITS15
;
7909 kern_type
= KERN_TYPE_SHA256
;
7910 dgst_size
= DGST_SIZE_4_8
;
7911 parse_func
= sha256_parse_hash
;
7912 sort_by_digest
= sort_by_digest_4_8
;
7913 opti_type
= OPTI_TYPE_ZERO_BYTE
7914 | OPTI_TYPE_PRECOMPUTE_INIT
7915 | OPTI_TYPE_PRECOMPUTE_MERKLE
7916 | OPTI_TYPE_EARLY_SKIP
7917 | OPTI_TYPE_NOT_ITERATED
7918 | OPTI_TYPE_NOT_SALTED
7919 | OPTI_TYPE_RAW_HASH
;
7926 case 1410: hash_type
= HASH_TYPE_SHA256
;
7927 salt_type
= SALT_TYPE_INTERN
;
7928 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7929 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7930 | OPTS_TYPE_ST_ADD80
7931 | OPTS_TYPE_ST_ADDBITS15
;
7932 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7933 dgst_size
= DGST_SIZE_4_8
;
7934 parse_func
= sha256s_parse_hash
;
7935 sort_by_digest
= sort_by_digest_4_8
;
7936 opti_type
= OPTI_TYPE_ZERO_BYTE
7937 | OPTI_TYPE_PRECOMPUTE_INIT
7938 | OPTI_TYPE_PRECOMPUTE_MERKLE
7939 | OPTI_TYPE_EARLY_SKIP
7940 | OPTI_TYPE_NOT_ITERATED
7941 | OPTI_TYPE_APPENDED_SALT
7942 | OPTI_TYPE_RAW_HASH
;
7949 case 1420: hash_type
= HASH_TYPE_SHA256
;
7950 salt_type
= SALT_TYPE_INTERN
;
7951 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7952 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7953 | OPTS_TYPE_PT_ADD80
7954 | OPTS_TYPE_PT_ADDBITS15
;
7955 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7956 dgst_size
= DGST_SIZE_4_8
;
7957 parse_func
= sha256s_parse_hash
;
7958 sort_by_digest
= sort_by_digest_4_8
;
7959 opti_type
= OPTI_TYPE_ZERO_BYTE
7960 | OPTI_TYPE_PRECOMPUTE_INIT
7961 | OPTI_TYPE_PRECOMPUTE_MERKLE
7962 | OPTI_TYPE_EARLY_SKIP
7963 | OPTI_TYPE_NOT_ITERATED
7964 | OPTI_TYPE_PREPENDED_SALT
7965 | OPTI_TYPE_RAW_HASH
;
7972 case 1421: hash_type
= HASH_TYPE_SHA256
;
7973 salt_type
= SALT_TYPE_EMBEDDED
;
7974 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7975 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7976 | OPTS_TYPE_PT_ADD80
7977 | OPTS_TYPE_PT_ADDBITS15
;
7978 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7979 dgst_size
= DGST_SIZE_4_8
;
7980 parse_func
= hmailserver_parse_hash
;
7981 sort_by_digest
= sort_by_digest_4_8
;
7982 opti_type
= OPTI_TYPE_ZERO_BYTE
7983 | OPTI_TYPE_PRECOMPUTE_INIT
7984 | OPTI_TYPE_PRECOMPUTE_MERKLE
7985 | OPTI_TYPE_EARLY_SKIP
7986 | OPTI_TYPE_NOT_ITERATED
7987 | OPTI_TYPE_PREPENDED_SALT
7988 | OPTI_TYPE_RAW_HASH
;
7995 case 1430: hash_type
= HASH_TYPE_SHA256
;
7996 salt_type
= SALT_TYPE_INTERN
;
7997 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7998 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7999 | OPTS_TYPE_PT_UNICODE
8000 | OPTS_TYPE_ST_ADD80
8001 | OPTS_TYPE_ST_ADDBITS15
;
8002 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8003 dgst_size
= DGST_SIZE_4_8
;
8004 parse_func
= sha256s_parse_hash
;
8005 sort_by_digest
= sort_by_digest_4_8
;
8006 opti_type
= OPTI_TYPE_ZERO_BYTE
8007 | OPTI_TYPE_PRECOMPUTE_INIT
8008 | OPTI_TYPE_PRECOMPUTE_MERKLE
8009 | OPTI_TYPE_EARLY_SKIP
8010 | OPTI_TYPE_NOT_ITERATED
8011 | OPTI_TYPE_APPENDED_SALT
8012 | OPTI_TYPE_RAW_HASH
;
8019 case 1440: hash_type
= HASH_TYPE_SHA256
;
8020 salt_type
= SALT_TYPE_INTERN
;
8021 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8022 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8023 | OPTS_TYPE_PT_ADD80
8024 | OPTS_TYPE_PT_ADDBITS15
8025 | OPTS_TYPE_PT_UNICODE
;
8026 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8027 dgst_size
= DGST_SIZE_4_8
;
8028 parse_func
= sha256s_parse_hash
;
8029 sort_by_digest
= sort_by_digest_4_8
;
8030 opti_type
= OPTI_TYPE_ZERO_BYTE
8031 | OPTI_TYPE_PRECOMPUTE_INIT
8032 | OPTI_TYPE_PRECOMPUTE_MERKLE
8033 | OPTI_TYPE_EARLY_SKIP
8034 | OPTI_TYPE_NOT_ITERATED
8035 | OPTI_TYPE_PREPENDED_SALT
8036 | OPTI_TYPE_RAW_HASH
;
8043 case 1441: hash_type
= HASH_TYPE_SHA256
;
8044 salt_type
= SALT_TYPE_EMBEDDED
;
8045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8046 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8047 | OPTS_TYPE_PT_ADD80
8048 | OPTS_TYPE_PT_ADDBITS15
8049 | OPTS_TYPE_PT_UNICODE
8050 | OPTS_TYPE_ST_BASE64
;
8051 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8052 dgst_size
= DGST_SIZE_4_8
;
8053 parse_func
= episerver4_parse_hash
;
8054 sort_by_digest
= sort_by_digest_4_8
;
8055 opti_type
= OPTI_TYPE_ZERO_BYTE
8056 | OPTI_TYPE_PRECOMPUTE_INIT
8057 | OPTI_TYPE_PRECOMPUTE_MERKLE
8058 | OPTI_TYPE_EARLY_SKIP
8059 | OPTI_TYPE_NOT_ITERATED
8060 | OPTI_TYPE_PREPENDED_SALT
8061 | OPTI_TYPE_RAW_HASH
;
8068 case 1450: hash_type
= HASH_TYPE_SHA256
;
8069 salt_type
= SALT_TYPE_INTERN
;
8070 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8071 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8072 | OPTS_TYPE_ST_ADD80
;
8073 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8074 dgst_size
= DGST_SIZE_4_8
;
8075 parse_func
= hmacsha256_parse_hash
;
8076 sort_by_digest
= sort_by_digest_4_8
;
8077 opti_type
= OPTI_TYPE_ZERO_BYTE
8078 | OPTI_TYPE_NOT_ITERATED
;
8085 case 1460: hash_type
= HASH_TYPE_SHA256
;
8086 salt_type
= SALT_TYPE_INTERN
;
8087 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8088 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8089 | OPTS_TYPE_PT_ADD80
8090 | OPTS_TYPE_PT_ADDBITS15
;
8091 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8092 dgst_size
= DGST_SIZE_4_8
;
8093 parse_func
= hmacsha256_parse_hash
;
8094 sort_by_digest
= sort_by_digest_4_8
;
8095 opti_type
= OPTI_TYPE_ZERO_BYTE
8096 | OPTI_TYPE_NOT_ITERATED
;
8103 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8104 salt_type
= SALT_TYPE_EMBEDDED
;
8105 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8106 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8107 | OPTS_TYPE_PT_BITSLICE
;
8108 kern_type
= KERN_TYPE_DESCRYPT
;
8109 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8110 parse_func
= descrypt_parse_hash
;
8111 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8112 opti_type
= OPTI_TYPE_ZERO_BYTE
8113 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8120 case 1600: hash_type
= HASH_TYPE_MD5
;
8121 salt_type
= SALT_TYPE_EMBEDDED
;
8122 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8123 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8124 kern_type
= KERN_TYPE_APR1CRYPT
;
8125 dgst_size
= DGST_SIZE_4_4
;
8126 parse_func
= md5apr1_parse_hash
;
8127 sort_by_digest
= sort_by_digest_4_4
;
8128 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8135 case 1700: hash_type
= HASH_TYPE_SHA512
;
8136 salt_type
= SALT_TYPE_NONE
;
8137 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8138 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8139 | OPTS_TYPE_PT_ADD80
8140 | OPTS_TYPE_PT_ADDBITS15
;
8141 kern_type
= KERN_TYPE_SHA512
;
8142 dgst_size
= DGST_SIZE_8_8
;
8143 parse_func
= sha512_parse_hash
;
8144 sort_by_digest
= sort_by_digest_8_8
;
8145 opti_type
= OPTI_TYPE_ZERO_BYTE
8146 | OPTI_TYPE_PRECOMPUTE_INIT
8147 | OPTI_TYPE_PRECOMPUTE_MERKLE
8148 | OPTI_TYPE_EARLY_SKIP
8149 | OPTI_TYPE_NOT_ITERATED
8150 | OPTI_TYPE_NOT_SALTED
8151 | OPTI_TYPE_USES_BITS_64
8152 | OPTI_TYPE_RAW_HASH
;
8159 case 1710: hash_type
= HASH_TYPE_SHA512
;
8160 salt_type
= SALT_TYPE_INTERN
;
8161 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8162 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8163 | OPTS_TYPE_ST_ADD80
8164 | OPTS_TYPE_ST_ADDBITS15
;
8165 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8166 dgst_size
= DGST_SIZE_8_8
;
8167 parse_func
= sha512s_parse_hash
;
8168 sort_by_digest
= sort_by_digest_8_8
;
8169 opti_type
= OPTI_TYPE_ZERO_BYTE
8170 | OPTI_TYPE_PRECOMPUTE_INIT
8171 | OPTI_TYPE_PRECOMPUTE_MERKLE
8172 | OPTI_TYPE_EARLY_SKIP
8173 | OPTI_TYPE_NOT_ITERATED
8174 | OPTI_TYPE_APPENDED_SALT
8175 | OPTI_TYPE_USES_BITS_64
8176 | OPTI_TYPE_RAW_HASH
;
8183 case 1711: hash_type
= HASH_TYPE_SHA512
;
8184 salt_type
= SALT_TYPE_EMBEDDED
;
8185 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8186 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8187 | OPTS_TYPE_ST_ADD80
8188 | OPTS_TYPE_ST_ADDBITS15
;
8189 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8190 dgst_size
= DGST_SIZE_8_8
;
8191 parse_func
= sha512b64s_parse_hash
;
8192 sort_by_digest
= sort_by_digest_8_8
;
8193 opti_type
= OPTI_TYPE_ZERO_BYTE
8194 | OPTI_TYPE_PRECOMPUTE_INIT
8195 | OPTI_TYPE_PRECOMPUTE_MERKLE
8196 | OPTI_TYPE_EARLY_SKIP
8197 | OPTI_TYPE_NOT_ITERATED
8198 | OPTI_TYPE_APPENDED_SALT
8199 | OPTI_TYPE_USES_BITS_64
8200 | OPTI_TYPE_RAW_HASH
;
8207 case 1720: hash_type
= HASH_TYPE_SHA512
;
8208 salt_type
= SALT_TYPE_INTERN
;
8209 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8210 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8211 | OPTS_TYPE_PT_ADD80
8212 | OPTS_TYPE_PT_ADDBITS15
;
8213 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8214 dgst_size
= DGST_SIZE_8_8
;
8215 parse_func
= sha512s_parse_hash
;
8216 sort_by_digest
= sort_by_digest_8_8
;
8217 opti_type
= OPTI_TYPE_ZERO_BYTE
8218 | OPTI_TYPE_PRECOMPUTE_INIT
8219 | OPTI_TYPE_PRECOMPUTE_MERKLE
8220 | OPTI_TYPE_EARLY_SKIP
8221 | OPTI_TYPE_NOT_ITERATED
8222 | OPTI_TYPE_PREPENDED_SALT
8223 | OPTI_TYPE_USES_BITS_64
8224 | OPTI_TYPE_RAW_HASH
;
8231 case 1722: hash_type
= HASH_TYPE_SHA512
;
8232 salt_type
= SALT_TYPE_EMBEDDED
;
8233 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8234 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8235 | OPTS_TYPE_PT_ADD80
8236 | OPTS_TYPE_PT_ADDBITS15
8238 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8239 dgst_size
= DGST_SIZE_8_8
;
8240 parse_func
= osx512_parse_hash
;
8241 sort_by_digest
= sort_by_digest_8_8
;
8242 opti_type
= OPTI_TYPE_ZERO_BYTE
8243 | OPTI_TYPE_PRECOMPUTE_INIT
8244 | OPTI_TYPE_PRECOMPUTE_MERKLE
8245 | OPTI_TYPE_EARLY_SKIP
8246 | OPTI_TYPE_NOT_ITERATED
8247 | OPTI_TYPE_PREPENDED_SALT
8248 | OPTI_TYPE_USES_BITS_64
8249 | OPTI_TYPE_RAW_HASH
;
8256 case 1730: hash_type
= HASH_TYPE_SHA512
;
8257 salt_type
= SALT_TYPE_INTERN
;
8258 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8259 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8260 | OPTS_TYPE_PT_UNICODE
8261 | OPTS_TYPE_ST_ADD80
8262 | OPTS_TYPE_ST_ADDBITS15
;
8263 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8264 dgst_size
= DGST_SIZE_8_8
;
8265 parse_func
= sha512s_parse_hash
;
8266 sort_by_digest
= sort_by_digest_8_8
;
8267 opti_type
= OPTI_TYPE_ZERO_BYTE
8268 | OPTI_TYPE_PRECOMPUTE_INIT
8269 | OPTI_TYPE_PRECOMPUTE_MERKLE
8270 | OPTI_TYPE_EARLY_SKIP
8271 | OPTI_TYPE_NOT_ITERATED
8272 | OPTI_TYPE_APPENDED_SALT
8273 | OPTI_TYPE_USES_BITS_64
8274 | OPTI_TYPE_RAW_HASH
;
8281 case 1731: hash_type
= HASH_TYPE_SHA512
;
8282 salt_type
= SALT_TYPE_EMBEDDED
;
8283 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8284 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8285 | OPTS_TYPE_PT_UNICODE
8286 | OPTS_TYPE_ST_ADD80
8287 | OPTS_TYPE_ST_ADDBITS15
8289 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8290 dgst_size
= DGST_SIZE_8_8
;
8291 parse_func
= mssql2012_parse_hash
;
8292 sort_by_digest
= sort_by_digest_8_8
;
8293 opti_type
= OPTI_TYPE_ZERO_BYTE
8294 | OPTI_TYPE_PRECOMPUTE_INIT
8295 | OPTI_TYPE_PRECOMPUTE_MERKLE
8296 | OPTI_TYPE_EARLY_SKIP
8297 | OPTI_TYPE_NOT_ITERATED
8298 | OPTI_TYPE_APPENDED_SALT
8299 | OPTI_TYPE_USES_BITS_64
8300 | OPTI_TYPE_RAW_HASH
;
8307 case 1740: hash_type
= HASH_TYPE_SHA512
;
8308 salt_type
= SALT_TYPE_INTERN
;
8309 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8310 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8311 | OPTS_TYPE_PT_ADD80
8312 | OPTS_TYPE_PT_ADDBITS15
8313 | OPTS_TYPE_PT_UNICODE
;
8314 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8315 dgst_size
= DGST_SIZE_8_8
;
8316 parse_func
= sha512s_parse_hash
;
8317 sort_by_digest
= sort_by_digest_8_8
;
8318 opti_type
= OPTI_TYPE_ZERO_BYTE
8319 | OPTI_TYPE_PRECOMPUTE_INIT
8320 | OPTI_TYPE_PRECOMPUTE_MERKLE
8321 | OPTI_TYPE_EARLY_SKIP
8322 | OPTI_TYPE_NOT_ITERATED
8323 | OPTI_TYPE_PREPENDED_SALT
8324 | OPTI_TYPE_USES_BITS_64
8325 | OPTI_TYPE_RAW_HASH
;
8332 case 1750: hash_type
= HASH_TYPE_SHA512
;
8333 salt_type
= SALT_TYPE_INTERN
;
8334 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8335 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8336 | OPTS_TYPE_ST_ADD80
;
8337 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8338 dgst_size
= DGST_SIZE_8_8
;
8339 parse_func
= hmacsha512_parse_hash
;
8340 sort_by_digest
= sort_by_digest_8_8
;
8341 opti_type
= OPTI_TYPE_ZERO_BYTE
8342 | OPTI_TYPE_USES_BITS_64
8343 | OPTI_TYPE_NOT_ITERATED
;
8350 case 1760: hash_type
= HASH_TYPE_SHA512
;
8351 salt_type
= SALT_TYPE_INTERN
;
8352 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8353 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8354 | OPTS_TYPE_PT_ADD80
8355 | OPTS_TYPE_PT_ADDBITS15
;
8356 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8357 dgst_size
= DGST_SIZE_8_8
;
8358 parse_func
= hmacsha512_parse_hash
;
8359 sort_by_digest
= sort_by_digest_8_8
;
8360 opti_type
= OPTI_TYPE_ZERO_BYTE
8361 | OPTI_TYPE_USES_BITS_64
8362 | OPTI_TYPE_NOT_ITERATED
;
8369 case 1800: hash_type
= HASH_TYPE_SHA512
;
8370 salt_type
= SALT_TYPE_EMBEDDED
;
8371 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8372 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8373 kern_type
= KERN_TYPE_SHA512CRYPT
;
8374 dgst_size
= DGST_SIZE_8_8
;
8375 parse_func
= sha512crypt_parse_hash
;
8376 sort_by_digest
= sort_by_digest_8_8
;
8377 opti_type
= OPTI_TYPE_ZERO_BYTE
8378 | OPTI_TYPE_USES_BITS_64
;
8385 case 2100: hash_type
= HASH_TYPE_DCC2
;
8386 salt_type
= SALT_TYPE_EMBEDDED
;
8387 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8388 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8389 | OPTS_TYPE_ST_LOWER
8390 | OPTS_TYPE_ST_UNICODE
;
8391 kern_type
= KERN_TYPE_DCC2
;
8392 dgst_size
= DGST_SIZE_4_4
;
8393 parse_func
= dcc2_parse_hash
;
8394 sort_by_digest
= sort_by_digest_4_4
;
8395 opti_type
= OPTI_TYPE_ZERO_BYTE
8396 | OPTI_TYPE_SLOW_HASH_SIMD
;
8403 case 2400: hash_type
= HASH_TYPE_MD5
;
8404 salt_type
= SALT_TYPE_NONE
;
8405 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8406 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8407 kern_type
= KERN_TYPE_MD5PIX
;
8408 dgst_size
= DGST_SIZE_4_4
;
8409 parse_func
= md5pix_parse_hash
;
8410 sort_by_digest
= sort_by_digest_4_4
;
8411 opti_type
= OPTI_TYPE_ZERO_BYTE
8412 | OPTI_TYPE_PRECOMPUTE_INIT
8413 | OPTI_TYPE_PRECOMPUTE_MERKLE
8414 | OPTI_TYPE_EARLY_SKIP
8415 | OPTI_TYPE_NOT_ITERATED
8416 | OPTI_TYPE_NOT_SALTED
;
8423 case 2410: hash_type
= HASH_TYPE_MD5
;
8424 salt_type
= SALT_TYPE_INTERN
;
8425 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8426 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8427 kern_type
= KERN_TYPE_MD5ASA
;
8428 dgst_size
= DGST_SIZE_4_4
;
8429 parse_func
= md5asa_parse_hash
;
8430 sort_by_digest
= sort_by_digest_4_4
;
8431 opti_type
= OPTI_TYPE_ZERO_BYTE
8432 | OPTI_TYPE_PRECOMPUTE_INIT
8433 | OPTI_TYPE_PRECOMPUTE_MERKLE
8434 | OPTI_TYPE_EARLY_SKIP
8435 | OPTI_TYPE_NOT_ITERATED
;
8442 case 2500: hash_type
= HASH_TYPE_WPA
;
8443 salt_type
= SALT_TYPE_EMBEDDED
;
8444 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8445 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8446 kern_type
= KERN_TYPE_WPA
;
8447 dgst_size
= DGST_SIZE_4_4
;
8448 parse_func
= wpa_parse_hash
;
8449 sort_by_digest
= sort_by_digest_4_4
;
8450 opti_type
= OPTI_TYPE_ZERO_BYTE
8451 | OPTI_TYPE_SLOW_HASH_SIMD
;
8458 case 2600: hash_type
= HASH_TYPE_MD5
;
8459 salt_type
= SALT_TYPE_VIRTUAL
;
8460 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8462 | OPTS_TYPE_PT_ADD80
8463 | OPTS_TYPE_PT_ADDBITS14
8464 | OPTS_TYPE_ST_ADD80
;
8465 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8466 dgst_size
= DGST_SIZE_4_4
;
8467 parse_func
= md5md5_parse_hash
;
8468 sort_by_digest
= sort_by_digest_4_4
;
8469 opti_type
= OPTI_TYPE_ZERO_BYTE
8470 | OPTI_TYPE_PRECOMPUTE_INIT
8471 | OPTI_TYPE_PRECOMPUTE_MERKLE
8472 | OPTI_TYPE_EARLY_SKIP
;
8479 case 2611: hash_type
= HASH_TYPE_MD5
;
8480 salt_type
= SALT_TYPE_INTERN
;
8481 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8482 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8483 | OPTS_TYPE_PT_ADD80
8484 | OPTS_TYPE_PT_ADDBITS14
8485 | OPTS_TYPE_ST_ADD80
;
8486 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8487 dgst_size
= DGST_SIZE_4_4
;
8488 parse_func
= vb3_parse_hash
;
8489 sort_by_digest
= sort_by_digest_4_4
;
8490 opti_type
= OPTI_TYPE_ZERO_BYTE
8491 | OPTI_TYPE_PRECOMPUTE_INIT
8492 | OPTI_TYPE_PRECOMPUTE_MERKLE
8493 | OPTI_TYPE_EARLY_SKIP
;
8500 case 2612: hash_type
= HASH_TYPE_MD5
;
8501 salt_type
= SALT_TYPE_EMBEDDED
;
8502 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8503 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8504 | OPTS_TYPE_PT_ADD80
8505 | OPTS_TYPE_PT_ADDBITS14
8506 | OPTS_TYPE_ST_ADD80
8508 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8509 dgst_size
= DGST_SIZE_4_4
;
8510 parse_func
= phps_parse_hash
;
8511 sort_by_digest
= sort_by_digest_4_4
;
8512 opti_type
= OPTI_TYPE_ZERO_BYTE
8513 | OPTI_TYPE_PRECOMPUTE_INIT
8514 | OPTI_TYPE_PRECOMPUTE_MERKLE
8515 | OPTI_TYPE_EARLY_SKIP
;
8522 case 2711: hash_type
= HASH_TYPE_MD5
;
8523 salt_type
= SALT_TYPE_INTERN
;
8524 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8525 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8526 | OPTS_TYPE_PT_ADD80
8527 | OPTS_TYPE_PT_ADDBITS14
8528 | OPTS_TYPE_ST_ADD80
;
8529 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8530 dgst_size
= DGST_SIZE_4_4
;
8531 parse_func
= vb30_parse_hash
;
8532 sort_by_digest
= sort_by_digest_4_4
;
8533 opti_type
= OPTI_TYPE_ZERO_BYTE
8534 | OPTI_TYPE_PRECOMPUTE_INIT
8535 | OPTI_TYPE_EARLY_SKIP
;
8542 case 2811: hash_type
= HASH_TYPE_MD5
;
8543 salt_type
= SALT_TYPE_INTERN
;
8544 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8546 | OPTS_TYPE_PT_ADD80
8547 | OPTS_TYPE_PT_ADDBITS14
;
8548 kern_type
= KERN_TYPE_MD55_SLTPW
;
8549 dgst_size
= DGST_SIZE_4_4
;
8550 parse_func
= ipb2_parse_hash
;
8551 sort_by_digest
= sort_by_digest_4_4
;
8552 opti_type
= OPTI_TYPE_ZERO_BYTE
8553 | OPTI_TYPE_PRECOMPUTE_INIT
8554 | OPTI_TYPE_EARLY_SKIP
;
8561 case 3000: hash_type
= HASH_TYPE_LM
;
8562 salt_type
= SALT_TYPE_NONE
;
8563 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8564 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8565 | OPTS_TYPE_PT_UPPER
8566 | OPTS_TYPE_PT_BITSLICE
;
8567 kern_type
= KERN_TYPE_LM
;
8568 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8569 parse_func
= lm_parse_hash
;
8570 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8571 opti_type
= OPTI_TYPE_ZERO_BYTE
8572 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8579 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8580 salt_type
= SALT_TYPE_INTERN
;
8581 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8582 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8583 | OPTS_TYPE_PT_UPPER
8584 | OPTS_TYPE_ST_UPPER
;
8585 kern_type
= KERN_TYPE_ORACLEH
;
8586 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8587 parse_func
= oracleh_parse_hash
;
8588 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8589 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8596 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8597 salt_type
= SALT_TYPE_EMBEDDED
;
8598 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8599 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8600 | OPTS_TYPE_ST_GENERATE_LE
;
8601 kern_type
= KERN_TYPE_BCRYPT
;
8602 dgst_size
= DGST_SIZE_4_6
;
8603 parse_func
= bcrypt_parse_hash
;
8604 sort_by_digest
= sort_by_digest_4_6
;
8605 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8612 case 3710: hash_type
= HASH_TYPE_MD5
;
8613 salt_type
= SALT_TYPE_INTERN
;
8614 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8615 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8616 | OPTS_TYPE_PT_ADD80
8617 | OPTS_TYPE_PT_ADDBITS14
;
8618 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8619 dgst_size
= DGST_SIZE_4_4
;
8620 parse_func
= md5s_parse_hash
;
8621 sort_by_digest
= sort_by_digest_4_4
;
8622 opti_type
= OPTI_TYPE_ZERO_BYTE
8623 | OPTI_TYPE_PRECOMPUTE_INIT
8624 | OPTI_TYPE_PRECOMPUTE_MERKLE
8625 | OPTI_TYPE_EARLY_SKIP
;
8632 case 3711: hash_type
= HASH_TYPE_MD5
;
8633 salt_type
= SALT_TYPE_EMBEDDED
;
8634 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8635 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8636 | OPTS_TYPE_PT_ADD80
8637 | OPTS_TYPE_PT_ADDBITS14
;
8638 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8639 dgst_size
= DGST_SIZE_4_4
;
8640 parse_func
= mediawiki_b_parse_hash
;
8641 sort_by_digest
= sort_by_digest_4_4
;
8642 opti_type
= OPTI_TYPE_ZERO_BYTE
8643 | OPTI_TYPE_PRECOMPUTE_INIT
8644 | OPTI_TYPE_PRECOMPUTE_MERKLE
8645 | OPTI_TYPE_EARLY_SKIP
;
8652 case 3800: hash_type
= HASH_TYPE_MD5
;
8653 salt_type
= SALT_TYPE_INTERN
;
8654 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8655 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8656 | OPTS_TYPE_ST_ADDBITS14
;
8657 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8658 dgst_size
= DGST_SIZE_4_4
;
8659 parse_func
= md5s_parse_hash
;
8660 sort_by_digest
= sort_by_digest_4_4
;
8661 opti_type
= OPTI_TYPE_ZERO_BYTE
8662 | OPTI_TYPE_PRECOMPUTE_INIT
8663 | OPTI_TYPE_PRECOMPUTE_MERKLE
8664 | OPTI_TYPE_EARLY_SKIP
8665 | OPTI_TYPE_NOT_ITERATED
8666 | OPTI_TYPE_RAW_HASH
;
8673 case 4300: hash_type
= HASH_TYPE_MD5
;
8674 salt_type
= SALT_TYPE_VIRTUAL
;
8675 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8676 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8677 | OPTS_TYPE_PT_ADD80
8678 | OPTS_TYPE_PT_ADDBITS14
8679 | OPTS_TYPE_ST_ADD80
;
8680 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8681 dgst_size
= DGST_SIZE_4_4
;
8682 parse_func
= md5md5_parse_hash
;
8683 sort_by_digest
= sort_by_digest_4_4
;
8684 opti_type
= OPTI_TYPE_ZERO_BYTE
8685 | OPTI_TYPE_PRECOMPUTE_INIT
8686 | OPTI_TYPE_PRECOMPUTE_MERKLE
8687 | OPTI_TYPE_EARLY_SKIP
;
8695 case 4400: hash_type
= HASH_TYPE_MD5
;
8696 salt_type
= SALT_TYPE_NONE
;
8697 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8698 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8699 | OPTS_TYPE_PT_ADD80
8700 | OPTS_TYPE_PT_ADDBITS15
;
8701 kern_type
= KERN_TYPE_MD5_SHA1
;
8702 dgst_size
= DGST_SIZE_4_4
;
8703 parse_func
= md5_parse_hash
;
8704 sort_by_digest
= sort_by_digest_4_4
;
8705 opti_type
= OPTI_TYPE_ZERO_BYTE
8706 | OPTI_TYPE_PRECOMPUTE_INIT
8707 | OPTI_TYPE_PRECOMPUTE_MERKLE
8708 | OPTI_TYPE_EARLY_SKIP
8709 | OPTI_TYPE_NOT_ITERATED
8710 | OPTI_TYPE_NOT_SALTED
8711 | OPTI_TYPE_RAW_HASH
;
8718 case 4500: hash_type
= HASH_TYPE_SHA1
;
8719 salt_type
= SALT_TYPE_NONE
;
8720 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8721 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8722 | OPTS_TYPE_PT_ADD80
8723 | OPTS_TYPE_PT_ADDBITS15
;
8724 kern_type
= KERN_TYPE_SHA11
;
8725 dgst_size
= DGST_SIZE_4_5
;
8726 parse_func
= sha1_parse_hash
;
8727 sort_by_digest
= sort_by_digest_4_5
;
8728 opti_type
= OPTI_TYPE_ZERO_BYTE
8729 | OPTI_TYPE_PRECOMPUTE_INIT
8730 | OPTI_TYPE_PRECOMPUTE_MERKLE
8731 | OPTI_TYPE_EARLY_SKIP
8732 | OPTI_TYPE_NOT_SALTED
;
8739 case 4700: hash_type
= HASH_TYPE_SHA1
;
8740 salt_type
= SALT_TYPE_NONE
;
8741 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8742 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8743 | OPTS_TYPE_PT_ADD80
8744 | OPTS_TYPE_PT_ADDBITS14
;
8745 kern_type
= KERN_TYPE_SHA1_MD5
;
8746 dgst_size
= DGST_SIZE_4_5
;
8747 parse_func
= sha1_parse_hash
;
8748 sort_by_digest
= sort_by_digest_4_5
;
8749 opti_type
= OPTI_TYPE_ZERO_BYTE
8750 | OPTI_TYPE_PRECOMPUTE_INIT
8751 | OPTI_TYPE_PRECOMPUTE_MERKLE
8752 | OPTI_TYPE_EARLY_SKIP
8753 | OPTI_TYPE_NOT_ITERATED
8754 | OPTI_TYPE_NOT_SALTED
8755 | OPTI_TYPE_RAW_HASH
;
8762 case 4800: hash_type
= HASH_TYPE_MD5
;
8763 salt_type
= SALT_TYPE_EMBEDDED
;
8764 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8765 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8766 | OPTS_TYPE_PT_ADDBITS14
;
8767 kern_type
= KERN_TYPE_MD5_CHAP
;
8768 dgst_size
= DGST_SIZE_4_4
;
8769 parse_func
= chap_parse_hash
;
8770 sort_by_digest
= sort_by_digest_4_4
;
8771 opti_type
= OPTI_TYPE_ZERO_BYTE
8772 | OPTI_TYPE_PRECOMPUTE_INIT
8773 | OPTI_TYPE_PRECOMPUTE_MERKLE
8774 | OPTI_TYPE_MEET_IN_MIDDLE
8775 | OPTI_TYPE_EARLY_SKIP
8776 | OPTI_TYPE_NOT_ITERATED
8777 | OPTI_TYPE_RAW_HASH
;
8784 case 4900: hash_type
= HASH_TYPE_SHA1
;
8785 salt_type
= SALT_TYPE_INTERN
;
8786 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8787 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8788 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8789 dgst_size
= DGST_SIZE_4_5
;
8790 parse_func
= sha1s_parse_hash
;
8791 sort_by_digest
= sort_by_digest_4_5
;
8792 opti_type
= OPTI_TYPE_ZERO_BYTE
8793 | OPTI_TYPE_PRECOMPUTE_INIT
8794 | OPTI_TYPE_PRECOMPUTE_MERKLE
8795 | OPTI_TYPE_EARLY_SKIP
;
8802 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8803 salt_type
= SALT_TYPE_EMBEDDED
;
8804 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8805 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8806 | OPTS_TYPE_PT_ADD01
;
8807 kern_type
= KERN_TYPE_KECCAK
;
8808 dgst_size
= DGST_SIZE_8_25
;
8809 parse_func
= keccak_parse_hash
;
8810 sort_by_digest
= sort_by_digest_8_25
;
8811 opti_type
= OPTI_TYPE_ZERO_BYTE
8812 | OPTI_TYPE_USES_BITS_64
8813 | OPTI_TYPE_RAW_HASH
;
8820 case 5100: hash_type
= HASH_TYPE_MD5H
;
8821 salt_type
= SALT_TYPE_NONE
;
8822 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8823 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8824 | OPTS_TYPE_PT_ADD80
8825 | OPTS_TYPE_PT_ADDBITS14
;
8826 kern_type
= KERN_TYPE_MD5H
;
8827 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8828 parse_func
= md5half_parse_hash
;
8829 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8830 opti_type
= OPTI_TYPE_ZERO_BYTE
8831 | OPTI_TYPE_RAW_HASH
;
8838 case 5200: hash_type
= HASH_TYPE_SHA256
;
8839 salt_type
= SALT_TYPE_EMBEDDED
;
8840 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8841 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8842 kern_type
= KERN_TYPE_PSAFE3
;
8843 dgst_size
= DGST_SIZE_4_8
;
8844 parse_func
= psafe3_parse_hash
;
8845 sort_by_digest
= sort_by_digest_4_8
;
8846 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8853 case 5300: hash_type
= HASH_TYPE_MD5
;
8854 salt_type
= SALT_TYPE_EMBEDDED
;
8855 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8856 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8857 | OPTS_TYPE_ST_ADD80
;
8858 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8859 dgst_size
= DGST_SIZE_4_4
;
8860 parse_func
= ikepsk_md5_parse_hash
;
8861 sort_by_digest
= sort_by_digest_4_4
;
8862 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8869 case 5400: hash_type
= HASH_TYPE_SHA1
;
8870 salt_type
= SALT_TYPE_EMBEDDED
;
8871 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8872 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8873 | OPTS_TYPE_ST_ADD80
;
8874 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8875 dgst_size
= DGST_SIZE_4_5
;
8876 parse_func
= ikepsk_sha1_parse_hash
;
8877 sort_by_digest
= sort_by_digest_4_5
;
8878 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8885 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8886 salt_type
= SALT_TYPE_EMBEDDED
;
8887 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8888 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8889 | OPTS_TYPE_PT_ADD80
8890 | OPTS_TYPE_PT_ADDBITS14
8891 | OPTS_TYPE_PT_UNICODE
8893 kern_type
= KERN_TYPE_NETNTLMv1
;
8894 dgst_size
= DGST_SIZE_4_4
;
8895 parse_func
= netntlmv1_parse_hash
;
8896 sort_by_digest
= sort_by_digest_4_4
;
8897 opti_type
= OPTI_TYPE_ZERO_BYTE
8898 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8905 case 5600: hash_type
= HASH_TYPE_MD5
;
8906 salt_type
= SALT_TYPE_EMBEDDED
;
8907 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8908 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8909 | OPTS_TYPE_PT_ADD80
8910 | OPTS_TYPE_PT_ADDBITS14
8911 | OPTS_TYPE_PT_UNICODE
;
8912 kern_type
= KERN_TYPE_NETNTLMv2
;
8913 dgst_size
= DGST_SIZE_4_4
;
8914 parse_func
= netntlmv2_parse_hash
;
8915 sort_by_digest
= sort_by_digest_4_4
;
8916 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8923 case 5700: hash_type
= HASH_TYPE_SHA256
;
8924 salt_type
= SALT_TYPE_NONE
;
8925 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8926 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8927 | OPTS_TYPE_PT_ADD80
8928 | OPTS_TYPE_PT_ADDBITS15
;
8929 kern_type
= KERN_TYPE_SHA256
;
8930 dgst_size
= DGST_SIZE_4_8
;
8931 parse_func
= cisco4_parse_hash
;
8932 sort_by_digest
= sort_by_digest_4_8
;
8933 opti_type
= OPTI_TYPE_ZERO_BYTE
8934 | OPTI_TYPE_PRECOMPUTE_INIT
8935 | OPTI_TYPE_PRECOMPUTE_MERKLE
8936 | OPTI_TYPE_EARLY_SKIP
8937 | OPTI_TYPE_NOT_ITERATED
8938 | OPTI_TYPE_NOT_SALTED
8939 | OPTI_TYPE_RAW_HASH
;
8946 case 5800: hash_type
= HASH_TYPE_SHA1
;
8947 salt_type
= SALT_TYPE_INTERN
;
8948 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8950 | OPTS_TYPE_ST_ADD80
;
8951 kern_type
= KERN_TYPE_ANDROIDPIN
;
8952 dgst_size
= DGST_SIZE_4_5
;
8953 parse_func
= androidpin_parse_hash
;
8954 sort_by_digest
= sort_by_digest_4_5
;
8955 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8962 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8963 salt_type
= SALT_TYPE_NONE
;
8964 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8965 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8966 | OPTS_TYPE_PT_ADD80
;
8967 kern_type
= KERN_TYPE_RIPEMD160
;
8968 dgst_size
= DGST_SIZE_4_5
;
8969 parse_func
= ripemd160_parse_hash
;
8970 sort_by_digest
= sort_by_digest_4_5
;
8971 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8978 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8979 salt_type
= SALT_TYPE_NONE
;
8980 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8981 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8982 | OPTS_TYPE_PT_ADD80
;
8983 kern_type
= KERN_TYPE_WHIRLPOOL
;
8984 dgst_size
= DGST_SIZE_4_16
;
8985 parse_func
= whirlpool_parse_hash
;
8986 sort_by_digest
= sort_by_digest_4_16
;
8987 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8994 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8995 salt_type
= SALT_TYPE_EMBEDDED
;
8996 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8997 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8998 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8999 dgst_size
= DGST_SIZE_4_5
;
9000 parse_func
= truecrypt_parse_hash_2k
;
9001 sort_by_digest
= sort_by_digest_4_5
;
9002 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9009 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9010 salt_type
= SALT_TYPE_EMBEDDED
;
9011 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9012 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9013 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9014 dgst_size
= DGST_SIZE_4_5
;
9015 parse_func
= truecrypt_parse_hash_2k
;
9016 sort_by_digest
= sort_by_digest_4_5
;
9017 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9024 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9025 salt_type
= SALT_TYPE_EMBEDDED
;
9026 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9027 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9028 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9029 dgst_size
= DGST_SIZE_4_5
;
9030 parse_func
= truecrypt_parse_hash_2k
;
9031 sort_by_digest
= sort_by_digest_4_5
;
9032 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9039 case 6221: hash_type
= HASH_TYPE_SHA512
;
9040 salt_type
= SALT_TYPE_EMBEDDED
;
9041 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9042 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9043 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9044 dgst_size
= DGST_SIZE_8_8
;
9045 parse_func
= truecrypt_parse_hash_1k
;
9046 sort_by_digest
= sort_by_digest_8_8
;
9047 opti_type
= OPTI_TYPE_ZERO_BYTE
9048 | OPTI_TYPE_USES_BITS_64
;
9055 case 6222: hash_type
= HASH_TYPE_SHA512
;
9056 salt_type
= SALT_TYPE_EMBEDDED
;
9057 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9058 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9059 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9060 dgst_size
= DGST_SIZE_8_8
;
9061 parse_func
= truecrypt_parse_hash_1k
;
9062 sort_by_digest
= sort_by_digest_8_8
;
9063 opti_type
= OPTI_TYPE_ZERO_BYTE
9064 | OPTI_TYPE_USES_BITS_64
;
9071 case 6223: hash_type
= HASH_TYPE_SHA512
;
9072 salt_type
= SALT_TYPE_EMBEDDED
;
9073 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9074 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9075 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9076 dgst_size
= DGST_SIZE_8_8
;
9077 parse_func
= truecrypt_parse_hash_1k
;
9078 sort_by_digest
= sort_by_digest_8_8
;
9079 opti_type
= OPTI_TYPE_ZERO_BYTE
9080 | OPTI_TYPE_USES_BITS_64
;
9087 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9088 salt_type
= SALT_TYPE_EMBEDDED
;
9089 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9090 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9091 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9092 dgst_size
= DGST_SIZE_4_8
;
9093 parse_func
= truecrypt_parse_hash_1k
;
9094 sort_by_digest
= sort_by_digest_4_8
;
9095 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9102 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9103 salt_type
= SALT_TYPE_EMBEDDED
;
9104 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9106 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9107 dgst_size
= DGST_SIZE_4_8
;
9108 parse_func
= truecrypt_parse_hash_1k
;
9109 sort_by_digest
= sort_by_digest_4_8
;
9110 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9117 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9118 salt_type
= SALT_TYPE_EMBEDDED
;
9119 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9120 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9121 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9122 dgst_size
= DGST_SIZE_4_8
;
9123 parse_func
= truecrypt_parse_hash_1k
;
9124 sort_by_digest
= sort_by_digest_4_8
;
9125 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9132 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9133 salt_type
= SALT_TYPE_EMBEDDED
;
9134 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9135 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9136 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9137 dgst_size
= DGST_SIZE_4_5
;
9138 parse_func
= truecrypt_parse_hash_1k
;
9139 sort_by_digest
= sort_by_digest_4_5
;
9140 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9147 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9148 salt_type
= SALT_TYPE_EMBEDDED
;
9149 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9150 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9151 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9152 dgst_size
= DGST_SIZE_4_5
;
9153 parse_func
= truecrypt_parse_hash_1k
;
9154 sort_by_digest
= sort_by_digest_4_5
;
9155 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9162 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9163 salt_type
= SALT_TYPE_EMBEDDED
;
9164 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9166 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9167 dgst_size
= DGST_SIZE_4_5
;
9168 parse_func
= truecrypt_parse_hash_1k
;
9169 sort_by_digest
= sort_by_digest_4_5
;
9170 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9177 case 6300: hash_type
= HASH_TYPE_MD5
;
9178 salt_type
= SALT_TYPE_EMBEDDED
;
9179 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9180 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9181 kern_type
= KERN_TYPE_MD5AIX
;
9182 dgst_size
= DGST_SIZE_4_4
;
9183 parse_func
= md5aix_parse_hash
;
9184 sort_by_digest
= sort_by_digest_4_4
;
9185 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9192 case 6400: hash_type
= HASH_TYPE_SHA256
;
9193 salt_type
= SALT_TYPE_EMBEDDED
;
9194 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9195 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9196 kern_type
= KERN_TYPE_SHA256AIX
;
9197 dgst_size
= DGST_SIZE_4_8
;
9198 parse_func
= sha256aix_parse_hash
;
9199 sort_by_digest
= sort_by_digest_4_8
;
9200 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9207 case 6500: hash_type
= HASH_TYPE_SHA512
;
9208 salt_type
= SALT_TYPE_EMBEDDED
;
9209 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9210 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9211 kern_type
= KERN_TYPE_SHA512AIX
;
9212 dgst_size
= DGST_SIZE_8_8
;
9213 parse_func
= sha512aix_parse_hash
;
9214 sort_by_digest
= sort_by_digest_8_8
;
9215 opti_type
= OPTI_TYPE_ZERO_BYTE
9216 | OPTI_TYPE_USES_BITS_64
;
9223 case 6600: hash_type
= HASH_TYPE_AES
;
9224 salt_type
= SALT_TYPE_EMBEDDED
;
9225 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9226 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9227 kern_type
= KERN_TYPE_AGILEKEY
;
9228 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9229 parse_func
= agilekey_parse_hash
;
9230 sort_by_digest
= sort_by_digest_4_5
;
9231 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9238 case 6700: hash_type
= HASH_TYPE_SHA1
;
9239 salt_type
= SALT_TYPE_EMBEDDED
;
9240 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9242 kern_type
= KERN_TYPE_SHA1AIX
;
9243 dgst_size
= DGST_SIZE_4_5
;
9244 parse_func
= sha1aix_parse_hash
;
9245 sort_by_digest
= sort_by_digest_4_5
;
9246 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9253 case 6800: hash_type
= HASH_TYPE_AES
;
9254 salt_type
= SALT_TYPE_EMBEDDED
;
9255 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9256 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9257 kern_type
= KERN_TYPE_LASTPASS
;
9258 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9259 parse_func
= lastpass_parse_hash
;
9260 sort_by_digest
= sort_by_digest_4_8
;
9261 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9268 case 6900: hash_type
= HASH_TYPE_GOST
;
9269 salt_type
= SALT_TYPE_NONE
;
9270 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9271 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9272 kern_type
= KERN_TYPE_GOST
;
9273 dgst_size
= DGST_SIZE_4_8
;
9274 parse_func
= gost_parse_hash
;
9275 sort_by_digest
= sort_by_digest_4_8
;
9276 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9283 case 7100: hash_type
= HASH_TYPE_SHA512
;
9284 salt_type
= SALT_TYPE_EMBEDDED
;
9285 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9287 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9288 dgst_size
= DGST_SIZE_8_16
;
9289 parse_func
= sha512osx_parse_hash
;
9290 sort_by_digest
= sort_by_digest_8_16
;
9291 opti_type
= OPTI_TYPE_ZERO_BYTE
9292 | OPTI_TYPE_USES_BITS_64
9293 | OPTI_TYPE_SLOW_HASH_SIMD
;
9300 case 7200: hash_type
= HASH_TYPE_SHA512
;
9301 salt_type
= SALT_TYPE_EMBEDDED
;
9302 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9303 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9304 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9305 dgst_size
= DGST_SIZE_8_16
;
9306 parse_func
= sha512grub_parse_hash
;
9307 sort_by_digest
= sort_by_digest_8_16
;
9308 opti_type
= OPTI_TYPE_ZERO_BYTE
9309 | OPTI_TYPE_USES_BITS_64
9310 | OPTI_TYPE_SLOW_HASH_SIMD
;
9317 case 7300: hash_type
= HASH_TYPE_SHA1
;
9318 salt_type
= SALT_TYPE_EMBEDDED
;
9319 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9320 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9321 | OPTS_TYPE_ST_ADD80
9322 | OPTS_TYPE_ST_ADDBITS15
;
9323 kern_type
= KERN_TYPE_RAKP
;
9324 dgst_size
= DGST_SIZE_4_5
;
9325 parse_func
= rakp_parse_hash
;
9326 sort_by_digest
= sort_by_digest_4_5
;
9327 opti_type
= OPTI_TYPE_ZERO_BYTE
9328 | OPTI_TYPE_NOT_ITERATED
;
9335 case 7400: hash_type
= HASH_TYPE_SHA256
;
9336 salt_type
= SALT_TYPE_EMBEDDED
;
9337 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9338 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9339 kern_type
= KERN_TYPE_SHA256CRYPT
;
9340 dgst_size
= DGST_SIZE_4_8
;
9341 parse_func
= sha256crypt_parse_hash
;
9342 sort_by_digest
= sort_by_digest_4_8
;
9343 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9350 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9351 salt_type
= SALT_TYPE_EMBEDDED
;
9352 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9353 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9354 kern_type
= KERN_TYPE_KRB5PA
;
9355 dgst_size
= DGST_SIZE_4_4
;
9356 parse_func
= krb5pa_parse_hash
;
9357 sort_by_digest
= sort_by_digest_4_4
;
9358 opti_type
= OPTI_TYPE_ZERO_BYTE
9359 | OPTI_TYPE_NOT_ITERATED
;
9366 case 7600: hash_type
= HASH_TYPE_SHA1
;
9367 salt_type
= SALT_TYPE_INTERN
;
9368 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9369 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9370 | OPTS_TYPE_PT_ADD80
9371 | OPTS_TYPE_PT_ADDBITS15
;
9372 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9373 dgst_size
= DGST_SIZE_4_5
;
9374 parse_func
= redmine_parse_hash
;
9375 sort_by_digest
= sort_by_digest_4_5
;
9376 opti_type
= OPTI_TYPE_ZERO_BYTE
9377 | OPTI_TYPE_PRECOMPUTE_INIT
9378 | OPTI_TYPE_EARLY_SKIP
9379 | OPTI_TYPE_NOT_ITERATED
9380 | OPTI_TYPE_PREPENDED_SALT
;
9387 case 7700: hash_type
= HASH_TYPE_SAPB
;
9388 salt_type
= SALT_TYPE_EMBEDDED
;
9389 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9390 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9391 | OPTS_TYPE_PT_UPPER
9392 | OPTS_TYPE_ST_UPPER
;
9393 kern_type
= KERN_TYPE_SAPB
;
9394 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9395 parse_func
= sapb_parse_hash
;
9396 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9397 opti_type
= OPTI_TYPE_ZERO_BYTE
9398 | OPTI_TYPE_PRECOMPUTE_INIT
9399 | OPTI_TYPE_NOT_ITERATED
;
9406 case 7800: hash_type
= HASH_TYPE_SAPG
;
9407 salt_type
= SALT_TYPE_EMBEDDED
;
9408 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9409 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9410 | OPTS_TYPE_ST_ADD80
9411 | OPTS_TYPE_ST_UPPER
;
9412 kern_type
= KERN_TYPE_SAPG
;
9413 dgst_size
= DGST_SIZE_4_5
;
9414 parse_func
= sapg_parse_hash
;
9415 sort_by_digest
= sort_by_digest_4_5
;
9416 opti_type
= OPTI_TYPE_ZERO_BYTE
9417 | OPTI_TYPE_PRECOMPUTE_INIT
9418 | OPTI_TYPE_NOT_ITERATED
;
9425 case 7900: hash_type
= HASH_TYPE_SHA512
;
9426 salt_type
= SALT_TYPE_EMBEDDED
;
9427 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9428 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9429 kern_type
= KERN_TYPE_DRUPAL7
;
9430 dgst_size
= DGST_SIZE_8_8
;
9431 parse_func
= drupal7_parse_hash
;
9432 sort_by_digest
= sort_by_digest_8_8
;
9433 opti_type
= OPTI_TYPE_ZERO_BYTE
9434 | OPTI_TYPE_USES_BITS_64
;
9441 case 8000: hash_type
= HASH_TYPE_SHA256
;
9442 salt_type
= SALT_TYPE_EMBEDDED
;
9443 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9444 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9445 | OPTS_TYPE_PT_UNICODE
9446 | OPTS_TYPE_ST_ADD80
9448 kern_type
= KERN_TYPE_SYBASEASE
;
9449 dgst_size
= DGST_SIZE_4_8
;
9450 parse_func
= sybasease_parse_hash
;
9451 sort_by_digest
= sort_by_digest_4_8
;
9452 opti_type
= OPTI_TYPE_ZERO_BYTE
9453 | OPTI_TYPE_PRECOMPUTE_INIT
9454 | OPTI_TYPE_EARLY_SKIP
9455 | OPTI_TYPE_NOT_ITERATED
9456 | OPTI_TYPE_RAW_HASH
;
9463 case 8100: hash_type
= HASH_TYPE_SHA1
;
9464 salt_type
= SALT_TYPE_EMBEDDED
;
9465 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9466 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9467 kern_type
= KERN_TYPE_NETSCALER
;
9468 dgst_size
= DGST_SIZE_4_5
;
9469 parse_func
= netscaler_parse_hash
;
9470 sort_by_digest
= sort_by_digest_4_5
;
9471 opti_type
= OPTI_TYPE_ZERO_BYTE
9472 | OPTI_TYPE_PRECOMPUTE_INIT
9473 | OPTI_TYPE_PRECOMPUTE_MERKLE
9474 | OPTI_TYPE_EARLY_SKIP
9475 | OPTI_TYPE_NOT_ITERATED
9476 | OPTI_TYPE_PREPENDED_SALT
9477 | OPTI_TYPE_RAW_HASH
;
9484 case 8200: hash_type
= HASH_TYPE_SHA256
;
9485 salt_type
= SALT_TYPE_EMBEDDED
;
9486 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9488 kern_type
= KERN_TYPE_CLOUDKEY
;
9489 dgst_size
= DGST_SIZE_4_8
;
9490 parse_func
= cloudkey_parse_hash
;
9491 sort_by_digest
= sort_by_digest_4_8
;
9492 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9499 case 8300: hash_type
= HASH_TYPE_SHA1
;
9500 salt_type
= SALT_TYPE_EMBEDDED
;
9501 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9502 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9504 | OPTS_TYPE_ST_ADD80
;
9505 kern_type
= KERN_TYPE_NSEC3
;
9506 dgst_size
= DGST_SIZE_4_5
;
9507 parse_func
= nsec3_parse_hash
;
9508 sort_by_digest
= sort_by_digest_4_5
;
9509 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9516 case 8400: hash_type
= HASH_TYPE_SHA1
;
9517 salt_type
= SALT_TYPE_INTERN
;
9518 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9519 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9520 | OPTS_TYPE_PT_ADD80
9521 | OPTS_TYPE_PT_ADDBITS15
;
9522 kern_type
= KERN_TYPE_WBB3
;
9523 dgst_size
= DGST_SIZE_4_5
;
9524 parse_func
= wbb3_parse_hash
;
9525 sort_by_digest
= sort_by_digest_4_5
;
9526 opti_type
= OPTI_TYPE_ZERO_BYTE
9527 | OPTI_TYPE_PRECOMPUTE_INIT
9528 | OPTI_TYPE_NOT_ITERATED
;
9535 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9536 salt_type
= SALT_TYPE_EMBEDDED
;
9537 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9538 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9539 | OPTS_TYPE_ST_UPPER
;
9540 kern_type
= KERN_TYPE_RACF
;
9541 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9542 parse_func
= racf_parse_hash
;
9543 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9544 opti_type
= OPTI_TYPE_ZERO_BYTE
9545 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9552 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9553 salt_type
= SALT_TYPE_NONE
;
9554 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9555 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9556 kern_type
= KERN_TYPE_LOTUS5
;
9557 dgst_size
= DGST_SIZE_4_4
;
9558 parse_func
= lotus5_parse_hash
;
9559 sort_by_digest
= sort_by_digest_4_4
;
9560 opti_type
= OPTI_TYPE_EARLY_SKIP
9561 | OPTI_TYPE_NOT_ITERATED
9562 | OPTI_TYPE_NOT_SALTED
9563 | OPTI_TYPE_RAW_HASH
;
9570 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9571 salt_type
= SALT_TYPE_EMBEDDED
;
9572 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9573 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9574 kern_type
= KERN_TYPE_LOTUS6
;
9575 dgst_size
= DGST_SIZE_4_4
;
9576 parse_func
= lotus6_parse_hash
;
9577 sort_by_digest
= sort_by_digest_4_4
;
9578 opti_type
= OPTI_TYPE_EARLY_SKIP
9579 | OPTI_TYPE_NOT_ITERATED
9580 | OPTI_TYPE_RAW_HASH
;
9587 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9588 salt_type
= SALT_TYPE_EMBEDDED
;
9589 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9590 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9591 kern_type
= KERN_TYPE_ANDROIDFDE
;
9592 dgst_size
= DGST_SIZE_4_4
;
9593 parse_func
= androidfde_parse_hash
;
9594 sort_by_digest
= sort_by_digest_4_4
;
9595 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9602 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9603 salt_type
= SALT_TYPE_EMBEDDED
;
9604 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9606 kern_type
= KERN_TYPE_SCRYPT
;
9607 dgst_size
= DGST_SIZE_4_8
;
9608 parse_func
= scrypt_parse_hash
;
9609 sort_by_digest
= sort_by_digest_4_8
;
9610 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9617 case 9000: hash_type
= HASH_TYPE_SHA1
;
9618 salt_type
= SALT_TYPE_EMBEDDED
;
9619 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9620 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9621 | OPTS_TYPE_ST_GENERATE_LE
;
9622 kern_type
= KERN_TYPE_PSAFE2
;
9623 dgst_size
= DGST_SIZE_4_5
;
9624 parse_func
= psafe2_parse_hash
;
9625 sort_by_digest
= sort_by_digest_4_5
;
9626 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9633 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9634 salt_type
= SALT_TYPE_EMBEDDED
;
9635 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9637 kern_type
= KERN_TYPE_LOTUS8
;
9638 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9639 parse_func
= lotus8_parse_hash
;
9640 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9641 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9648 case 9200: hash_type
= HASH_TYPE_SHA256
;
9649 salt_type
= SALT_TYPE_EMBEDDED
;
9650 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9651 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9652 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9653 dgst_size
= DGST_SIZE_4_32
;
9654 parse_func
= cisco8_parse_hash
;
9655 sort_by_digest
= sort_by_digest_4_32
;
9656 opti_type
= OPTI_TYPE_ZERO_BYTE
9657 | OPTI_TYPE_SLOW_HASH_SIMD
;
9664 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9665 salt_type
= SALT_TYPE_EMBEDDED
;
9666 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9667 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9668 kern_type
= KERN_TYPE_SCRYPT
;
9669 dgst_size
= DGST_SIZE_4_8
;
9670 parse_func
= cisco9_parse_hash
;
9671 sort_by_digest
= sort_by_digest_4_8
;
9672 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9679 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9680 salt_type
= SALT_TYPE_EMBEDDED
;
9681 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9683 kern_type
= KERN_TYPE_OFFICE2007
;
9684 dgst_size
= DGST_SIZE_4_4
;
9685 parse_func
= office2007_parse_hash
;
9686 sort_by_digest
= sort_by_digest_4_4
;
9687 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9694 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9695 salt_type
= SALT_TYPE_EMBEDDED
;
9696 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9697 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9698 kern_type
= KERN_TYPE_OFFICE2010
;
9699 dgst_size
= DGST_SIZE_4_4
;
9700 parse_func
= office2010_parse_hash
;
9701 sort_by_digest
= sort_by_digest_4_4
;
9702 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9709 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9710 salt_type
= SALT_TYPE_EMBEDDED
;
9711 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9713 kern_type
= KERN_TYPE_OFFICE2013
;
9714 dgst_size
= DGST_SIZE_4_4
;
9715 parse_func
= office2013_parse_hash
;
9716 sort_by_digest
= sort_by_digest_4_4
;
9717 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9724 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9725 salt_type
= SALT_TYPE_EMBEDDED
;
9726 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9728 | OPTS_TYPE_PT_ADD80
9729 | OPTS_TYPE_PT_UNICODE
;
9730 kern_type
= KERN_TYPE_OLDOFFICE01
;
9731 dgst_size
= DGST_SIZE_4_4
;
9732 parse_func
= oldoffice01_parse_hash
;
9733 sort_by_digest
= sort_by_digest_4_4
;
9734 opti_type
= OPTI_TYPE_ZERO_BYTE
9735 | OPTI_TYPE_PRECOMPUTE_INIT
9736 | OPTI_TYPE_NOT_ITERATED
;
9743 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9744 salt_type
= SALT_TYPE_EMBEDDED
;
9745 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9746 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9747 | OPTS_TYPE_PT_ADD80
;
9748 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9749 dgst_size
= DGST_SIZE_4_4
;
9750 parse_func
= oldoffice01cm1_parse_hash
;
9751 sort_by_digest
= sort_by_digest_4_4
;
9752 opti_type
= OPTI_TYPE_ZERO_BYTE
9753 | OPTI_TYPE_PRECOMPUTE_INIT
9754 | OPTI_TYPE_NOT_ITERATED
;
9761 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9762 salt_type
= SALT_TYPE_EMBEDDED
;
9763 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9764 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9765 | OPTS_TYPE_PT_ADD80
9766 | OPTS_TYPE_PT_UNICODE
9767 | OPTS_TYPE_PT_NEVERCRACK
;
9768 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9769 dgst_size
= DGST_SIZE_4_4
;
9770 parse_func
= oldoffice01cm2_parse_hash
;
9771 sort_by_digest
= sort_by_digest_4_4
;
9772 opti_type
= OPTI_TYPE_ZERO_BYTE
9773 | OPTI_TYPE_PRECOMPUTE_INIT
9774 | OPTI_TYPE_NOT_ITERATED
;
9781 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9782 salt_type
= SALT_TYPE_EMBEDDED
;
9783 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9784 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9785 | OPTS_TYPE_PT_ADD80
9786 | OPTS_TYPE_PT_UNICODE
;
9787 kern_type
= KERN_TYPE_OLDOFFICE34
;
9788 dgst_size
= DGST_SIZE_4_4
;
9789 parse_func
= oldoffice34_parse_hash
;
9790 sort_by_digest
= sort_by_digest_4_4
;
9791 opti_type
= OPTI_TYPE_ZERO_BYTE
9792 | OPTI_TYPE_PRECOMPUTE_INIT
9793 | OPTI_TYPE_NOT_ITERATED
;
9800 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9801 salt_type
= SALT_TYPE_EMBEDDED
;
9802 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9803 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9804 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9805 dgst_size
= DGST_SIZE_4_4
;
9806 parse_func
= oldoffice34cm1_parse_hash
;
9807 sort_by_digest
= sort_by_digest_4_4
;
9808 opti_type
= OPTI_TYPE_ZERO_BYTE
9809 | OPTI_TYPE_PRECOMPUTE_INIT
9810 | OPTI_TYPE_NOT_ITERATED
;
9817 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9818 salt_type
= SALT_TYPE_EMBEDDED
;
9819 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9820 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9821 | OPTS_TYPE_PT_ADD80
9822 | OPTS_TYPE_PT_UNICODE
9823 | OPTS_TYPE_PT_NEVERCRACK
;
9824 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9825 dgst_size
= DGST_SIZE_4_4
;
9826 parse_func
= oldoffice34cm2_parse_hash
;
9827 sort_by_digest
= sort_by_digest_4_4
;
9828 opti_type
= OPTI_TYPE_ZERO_BYTE
9829 | OPTI_TYPE_PRECOMPUTE_INIT
9830 | OPTI_TYPE_NOT_ITERATED
;
9837 case 9900: hash_type
= HASH_TYPE_MD5
;
9838 salt_type
= SALT_TYPE_NONE
;
9839 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9840 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9841 kern_type
= KERN_TYPE_RADMIN2
;
9842 dgst_size
= DGST_SIZE_4_4
;
9843 parse_func
= radmin2_parse_hash
;
9844 sort_by_digest
= sort_by_digest_4_4
;
9845 opti_type
= OPTI_TYPE_ZERO_BYTE
9846 | OPTI_TYPE_PRECOMPUTE_INIT
9847 | OPTI_TYPE_EARLY_SKIP
9848 | OPTI_TYPE_NOT_ITERATED
9849 | OPTI_TYPE_NOT_SALTED
;
9856 case 10000: hash_type
= HASH_TYPE_SHA256
;
9857 salt_type
= SALT_TYPE_EMBEDDED
;
9858 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9859 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9860 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9861 dgst_size
= DGST_SIZE_4_32
;
9862 parse_func
= djangopbkdf2_parse_hash
;
9863 sort_by_digest
= sort_by_digest_4_32
;
9864 opti_type
= OPTI_TYPE_ZERO_BYTE
9865 | OPTI_TYPE_SLOW_HASH_SIMD
;
9872 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9873 salt_type
= SALT_TYPE_EMBEDDED
;
9874 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9875 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9876 kern_type
= KERN_TYPE_SIPHASH
;
9877 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9878 parse_func
= siphash_parse_hash
;
9879 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9880 opti_type
= OPTI_TYPE_ZERO_BYTE
9881 | OPTI_TYPE_NOT_ITERATED
9882 | OPTI_TYPE_RAW_HASH
;
9889 case 10200: hash_type
= HASH_TYPE_MD5
;
9890 salt_type
= SALT_TYPE_EMBEDDED
;
9891 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9892 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9893 | OPTS_TYPE_ST_ADD80
9894 | OPTS_TYPE_ST_ADDBITS14
;
9895 kern_type
= KERN_TYPE_HMACMD5_PW
;
9896 dgst_size
= DGST_SIZE_4_4
;
9897 parse_func
= crammd5_parse_hash
;
9898 sort_by_digest
= sort_by_digest_4_4
;
9899 opti_type
= OPTI_TYPE_ZERO_BYTE
9900 | OPTI_TYPE_NOT_ITERATED
;
9907 case 10300: hash_type
= HASH_TYPE_SHA1
;
9908 salt_type
= SALT_TYPE_EMBEDDED
;
9909 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9910 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9911 kern_type
= KERN_TYPE_SAPH_SHA1
;
9912 dgst_size
= DGST_SIZE_4_5
;
9913 parse_func
= saph_sha1_parse_hash
;
9914 sort_by_digest
= sort_by_digest_4_5
;
9915 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9922 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9923 salt_type
= SALT_TYPE_EMBEDDED
;
9924 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9926 kern_type
= KERN_TYPE_PDF11
;
9927 dgst_size
= DGST_SIZE_4_4
;
9928 parse_func
= pdf11_parse_hash
;
9929 sort_by_digest
= sort_by_digest_4_4
;
9930 opti_type
= OPTI_TYPE_ZERO_BYTE
9931 | OPTI_TYPE_NOT_ITERATED
;
9938 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9939 salt_type
= SALT_TYPE_EMBEDDED
;
9940 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9941 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9942 kern_type
= KERN_TYPE_PDF11CM1
;
9943 dgst_size
= DGST_SIZE_4_4
;
9944 parse_func
= pdf11cm1_parse_hash
;
9945 sort_by_digest
= sort_by_digest_4_4
;
9946 opti_type
= OPTI_TYPE_ZERO_BYTE
9947 | OPTI_TYPE_NOT_ITERATED
;
9954 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9955 salt_type
= SALT_TYPE_EMBEDDED
;
9956 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9957 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9958 kern_type
= KERN_TYPE_PDF11CM2
;
9959 dgst_size
= DGST_SIZE_4_4
;
9960 parse_func
= pdf11cm2_parse_hash
;
9961 sort_by_digest
= sort_by_digest_4_4
;
9962 opti_type
= OPTI_TYPE_ZERO_BYTE
9963 | OPTI_TYPE_NOT_ITERATED
;
9970 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9971 salt_type
= SALT_TYPE_EMBEDDED
;
9972 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9973 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9974 kern_type
= KERN_TYPE_PDF14
;
9975 dgst_size
= DGST_SIZE_4_4
;
9976 parse_func
= pdf14_parse_hash
;
9977 sort_by_digest
= sort_by_digest_4_4
;
9978 opti_type
= OPTI_TYPE_ZERO_BYTE
9979 | OPTI_TYPE_NOT_ITERATED
;
9986 case 10600: hash_type
= HASH_TYPE_SHA256
;
9987 salt_type
= SALT_TYPE_EMBEDDED
;
9988 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9989 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9990 | OPTS_TYPE_ST_ADD80
9991 | OPTS_TYPE_ST_ADDBITS15
9992 | OPTS_TYPE_HASH_COPY
;
9993 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9994 dgst_size
= DGST_SIZE_4_8
;
9995 parse_func
= pdf17l3_parse_hash
;
9996 sort_by_digest
= sort_by_digest_4_8
;
9997 opti_type
= OPTI_TYPE_ZERO_BYTE
9998 | OPTI_TYPE_PRECOMPUTE_INIT
9999 | OPTI_TYPE_PRECOMPUTE_MERKLE
10000 | OPTI_TYPE_EARLY_SKIP
10001 | OPTI_TYPE_NOT_ITERATED
10002 | OPTI_TYPE_APPENDED_SALT
10003 | OPTI_TYPE_RAW_HASH
;
10010 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10011 salt_type
= SALT_TYPE_EMBEDDED
;
10012 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10013 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10014 | OPTS_TYPE_HASH_COPY
;
10015 kern_type
= KERN_TYPE_PDF17L8
;
10016 dgst_size
= DGST_SIZE_4_8
;
10017 parse_func
= pdf17l8_parse_hash
;
10018 sort_by_digest
= sort_by_digest_4_8
;
10019 opti_type
= OPTI_TYPE_ZERO_BYTE
10020 | OPTI_TYPE_NOT_ITERATED
;
10027 case 10800: hash_type
= HASH_TYPE_SHA384
;
10028 salt_type
= SALT_TYPE_NONE
;
10029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10030 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10031 | OPTS_TYPE_PT_ADD80
10032 | OPTS_TYPE_PT_ADDBITS15
;
10033 kern_type
= KERN_TYPE_SHA384
;
10034 dgst_size
= DGST_SIZE_8_8
;
10035 parse_func
= sha384_parse_hash
;
10036 sort_by_digest
= sort_by_digest_8_8
;
10037 opti_type
= OPTI_TYPE_ZERO_BYTE
10038 | OPTI_TYPE_PRECOMPUTE_INIT
10039 | OPTI_TYPE_PRECOMPUTE_MERKLE
10040 | OPTI_TYPE_EARLY_SKIP
10041 | OPTI_TYPE_NOT_ITERATED
10042 | OPTI_TYPE_NOT_SALTED
10043 | OPTI_TYPE_USES_BITS_64
10044 | OPTI_TYPE_RAW_HASH
;
10051 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10052 salt_type
= SALT_TYPE_EMBEDDED
;
10053 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10054 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10055 | OPTS_TYPE_ST_BASE64
10056 | OPTS_TYPE_HASH_COPY
;
10057 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10058 dgst_size
= DGST_SIZE_4_32
;
10059 parse_func
= pbkdf2_sha256_parse_hash
;
10060 sort_by_digest
= sort_by_digest_4_32
;
10061 opti_type
= OPTI_TYPE_ZERO_BYTE
10062 | OPTI_TYPE_SLOW_HASH_SIMD
;
10069 case 11000: hash_type
= HASH_TYPE_MD5
;
10070 salt_type
= SALT_TYPE_INTERN
;
10071 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10072 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10073 | OPTS_TYPE_PT_ADD80
;
10074 kern_type
= KERN_TYPE_PRESTASHOP
;
10075 dgst_size
= DGST_SIZE_4_4
;
10076 parse_func
= prestashop_parse_hash
;
10077 sort_by_digest
= sort_by_digest_4_4
;
10078 opti_type
= OPTI_TYPE_ZERO_BYTE
10079 | OPTI_TYPE_PRECOMPUTE_INIT
10080 | OPTI_TYPE_NOT_ITERATED
10081 | OPTI_TYPE_PREPENDED_SALT
;
10088 case 11100: hash_type
= HASH_TYPE_MD5
;
10089 salt_type
= SALT_TYPE_EMBEDDED
;
10090 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10092 | OPTS_TYPE_ST_ADD80
;
10093 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10094 dgst_size
= DGST_SIZE_4_4
;
10095 parse_func
= postgresql_auth_parse_hash
;
10096 sort_by_digest
= sort_by_digest_4_4
;
10097 opti_type
= OPTI_TYPE_ZERO_BYTE
10098 | OPTI_TYPE_PRECOMPUTE_INIT
10099 | OPTI_TYPE_PRECOMPUTE_MERKLE
10100 | OPTI_TYPE_EARLY_SKIP
;
10107 case 11200: hash_type
= HASH_TYPE_SHA1
;
10108 salt_type
= SALT_TYPE_EMBEDDED
;
10109 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10110 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10111 | OPTS_TYPE_PT_ADD80
10112 | OPTS_TYPE_ST_HEX
;
10113 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10114 dgst_size
= DGST_SIZE_4_5
;
10115 parse_func
= mysql_auth_parse_hash
;
10116 sort_by_digest
= sort_by_digest_4_5
;
10117 opti_type
= OPTI_TYPE_ZERO_BYTE
10118 | OPTI_TYPE_EARLY_SKIP
;
10125 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10126 salt_type
= SALT_TYPE_EMBEDDED
;
10127 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10130 | OPTS_TYPE_ST_ADD80
;
10131 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10132 dgst_size
= DGST_SIZE_4_4
;
10133 parse_func
= bitcoin_wallet_parse_hash
;
10134 sort_by_digest
= sort_by_digest_4_4
;
10135 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10142 case 11400: hash_type
= HASH_TYPE_MD5
;
10143 salt_type
= SALT_TYPE_EMBEDDED
;
10144 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10145 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10146 | OPTS_TYPE_PT_ADD80
10147 | OPTS_TYPE_HASH_COPY
;
10148 kern_type
= KERN_TYPE_SIP_AUTH
;
10149 dgst_size
= DGST_SIZE_4_4
;
10150 parse_func
= sip_auth_parse_hash
;
10151 sort_by_digest
= sort_by_digest_4_4
;
10152 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10159 case 11500: hash_type
= HASH_TYPE_CRC32
;
10160 salt_type
= SALT_TYPE_INTERN
;
10161 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10162 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10163 | OPTS_TYPE_ST_GENERATE_LE
10164 | OPTS_TYPE_ST_HEX
;
10165 kern_type
= KERN_TYPE_CRC32
;
10166 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10167 parse_func
= crc32_parse_hash
;
10168 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10169 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10176 case 11600: hash_type
= HASH_TYPE_AES
;
10177 salt_type
= SALT_TYPE_EMBEDDED
;
10178 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10179 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10180 | OPTS_TYPE_PT_NEVERCRACK
;
10181 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10182 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10183 parse_func
= seven_zip_parse_hash
;
10184 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10185 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10192 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10193 salt_type
= SALT_TYPE_NONE
;
10194 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10195 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10196 | OPTS_TYPE_PT_ADD01
;
10197 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10198 dgst_size
= DGST_SIZE_4_8
;
10199 parse_func
= gost2012sbog_256_parse_hash
;
10200 sort_by_digest
= sort_by_digest_4_8
;
10201 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10208 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10209 salt_type
= SALT_TYPE_NONE
;
10210 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10211 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10212 | OPTS_TYPE_PT_ADD01
;
10213 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10214 dgst_size
= DGST_SIZE_4_16
;
10215 parse_func
= gost2012sbog_512_parse_hash
;
10216 sort_by_digest
= sort_by_digest_4_16
;
10217 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10224 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10225 salt_type
= SALT_TYPE_EMBEDDED
;
10226 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10227 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10228 | OPTS_TYPE_ST_BASE64
10229 | OPTS_TYPE_HASH_COPY
;
10230 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10231 dgst_size
= DGST_SIZE_4_32
;
10232 parse_func
= pbkdf2_md5_parse_hash
;
10233 sort_by_digest
= sort_by_digest_4_32
;
10234 opti_type
= OPTI_TYPE_ZERO_BYTE
10235 | OPTI_TYPE_SLOW_HASH_SIMD
;
10242 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10243 salt_type
= SALT_TYPE_EMBEDDED
;
10244 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10245 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10246 | OPTS_TYPE_ST_BASE64
10247 | OPTS_TYPE_HASH_COPY
;
10248 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10249 dgst_size
= DGST_SIZE_4_32
;
10250 parse_func
= pbkdf2_sha1_parse_hash
;
10251 sort_by_digest
= sort_by_digest_4_32
;
10252 opti_type
= OPTI_TYPE_ZERO_BYTE
10253 | OPTI_TYPE_SLOW_HASH_SIMD
;
10260 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10261 salt_type
= SALT_TYPE_EMBEDDED
;
10262 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10263 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10264 | OPTS_TYPE_ST_BASE64
10265 | OPTS_TYPE_HASH_COPY
;
10266 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10267 dgst_size
= DGST_SIZE_8_16
;
10268 parse_func
= pbkdf2_sha512_parse_hash
;
10269 sort_by_digest
= sort_by_digest_8_16
;
10270 opti_type
= OPTI_TYPE_ZERO_BYTE
10271 | OPTI_TYPE_USES_BITS_64
10272 | OPTI_TYPE_SLOW_HASH_SIMD
;
10279 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10280 salt_type
= SALT_TYPE_EMBEDDED
;
10281 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10282 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10283 kern_type
= KERN_TYPE_ECRYPTFS
;
10284 dgst_size
= DGST_SIZE_8_8
;
10285 parse_func
= ecryptfs_parse_hash
;
10286 sort_by_digest
= sort_by_digest_8_8
;
10287 opti_type
= OPTI_TYPE_ZERO_BYTE
10288 | OPTI_TYPE_USES_BITS_64
;
10295 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10296 salt_type
= SALT_TYPE_EMBEDDED
;
10297 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10298 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10299 kern_type
= KERN_TYPE_ORACLET
;
10300 dgst_size
= DGST_SIZE_8_16
;
10301 parse_func
= oraclet_parse_hash
;
10302 sort_by_digest
= sort_by_digest_8_16
;
10303 opti_type
= OPTI_TYPE_ZERO_BYTE
10304 | OPTI_TYPE_USES_BITS_64
;
10311 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10312 salt_type
= SALT_TYPE_EMBEDDED
;
10313 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10314 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10315 kern_type
= KERN_TYPE_BSDICRYPT
;
10316 dgst_size
= DGST_SIZE_4_4
;
10317 parse_func
= bsdicrypt_parse_hash
;
10318 sort_by_digest
= sort_by_digest_4_4
;
10319 opti_type
= OPTI_TYPE_ZERO_BYTE
10320 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10327 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10328 salt_type
= SALT_TYPE_EMBEDDED
;
10329 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10330 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10331 kern_type
= KERN_TYPE_RAR3
;
10332 dgst_size
= DGST_SIZE_4_4
;
10333 parse_func
= rar3hp_parse_hash
;
10334 sort_by_digest
= sort_by_digest_4_4
;
10335 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10342 case 12600: hash_type
= HASH_TYPE_SHA256
;
10343 salt_type
= SALT_TYPE_INTERN
;
10344 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10345 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10346 | OPTS_TYPE_PT_ADD80
;
10347 kern_type
= KERN_TYPE_CF10
;
10348 dgst_size
= DGST_SIZE_4_8
;
10349 parse_func
= cf10_parse_hash
;
10350 sort_by_digest
= sort_by_digest_4_8
;
10351 opti_type
= OPTI_TYPE_ZERO_BYTE
10352 | OPTI_TYPE_PRECOMPUTE_INIT
10353 | OPTI_TYPE_EARLY_SKIP
10354 | OPTI_TYPE_NOT_ITERATED
;
10361 case 12700: hash_type
= HASH_TYPE_AES
;
10362 salt_type
= SALT_TYPE_EMBEDDED
;
10363 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10365 | OPTS_TYPE_HASH_COPY
;
10366 kern_type
= KERN_TYPE_MYWALLET
;
10367 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10368 parse_func
= mywallet_parse_hash
;
10369 sort_by_digest
= sort_by_digest_4_5
;
10370 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10377 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10378 salt_type
= SALT_TYPE_EMBEDDED
;
10379 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10381 kern_type
= KERN_TYPE_MS_DRSR
;
10382 dgst_size
= DGST_SIZE_4_8
;
10383 parse_func
= ms_drsr_parse_hash
;
10384 sort_by_digest
= sort_by_digest_4_8
;
10385 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10392 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10393 salt_type
= SALT_TYPE_EMBEDDED
;
10394 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10395 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10396 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10397 dgst_size
= DGST_SIZE_4_8
;
10398 parse_func
= androidfde_samsung_parse_hash
;
10399 sort_by_digest
= sort_by_digest_4_8
;
10400 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10407 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10408 salt_type
= SALT_TYPE_EMBEDDED
;
10409 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10410 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10411 kern_type
= KERN_TYPE_RAR5
;
10412 dgst_size
= DGST_SIZE_4_4
;
10413 parse_func
= rar5_parse_hash
;
10414 sort_by_digest
= sort_by_digest_4_4
;
10415 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10422 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10423 salt_type
= SALT_TYPE_EMBEDDED
;
10424 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10425 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10426 kern_type
= KERN_TYPE_KRB5TGS
;
10427 dgst_size
= DGST_SIZE_4_4
;
10428 parse_func
= krb5tgs_parse_hash
;
10429 sort_by_digest
= sort_by_digest_4_4
;
10430 opti_type
= OPTI_TYPE_ZERO_BYTE
10431 | OPTI_TYPE_NOT_ITERATED
;
10438 case 13200: hash_type
= HASH_TYPE_AES
;
10439 salt_type
= SALT_TYPE_EMBEDDED
;
10440 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10441 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10442 kern_type
= KERN_TYPE_AXCRYPT
;
10443 dgst_size
= DGST_SIZE_4_4
;
10444 parse_func
= axcrypt_parse_hash
;
10445 sort_by_digest
= sort_by_digest_4_4
;
10446 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10453 case 13300: hash_type
= HASH_TYPE_SHA1
;
10454 salt_type
= SALT_TYPE_NONE
;
10455 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10456 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10457 | OPTS_TYPE_PT_ADD80
10458 | OPTS_TYPE_PT_ADDBITS15
;
10459 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10460 dgst_size
= DGST_SIZE_4_5
;
10461 parse_func
= sha1axcrypt_parse_hash
;
10462 sort_by_digest
= sort_by_digest_4_5
;
10463 opti_type
= OPTI_TYPE_ZERO_BYTE
10464 | OPTI_TYPE_PRECOMPUTE_INIT
10465 | OPTI_TYPE_EARLY_SKIP
10466 | OPTI_TYPE_NOT_ITERATED
10467 | OPTI_TYPE_NOT_SALTED
;
10474 case 13400: hash_type
= HASH_TYPE_AES
;
10475 salt_type
= SALT_TYPE_EMBEDDED
;
10476 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10477 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10478 kern_type
= KERN_TYPE_KEEPASS
;
10479 dgst_size
= DGST_SIZE_4_4
;
10480 parse_func
= keepass_parse_hash
;
10481 sort_by_digest
= sort_by_digest_4_4
;
10482 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10489 case 13500: hash_type
= HASH_TYPE_SHA1
;
10490 salt_type
= SALT_TYPE_EMBEDDED
;
10491 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10492 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10493 | OPTS_TYPE_PT_UNICODE
10494 | OPTS_TYPE_PT_ADD80
;
10495 kern_type
= KERN_TYPE_PSTOKEN
;
10496 dgst_size
= DGST_SIZE_4_5
;
10497 parse_func
= pstoken_parse_hash
;
10498 sort_by_digest
= sort_by_digest_4_5
;
10499 opti_type
= OPTI_TYPE_ZERO_BYTE
10500 | OPTI_TYPE_PRECOMPUTE_INIT
10501 | OPTI_TYPE_EARLY_SKIP
10502 | OPTI_TYPE_NOT_ITERATED
10503 | OPTI_TYPE_PREPENDED_SALT
10504 | OPTI_TYPE_RAW_HASH
;
10511 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10512 salt_type
= SALT_TYPE_EMBEDDED
;
10513 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10515 kern_type
= KERN_TYPE_ZIP2
;
10516 dgst_size
= DGST_SIZE_4_4
;
10517 parse_func
= zip2_parse_hash
;
10518 sort_by_digest
= sort_by_digest_4_4
;
10519 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10526 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10527 salt_type
= SALT_TYPE_EMBEDDED
;
10528 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10530 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10531 dgst_size
= DGST_SIZE_4_5
;
10532 parse_func
= veracrypt_parse_hash_655331
;
10533 sort_by_digest
= sort_by_digest_4_5
;
10534 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10541 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10542 salt_type
= SALT_TYPE_EMBEDDED
;
10543 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10544 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10545 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10546 dgst_size
= DGST_SIZE_4_5
;
10547 parse_func
= veracrypt_parse_hash_655331
;
10548 sort_by_digest
= sort_by_digest_4_5
;
10549 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10556 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10557 salt_type
= SALT_TYPE_EMBEDDED
;
10558 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10559 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10560 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10561 dgst_size
= DGST_SIZE_4_5
;
10562 parse_func
= veracrypt_parse_hash_655331
;
10563 sort_by_digest
= sort_by_digest_4_5
;
10564 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10571 case 13721: hash_type
= HASH_TYPE_SHA512
;
10572 salt_type
= SALT_TYPE_EMBEDDED
;
10573 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10575 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10576 dgst_size
= DGST_SIZE_8_8
;
10577 parse_func
= veracrypt_parse_hash_500000
;
10578 sort_by_digest
= sort_by_digest_8_8
;
10579 opti_type
= OPTI_TYPE_ZERO_BYTE
10580 | OPTI_TYPE_USES_BITS_64
;
10587 case 13722: hash_type
= HASH_TYPE_SHA512
;
10588 salt_type
= SALT_TYPE_EMBEDDED
;
10589 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10590 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10591 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10592 dgst_size
= DGST_SIZE_8_8
;
10593 parse_func
= veracrypt_parse_hash_500000
;
10594 sort_by_digest
= sort_by_digest_8_8
;
10595 opti_type
= OPTI_TYPE_ZERO_BYTE
10596 | OPTI_TYPE_USES_BITS_64
;
10603 case 13723: hash_type
= HASH_TYPE_SHA512
;
10604 salt_type
= SALT_TYPE_EMBEDDED
;
10605 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10606 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10607 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10608 dgst_size
= DGST_SIZE_8_8
;
10609 parse_func
= veracrypt_parse_hash_500000
;
10610 sort_by_digest
= sort_by_digest_8_8
;
10611 opti_type
= OPTI_TYPE_ZERO_BYTE
10612 | OPTI_TYPE_USES_BITS_64
;
10619 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10620 salt_type
= SALT_TYPE_EMBEDDED
;
10621 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10623 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10624 dgst_size
= DGST_SIZE_4_8
;
10625 parse_func
= veracrypt_parse_hash_500000
;
10626 sort_by_digest
= sort_by_digest_4_8
;
10627 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10634 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10635 salt_type
= SALT_TYPE_EMBEDDED
;
10636 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10637 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10638 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10639 dgst_size
= DGST_SIZE_4_8
;
10640 parse_func
= veracrypt_parse_hash_500000
;
10641 sort_by_digest
= sort_by_digest_4_8
;
10642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10649 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10650 salt_type
= SALT_TYPE_EMBEDDED
;
10651 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10653 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10654 dgst_size
= DGST_SIZE_4_8
;
10655 parse_func
= veracrypt_parse_hash_500000
;
10656 sort_by_digest
= sort_by_digest_4_8
;
10657 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10664 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10665 salt_type
= SALT_TYPE_EMBEDDED
;
10666 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10667 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10668 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10669 dgst_size
= DGST_SIZE_4_5
;
10670 parse_func
= veracrypt_parse_hash_327661
;
10671 sort_by_digest
= sort_by_digest_4_5
;
10672 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10679 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10680 salt_type
= SALT_TYPE_EMBEDDED
;
10681 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10683 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10684 dgst_size
= DGST_SIZE_4_5
;
10685 parse_func
= veracrypt_parse_hash_327661
;
10686 sort_by_digest
= sort_by_digest_4_5
;
10687 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10694 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10695 salt_type
= SALT_TYPE_EMBEDDED
;
10696 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10697 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10698 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10699 dgst_size
= DGST_SIZE_4_5
;
10700 parse_func
= veracrypt_parse_hash_327661
;
10701 sort_by_digest
= sort_by_digest_4_5
;
10702 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10709 case 13751: hash_type
= HASH_TYPE_SHA256
;
10710 salt_type
= SALT_TYPE_EMBEDDED
;
10711 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10713 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10714 dgst_size
= DGST_SIZE_4_8
;
10715 parse_func
= veracrypt_parse_hash_500000
;
10716 sort_by_digest
= sort_by_digest_4_8
;
10717 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10724 case 13752: hash_type
= HASH_TYPE_SHA256
;
10725 salt_type
= SALT_TYPE_EMBEDDED
;
10726 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10728 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10729 dgst_size
= DGST_SIZE_4_8
;
10730 parse_func
= veracrypt_parse_hash_500000
;
10731 sort_by_digest
= sort_by_digest_4_8
;
10732 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10739 case 13753: hash_type
= HASH_TYPE_SHA256
;
10740 salt_type
= SALT_TYPE_EMBEDDED
;
10741 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10742 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10743 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10744 dgst_size
= DGST_SIZE_4_8
;
10745 parse_func
= veracrypt_parse_hash_500000
;
10746 sort_by_digest
= sort_by_digest_4_8
;
10747 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10754 case 13761: hash_type
= HASH_TYPE_SHA256
;
10755 salt_type
= SALT_TYPE_EMBEDDED
;
10756 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10758 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10759 dgst_size
= DGST_SIZE_4_8
;
10760 parse_func
= veracrypt_parse_hash_200000
;
10761 sort_by_digest
= sort_by_digest_4_8
;
10762 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10769 case 13762: hash_type
= HASH_TYPE_SHA256
;
10770 salt_type
= SALT_TYPE_EMBEDDED
;
10771 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10772 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10773 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10774 dgst_size
= DGST_SIZE_4_8
;
10775 parse_func
= veracrypt_parse_hash_200000
;
10776 sort_by_digest
= sort_by_digest_4_8
;
10777 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10784 case 13763: hash_type
= HASH_TYPE_SHA256
;
10785 salt_type
= SALT_TYPE_EMBEDDED
;
10786 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10787 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10788 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10789 dgst_size
= DGST_SIZE_4_8
;
10790 parse_func
= veracrypt_parse_hash_200000
;
10791 sort_by_digest
= sort_by_digest_4_8
;
10792 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10800 default: usage_mini_print (PROGNAME
); return (-1);
10807 data
.parse_func
= parse_func
;
10815 if (salt_type
== SALT_TYPE_INTERN
)
10817 opts_type
|= OPTS_TYPE_ST_HEX
;
10821 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10827 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10828 | (salt_type
== SALT_TYPE_EXTERN
)
10829 | (salt_type
== SALT_TYPE_EMBEDDED
)
10830 | (salt_type
== SALT_TYPE_VIRTUAL
));
10832 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10834 data
.hash_type
= hash_type
;
10835 data
.attack_mode
= attack_mode
;
10836 data
.attack_kern
= attack_kern
;
10837 data
.attack_exec
= attack_exec
;
10838 data
.kern_type
= kern_type
;
10839 data
.opts_type
= opts_type
;
10840 data
.dgst_size
= dgst_size
;
10841 data
.salt_type
= salt_type
;
10842 data
.isSalted
= isSalted
;
10843 data
.sort_by_digest
= sort_by_digest
;
10844 data
.dgst_pos0
= dgst_pos0
;
10845 data
.dgst_pos1
= dgst_pos1
;
10846 data
.dgst_pos2
= dgst_pos2
;
10847 data
.dgst_pos3
= dgst_pos3
;
10853 case 2500: esalt_size
= sizeof (wpa_t
); break;
10854 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10855 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10856 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10857 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10858 case 6211: esalt_size
= sizeof (tc_t
); break;
10859 case 6212: esalt_size
= sizeof (tc_t
); break;
10860 case 6213: esalt_size
= sizeof (tc_t
); break;
10861 case 6221: esalt_size
= sizeof (tc_t
); break;
10862 case 6222: esalt_size
= sizeof (tc_t
); break;
10863 case 6223: esalt_size
= sizeof (tc_t
); break;
10864 case 6231: esalt_size
= sizeof (tc_t
); break;
10865 case 6232: esalt_size
= sizeof (tc_t
); break;
10866 case 6233: esalt_size
= sizeof (tc_t
); break;
10867 case 6241: esalt_size
= sizeof (tc_t
); break;
10868 case 6242: esalt_size
= sizeof (tc_t
); break;
10869 case 6243: esalt_size
= sizeof (tc_t
); break;
10870 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10871 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10872 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10873 case 7300: esalt_size
= sizeof (rakp_t
); break;
10874 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10875 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10876 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10877 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10878 case 9400: esalt_size
= sizeof (office2007_t
); break;
10879 case 9500: esalt_size
= sizeof (office2010_t
); break;
10880 case 9600: esalt_size
= sizeof (office2013_t
); break;
10881 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10882 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10883 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10884 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10885 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10886 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10887 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10888 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10889 case 10400: esalt_size
= sizeof (pdf_t
); break;
10890 case 10410: esalt_size
= sizeof (pdf_t
); break;
10891 case 10420: esalt_size
= sizeof (pdf_t
); break;
10892 case 10500: esalt_size
= sizeof (pdf_t
); break;
10893 case 10600: esalt_size
= sizeof (pdf_t
); break;
10894 case 10700: esalt_size
= sizeof (pdf_t
); break;
10895 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10896 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10897 case 11400: esalt_size
= sizeof (sip_t
); break;
10898 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10899 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10900 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10901 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10902 case 13000: esalt_size
= sizeof (rar5_t
); break;
10903 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10904 case 13400: esalt_size
= sizeof (keepass_t
); break;
10905 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10906 case 13600: esalt_size
= sizeof (zip2_t
); break;
10907 case 13711: esalt_size
= sizeof (tc_t
); break;
10908 case 13712: esalt_size
= sizeof (tc_t
); break;
10909 case 13713: esalt_size
= sizeof (tc_t
); break;
10910 case 13721: esalt_size
= sizeof (tc_t
); break;
10911 case 13722: esalt_size
= sizeof (tc_t
); break;
10912 case 13723: esalt_size
= sizeof (tc_t
); break;
10913 case 13731: esalt_size
= sizeof (tc_t
); break;
10914 case 13732: esalt_size
= sizeof (tc_t
); break;
10915 case 13733: esalt_size
= sizeof (tc_t
); break;
10916 case 13741: esalt_size
= sizeof (tc_t
); break;
10917 case 13742: esalt_size
= sizeof (tc_t
); break;
10918 case 13743: esalt_size
= sizeof (tc_t
); break;
10919 case 13751: esalt_size
= sizeof (tc_t
); break;
10920 case 13752: esalt_size
= sizeof (tc_t
); break;
10921 case 13753: esalt_size
= sizeof (tc_t
); break;
10922 case 13761: esalt_size
= sizeof (tc_t
); break;
10923 case 13762: esalt_size
= sizeof (tc_t
); break;
10924 case 13763: esalt_size
= sizeof (tc_t
); break;
10927 data
.esalt_size
= esalt_size
;
10930 * choose dictionary parser
10933 if (hash_type
== HASH_TYPE_LM
)
10935 get_next_word_func
= get_next_word_lm
;
10937 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10939 get_next_word_func
= get_next_word_uc
;
10943 get_next_word_func
= get_next_word_std
;
10950 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10953 size_t dictstat_nmemb
= 0;
10957 uint dictstat_nmemb
= 0;
10960 char dictstat
[256] = { 0 };
10962 FILE *dictstat_fp
= NULL
;
10966 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10968 dictstat_fp
= fopen (dictstat
, "rb");
10973 struct stat tmpstat
;
10975 fstat (fileno (dictstat_fp
), &tmpstat
);
10979 struct stat64 tmpstat
;
10981 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10984 if (tmpstat
.st_mtime
< COMPTIME
)
10986 /* with v0.15 the format changed so we have to ensure user is using a good version
10987 since there is no version-header in the dictstat file */
10989 fclose (dictstat_fp
);
10995 while (!feof (dictstat_fp
))
10999 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11001 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11003 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11005 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11011 fclose (dictstat_fp
);
11020 char potfile
[256] = { 0 };
11022 if (potfile_path
== NULL
)
11024 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11028 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11031 data
.pot_fp
= NULL
;
11033 FILE *out_fp
= NULL
;
11034 FILE *pot_fp
= NULL
;
11036 if (show
== 1 || left
== 1)
11038 pot_fp
= fopen (potfile
, "rb");
11040 if (pot_fp
== NULL
)
11042 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11047 if (outfile
!= NULL
)
11049 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11051 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11065 if (potfile_disable
== 0)
11067 pot_fp
= fopen (potfile
, "ab");
11069 if (pot_fp
== NULL
)
11071 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11076 data
.pot_fp
= pot_fp
;
11083 uint pot_avail
= 0;
11085 if (show
== 1 || left
== 1)
11087 SUPPRESS_OUTPUT
= 1;
11089 pot_avail
= count_lines (pot_fp
);
11093 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11095 uint pot_hashes_avail
= 0;
11099 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11101 while (!feof (pot_fp
))
11105 int line_len
= fgetl (pot_fp
, line_buf
);
11107 if (line_len
== 0) continue;
11109 char *plain_buf
= line_buf
+ line_len
;
11111 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11113 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11115 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11116 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11118 if (pot_cnt
== pot_hashes_avail
)
11122 for (pos
= 0; pos
< INCR_POT
; pos
++)
11124 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11126 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11128 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11130 tmp_hash
->digest
= mymalloc (dgst_size
);
11134 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11139 tmp_hash
->esalt
= mymalloc (esalt_size
);
11142 pot_hashes_avail
++;
11150 int iter
= MAX_CUT_TRIES
;
11154 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11156 if (line_buf
[i
] == ':')
11164 if (data
.hash_mode
!= 2500)
11166 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11170 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11172 if (line_len
> max_salt_size
)
11174 parser_status
= PARSER_GLOBAL_LENGTH
;
11178 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11180 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11182 hashes_buf
->salt
->salt_len
= line_len
;
11184 parser_status
= PARSER_OK
;
11188 // if NOT parsed without error, we add the ":" to the plain
11190 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11196 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11198 if (parser_status
< PARSER_GLOBAL_ZERO
)
11200 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11205 if (plain_len
>= 255) continue;
11207 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11209 pot_ptr
->plain_len
= plain_len
;
11218 SUPPRESS_OUTPUT
= 0;
11220 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11227 uint pw_min
= PW_MIN
;
11228 uint pw_max
= PW_MAX
;
11232 case 125: if (pw_max
> 32) pw_max
= 32;
11234 case 400: if (pw_max
> 40) pw_max
= 40;
11236 case 500: if (pw_max
> 16) pw_max
= 16;
11238 case 1500: if (pw_max
> 8) pw_max
= 8;
11240 case 1600: if (pw_max
> 16) pw_max
= 16;
11242 case 1800: if (pw_max
> 16) pw_max
= 16;
11244 case 2100: if (pw_max
> 16) pw_max
= 16;
11246 case 2500: if (pw_min
< 8) pw_min
= 8;
11248 case 3000: if (pw_max
> 7) pw_max
= 7;
11250 case 5200: if (pw_max
> 24) pw_max
= 24;
11252 case 5800: if (pw_max
> 16) pw_max
= 16;
11254 case 6300: if (pw_max
> 16) pw_max
= 16;
11256 case 7400: if (pw_max
> 16) pw_max
= 16;
11258 case 7500: if (pw_max
> 8) pw_max
= 8;
11260 case 7900: if (pw_max
> 48) pw_max
= 48;
11262 case 8500: if (pw_max
> 8) pw_max
= 8;
11264 case 8600: if (pw_max
> 16) pw_max
= 16;
11266 case 9710: pw_min
= 5;
11269 case 9810: pw_min
= 5;
11272 case 10410: pw_min
= 5;
11275 case 10300: if (pw_max
< 3) pw_min
= 3;
11276 if (pw_max
> 40) pw_max
= 40;
11278 case 10500: if (pw_max
< 3) pw_min
= 3;
11279 if (pw_max
> 40) pw_max
= 40;
11281 case 10700: if (pw_max
> 16) pw_max
= 16;
11283 case 11300: if (pw_max
> 40) pw_max
= 40;
11285 case 11600: if (pw_max
> 32) pw_max
= 32;
11287 case 12500: if (pw_max
> 20) pw_max
= 20;
11289 case 12800: if (pw_max
> 24) pw_max
= 24;
11293 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11295 switch (attack_kern
)
11297 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11299 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11305 * charsets : keep them together for more easy maintainnce
11308 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11309 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11311 mp_setup_sys (mp_sys
);
11313 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11314 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11315 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11316 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11319 * load hashes, part I: find input mode, count hashes
11322 uint hashlist_mode
= 0;
11323 uint hashlist_format
= HLFMT_HASHCAT
;
11325 uint hashes_avail
= 0;
11327 if (benchmark
== 0)
11331 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11333 if ((hash_mode
== 2500) ||
11334 (hash_mode
== 5200) ||
11335 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11336 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11337 (hash_mode
== 9000))
11339 hashlist_mode
= HL_MODE_ARG
;
11341 char *hashfile
= myargv
[optind
];
11343 data
.hashfile
= hashfile
;
11345 logfile_top_var_string ("target", hashfile
);
11348 if (hashlist_mode
== HL_MODE_ARG
)
11350 if (hash_mode
== 2500)
11354 if (stat (data
.hashfile
, &st
) == -1)
11356 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11361 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11368 else if (hashlist_mode
== HL_MODE_FILE
)
11370 char *hashfile
= myargv
[optind
];
11372 data
.hashfile
= hashfile
;
11374 logfile_top_var_string ("target", hashfile
);
11378 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11380 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11385 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11387 hashes_avail
= count_lines (fp
);
11391 if (hashes_avail
== 0)
11393 log_error ("ERROR: hashfile is empty or corrupt");
11400 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11402 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11404 log_error ("ERROR: remove not supported in native hashfile-format mode");
11416 hashlist_mode
= HL_MODE_ARG
;
11421 if (hash_mode
== 3000) hashes_avail
*= 2;
11423 data
.hashlist_mode
= hashlist_mode
;
11424 data
.hashlist_format
= hashlist_format
;
11426 logfile_top_uint (hashlist_mode
);
11427 logfile_top_uint (hashlist_format
);
11430 * load hashes, part II: allocate required memory, set pointers
11433 hash_t
*hashes_buf
= NULL
;
11434 void *digests_buf
= NULL
;
11435 salt_t
*salts_buf
= NULL
;
11436 void *esalts_buf
= NULL
;
11438 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11440 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11442 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11446 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11448 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11450 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11452 if (username
&& (remove
|| show
|| left
))
11454 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11459 hash_info
->orighash
= (char *) mymalloc (256);
11466 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11470 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11475 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11478 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11480 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11484 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11488 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11493 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11498 * load hashes, part III: parse hashes or generate them if benchmark
11501 uint hashes_cnt
= 0;
11503 if (benchmark
== 0)
11507 // useless to read hash file for keyspace, cheat a little bit w/ optind
11509 else if (hashes_avail
== 0)
11512 else if (hashlist_mode
== HL_MODE_ARG
)
11514 char *input_buf
= myargv
[optind
];
11516 uint input_len
= strlen (input_buf
);
11518 logfile_top_var_string ("target", input_buf
);
11520 char *hash_buf
= NULL
;
11523 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11525 bool hash_fmt_error
= 0;
11527 if (hash_len
< 1) hash_fmt_error
= 1;
11528 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11530 if (hash_fmt_error
)
11532 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11536 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11538 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11540 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11545 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11548 int parser_status
= PARSER_OK
;
11550 if (hash_mode
== 2500)
11554 log_error ("ERROR: hccap file not specified");
11559 hashlist_mode
= HL_MODE_FILE
;
11561 data
.hashlist_mode
= hashlist_mode
;
11563 FILE *fp
= fopen (hash_buf
, "rb");
11567 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11572 if (hashes_avail
< 1)
11574 log_error ("ERROR: hccap file is empty or corrupt");
11581 uint hccap_size
= sizeof (hccap_t
);
11583 char *in
= (char *) mymalloc (hccap_size
);
11587 int n
= fread (in
, hccap_size
, 1, fp
);
11591 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11596 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11598 if (parser_status
!= PARSER_OK
)
11600 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11605 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11607 if ((show
== 1) || (left
== 1))
11609 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11611 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11613 int cur_pos
= tmp_salt
->salt_len
;
11614 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11616 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11618 // do the appending task
11620 snprintf (salt_ptr
+ cur_pos
,
11622 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11634 wpa
->orig_mac2
[5]);
11636 // memset () the remaining part of the salt
11638 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11639 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11641 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11643 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11646 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
);
11647 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
);
11656 else if (hash_mode
== 3000)
11658 if (hash_len
== 32)
11660 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11662 hash_t
*lm_hash_left
= NULL
;
11664 if (parser_status
== PARSER_OK
)
11666 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11672 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11675 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11677 hash_t
*lm_hash_right
= NULL
;
11679 if (parser_status
== PARSER_OK
)
11681 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11687 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11692 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11694 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
);
11695 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
);
11700 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11702 if (parser_status
== PARSER_OK
)
11704 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11705 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11708 if (parser_status
== PARSER_OK
)
11714 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11720 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11722 if (parser_status
== PARSER_OK
)
11724 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11725 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11728 if (parser_status
== PARSER_OK
)
11734 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11739 else if (hashlist_mode
== HL_MODE_FILE
)
11741 char *hashfile
= data
.hashfile
;
11745 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11747 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11754 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11760 int line_len
= fgetl (fp
, line_buf
);
11762 if (line_len
== 0) continue;
11764 char *hash_buf
= NULL
;
11767 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11769 bool hash_fmt_error
= 0;
11771 if (hash_len
< 1) hash_fmt_error
= 1;
11772 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11774 if (hash_fmt_error
)
11776 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11783 char *user_buf
= NULL
;
11786 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11788 if (remove
|| show
)
11790 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11792 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11794 user_t
*user_ptr
= *user
;
11796 if (user_buf
!= NULL
)
11798 user_ptr
->user_name
= mystrdup (user_buf
);
11802 user_ptr
->user_name
= mystrdup ("");
11805 user_ptr
->user_len
= user_len
;
11809 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11811 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11813 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11818 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11821 if (hash_mode
== 3000)
11823 if (hash_len
== 32)
11825 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11827 if (parser_status
< PARSER_GLOBAL_ZERO
)
11829 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11834 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11838 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11840 if (parser_status
< PARSER_GLOBAL_ZERO
)
11842 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11847 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11849 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);
11855 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
);
11856 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
);
11860 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11862 if (parser_status
< PARSER_GLOBAL_ZERO
)
11864 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11869 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);
11871 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11872 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11879 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11881 if (parser_status
< PARSER_GLOBAL_ZERO
)
11883 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11888 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);
11890 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11891 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11901 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11903 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11910 hashes_buf
[0].salt
->salt_len
= 8;
11912 // special salt handling
11916 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11917 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11919 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11921 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11923 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11925 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11927 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11929 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11931 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11933 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11935 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11937 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11938 hashes_buf
[0].salt
->scrypt_N
= 1024;
11939 hashes_buf
[0].salt
->scrypt_r
= 1;
11940 hashes_buf
[0].salt
->scrypt_p
= 1;
11942 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11944 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11945 hashes_buf
[0].salt
->scrypt_N
= 16384;
11946 hashes_buf
[0].salt
->scrypt_r
= 1;
11947 hashes_buf
[0].salt
->scrypt_p
= 1;
11949 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11951 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11953 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11955 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11957 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11959 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11961 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11963 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11965 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11967 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11969 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11971 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11973 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11975 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11977 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11981 // special esalt handling
11985 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11987 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11988 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11990 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11991 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11993 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11994 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11995 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11996 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11998 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11999 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12000 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12001 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12003 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12005 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12006 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12007 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12009 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12010 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12011 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12013 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12014 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12015 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12017 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12018 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12019 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12021 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12022 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12023 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12025 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12026 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12027 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12029 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12030 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12031 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12033 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12035 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12037 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12038 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12039 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12048 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12050 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12052 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12054 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12056 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12058 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12060 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12062 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12064 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12066 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12068 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12070 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12072 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12074 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12076 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12078 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12080 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12082 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12084 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12086 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12088 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12090 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12092 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12094 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12096 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12098 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12100 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12102 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12104 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12106 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12108 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12110 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12112 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12114 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12116 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12118 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12122 // set default iterations
12126 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12128 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12130 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12132 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12134 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12136 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12138 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12140 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12142 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12144 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12146 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12148 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12150 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12152 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12154 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12156 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12158 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12160 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12162 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12164 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12166 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12168 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12170 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12172 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12174 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12176 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12178 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12180 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12182 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12184 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12186 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12188 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12190 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12192 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12194 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12196 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12198 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12200 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12202 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12204 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12206 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12208 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12210 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12212 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12214 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12216 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12218 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12220 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12222 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12224 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12226 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12228 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12230 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12232 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12234 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12236 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12238 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12240 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12242 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12244 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12246 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12248 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12250 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12252 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12254 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12256 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12258 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12260 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12262 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12264 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12266 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12268 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12270 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12272 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12274 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12276 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12278 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12280 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12282 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12284 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12286 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12288 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12295 if (show
== 1 || left
== 1)
12297 for (uint i
= 0; i
< pot_cnt
; i
++)
12299 pot_t
*pot_ptr
= &pot
[i
];
12301 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12303 local_free (hashes_buf
->digest
);
12307 local_free (hashes_buf
->salt
);
12313 if (data
.quiet
== 0) log_info_nn ("");
12320 if (hashes_cnt
== 0)
12322 log_error ("ERROR: No hashes loaded");
12329 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12332 if (data
.outfile
!= NULL
)
12334 if (data
.hashfile
!= NULL
)
12337 struct stat tmpstat_outfile
;
12338 struct stat tmpstat_hashfile
;
12342 struct stat64 tmpstat_outfile
;
12343 struct stat64 tmpstat_hashfile
;
12346 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12348 if (tmp_outfile_fp
)
12351 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12355 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12358 fclose (tmp_outfile_fp
);
12361 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12363 if (tmp_hashfile_fp
)
12366 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12370 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12373 fclose (tmp_hashfile_fp
);
12376 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12378 tmpstat_outfile
.st_mode
= 0;
12379 tmpstat_outfile
.st_nlink
= 0;
12380 tmpstat_outfile
.st_uid
= 0;
12381 tmpstat_outfile
.st_gid
= 0;
12382 tmpstat_outfile
.st_rdev
= 0;
12383 tmpstat_outfile
.st_atime
= 0;
12385 tmpstat_hashfile
.st_mode
= 0;
12386 tmpstat_hashfile
.st_nlink
= 0;
12387 tmpstat_hashfile
.st_uid
= 0;
12388 tmpstat_hashfile
.st_gid
= 0;
12389 tmpstat_hashfile
.st_rdev
= 0;
12390 tmpstat_hashfile
.st_atime
= 0;
12393 tmpstat_outfile
.st_blksize
= 0;
12394 tmpstat_outfile
.st_blocks
= 0;
12396 tmpstat_hashfile
.st_blksize
= 0;
12397 tmpstat_hashfile
.st_blocks
= 0;
12401 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12403 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12410 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12412 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12422 * Remove duplicates
12425 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12429 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12433 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12436 uint hashes_cnt_orig
= hashes_cnt
;
12440 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12444 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12446 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12451 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12454 if (hashes_pos
> hashes_cnt
)
12456 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12466 uint potfile_remove_cracks
= 0;
12468 if (potfile_disable
== 0)
12472 hash_buf
.digest
= mymalloc (dgst_size
);
12473 hash_buf
.salt
= NULL
;
12474 hash_buf
.esalt
= NULL
;
12475 hash_buf
.hash_info
= NULL
;
12476 hash_buf
.cracked
= 0;
12480 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12485 hash_buf
.esalt
= mymalloc (esalt_size
);
12488 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12490 // no solution for these special hash types (for instane because they use hashfile in output etc)
12491 if ((hash_mode
!= 5200) &&
12492 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12493 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12494 (hash_mode
!= 9000))
12496 FILE *fp
= fopen (potfile
, "rb");
12500 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12502 // to be safe work with a copy (because of line_len loop, i etc)
12503 // moved up here because it's easier to handle continue case
12506 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12510 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12512 if (ptr
== NULL
) break;
12514 int line_len
= strlen (line_buf
);
12516 if (line_len
== 0) continue;
12518 int iter
= MAX_CUT_TRIES
;
12520 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12522 if (line_buf
[i
] != ':') continue;
12526 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12529 hash_t
*found
= NULL
;
12531 if (hash_mode
== 6800)
12533 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12535 // manipulate salt_buf
12536 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12538 hash_buf
.salt
->salt_len
= i
;
12540 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12543 else if (hash_mode
== 2500)
12545 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12547 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12548 // manipulate salt_buf
12550 memcpy (line_buf_cpy
, line_buf
, i
);
12552 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12554 if (mac2_pos
== NULL
) continue;
12559 if (strlen (mac2_pos
) != 12) continue;
12561 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12563 if (mac1_pos
== NULL
) continue;
12568 if (strlen (mac1_pos
) != 12) continue;
12570 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12572 // here we need the ESSID
12573 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12575 hash_buf
.salt
->salt_len
= essid_length
;
12577 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12581 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12583 // compare hex string(s) vs binary MAC address(es)
12585 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12587 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12596 if (!found
) continue;
12598 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12600 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12612 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12614 if (parser_status
== PARSER_OK
)
12618 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12622 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12627 if (found
== NULL
) continue;
12629 if (!found
->cracked
) potfile_remove_cracks
++;
12631 found
->cracked
= 1;
12639 myfree (line_buf_cpy
);
12649 local_free (hash_buf
.esalt
);
12654 local_free (hash_buf
.salt
);
12657 local_free (hash_buf
.digest
);
12661 * Now generate all the buffers required for later
12664 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12666 salt_t
*salts_buf_new
= NULL
;
12667 void *esalts_buf_new
= NULL
;
12671 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12675 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12680 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12683 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12685 uint digests_cnt
= hashes_cnt
;
12686 uint digests_done
= 0;
12688 size_t size_digests
= digests_cnt
* dgst_size
;
12689 size_t size_shown
= digests_cnt
* sizeof (uint
);
12691 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12692 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12694 uint salts_cnt
= 0;
12695 uint salts_done
= 0;
12697 hashinfo_t
**hash_info
= NULL
;
12699 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12701 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12703 if (username
&& (remove
|| show
))
12707 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12709 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12711 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12716 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12721 // copied from inner loop
12723 salt_buf
= &salts_buf_new
[salts_cnt
];
12725 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12729 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12732 salt_buf
->digests_cnt
= 0;
12733 salt_buf
->digests_done
= 0;
12734 salt_buf
->digests_offset
= 0;
12739 if (hashes_buf
[0].cracked
== 1)
12741 digests_shown
[0] = 1;
12745 salt_buf
->digests_done
++;
12748 salt_buf
->digests_cnt
++;
12750 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12752 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12754 hash_info
[0] = hashes_buf
[0].hash_info
;
12757 // copy from inner loop
12759 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12763 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12765 salt_buf
= &salts_buf_new
[salts_cnt
];
12767 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12771 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12774 salt_buf
->digests_cnt
= 0;
12775 salt_buf
->digests_done
= 0;
12776 salt_buf
->digests_offset
= hashes_pos
;
12782 if (hashes_buf
[hashes_pos
].cracked
== 1)
12784 digests_shown
[hashes_pos
] = 1;
12788 salt_buf
->digests_done
++;
12791 salt_buf
->digests_cnt
++;
12793 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12795 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12797 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12801 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12803 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12805 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12807 salts_shown
[salt_pos
] = 1;
12812 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12815 local_free (digests_buf
);
12816 local_free (salts_buf
);
12817 local_free (esalts_buf
);
12819 digests_buf
= digests_buf_new
;
12820 salts_buf
= salts_buf_new
;
12821 esalts_buf
= esalts_buf_new
;
12823 local_free (hashes_buf
);
12826 * special modification not set from parser
12831 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12832 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12833 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12834 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12835 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12836 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12837 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12838 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12839 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12840 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12841 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12842 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12843 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12844 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12845 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12846 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12847 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12848 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12849 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12850 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12851 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12852 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12853 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12854 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12855 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12856 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12857 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12858 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12859 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12860 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12863 if (truecrypt_keyfiles
)
12865 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12867 char *keyfiles
= strdup (truecrypt_keyfiles
);
12869 char *keyfile
= strtok (keyfiles
, ",");
12873 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12875 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12880 if (veracrypt_keyfiles
)
12882 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12884 char *keyfiles
= strdup (veracrypt_keyfiles
);
12886 char *keyfile
= strtok (keyfiles
, ",");
12890 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12892 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12897 data
.digests_cnt
= digests_cnt
;
12898 data
.digests_done
= digests_done
;
12899 data
.digests_buf
= digests_buf
;
12900 data
.digests_shown
= digests_shown
;
12901 data
.digests_shown_tmp
= digests_shown_tmp
;
12903 data
.salts_cnt
= salts_cnt
;
12904 data
.salts_done
= salts_done
;
12905 data
.salts_buf
= salts_buf
;
12906 data
.salts_shown
= salts_shown
;
12908 data
.esalts_buf
= esalts_buf
;
12909 data
.hash_info
= hash_info
;
12912 * Automatic Optimizers
12915 if (salts_cnt
== 1)
12916 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12918 if (digests_cnt
== 1)
12919 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12921 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12922 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12924 if (attack_mode
== ATTACK_MODE_BF
)
12925 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12927 data
.opti_type
= opti_type
;
12929 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12931 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12933 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12935 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12937 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12938 opts_type
|= OPTS_TYPE_PT_ADD80
;
12941 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12943 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12944 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12947 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12949 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12950 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12957 * Some algorithm, like descrypt, can benefit from JIT compilation
12960 int force_jit_compilation
= -1;
12962 if (hash_mode
== 8900)
12964 force_jit_compilation
= 8900;
12966 else if (hash_mode
== 9300)
12968 force_jit_compilation
= 8900;
12970 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12972 force_jit_compilation
= 1500;
12976 * generate bitmap tables
12979 const uint bitmap_shift1
= 5;
12980 const uint bitmap_shift2
= 13;
12982 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12984 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12985 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12986 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12987 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12988 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12989 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12990 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12991 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12998 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13000 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13002 bitmap_nums
= 1 << bitmap_bits
;
13004 bitmap_mask
= bitmap_nums
- 1;
13006 bitmap_size
= bitmap_nums
* sizeof (uint
);
13008 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13010 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;
13011 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;
13016 bitmap_nums
= 1 << bitmap_bits
;
13018 bitmap_mask
= bitmap_nums
- 1;
13020 bitmap_size
= bitmap_nums
* sizeof (uint
);
13022 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);
13023 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);
13026 * prepare quick rule
13029 data
.rule_buf_l
= rule_buf_l
;
13030 data
.rule_buf_r
= rule_buf_r
;
13032 int rule_len_l
= (int) strlen (rule_buf_l
);
13033 int rule_len_r
= (int) strlen (rule_buf_r
);
13035 data
.rule_len_l
= rule_len_l
;
13036 data
.rule_len_r
= rule_len_r
;
13042 uint
*all_kernel_rules_cnt
= NULL
;
13044 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13048 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13050 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13053 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13057 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13059 uint kernel_rules_avail
= 0;
13061 uint kernel_rules_cnt
= 0;
13063 kernel_rule_t
*kernel_rules_buf
= NULL
;
13065 char *rp_file
= rp_files
[i
];
13067 char in
[BLOCK_SIZE
] = { 0 };
13068 char out
[BLOCK_SIZE
] = { 0 };
13072 uint rule_line
= 0;
13074 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13076 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13083 memset (rule_buf
, 0, HCBUFSIZ
);
13085 rule_len
= fgetl (fp
, rule_buf
);
13089 if (rule_len
== 0) continue;
13091 if (rule_buf
[0] == '#') continue;
13093 if (kernel_rules_avail
== kernel_rules_cnt
)
13095 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13097 kernel_rules_avail
+= INCR_RULES
;
13100 memset (in
, 0, BLOCK_SIZE
);
13101 memset (out
, 0, BLOCK_SIZE
);
13103 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13107 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13112 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13114 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13116 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13122 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13124 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13130 kernel_rules_cnt
++;
13135 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13137 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13141 * merge rules or automatic rule generator
13144 uint kernel_rules_cnt
= 0;
13146 kernel_rule_t
*kernel_rules_buf
= NULL
;
13148 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13152 kernel_rules_cnt
= 1;
13154 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13156 repeats
[0] = kernel_rules_cnt
;
13158 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13160 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13162 repeats
[i
+ 1] = kernel_rules_cnt
;
13165 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13167 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13169 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13173 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13175 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13177 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13180 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13182 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13184 if (out_pos
== RULES_MAX
- 1)
13186 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13191 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13196 local_free (repeats
);
13200 uint kernel_rules_avail
= 0;
13202 while (kernel_rules_cnt
< rp_gen
)
13204 if (kernel_rules_avail
== kernel_rules_cnt
)
13206 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13208 kernel_rules_avail
+= INCR_RULES
;
13211 memset (rule_buf
, 0, HCBUFSIZ
);
13213 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13215 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13217 kernel_rules_cnt
++;
13225 * generate NOP rules
13228 if (kernel_rules_cnt
== 0)
13230 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13232 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13234 kernel_rules_cnt
++;
13237 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13238 data
.kernel_rules_buf
= kernel_rules_buf
;
13241 * OpenCL platforms: detect
13244 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13245 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13247 cl_uint platforms_cnt
= 0;
13248 cl_uint platform_devices_cnt
= 0;
13252 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13254 if (platforms_cnt
== 0)
13257 log_info ("ATTENTION! No OpenCL compatible platform found");
13259 log_info ("You're probably missing the OpenCL runtime installation");
13260 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13261 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13262 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13268 if (opencl_platforms_filter
!= (uint
) -1)
13270 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13272 if (opencl_platforms_filter
> platform_cnt_mask
)
13274 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13282 * OpenCL device types:
13283 * 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.
13284 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13287 if (opencl_device_types
== NULL
)
13289 cl_device_type device_types_all
= 0;
13291 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13293 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13295 cl_platform_id platform
= platforms
[platform_id
];
13297 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13299 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13301 cl_device_id device
= platform_devices
[platform_devices_id
];
13303 cl_device_type device_type
;
13305 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13307 device_types_all
|= device_type
;
13311 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13313 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13318 * OpenCL devices: simply push all devices from all platforms into the same device array
13322 int need_nvapi
= 0;
13325 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13327 data
.devices_param
= devices_param
;
13329 uint devices_cnt
= 0;
13331 uint devices_active
= 0;
13333 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13335 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13337 cl_platform_id platform
= platforms
[platform_id
];
13339 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13341 char platform_vendor
[INFOSZ
] = { 0 };
13343 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13345 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13346 // this causes trouble with vendor id based macros
13347 // we'll assign generic to those without special optimization available
13349 cl_uint platform_vendor_id
= 0;
13351 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13353 platform_vendor_id
= VENDOR_ID_AMD
;
13355 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13357 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13359 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13361 platform_vendor_id
= VENDOR_ID_APPLE
;
13363 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13365 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13367 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13369 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13371 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13373 platform_vendor_id
= VENDOR_ID_MESA
;
13375 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13377 platform_vendor_id
= VENDOR_ID_NV
;
13379 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13381 platform_vendor_id
= VENDOR_ID_POCL
;
13385 platform_vendor_id
= VENDOR_ID_GENERIC
;
13388 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13390 size_t param_value_size
= 0;
13392 const uint device_id
= devices_cnt
;
13394 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13396 device_param
->platform_vendor_id
= platform_vendor_id
;
13398 device_param
->device
= platform_devices
[platform_devices_id
];
13400 device_param
->device_id
= device_id
;
13402 device_param
->platform_devices_id
= platform_devices_id
;
13406 cl_device_type device_type
;
13408 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13410 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13412 device_param
->device_type
= device_type
;
13416 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13418 char *device_name
= (char *) mymalloc (param_value_size
);
13420 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13422 device_param
->device_name
= device_name
;
13426 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13428 char *device_vendor
= (char *) mymalloc (param_value_size
);
13430 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13432 device_param
->device_vendor
= device_vendor
;
13434 cl_uint device_vendor_id
= 0;
13436 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13438 device_vendor_id
= VENDOR_ID_AMD
;
13440 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13442 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13444 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13446 device_vendor_id
= VENDOR_ID_APPLE
;
13448 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13450 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13452 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13454 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13456 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13458 device_vendor_id
= VENDOR_ID_MESA
;
13460 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13462 device_vendor_id
= VENDOR_ID_NV
;
13464 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13466 device_vendor_id
= VENDOR_ID_POCL
;
13470 device_vendor_id
= VENDOR_ID_GENERIC
;
13473 device_param
->device_vendor_id
= device_vendor_id
;
13477 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13481 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13483 char *device_version
= (char *) mymalloc (param_value_size
);
13485 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13487 device_param
->device_version
= device_version
;
13489 // device_opencl_version
13491 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13493 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13495 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13497 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13499 myfree (device_opencl_version
);
13503 cl_uint vector_width
;
13505 if (opencl_vector_width_chgd
== 0)
13507 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13509 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13511 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13515 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13520 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13525 vector_width
= opencl_vector_width
;
13528 if (vector_width
> 16) vector_width
= 16;
13530 device_param
->vector_width
= vector_width
;
13532 // max_compute_units
13534 cl_uint device_processors
;
13536 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13538 device_param
->device_processors
= device_processors
;
13540 // device_maxmem_alloc
13541 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13543 cl_ulong device_maxmem_alloc
;
13545 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13547 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13549 // device_global_mem
13551 cl_ulong device_global_mem
;
13553 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13555 device_param
->device_global_mem
= device_global_mem
;
13557 // max_work_group_size
13559 size_t device_maxworkgroup_size
;
13561 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13563 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13565 // max_clock_frequency
13567 cl_uint device_maxclock_frequency
;
13569 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13571 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13573 // device_endian_little
13575 cl_bool device_endian_little
;
13577 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13579 if (device_endian_little
== CL_FALSE
)
13581 log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13583 device_param
->skipped
= 1;
13586 // device_available
13588 cl_bool device_available
;
13590 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13592 if (device_available
== CL_FALSE
)
13594 log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13596 device_param
->skipped
= 1;
13599 // device_compiler_available
13601 cl_bool device_compiler_available
;
13603 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13605 if (device_compiler_available
== CL_FALSE
)
13607 log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13609 device_param
->skipped
= 1;
13612 // device_execution_capabilities
13614 cl_device_exec_capabilities device_execution_capabilities
;
13616 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13618 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13620 log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13622 device_param
->skipped
= 1;
13625 // device_extensions
13627 size_t device_extensions_size
;
13629 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13631 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13633 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13635 if (strstr (device_extensions
, "base_atomics") == 0)
13637 log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13639 device_param
->skipped
= 1;
13642 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13644 log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13646 device_param
->skipped
= 1;
13649 myfree (device_extensions
);
13651 // device_local_mem_size
13653 cl_ulong device_local_mem_size
;
13655 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13657 if (device_local_mem_size
< 32768)
13659 log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13661 device_param
->skipped
= 1;
13664 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13665 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13666 // This results in both utilizing it for 50%
13667 // However, Intel has much better SIMD control over their own hardware
13668 // It makes sense to give them full control over their own hardware
13670 if (device_type
& CL_DEVICE_TYPE_CPU
)
13672 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13674 if (data
.force
== 0)
13676 log_info ("Device #%u: WARNING: not native intel opencl runtime, expect massive speed loss", device_id
+ 1);
13677 log_info (" You can use --force to override this but do not post error reports if you do so");
13679 device_param
->skipped
= 1;
13686 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13687 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13691 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13693 char *driver_version
= (char *) mymalloc (param_value_size
);
13695 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13697 device_param
->driver_version
= driver_version
;
13699 // device_name_chksum
13701 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13704 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
);
13706 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
);
13709 uint device_name_digest
[4] = { 0 };
13711 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13713 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13715 device_param
->device_name_chksum
= device_name_chksum
;
13717 // device_processor_cores
13719 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
13721 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
13726 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
13736 // device_processor_cores
13738 if (device_type
& CL_DEVICE_TYPE_CPU
)
13740 cl_uint device_processor_cores
= 1;
13742 device_param
->device_processor_cores
= device_processor_cores
;
13745 if (device_type
& CL_DEVICE_TYPE_GPU
)
13747 if (device_vendor_id
== VENDOR_ID_AMD
)
13749 cl_uint device_processor_cores
= 0;
13751 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13753 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13755 device_param
->device_processor_cores
= device_processor_cores
;
13757 else if (device_vendor_id
== VENDOR_ID_NV
)
13759 cl_uint kernel_exec_timeout
= 0;
13761 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13763 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13765 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13767 cl_uint device_processor_cores
= 0;
13769 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13771 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13773 device_param
->device_processor_cores
= device_processor_cores
;
13775 cl_uint sm_minor
= 0;
13776 cl_uint sm_major
= 0;
13778 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13779 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13781 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13782 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13784 device_param
->sm_minor
= sm_minor
;
13785 device_param
->sm_major
= sm_major
;
13789 cl_uint device_processor_cores
= 1;
13791 device_param
->device_processor_cores
= device_processor_cores
;
13797 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13799 if (machine_readable
== 0)
13801 if (device_param
->skipped
== 0)
13803 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13806 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13807 (unsigned int) (device_global_mem
/ 1024 / 1024),
13808 (unsigned int) device_processors
);
13812 log_info ("Device #%u: %s, skipped",
13819 // common driver check
13821 if (device_param
->skipped
== 0)
13823 if (device_type
& CL_DEVICE_TYPE_GPU
)
13825 if (platform_vendor_id
== VENDOR_ID_AMD
)
13827 int catalyst_check
= (force
== 1) ? 0 : 1;
13829 int catalyst_warn
= 0;
13831 int catalyst_broken
= 0;
13833 if (catalyst_check
== 1)
13837 // v14.9 and higher
13838 if (atoi (device_param
->driver_version
) >= 1573)
13843 catalyst_check
= 0;
13846 if (catalyst_broken
== 1)
13849 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13850 log_info ("It will pass over cracked hashes and does not report them as cracked");
13851 log_info ("You are STRONGLY encouraged not to use it");
13852 log_info ("You can use --force to override this but do not post error reports if you do so");
13858 if (catalyst_warn
== 1)
13861 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13862 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13863 log_info ("See hashcat's homepage for official supported catalyst drivers");
13865 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13867 log_info ("You can use --force to override this but do not post error reports if you do so");
13873 else if (platform_vendor_id
== VENDOR_ID_NV
)
13875 if (device_param
->kernel_exec_timeout
!= 0)
13877 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);
13878 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13883 /* turns out pocl still creates segfaults (because of llvm)
13884 if (device_type & CL_DEVICE_TYPE_CPU)
13886 if (platform_vendor_id == VENDOR_ID_AMD)
13891 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13892 log_info ("You are STRONGLY encouraged not to use it");
13893 log_info ("You can use --force to override this but do not post error reports if you do so");
13894 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13904 * kernel accel and loops tuning db adjustment
13907 device_param
->kernel_accel_min
= 1;
13908 device_param
->kernel_accel_max
= 1024;
13910 device_param
->kernel_loops_min
= 1;
13911 device_param
->kernel_loops_max
= 1024;
13913 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13915 if (tuningdb_entry
)
13917 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13918 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13922 device_param
->kernel_accel_min
= _kernel_accel
;
13923 device_param
->kernel_accel_max
= _kernel_accel
;
13928 if (workload_profile
== 1)
13930 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13932 else if (workload_profile
== 2)
13934 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13937 device_param
->kernel_loops_min
= _kernel_loops
;
13938 device_param
->kernel_loops_max
= _kernel_loops
;
13942 // commandline parameters overwrite tuningdb entries
13946 device_param
->kernel_accel_min
= kernel_accel
;
13947 device_param
->kernel_accel_max
= kernel_accel
;
13952 device_param
->kernel_loops_min
= kernel_loops
;
13953 device_param
->kernel_loops_max
= kernel_loops
;
13969 if (keyspace
== 0 && devices_active
== 0)
13971 log_error ("ERROR: No devices found/left");
13976 // 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)
13978 if (devices_filter
!= (uint
) -1)
13980 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13982 if (devices_filter
> devices_cnt_mask
)
13984 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13990 data
.devices_cnt
= devices_cnt
;
13992 data
.devices_active
= devices_active
;
13994 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13996 if (machine_readable
== 0)
14007 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0, 0 } };
14008 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0, 0 } };
14009 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0, 0 } };
14011 if (gpu_temp_disable
== 0)
14013 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14014 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14015 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14017 data
.hm_adl
= NULL
;
14018 data
.hm_nvapi
= NULL
;
14019 data
.hm_nvml
= NULL
;
14021 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
14023 data
.hm_nvml
= nvml
;
14028 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
14030 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
14032 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
14036 for (int i
= 0; i
< tmp_in
; i
++)
14038 hm_adapters_nvml
[tmp_out
++].adapter_index
.nvml
= nvmlGPUHandle
[i
];
14041 for (int i
= 0; i
< tmp_out
; i
++)
14043 unsigned int speed
;
14045 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].adapter_index
.nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
14047 hm_NVML_nvmlDeviceSetComputeMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].adapter_index
.nvml
, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS
);
14049 hm_NVML_nvmlDeviceSetGpuOperationMode (data
.hm_nvml
, 1, hm_adapters_nvml
[i
].adapter_index
.nvml
, NVML_GOM_ALL_ON
);
14054 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
14056 data
.hm_nvapi
= nvapi
;
14061 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
14063 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
14065 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
14069 for (int i
= 0; i
< tmp_in
; i
++)
14071 hm_adapters_nvapi
[tmp_out
++].adapter_index
.nvapi
= nvGPUHandle
[i
];
14076 if ((need_adl
== 1) && (adl_init (adl
) == 0))
14083 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14085 // total number of adapters
14087 int hm_adapters_num
;
14089 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return (-1);
14093 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
14095 if (lpAdapterInfo
== NULL
) return (-1);
14097 // get a list (of ids of) valid/usable adapters
14099 int num_adl_adapters
= 0;
14101 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14103 if (num_adl_adapters
> 0)
14105 hc_thread_mutex_lock (mux_adl
);
14107 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
14109 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14111 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14112 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14114 hc_thread_mutex_unlock (mux_adl
);
14117 myfree (valid_adl_device_list
);
14118 myfree (lpAdapterInfo
);
14122 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14124 gpu_temp_disable
= 1;
14129 * OpenCL devices: allocate buffer for device specific information
14132 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14133 int *temp_retain_fanpolicy_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14135 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14137 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14139 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
14142 * User-defined GPU temp handling
14145 if (gpu_temp_disable
== 1)
14147 gpu_temp_abort
= 0;
14148 gpu_temp_retain
= 0;
14151 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14153 if (gpu_temp_abort
< gpu_temp_retain
)
14155 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14161 data
.gpu_temp_disable
= gpu_temp_disable
;
14162 data
.gpu_temp_abort
= gpu_temp_abort
;
14163 data
.gpu_temp_retain
= gpu_temp_retain
;
14167 * enable custom signal handler(s)
14170 if (benchmark
== 0)
14172 hc_signal (sigHandler_default
);
14176 hc_signal (sigHandler_benchmark
);
14183 if (data
.quiet
== 0)
14185 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14187 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
);
14189 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14191 log_info ("Rules: %u", kernel_rules_cnt
);
14196 log_info ("Applicable Optimizers:");
14198 for (uint i
= 0; i
< 32; i
++)
14200 const uint opti_bit
= 1u << i
;
14202 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14207 * Watchdog and Temperature balance
14211 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
)
14213 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14216 if (gpu_temp_abort
== 0)
14218 log_info ("Watchdog: Temperature abort trigger disabled");
14222 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14225 if (gpu_temp_retain
== 0)
14227 log_info ("Watchdog: Temperature retain trigger disabled");
14231 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14234 if (data
.quiet
== 0) log_info ("");
14244 if (gpu_temp_disable
== 0)
14246 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14248 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14250 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14252 if (device_param
->skipped
) continue;
14254 const uint platform_devices_id
= device_param
->platform_devices_id
;
14256 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14258 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nvml
[platform_devices_id
], sizeof (hm_attrs_t
));
14261 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14263 memcpy (&data
.hm_device
[device_id
], &hm_adapters_adl
[platform_devices_id
], sizeof (hm_attrs_t
));
14269 * powertune on user request
14272 if (powertune_enable
== 1)
14274 hc_thread_mutex_lock (mux_adl
);
14276 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14278 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14280 if (device_param
->skipped
) continue;
14282 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
14286 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14287 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14288 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14289 * Driver / ADL bug?
14292 if (data
.hm_device
[device_id
].od_version
== 6)
14296 // check powertune capabilities first, if not available then skip device
14298 int powertune_supported
= 0;
14300 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &powertune_supported
)) != ADL_OK
)
14302 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14307 // first backup current value, we will restore it later
14309 if (powertune_supported
!= 0)
14311 // powercontrol settings
14313 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14315 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &powertune
)) == ADL_OK
)
14317 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &od_power_control_status
[device_id
]);
14320 if (ADL_rc
!= ADL_OK
)
14322 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14327 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, powertune
.iMaxValue
)) != ADL_OK
)
14329 log_error ("ERROR: Failed to set new ADL PowerControl values");
14336 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
14338 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
14340 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
14342 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
14347 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
14349 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
14351 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &caps
)) != ADL_OK
)
14353 log_error ("ERROR: Failed to get ADL device capabilities");
14358 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
14359 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
14361 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
14362 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
14364 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
14365 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
14367 // warning if profile has too low max values
14369 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
14371 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
14374 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
14376 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
14379 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
14381 performance_state
->iNumberOfPerformanceLevels
= 2;
14383 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
14384 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
14385 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
14386 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
14388 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
14390 log_info ("ERROR: Failed to set ADL performance state");
14395 local_free (performance_state
);
14398 // set powertune value only
14400 if (powertune_supported
!= 0)
14403 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14405 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &powertune
)) != ADL_OK
)
14407 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14412 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, powertune
.iMaxValue
)) != ADL_OK
)
14414 log_error ("ERROR: Failed to set new ADL PowerControl values");
14422 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
14424 // first backup current value, we will restore it later
14426 unsigned int limit
;
14428 int powertune_supported
= 0;
14430 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].adapter_index
.nvml
, &limit
) == NVML_SUCCESS
)
14432 powertune_supported
= 1;
14435 // if backup worked, activate the maximum allowed
14437 if (powertune_supported
!= 0)
14439 unsigned int minLimit
;
14440 unsigned int maxLimit
;
14442 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].adapter_index
.nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
14446 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].adapter_index
.nvml
, maxLimit
) == NVML_SUCCESS
)
14448 // now we can be sure we need to reset later
14450 nvml_power_limit
[device_id
] = limit
;
14458 hc_thread_mutex_unlock (mux_adl
);
14461 #endif // HAVE_HWMON
14464 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14467 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14469 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14475 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14477 if (device_param
->skipped
) continue;
14480 * device properties
14483 const char *device_name_chksum
= device_param
->device_name_chksum
;
14484 const u32 device_processors
= device_param
->device_processors
;
14485 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14488 * create context for each device
14491 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14494 * create command-queue
14497 // not supported with NV
14498 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14500 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14503 * kernel threads: some algorithms need a fixed kernel-threads count
14504 * because of shared memory usage or bitslice
14505 * there needs to be some upper limit, otherwise there's too much overhead
14508 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14510 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14512 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14515 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14516 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14517 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14518 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14519 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14520 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14521 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14522 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14523 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14524 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14525 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14526 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14527 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14529 device_param
->kernel_threads
= kernel_threads
;
14532 * create input buffers on device : calculate size of fixed memory buffers
14535 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14536 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14538 device_param
->size_root_css
= size_root_css
;
14539 device_param
->size_markov_css
= size_markov_css
;
14541 size_t size_results
= sizeof (uint
);
14543 device_param
->size_results
= size_results
;
14545 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14546 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14548 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14549 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14550 size_t size_esalts
= salts_cnt
* esalt_size
;
14552 device_param
->size_plains
= size_plains
;
14553 device_param
->size_digests
= size_digests
;
14554 device_param
->size_shown
= size_shown
;
14555 device_param
->size_salts
= size_salts
;
14557 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14558 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14559 size_t size_tm
= 32 * sizeof (bs_word_t
);
14563 size_t size_scryptV
= 1;
14565 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14567 uint tmto_start
= 0;
14568 uint tmto_stop
= 10;
14572 tmto_start
= scrypt_tmto
;
14576 // in case the user did not specify the tmto manually
14577 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14578 // but set the lower end only in case the user has a device with too less memory
14580 if (hash_mode
== 8900)
14582 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14586 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14591 else if (hash_mode
== 9300)
14593 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14597 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14604 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14606 // TODO: in theory the following calculation needs to be done per salt, not global
14607 // we assume all hashes have the same scrypt settings
14609 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14611 size_scryptV
/= 1 << tmto
;
14613 size_scryptV
*= device_processors
* device_processor_cores
;
14615 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14617 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14622 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14624 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14625 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14631 if (data
.salts_buf
[0].scrypt_phy
== 0)
14633 log_error ("ERROR: can't allocate enough device memory");
14638 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14642 * some algorithms need a fixed kernel-loops count
14645 if (hash_mode
== 1500)
14647 const u32 kernel_loops_fixed
= 1024;
14649 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14650 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14653 if (hash_mode
== 3000)
14655 const u32 kernel_loops_fixed
= 1024;
14657 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14658 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14661 if (hash_mode
== 8900)
14663 const u32 kernel_loops_fixed
= 1;
14665 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14666 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14669 if (hash_mode
== 9300)
14671 const u32 kernel_loops_fixed
= 1;
14673 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14674 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14677 if (hash_mode
== 12500)
14679 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14681 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14682 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14686 * some algorithms have a maximum kernel-loops count
14689 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14691 u32 innerloop_cnt
= 0;
14693 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14695 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14696 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14697 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14701 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14704 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14705 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14707 device_param
->kernel_loops_max
= innerloop_cnt
;
14711 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14712 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14714 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14716 size_t size_pws
= 4;
14717 size_t size_tmps
= 4;
14718 size_t size_hooks
= 4;
14720 while (kernel_accel_max
>= kernel_accel_min
)
14722 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14726 size_pws
= kernel_power_max
* sizeof (pw_t
);
14732 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14733 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14734 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14735 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14736 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14737 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14738 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14739 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14740 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14741 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14742 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14743 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14744 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14745 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14746 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14747 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14748 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14749 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14750 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14751 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14752 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14753 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14754 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14755 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14756 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14757 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14758 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14759 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14760 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14761 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14762 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14763 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14764 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14765 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14766 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14767 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14768 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14769 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14770 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14771 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14772 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14773 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14774 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14775 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14776 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14777 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14778 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14779 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14780 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14781 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14782 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14783 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14784 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14785 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14786 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14787 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14788 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14789 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14790 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14791 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14792 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14793 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14794 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14795 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14796 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14797 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14798 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14799 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14800 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14801 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14802 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14803 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14804 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14805 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14806 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14807 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14808 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14809 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14810 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14811 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14812 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14813 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14818 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14823 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14824 // if not, decrease amplifier and try again
14828 const u64 size_total
14845 + size_pws
// not a bug
14856 // Don't ask me, ask AMD!
14858 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14859 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14863 kernel_accel_max
--;
14872 if (kernel_accel_max == 0)
14874 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14880 device_param
->kernel_accel_min
= kernel_accel_min
;
14881 device_param
->kernel_accel_max
= kernel_accel_max
;
14884 if (kernel_accel_max < kernel_accel)
14886 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14888 device_param->kernel_accel = kernel_accel_max;
14892 device_param
->size_bfs
= size_bfs
;
14893 device_param
->size_combs
= size_combs
;
14894 device_param
->size_rules
= size_rules
;
14895 device_param
->size_rules_c
= size_rules_c
;
14896 device_param
->size_pws
= size_pws
;
14897 device_param
->size_tmps
= size_tmps
;
14898 device_param
->size_hooks
= size_hooks
;
14901 * default building options
14904 char build_opts
[1024] = { 0 };
14906 // we don't have sm_* on vendors not NV but it doesn't matter
14909 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
);
14911 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
);
14914 char build_opts_new
[1024] = { 0 };
14916 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
);
14918 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14921 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14923 // we do vectorizing much better than the auto-vectorizer
14925 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14927 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14932 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14941 * kernel source filename
14944 char source_file
[256] = { 0 };
14946 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14950 if (stat (source_file
, &sst
) == -1)
14952 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14958 * kernel cached filename
14961 char cached_file
[256] = { 0 };
14963 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14969 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14975 * kernel compile or load
14978 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14980 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14982 if (force_jit_compilation
== -1)
14986 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14988 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14990 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14992 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14995 size_t build_log_size
= 0;
14997 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14999 if (build_log_size
> 1)
15001 char *build_log
= (char *) malloc (build_log_size
+ 1);
15003 memset (build_log
, 0, build_log_size
+ 1);
15005 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15015 device_param
->skipped
= true;
15017 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15022 size_t binary_size
;
15024 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15026 u8
*binary
= (u8
*) mymalloc (binary_size
);
15028 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15030 writeProgramBin (cached_file
, binary
, binary_size
);
15032 local_free (binary
);
15037 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15040 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15042 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15044 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15050 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
15053 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15055 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15057 char build_opts_update
[1024] = { 0 };
15059 if (force_jit_compilation
== 1500)
15061 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
15063 else if (force_jit_compilation
== 8900)
15065 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
);
15069 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
15072 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
15075 size_t build_log_size
= 0;
15077 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15079 if (build_log_size
> 1)
15081 char *build_log
= (char *) malloc (build_log_size
+ 1);
15083 memset (build_log
, 0, build_log_size
+ 1);
15085 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15095 device_param
->skipped
= true;
15097 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15101 local_free (kernel_lengths
);
15102 local_free (kernel_sources
[0]);
15103 local_free (kernel_sources
);
15107 * word generator kernel
15110 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
15113 * kernel mp source filename
15116 char source_file
[256] = { 0 };
15118 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
15122 if (stat (source_file
, &sst
) == -1)
15124 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15130 * kernel mp cached filename
15133 char cached_file
[256] = { 0 };
15135 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15141 if (stat (cached_file
, &cst
) == -1)
15147 * kernel compile or load
15150 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15152 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15156 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15157 if (quiet
== 0) log_info ("");
15159 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15161 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15163 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15167 device_param
->skipped
= true;
15169 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15174 size_t binary_size
;
15176 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15178 u8
*binary
= (u8
*) mymalloc (binary_size
);
15180 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15182 writeProgramBin (cached_file
, binary
, binary_size
);
15184 local_free (binary
);
15189 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15192 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15194 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15196 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15199 local_free (kernel_lengths
);
15200 local_free (kernel_sources
[0]);
15201 local_free (kernel_sources
);
15208 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15215 * kernel amp source filename
15218 char source_file
[256] = { 0 };
15220 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15224 if (stat (source_file
, &sst
) == -1)
15226 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15232 * kernel amp cached filename
15235 char cached_file
[256] = { 0 };
15237 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15243 if (stat (cached_file
, &cst
) == -1)
15249 * kernel compile or load
15252 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15254 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15258 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15259 if (quiet
== 0) log_info ("");
15261 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15263 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15265 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15269 device_param
->skipped
= true;
15271 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15276 size_t binary_size
;
15278 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15280 u8
*binary
= (u8
*) mymalloc (binary_size
);
15282 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15284 writeProgramBin (cached_file
, binary
, binary_size
);
15286 local_free (binary
);
15291 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15294 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15296 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15298 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15301 local_free (kernel_lengths
);
15302 local_free (kernel_sources
[0]);
15303 local_free (kernel_sources
);
15306 // some algorithm collide too fast, make that impossible
15308 if (benchmark
== 1)
15310 ((uint
*) digests_buf
)[0] = -1;
15311 ((uint
*) digests_buf
)[1] = -1;
15312 ((uint
*) digests_buf
)[2] = -1;
15313 ((uint
*) digests_buf
)[3] = -1;
15320 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15321 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15322 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15323 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15324 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15325 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15326 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15327 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15328 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15329 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15330 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15331 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15332 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15333 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15334 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15335 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15336 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15337 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15339 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
);
15340 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
);
15341 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
);
15342 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
);
15343 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
);
15344 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
);
15345 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
);
15346 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
);
15347 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15348 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15349 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15355 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15357 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15358 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15360 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15362 else if (attack_kern
== ATTACK_KERN_COMBI
)
15364 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15365 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15366 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15367 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15369 else if (attack_kern
== ATTACK_KERN_BF
)
15371 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15372 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15373 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15374 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15375 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15380 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15382 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15389 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15391 device_param
->pws_buf
= pws_buf
;
15393 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15395 device_param
->combs_buf
= combs_buf
;
15397 void *hooks_buf
= mymalloc (size_hooks
);
15399 device_param
->hooks_buf
= hooks_buf
;
15405 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15406 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15407 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15408 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15409 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15410 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15411 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15412 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15413 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15414 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15415 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15417 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15418 ? &device_param
->d_pws_buf
15419 : &device_param
->d_pws_amp_buf
;
15420 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15421 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15422 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15423 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15424 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15425 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15426 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15427 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15428 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15429 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15430 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15431 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15432 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15433 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15434 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15435 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15436 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15437 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15438 device_param
->kernel_params
[19] = &device_param
->d_result
;
15439 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15440 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15441 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15442 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15443 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15444 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15445 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15446 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15447 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15448 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15449 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15450 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15452 device_param
->kernel_params_mp_buf64
[3] = 0;
15453 device_param
->kernel_params_mp_buf32
[4] = 0;
15454 device_param
->kernel_params_mp_buf32
[5] = 0;
15455 device_param
->kernel_params_mp_buf32
[6] = 0;
15456 device_param
->kernel_params_mp_buf32
[7] = 0;
15457 device_param
->kernel_params_mp_buf32
[8] = 0;
15459 device_param
->kernel_params_mp
[0] = NULL
;
15460 device_param
->kernel_params_mp
[1] = NULL
;
15461 device_param
->kernel_params_mp
[2] = NULL
;
15462 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15463 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15464 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15465 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15466 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15467 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15469 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15470 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15471 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15472 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15473 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15474 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15475 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15477 device_param
->kernel_params_mp_l
[0] = NULL
;
15478 device_param
->kernel_params_mp_l
[1] = NULL
;
15479 device_param
->kernel_params_mp_l
[2] = NULL
;
15480 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15481 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15482 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15483 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15484 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15485 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15486 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15488 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15489 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15490 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15491 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15492 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15493 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15495 device_param
->kernel_params_mp_r
[0] = NULL
;
15496 device_param
->kernel_params_mp_r
[1] = NULL
;
15497 device_param
->kernel_params_mp_r
[2] = NULL
;
15498 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15499 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15500 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15501 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15502 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15503 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15505 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15506 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15508 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15509 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15510 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15511 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15512 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15513 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15514 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15516 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15517 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15519 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15520 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15522 device_param
->kernel_params_memset
[0] = NULL
;
15523 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15524 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15530 size_t kernel_wgs_tmp
;
15532 char kernel_name
[64] = { 0 };
15534 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15536 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15538 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15540 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15542 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15544 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15546 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15548 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15552 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15554 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15556 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15558 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15560 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15562 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15565 if (data
.attack_mode
== ATTACK_MODE_BF
)
15567 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15569 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15571 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15573 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
);
15579 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15581 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15583 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15585 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15587 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15589 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15591 if (opts_type
& OPTS_TYPE_HOOK12
)
15593 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15595 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15597 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
);
15600 if (opts_type
& OPTS_TYPE_HOOK23
)
15602 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15604 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15606 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
);
15610 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
);
15611 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
);
15612 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
);
15614 for (uint i
= 0; i
<= 20; i
++)
15616 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15617 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15618 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15620 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15621 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15624 for (uint i
= 21; i
<= 31; i
++)
15626 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15627 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15628 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15630 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15631 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15636 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15638 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
);
15640 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15641 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15642 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15646 if (attack_mode
== ATTACK_MODE_BF
)
15648 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15649 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15651 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
);
15652 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
);
15654 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15656 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15657 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15660 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15662 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15664 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
);
15666 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15668 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15670 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
);
15673 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15679 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15681 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
);
15684 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15690 for (uint i
= 0; i
< 5; i
++)
15692 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15695 for (uint i
= 5; i
< 7; i
++)
15697 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15701 // maybe this has been updated by clGetKernelWorkGroupInfo()
15702 // value can only be decreased, so we don't need to reallocate buffers
15704 device_param
->kernel_threads
= kernel_threads
;
15706 // zero some data buffers
15708 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15709 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15710 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15711 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15712 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15713 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15719 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15721 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15723 else if (attack_kern
== ATTACK_KERN_COMBI
)
15725 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15726 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15727 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15728 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15730 else if (attack_kern
== ATTACK_KERN_BF
)
15732 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15733 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15734 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15735 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15736 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15739 #if defined(HAVE_HWMON)
15742 * Store thermal target temperature so we can send a notice to user
15745 if (gpu_temp_disable
== 0)
15747 const int gpu_temp_threshold_slowdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15748 const int gpu_temp_threshold_shutdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15750 data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
= (gpu_temp_threshold_slowdown
> 0) ? gpu_temp_threshold_slowdown
: 10000;
15751 data
.hm_device
[device_id
].gpu_temp_threshold_shutdown
= (gpu_temp_threshold_shutdown
> 0) ? gpu_temp_threshold_shutdown
: 10000;
15753 // we could use those numbers for gpu_temp_retain and gpu_temp_abort, too
15757 * Store initial fanspeed if gpu_temp_retain is enabled
15760 if (gpu_temp_disable
== 0)
15762 if (gpu_temp_retain
!= 0)
15764 hc_thread_mutex_lock (mux_adl
);
15766 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
15768 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
15769 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
15771 temp_retain_fanspeed_value
[device_id
] = fanspeed
;
15772 temp_retain_fanpolicy_value
[device_id
] = fanpolicy
;
15774 // we also set it to tell the OS we take control over the fan and it's automatic controller
15775 // if it was set to automatic. we do not control user-defined fanspeeds.
15777 if (fanpolicy
== 1)
15779 data
.hm_device
[device_id
].fan_set_supported
= 1;
15783 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15785 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
15787 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15794 data
.hm_device
[device_id
].fan_set_supported
= 1;
15798 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
15800 data
.hm_device
[device_id
].fan_set_supported
= 0;
15805 data
.hm_device
[device_id
].fan_set_supported
= 0;
15809 hc_thread_mutex_unlock (mux_adl
);
15813 #endif // HAVE_HWMON
15816 if (data
.quiet
== 0) log_info_nn ("");
15819 * In benchmark-mode, inform user which algorithm is checked
15822 if (benchmark
== 1)
15824 if (machine_readable
== 0)
15828 data
.quiet
= quiet
;
15830 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15832 log_info ("Hashtype: %s", hash_type
);
15838 * keep track of the progress
15841 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15842 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15843 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15850 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15852 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15857 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15859 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15864 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15866 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15876 segment_size
*= (1024 * 1024);
15878 data
.segment_size
= segment_size
;
15880 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15882 wl_data
->buf
= (char *) mymalloc (segment_size
);
15883 wl_data
->avail
= segment_size
;
15884 wl_data
->incr
= segment_size
;
15888 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15890 data
.wordlist_mode
= wordlist_mode
;
15892 cs_t
*css_buf
= NULL
;
15896 char **masks
= NULL
;
15897 char **dictfiles
= NULL
;
15899 uint mask_from_file
= 0;
15901 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15903 if (wordlist_mode
== WL_MODE_FILE
)
15905 int wls_left
= myargc
- (optind
+ 1);
15907 for (int i
= 0; i
< wls_left
; i
++)
15909 char *l0_filename
= myargv
[optind
+ 1 + i
];
15911 struct stat l0_stat
;
15913 if (stat (l0_filename
, &l0_stat
) == -1)
15915 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15920 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15924 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15928 dictfiles
[dictcnt
- 1] = l0_filename
;
15932 // do not allow --keyspace w/ a directory
15936 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15941 char **dictionary_files
= NULL
;
15943 dictionary_files
= scan_directory (l0_filename
);
15945 if (dictionary_files
!= NULL
)
15947 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15949 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15951 char *l1_filename
= dictionary_files
[d
];
15953 struct stat l1_stat
;
15955 if (stat (l1_filename
, &l1_stat
) == -1)
15957 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15962 if (S_ISREG (l1_stat
.st_mode
))
15964 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15968 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15973 local_free (dictionary_files
);
15979 log_error ("ERROR: No usable dictionary file found.");
15984 else if (wordlist_mode
== WL_MODE_STDIN
)
15989 else if (attack_mode
== ATTACK_MODE_COMBI
)
15993 char *dictfile1
= myargv
[optind
+ 1 + 0];
15994 char *dictfile2
= myargv
[optind
+ 1 + 1];
15996 // find the bigger dictionary and use as base
16001 struct stat tmp_stat
;
16003 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
16005 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16010 if (stat (dictfile1
, &tmp_stat
) == -1)
16012 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16019 if (S_ISDIR (tmp_stat
.st_mode
))
16021 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16028 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16030 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16037 if (stat (dictfile2
, &tmp_stat
) == -1)
16039 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16047 if (S_ISDIR (tmp_stat
.st_mode
))
16049 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16057 data
.combs_cnt
= 1;
16061 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16063 data
.quiet
= quiet
;
16065 if (words1_cnt
== 0)
16067 log_error ("ERROR: %s: empty file", dictfile1
);
16075 data
.combs_cnt
= 1;
16079 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16081 data
.quiet
= quiet
;
16083 if (words2_cnt
== 0)
16085 log_error ("ERROR: %s: empty file", dictfile2
);
16096 data
.dictfile
= dictfile1
;
16097 data
.dictfile2
= dictfile2
;
16099 if (words1_cnt
>= words2_cnt
)
16101 data
.combs_cnt
= words2_cnt
;
16102 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16104 dictfiles
= &data
.dictfile
;
16110 data
.combs_cnt
= words1_cnt
;
16111 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16113 dictfiles
= &data
.dictfile2
;
16117 // we also have to switch wordlist related rules!
16119 char *tmpc
= data
.rule_buf_l
;
16121 data
.rule_buf_l
= data
.rule_buf_r
;
16122 data
.rule_buf_r
= tmpc
;
16124 int tmpi
= data
.rule_len_l
;
16126 data
.rule_len_l
= data
.rule_len_r
;
16127 data
.rule_len_r
= tmpi
;
16130 else if (attack_mode
== ATTACK_MODE_BF
)
16136 if (benchmark
== 0)
16138 mask
= myargv
[optind
+ 1];
16140 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16142 if ((optind
+ 2) <= myargc
)
16144 struct stat file_stat
;
16146 if (stat (mask
, &file_stat
) == -1)
16150 masks
[maskcnt
- 1] = mystrdup (mask
);
16154 int wls_left
= myargc
- (optind
+ 1);
16156 uint masks_avail
= INCR_MASKS
;
16158 for (int i
= 0; i
< wls_left
; i
++)
16162 mask
= myargv
[optind
+ 1 + i
];
16164 if (stat (mask
, &file_stat
) == -1)
16166 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16172 uint is_file
= S_ISREG (file_stat
.st_mode
);
16178 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16180 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16185 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16187 while (!feof (mask_fp
))
16189 memset (line_buf
, 0, HCBUFSIZ
);
16191 int line_len
= fgetl (mask_fp
, line_buf
);
16193 if (line_len
== 0) continue;
16195 if (line_buf
[0] == '#') continue;
16197 if (masks_avail
== maskcnt
)
16199 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16201 masks_avail
+= INCR_MASKS
;
16204 masks
[maskcnt
] = mystrdup (line_buf
);
16215 log_error ("ERROR: %s: unsupported file-type", mask
);
16221 mask_from_file
= 1;
16226 custom_charset_1
= (char *) "?l?d?u";
16227 custom_charset_2
= (char *) "?l?d";
16228 custom_charset_3
= (char *) "?l?d*!$@_";
16230 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16231 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16232 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16234 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16236 wordlist_mode
= WL_MODE_MASK
;
16238 data
.wordlist_mode
= wordlist_mode
;
16248 * generate full masks and charsets
16251 masks
= (char **) mymalloc (sizeof (char *));
16255 case 1731: pw_min
= 5;
16257 mask
= mystrdup ("?b?b?b?b?b");
16259 case 12500: pw_min
= 5;
16261 mask
= mystrdup ("?b?b?b?b?b");
16263 default: pw_min
= 7;
16265 mask
= mystrdup ("?b?b?b?b?b?b?b");
16271 masks
[maskcnt
- 1] = mystrdup (mask
);
16273 wordlist_mode
= WL_MODE_MASK
;
16275 data
.wordlist_mode
= wordlist_mode
;
16280 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16284 if (increment_min
> pw_min
) pw_min
= increment_min
;
16286 if (increment_max
< pw_max
) pw_max
= increment_max
;
16289 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16291 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16295 char *mask
= myargv
[myargc
- 1];
16299 masks
= (char **) mymalloc (1 * sizeof (char *));
16303 struct stat file_stat
;
16305 if (stat (mask
, &file_stat
) == -1)
16309 masks
[maskcnt
- 1] = mystrdup (mask
);
16313 uint is_file
= S_ISREG (file_stat
.st_mode
);
16319 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16321 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16326 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16328 uint masks_avail
= 1;
16330 while (!feof (mask_fp
))
16332 memset (line_buf
, 0, HCBUFSIZ
);
16334 int line_len
= fgetl (mask_fp
, line_buf
);
16336 if (line_len
== 0) continue;
16338 if (line_buf
[0] == '#') continue;
16340 if (masks_avail
== maskcnt
)
16342 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16344 masks_avail
+= INCR_MASKS
;
16347 masks
[maskcnt
] = mystrdup (line_buf
);
16356 mask_from_file
= 1;
16362 masks
[maskcnt
- 1] = mystrdup (mask
);
16368 int wls_left
= myargc
- (optind
+ 2);
16370 for (int i
= 0; i
< wls_left
; i
++)
16372 char *filename
= myargv
[optind
+ 1 + i
];
16374 struct stat file_stat
;
16376 if (stat (filename
, &file_stat
) == -1)
16378 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16383 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16387 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16391 dictfiles
[dictcnt
- 1] = filename
;
16395 // do not allow --keyspace w/ a directory
16399 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16404 char **dictionary_files
= NULL
;
16406 dictionary_files
= scan_directory (filename
);
16408 if (dictionary_files
!= NULL
)
16410 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16412 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16414 char *l1_filename
= dictionary_files
[d
];
16416 struct stat l1_stat
;
16418 if (stat (l1_filename
, &l1_stat
) == -1)
16420 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16425 if (S_ISREG (l1_stat
.st_mode
))
16427 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16431 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16436 local_free (dictionary_files
);
16442 log_error ("ERROR: No usable dictionary file found.");
16451 uint mask_min
= increment_min
; // we can't reject smaller masks here
16452 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16454 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16456 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16458 if (cur_mask
== NULL
) break;
16460 masks
[maskcnt
] = cur_mask
;
16464 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16468 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16470 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16474 char *mask
= myargv
[optind
+ 1 + 0];
16478 masks
= (char **) mymalloc (1 * sizeof (char *));
16482 struct stat file_stat
;
16484 if (stat (mask
, &file_stat
) == -1)
16488 masks
[maskcnt
- 1] = mystrdup (mask
);
16492 uint is_file
= S_ISREG (file_stat
.st_mode
);
16498 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16500 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16505 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16507 uint masks_avail
= 1;
16509 while (!feof (mask_fp
))
16511 memset (line_buf
, 0, HCBUFSIZ
);
16513 int line_len
= fgetl (mask_fp
, line_buf
);
16515 if (line_len
== 0) continue;
16517 if (line_buf
[0] == '#') continue;
16519 if (masks_avail
== maskcnt
)
16521 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16523 masks_avail
+= INCR_MASKS
;
16526 masks
[maskcnt
] = mystrdup (line_buf
);
16535 mask_from_file
= 1;
16541 masks
[maskcnt
- 1] = mystrdup (mask
);
16547 int wls_left
= myargc
- (optind
+ 2);
16549 for (int i
= 0; i
< wls_left
; i
++)
16551 char *filename
= myargv
[optind
+ 2 + i
];
16553 struct stat file_stat
;
16555 if (stat (filename
, &file_stat
) == -1)
16557 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16562 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16566 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16570 dictfiles
[dictcnt
- 1] = filename
;
16574 // do not allow --keyspace w/ a directory
16578 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16583 char **dictionary_files
= NULL
;
16585 dictionary_files
= scan_directory (filename
);
16587 if (dictionary_files
!= NULL
)
16589 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16591 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16593 char *l1_filename
= dictionary_files
[d
];
16595 struct stat l1_stat
;
16597 if (stat (l1_filename
, &l1_stat
) == -1)
16599 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16604 if (S_ISREG (l1_stat
.st_mode
))
16606 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16610 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16615 local_free (dictionary_files
);
16621 log_error ("ERROR: No usable dictionary file found.");
16630 uint mask_min
= increment_min
; // we can't reject smaller masks here
16631 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16633 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16635 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16637 if (cur_mask
== NULL
) break;
16639 masks
[maskcnt
] = cur_mask
;
16643 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16648 data
.pw_min
= pw_min
;
16649 data
.pw_max
= pw_max
;
16655 if (weak_hash_threshold
>= salts_cnt
)
16657 hc_device_param_t
*device_param
= NULL
;
16659 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16661 device_param
= &data
.devices_param
[device_id
];
16663 if (device_param
->skipped
) continue;
16668 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16670 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16672 weak_hash_check (device_param
, salt_pos
);
16675 // Display hack, guarantee that there is at least one \r before real start
16677 //if (data.quiet == 0) log_info ("");
16681 * status and monitor threads
16684 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16686 hc_thread_t i_thread
= 0;
16688 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16690 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16693 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16695 uint ni_threads_cnt
= 0;
16697 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16699 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16709 if (outfile_check_timer
!= 0)
16711 if (data
.outfile_check_directory
!= NULL
)
16713 if ((hash_mode
!= 5200) &&
16714 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16715 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16716 (hash_mode
!= 9000))
16718 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16724 outfile_check_timer
= 0;
16729 outfile_check_timer
= 0;
16735 * Inform the user if we got some hashes remove because of the pot file remove feature
16738 if (data
.quiet
== 0)
16740 if (potfile_remove_cracks
> 0)
16742 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16743 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16747 data
.outfile_check_timer
= outfile_check_timer
;
16753 char **induction_dictionaries
= NULL
;
16755 int induction_dictionaries_cnt
= 0;
16757 hcstat_table_t
*root_table_buf
= NULL
;
16758 hcstat_table_t
*markov_table_buf
= NULL
;
16760 uint initial_restore_done
= 0;
16762 data
.maskcnt
= maskcnt
;
16764 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16766 if (data
.devices_status
== STATUS_CRACKED
) break;
16768 data
.devices_status
= STATUS_INIT
;
16770 if (maskpos
> rd
->maskpos
)
16775 rd
->maskpos
= maskpos
;
16776 data
.maskpos
= maskpos
;
16778 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16780 char *mask
= masks
[maskpos
];
16782 if (mask_from_file
== 1)
16784 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16789 uint mask_offset
= 0;
16791 uint separator_cnt
;
16793 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16795 str_ptr
= strstr (mask
+ mask_offset
, ",");
16797 if (str_ptr
== NULL
) break;
16799 str_pos
= str_ptr
- mask
;
16801 // escaped separator, i.e. "\,"
16805 if (mask
[str_pos
- 1] == '\\')
16809 mask_offset
= str_pos
+ 1;
16815 // reset the offset
16819 mask
[str_pos
] = '\0';
16821 switch (separator_cnt
)
16824 mp_reset_usr (mp_usr
, 0);
16826 custom_charset_1
= mask
;
16827 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16831 mp_reset_usr (mp_usr
, 1);
16833 custom_charset_2
= mask
;
16834 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16838 mp_reset_usr (mp_usr
, 2);
16840 custom_charset_3
= mask
;
16841 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16845 mp_reset_usr (mp_usr
, 3);
16847 custom_charset_4
= mask
;
16848 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16852 mask
= mask
+ str_pos
+ 1;
16856 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16860 local_free (css_buf
);
16861 local_free (data
.root_css_buf
);
16862 local_free (data
.markov_css_buf
);
16864 local_free (masks
[maskpos
- 1]);
16867 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16870 data
.css_cnt
= css_cnt
;
16871 data
.css_buf
= css_buf
;
16873 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16875 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16877 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16878 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16880 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16882 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16884 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16885 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16887 data
.root_css_buf
= root_css_buf
;
16888 data
.markov_css_buf
= markov_css_buf
;
16890 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16892 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16894 local_free (root_table_buf
);
16895 local_free (markov_table_buf
);
16899 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16901 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16903 if (device_param
->skipped
) continue;
16905 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16906 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16907 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16909 device_param
->kernel_params_mp_buf64
[3] = 0;
16910 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16911 device_param
->kernel_params_mp_buf32
[5] = 0;
16912 device_param
->kernel_params_mp_buf32
[6] = 0;
16913 device_param
->kernel_params_mp_buf32
[7] = 0;
16915 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16917 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16918 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16919 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16920 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16922 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16924 device_param
->kernel_params_mp_buf32
[5] = 0;
16925 device_param
->kernel_params_mp_buf32
[6] = 0;
16926 device_param
->kernel_params_mp_buf32
[7] = 0;
16929 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
]);
16930 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
]);
16931 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
]);
16933 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
);
16934 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
);
16937 else if (attack_mode
== ATTACK_MODE_BF
)
16939 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16943 for (uint i
= 0; i
< dictcnt
; i
++)
16945 local_free (dictfiles
[i
]);
16948 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16950 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16952 if (l1_filename
== NULL
) break;
16956 dictfiles
[dictcnt
- 1] = l1_filename
;
16963 dictfiles
[dictcnt
- 1] = mask
;
16968 log_error ("ERROR: Mask is too small");
16975 free (induction_dictionaries
);
16977 // induction_dictionaries_cnt = 0; // implied
16979 if (attack_mode
!= ATTACK_MODE_BF
)
16983 induction_dictionaries
= scan_directory (induction_directory
);
16985 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16989 if (induction_dictionaries_cnt
)
16991 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16995 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16999 if ((maskcnt
> 1) || (dictcnt
> 1))
17001 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
17007 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
17009 char *subid
= logfile_generate_subid ();
17011 data
.subid
= subid
;
17013 logfile_sub_msg ("START");
17015 data
.devices_status
= STATUS_INIT
;
17017 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17018 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17019 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17021 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17025 data
.cpt_start
= time (NULL
);
17027 data
.cpt_total
= 0;
17029 if (data
.restore
== 0)
17031 rd
->words_cur
= skip
;
17038 data
.ms_paused
= 0;
17040 data
.kernel_power_div
= 0;
17042 data
.words_cur
= rd
->words_cur
;
17044 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17046 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17048 if (device_param
->skipped
) continue;
17050 device_param
->speed_pos
= 0;
17052 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17053 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17055 device_param
->exec_pos
= 0;
17057 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17059 device_param
->outerloop_pos
= 0;
17060 device_param
->outerloop_left
= 0;
17061 device_param
->innerloop_pos
= 0;
17062 device_param
->innerloop_left
= 0;
17064 // some more resets:
17066 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17068 device_param
->pws_cnt
= 0;
17070 device_param
->words_off
= 0;
17071 device_param
->words_done
= 0;
17074 // figure out some workload
17076 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17078 if (data
.wordlist_mode
== WL_MODE_FILE
)
17080 char *dictfile
= NULL
;
17082 if (induction_dictionaries_cnt
)
17084 dictfile
= induction_dictionaries
[0];
17088 dictfile
= dictfiles
[dictpos
];
17091 data
.dictfile
= dictfile
;
17093 logfile_sub_string (dictfile
);
17095 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17097 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17100 FILE *fd2
= fopen (dictfile
, "rb");
17104 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17109 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17113 if (data
.words_cnt
== 0)
17115 if (data
.devices_status
== STATUS_CRACKED
) break;
17116 if (data
.devices_status
== STATUS_ABORTED
) break;
17124 else if (attack_mode
== ATTACK_MODE_COMBI
)
17126 char *dictfile
= data
.dictfile
;
17127 char *dictfile2
= data
.dictfile2
;
17129 logfile_sub_string (dictfile
);
17130 logfile_sub_string (dictfile2
);
17132 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17134 FILE *fd2
= fopen (dictfile
, "rb");
17138 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17143 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17147 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17149 FILE *fd2
= fopen (dictfile2
, "rb");
17153 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17158 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17163 if (data
.words_cnt
== 0)
17165 if (data
.devices_status
== STATUS_CRACKED
) break;
17166 if (data
.devices_status
== STATUS_ABORTED
) break;
17173 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17175 char *dictfile
= NULL
;
17177 if (induction_dictionaries_cnt
)
17179 dictfile
= induction_dictionaries
[0];
17183 dictfile
= dictfiles
[dictpos
];
17186 data
.dictfile
= dictfile
;
17188 char *mask
= data
.mask
;
17190 logfile_sub_string (dictfile
);
17191 logfile_sub_string (mask
);
17193 FILE *fd2
= fopen (dictfile
, "rb");
17197 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17202 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17206 if (data
.words_cnt
== 0)
17208 if (data
.devices_status
== STATUS_CRACKED
) break;
17209 if (data
.devices_status
== STATUS_ABORTED
) break;
17216 else if (attack_mode
== ATTACK_MODE_BF
)
17218 local_free (css_buf
);
17219 local_free (data
.root_css_buf
);
17220 local_free (data
.markov_css_buf
);
17222 char *mask
= dictfiles
[dictpos
];
17224 logfile_sub_string (mask
);
17228 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17230 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17232 uint css_cnt_unicode
= css_cnt
* 2;
17234 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17236 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17238 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17240 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17241 css_buf_unicode
[j
+ 1].cs_len
= 1;
17246 css_buf
= css_buf_unicode
;
17247 css_cnt
= css_cnt_unicode
;
17250 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17252 uint mask_min
= pw_min
;
17253 uint mask_max
= pw_max
;
17255 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17261 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17263 if (css_cnt
< mask_min
)
17265 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17268 if (css_cnt
> mask_max
)
17270 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17273 // skip to next mask
17277 rd
->dictpos
= dictpos
;
17279 logfile_sub_msg ("STOP");
17284 uint save_css_cnt
= css_cnt
;
17286 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17288 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17290 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17291 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17293 uint css_cnt_salt
= css_cnt
+ salt_len
;
17295 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17297 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17299 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17301 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17302 css_buf_salt
[j
].cs_len
= 1;
17307 css_buf
= css_buf_salt
;
17308 css_cnt
= css_cnt_salt
;
17313 data
.css_cnt
= css_cnt
;
17314 data
.css_buf
= css_buf
;
17316 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17318 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17320 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17322 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17323 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17325 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17327 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17329 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17330 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17332 data
.root_css_buf
= root_css_buf
;
17333 data
.markov_css_buf
= markov_css_buf
;
17335 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17337 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17339 local_free (root_table_buf
);
17340 local_free (markov_table_buf
);
17344 uint css_cnt_l
= css_cnt
;
17347 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17349 if (save_css_cnt
< 6)
17353 else if (save_css_cnt
== 6)
17359 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17361 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17372 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17387 /* unfinished code?
17388 int sum = css_buf[css_cnt_r - 1].cs_len;
17390 for (uint i = 1; i < 4 && i < css_cnt; i++)
17392 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17396 sum *= css_buf[css_cnt_r - 1].cs_len;
17401 css_cnt_l
-= css_cnt_r
;
17403 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17405 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17407 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17409 if (device_param
->skipped
) continue;
17411 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17412 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17413 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17415 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17416 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17417 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17418 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17419 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17420 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17422 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17423 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17424 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17425 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17427 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17428 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17429 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17431 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17432 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17433 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17434 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17435 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17437 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
]);
17438 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
]);
17439 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
]);
17441 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
]);
17442 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
]);
17443 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
]);
17445 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
);
17446 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
);
17450 u64 words_base
= data
.words_cnt
;
17452 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17454 if (data
.kernel_rules_cnt
)
17456 words_base
/= data
.kernel_rules_cnt
;
17459 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17461 if (data
.combs_cnt
)
17463 words_base
/= data
.combs_cnt
;
17466 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17470 words_base
/= data
.bfs_cnt
;
17474 data
.words_base
= words_base
;
17478 log_info ("%llu", (unsigned long long int) words_base
);
17483 if (data
.words_cur
> data
.words_base
)
17485 log_error ("ERROR: restore value greater keyspace");
17490 if (data
.words_cur
)
17492 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17494 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17496 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17499 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17501 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17503 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17506 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17508 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17510 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17516 * Update loopback file
17525 uint random_num
= get_random_num (0, 9999);
17527 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17529 data
.loopback_file
= loopback_file
;
17533 * Update dictionary statistic
17538 dictstat_fp
= fopen (dictstat
, "wb");
17542 lock_file (dictstat_fp
);
17544 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17546 fclose (dictstat_fp
);
17550 data
.devices_status
= STATUS_RUNNING
;
17552 if (initial_restore_done
== 0)
17554 if (data
.restore_disable
== 0) cycle_restore ();
17556 initial_restore_done
= 1;
17559 hc_timer_set (&data
.timer_running
);
17561 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17563 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17565 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17566 if (quiet
== 0) fflush (stdout
);
17569 else if (wordlist_mode
== WL_MODE_STDIN
)
17571 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17572 if (data
.quiet
== 0) log_info ("");
17576 * create autotune threads
17579 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17581 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17583 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17585 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
17588 hc_thread_wait (data
.devices_cnt
, c_threads
);
17591 * Inform user about possible slow speeds
17594 uint kernel_power_all
= 0;
17596 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17598 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17600 kernel_power_all
+= device_param
->kernel_power
;
17603 data
.kernel_power_all
= kernel_power_all
;
17605 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17607 if (data
.words_base
< kernel_power_all
)
17611 log_info ("ATTENTION!");
17612 log_info (" The wordlist or mask you are using is too small.");
17613 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17614 log_info (" The cracking speed will drop.");
17615 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17622 * create cracker threads
17625 time_t runtime_start
;
17627 time (&runtime_start
);
17629 data
.runtime_start
= runtime_start
;
17631 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17633 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17635 if (wordlist_mode
== WL_MODE_STDIN
)
17637 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17641 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17645 hc_thread_wait (data
.devices_cnt
, c_threads
);
17647 local_free (c_threads
);
17653 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17655 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17657 if (data
.devices_status
== STATUS_CRACKED
) break;
17658 if (data
.devices_status
== STATUS_ABORTED
) break;
17660 if (data
.devices_status
== STATUS_BYPASS
)
17662 data
.devices_status
= STATUS_RUNNING
;
17665 if (induction_dictionaries_cnt
)
17667 unlink (induction_dictionaries
[0]);
17670 free (induction_dictionaries
);
17672 if (attack_mode
!= ATTACK_MODE_BF
)
17674 induction_dictionaries
= scan_directory (induction_directory
);
17676 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17679 if (benchmark
== 0)
17681 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17683 if (quiet
== 0) clear_prompt ();
17685 if (quiet
== 0) log_info ("");
17693 if (quiet
== 0) status_display ();
17696 if (quiet
== 0) log_info ("");
17700 if (attack_mode
== ATTACK_MODE_BF
)
17704 rd
->dictpos
= dictpos
;
17708 if (induction_dictionaries_cnt
)
17710 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17716 rd
->dictpos
= dictpos
;
17720 time_t runtime_stop
;
17722 time (&runtime_stop
);
17724 data
.runtime_stop
= runtime_stop
;
17726 logfile_sub_uint (runtime_start
);
17727 logfile_sub_uint (runtime_stop
);
17729 logfile_sub_msg ("STOP");
17731 global_free (subid
);
17734 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17736 if (data
.devices_status
== STATUS_CRACKED
) break;
17737 if (data
.devices_status
== STATUS_ABORTED
) break;
17738 if (data
.devices_status
== STATUS_QUIT
) break;
17740 if (data
.devices_status
== STATUS_BYPASS
)
17742 data
.devices_status
= STATUS_RUNNING
;
17746 // 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
17748 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17750 if (data
.wordlist_mode
== WL_MODE_FILE
)
17752 if (data
.dictfile
== NULL
)
17754 if (dictfiles
!= NULL
)
17756 data
.dictfile
= dictfiles
[0];
17758 hc_timer_set (&data
.timer_running
);
17763 // NOTE: combi is okay because it is already set beforehand
17764 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17766 if (data
.dictfile
== NULL
)
17768 if (dictfiles
!= NULL
)
17770 hc_timer_set (&data
.timer_running
);
17772 data
.dictfile
= dictfiles
[0];
17776 else if (attack_mode
== ATTACK_MODE_BF
)
17778 if (data
.mask
== NULL
)
17780 hc_timer_set (&data
.timer_running
);
17782 data
.mask
= masks
[0];
17786 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17788 data
.devices_status
= STATUS_EXHAUSTED
;
17791 // if cracked / aborted remove last induction dictionary
17793 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17795 struct stat induct_stat
;
17797 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17799 unlink (induction_dictionaries
[file_pos
]);
17803 // wait for non-interactive threads
17805 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17807 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17810 local_free (ni_threads
);
17812 // wait for interactive threads
17814 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17816 hc_thread_wait (1, &i_thread
);
17819 // we dont need restore file anymore
17820 if (data
.restore_disable
== 0)
17822 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17824 unlink (eff_restore_file
);
17825 unlink (new_restore_file
);
17833 // finally save left hashes
17835 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17844 if (benchmark
== 1)
17846 status_benchmark ();
17848 if (machine_readable
== 0)
17855 if (quiet
== 0) clear_prompt ();
17857 if (quiet
== 0) log_info ("");
17865 if (quiet
== 0) status_display ();
17868 if (quiet
== 0) log_info ("");
17871 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17873 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17875 if (device_param
->skipped
) continue;
17877 local_free (device_param
->combs_buf
);
17879 local_free (device_param
->hooks_buf
);
17881 local_free (device_param
->device_name
);
17883 local_free (device_param
->device_name_chksum
);
17885 local_free (device_param
->device_version
);
17887 local_free (device_param
->driver_version
);
17889 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17890 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17891 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17892 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17893 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17894 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17895 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17896 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17897 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17898 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17899 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17900 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17901 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17902 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17903 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17904 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17905 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17906 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17907 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17908 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17909 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17910 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17911 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17912 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17913 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17914 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17915 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17916 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17917 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17919 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17920 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17921 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17922 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17923 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17924 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17925 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17926 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17927 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17928 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17929 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17931 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17932 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17933 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17935 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17936 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17939 // reset default fan speed
17942 if (gpu_temp_disable
== 0)
17944 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17946 hc_thread_mutex_lock (mux_adl
);
17948 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17950 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17952 if (device_param
->skipped
) continue;
17954 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
17956 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17957 int fanpolicy
= temp_retain_fanpolicy_value
[device_id
];
17959 if (fanpolicy
== 1)
17963 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17965 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 0);
17967 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17972 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
17977 hc_thread_mutex_unlock (mux_adl
);
17981 // reset power tuning
17983 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17985 hc_thread_mutex_lock (mux_adl
);
17987 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17989 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17991 if (device_param
->skipped
) continue;
17993 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
17995 if (data
.hm_device
[device_id
].od_version
== 6)
17997 // check powertune capabilities first, if not available then skip device
17999 int powertune_supported
= 0;
18001 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, &powertune_supported
)) != ADL_OK
)
18003 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
18008 if (powertune_supported
!= 0)
18010 // powercontrol settings
18012 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, od_power_control_status
[device_id
])) != ADL_OK
)
18014 log_info ("ERROR: Failed to restore the ADL PowerControl values");
18021 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
18023 performance_state
->iNumberOfPerformanceLevels
= 2;
18025 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
18026 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
18027 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
18028 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
18030 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adapter_index
.adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
18032 log_info ("ERROR: Failed to restore ADL performance state");
18037 local_free (performance_state
);
18042 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
18044 unsigned int limit
= nvml_power_limit
[device_id
];
18048 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].adapter_index
.nvml
, limit
);
18053 hc_thread_mutex_unlock (mux_adl
);
18056 if (gpu_temp_disable
== 0)
18060 hm_NVML_nvmlShutdown (data
.hm_nvml
);
18062 nvml_close (data
.hm_nvml
);
18064 data
.hm_nvml
= NULL
;
18069 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
18071 adl_close (data
.hm_adl
);
18073 data
.hm_adl
= NULL
;
18076 #endif // HAVE_HWMON
18080 local_free (masks
);
18082 local_free (dictstat_base
);
18084 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18086 pot_t
*pot_ptr
= &pot
[pot_pos
];
18088 hash_t
*hash
= &pot_ptr
->hash
;
18090 local_free (hash
->digest
);
18094 local_free (hash
->salt
);
18100 local_free (all_kernel_rules_cnt
);
18101 local_free (all_kernel_rules_buf
);
18103 local_free (wl_data
->buf
);
18104 local_free (wl_data
);
18106 local_free (bitmap_s1_a
);
18107 local_free (bitmap_s1_b
);
18108 local_free (bitmap_s1_c
);
18109 local_free (bitmap_s1_d
);
18110 local_free (bitmap_s2_a
);
18111 local_free (bitmap_s2_b
);
18112 local_free (bitmap_s2_c
);
18113 local_free (bitmap_s2_d
);
18116 local_free (temp_retain_fanspeed_value
);
18117 local_free (od_clock_mem_status
);
18118 local_free (od_power_control_status
);
18119 local_free (nvml_power_limit
);
18122 global_free (devices_param
);
18124 global_free (kernel_rules_buf
);
18126 global_free (root_css_buf
);
18127 global_free (markov_css_buf
);
18129 global_free (digests_buf
);
18130 global_free (digests_shown
);
18131 global_free (digests_shown_tmp
);
18133 global_free (salts_buf
);
18134 global_free (salts_shown
);
18136 global_free (esalts_buf
);
18138 global_free (words_progress_done
);
18139 global_free (words_progress_rejected
);
18140 global_free (words_progress_restored
);
18142 if (pot_fp
) fclose (pot_fp
);
18144 if (data
.devices_status
== STATUS_QUIT
) break;
18147 // destroy others mutex
18149 hc_thread_mutex_delete (mux_dispatcher
);
18150 hc_thread_mutex_delete (mux_counter
);
18151 hc_thread_mutex_delete (mux_display
);
18152 hc_thread_mutex_delete (mux_adl
);
18156 local_free (eff_restore_file
);
18157 local_free (new_restore_file
);
18163 tuning_db_destroy (tuning_db
);
18167 local_free (loopback_file
);
18169 if (loopback
== 1) unlink (loopback_file
);
18171 // induction directory
18173 if (induction_dir
== NULL
)
18175 if (attack_mode
!= ATTACK_MODE_BF
)
18177 if (rmdir (induction_directory
) == -1)
18179 if (errno
== ENOENT
)
18181 // good, we can ignore
18183 else if (errno
== ENOTEMPTY
)
18185 // good, we can ignore
18189 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18195 local_free (induction_directory
);
18199 // outfile-check directory
18201 if (outfile_check_dir
== NULL
)
18203 if (rmdir (outfile_check_directory
) == -1)
18205 if (errno
== ENOENT
)
18207 // good, we can ignore
18209 else if (errno
== ENOTEMPTY
)
18211 // good, we can ignore
18215 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18221 local_free (outfile_check_directory
);
18228 logfile_top_uint (proc_start
);
18229 logfile_top_uint (proc_stop
);
18231 logfile_top_msg ("STOP");
18233 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18234 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18236 if (data
.ocl
) ocl_close (data
.ocl
);
18238 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18239 if (data
.devices_status
== STATUS_QUIT
) return 2;
18240 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18241 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18242 if (data
.devices_status
== STATUS_CRACKED
) return 0;