2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 70
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
318 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
324 static unsigned int full01
= 0x01010101;
325 static unsigned int full80
= 0x80808080;
327 int SUPPRESS_OUTPUT
= 0;
329 hc_thread_mutex_t mux_adl
;
330 hc_thread_mutex_t mux_counter
;
331 hc_thread_mutex_t mux_dispatcher
;
332 hc_thread_mutex_t mux_display
;
334 hc_global_data_t data
;
336 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
338 const char *USAGE_MINI
[] =
340 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
342 "Try --help for more help.",
346 const char *USAGE_BIG
[] =
348 "%s, advanced password recovery",
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
354 " Options Short / Long | Type | Description | Example",
355 "===============================|======|======================================================|=======================",
356 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
357 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
358 " -V, --version | | Print version |",
359 " -h, --help | | Print help |",
360 " --quiet | | Suppress output |",
361 " --hex-charset | | Assume charset is given in hex |",
362 " --hex-salt | | Assume salt is given in hex |",
363 " --hex-wordlist | | Assume words in wordlist is given in hex |",
364 " --force | | Ignore warnings |",
365 " --status | | Enable automatic update of the status-screen |",
366 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
367 " --machine-readable | | Display the status view in a machine readable format |",
368 " --loopback | | Add new plains to induct directory |",
369 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
370 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
371 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
372 " --markov-classic | | Enables classic markov-chains, no per-position |",
373 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
374 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
375 " --session | Str | Define specific session name | --session=mysession",
376 " --restore | | Restore session from --session |",
377 " --restore-disable | | Do not write restore file |",
378 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
379 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
380 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
381 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
382 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
383 " --show | | Show cracked passwords only |",
384 " --left | | Show un-cracked passwords only |",
385 " --username | | Enable ignoring of usernames in hashfile |",
386 " --remove | | Enable remove of hash once it is cracked |",
387 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
388 " --potfile-disable | | Do not write potfile |",
389 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
390 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
391 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
392 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
393 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
394 " --logfile-disable | | Disable the logfile |",
395 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
396 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
397 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
398 " -b, --benchmark | | Run benchmark |",
399 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
400 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
401 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
402 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
403 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
404 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
405 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
406 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
407 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
408 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
409 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
410 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
412 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
413 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
415 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
418 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
419 " -s, --skip | Num | Skip X words from the start | -s 1000000",
420 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
421 " --keyspace | | Show keyspace base:mod values and quit |",
422 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
423 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
424 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
425 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
426 " --generate-rules-func-min | Num | Force min X funcs per rule |",
427 " --generate-rules-func-max | Num | Force max X funcs per rule |",
428 " --generate-rules-seed | Num | Force RNG seed set to X |",
429 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
430 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
431 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
432 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
433 " -i, --increment | | Enable mask increment mode |",
434 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
435 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
437 "- [ Hash modes ] -",
439 " # | Name | Category",
440 " ======+==================================================+======================================",
441 " 900 | MD4 | Raw Hash",
442 " 0 | MD5 | Raw Hash",
443 " 5100 | Half MD5 | Raw Hash",
444 " 100 | SHA1 | Raw Hash",
445 " 10800 | SHA-384 | Raw Hash",
446 " 1400 | SHA-256 | Raw Hash",
447 " 1700 | SHA-512 | Raw Hash",
448 " 5000 | SHA-3(Keccak) | Raw Hash",
449 " 10100 | SipHash | Raw Hash",
450 " 6000 | RipeMD160 | Raw Hash",
451 " 6100 | Whirlpool | Raw Hash",
452 " 6900 | GOST R 34.11-94 | Raw Hash",
453 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
454 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
455 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
456 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
457 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
458 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
459 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
461 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
462 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
463 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
464 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
465 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
466 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
467 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
469 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
470 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
471 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
480 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
481 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
482 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
483 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
484 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
485 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
486 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
487 " 400 | phpass | Generic KDF",
488 " 8900 | scrypt | Generic KDF",
489 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
490 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
491 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
492 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
493 " 23 | Skype | Network protocols",
494 " 2500 | WPA/WPA2 | Network protocols",
495 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
496 " 5300 | IKE-PSK MD5 | Network protocols",
497 " 5400 | IKE-PSK SHA1 | Network protocols",
498 " 5500 | NetNTLMv1 | Network protocols",
499 " 5500 | NetNTLMv1 + ESS | Network protocols",
500 " 5600 | NetNTLMv2 | Network protocols",
501 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
502 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
503 " 8300 | DNSSEC (NSEC3) | Network protocols",
504 " 10200 | Cram MD5 | Network protocols",
505 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
506 " 11200 | MySQL CRAM (SHA1) | Network protocols",
507 " 11400 | SIP digest authentication (MD5) | Network protocols",
508 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
509 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
510 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
511 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
512 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
513 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
514 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
515 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
516 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
517 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
518 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
519 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
520 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
521 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
522 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
523 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
524 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
525 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
526 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
527 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
528 " 12 | PostgreSQL | Database Server",
529 " 131 | MSSQL(2000) | Database Server",
530 " 132 | MSSQL(2005) | Database Server",
531 " 1731 | MSSQL(2012) | Database Server",
532 " 1731 | MSSQL(2014) | Database Server",
533 " 200 | MySQL323 | Database Server",
534 " 300 | MySQL4.1/MySQL5 | Database Server",
535 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
536 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
537 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
538 " 8000 | Sybase ASE | Database Server",
539 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
540 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
541 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
542 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
543 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
544 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
545 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
546 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
547 " 11500 | CRC32 | Checksums",
548 " 3000 | LM | Operating-Systems",
549 " 1000 | NTLM | Operating-Systems",
550 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
551 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
552 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
553 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
554 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
555 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
556 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
557 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
558 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
559 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
560 " 1722 | OSX v10.7 | Operating-Systems",
561 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
562 " 6300 | AIX {smd5} | Operating-Systems",
563 " 6700 | AIX {ssha1} | Operating-Systems",
564 " 6400 | AIX {ssha256} | Operating-Systems",
565 " 6500 | AIX {ssha512} | Operating-Systems",
566 " 2400 | Cisco-PIX | Operating-Systems",
567 " 2410 | Cisco-ASA | Operating-Systems",
568 " 500 | Cisco-IOS $1$ | Operating-Systems",
569 " 5700 | Cisco-IOS $4$ | Operating-Systems",
570 " 9200 | Cisco-IOS $8$ | Operating-Systems",
571 " 9300 | Cisco-IOS $9$ | Operating-Systems",
572 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
573 " 501 | Juniper IVE | Operating-Systems",
574 " 5800 | Android PIN | Operating-Systems",
575 " 8100 | Citrix Netscaler | Operating-Systems",
576 " 8500 | RACF | Operating-Systems",
577 " 7200 | GRUB 2 | Operating-Systems",
578 " 9900 | Radmin2 | Operating-Systems",
579 " 125 | ArubaOS | Operating-Systems",
580 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
581 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
582 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
583 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
584 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
585 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
586 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
587 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
588 " 11600 | 7-Zip | Archives",
589 " 12500 | RAR3-hp | Archives",
590 " 13000 | RAR5 | Archives",
591 " 13200 | AxCrypt | Archives",
592 " 13300 | AxCrypt in memory SHA1 | Archives",
593 " 13600 | WinZip | Archives",
594 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
595 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
596 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
597 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
598 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
600 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
601 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
608 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
609 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
610 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
611 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
612 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
613 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
614 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
615 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
616 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
617 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
618 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
628 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
629 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
630 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
631 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
632 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
633 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
634 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
635 " 9400 | MS Office 2007 | Documents",
636 " 9500 | MS Office 2010 | Documents",
637 " 9600 | MS Office 2013 | Documents",
638 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
639 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
640 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
641 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
642 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
643 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
644 " 9000 | Password Safe v2 | Password Managers",
645 " 5200 | Password Safe v3 | Password Managers",
646 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
647 " 6600 | 1Password, agilekeychain | Password Managers",
648 " 8200 | 1Password, cloudkeychain | Password Managers",
649 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
650 " 12700 | Blockchain, My Wallet | Password Managers",
651 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
653 "- [ Outfile Formats ] -",
659 " 3 | hash[:salt]:plain",
661 " 5 | hash[:salt]:hex_plain",
662 " 6 | plain:hex_plain",
663 " 7 | hash[:salt]:plain:hex_plain",
665 " 9 | hash[:salt]:crack_pos",
666 " 10 | plain:crack_pos",
667 " 11 | hash[:salt]:plain:crack_pos",
668 " 12 | hex_plain:crack_pos",
669 " 13 | hash[:salt]:hex_plain:crack_pos",
670 " 14 | plain:hex_plain:crack_pos",
671 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
673 "- [ Rule Debugging Modes ] -",
678 " 2 | Original-Word",
679 " 3 | Original-Word:Finding-Rule",
680 " 4 | Original-Word:Finding-Rule:Processed-Word",
682 "- [ Attack Modes ] -",
689 " 6 | Hybrid Wordlist + Mask",
690 " 7 | Hybrid Mask + Wordlist",
692 "- [ Built-in Charsets ] -",
696 " l | abcdefghijklmnopqrstuvwxyz",
697 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
699 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
703 "- [ OpenCL Device Types ] -",
706 " ===+=============",
709 " 3 | FPGA, DSP, Co-Processor",
711 "- [ Workload Profiles ] -",
713 " # | Performance | Runtime | Power Consumption | Desktop Impact",
714 " ===+=============+=========+===================+=================",
715 " 1 | Low | 2 ms | Low | Minimal",
716 " 2 | Default | 12 ms | Economic | Noticeable",
717 " 3 | High | 96 ms | High | Unresponsive",
718 " 4 | Nightmare | 480 ms | Insane | Headless",
720 "If you have no idea what just happened then visit the following pages:",
722 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
723 "* https://hashcat.net/wiki/#frequently_asked_questions",
729 * hashcat specific functions
732 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
734 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
736 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
738 double exec_ms_sum
= 0;
742 for (int i
= 0; i
< last_num_entries
; i
++)
744 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
748 exec_ms_sum
+= exec_ms
;
754 if (exec_ms_cnt
== 0) return 0;
756 return exec_ms_sum
/ exec_ms_cnt
;
759 void status_display_machine_readable ()
763 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
769 fprintf (out
, "SPEED\t");
771 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
773 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
775 if (device_param
->skipped
) continue;
780 for (int i
= 0; i
< SPEED_CACHE
; i
++)
782 speed_cnt
+= device_param
->speed_cnt
[i
];
783 speed_ms
+= device_param
->speed_ms
[i
];
786 speed_cnt
/= SPEED_CACHE
;
787 speed_ms
/= SPEED_CACHE
;
789 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
796 fprintf (out
, "EXEC_RUNTIME\t");
798 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
800 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
802 if (device_param
->skipped
) continue;
804 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
806 fprintf (out
, "%f\t", exec_ms_avg
);
813 u64 words_cur
= get_lowest_words_done ();
815 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
821 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
824 u64 all_rejected
= 0;
825 u64 all_restored
= 0;
827 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
829 all_done
+= data
.words_progress_done
[salt_pos
];
830 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
831 all_restored
+= data
.words_progress_restored
[salt_pos
];
834 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
835 u64 progress_end
= progress_total
;
837 u64 progress_skip
= 0;
841 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
843 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
844 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
845 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
850 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
852 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
853 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
854 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
857 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
858 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
860 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
866 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
867 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
874 if (data
.gpu_temp_disable
== 0)
876 fprintf (out
, "TEMP\t");
878 hc_thread_mutex_lock (mux_adl
);
880 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
884 if (device_param
->skipped
) continue;
886 int temp
= hm_get_temperature_with_device_id (device_id
);
888 fprintf (out
, "%d\t", temp
);
891 hc_thread_mutex_unlock (mux_adl
);
911 void status_display ()
913 if (data
.devices_status
== STATUS_INIT
) return;
914 if (data
.devices_status
== STATUS_STARTING
) return;
915 if (data
.devices_status
== STATUS_BYPASS
) return;
917 if (data
.machine_readable
== 1)
919 status_display_machine_readable ();
924 char tmp_buf
[1000] = { 0 };
928 log_info ("Session.Name...: %s", data
.session
);
930 char *status_type
= strstatus (data
.devices_status
);
932 uint hash_mode
= data
.hash_mode
;
934 char *hash_type
= strhashtype (hash_mode
); // not a bug
936 log_info ("Status.........: %s", status_type
);
942 if (data
.rp_files_cnt
)
946 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
948 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
951 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
953 log_info ("Rules.Type.....: %s", tmp_buf
);
960 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
962 if (data
.rp_gen_seed
)
964 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
972 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
974 if (data
.wordlist_mode
== WL_MODE_FILE
)
976 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
978 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
980 log_info ("Input.Mode.....: Pipe");
983 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
985 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
986 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
988 else if (data
.attack_mode
== ATTACK_MODE_BF
)
990 char *mask
= data
.mask
;
994 uint mask_len
= data
.css_cnt
;
996 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1000 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1002 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1004 mask_len
-= data
.salts_buf
[0].salt_len
;
1008 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1010 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1013 if (data
.maskcnt
> 1)
1015 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1017 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1020 log_info ("Input.Mode.....: %s", tmp_buf
);
1025 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1027 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1028 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1030 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1032 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1033 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1036 if (data
.digests_cnt
== 1)
1038 if (data
.hash_mode
== 2500)
1040 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1042 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1043 (char *) data
.salts_buf
[0].salt_buf
,
1057 else if (data
.hash_mode
== 5200)
1059 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1061 else if (data
.hash_mode
== 9000)
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1065 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1069 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1071 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1075 char out_buf
[HCBUFSIZ
] = { 0 };
1077 ascii_digest (out_buf
, 0, 0);
1080 if (strlen (out_buf
) > 40)
1088 log_info ("Hash.Target....: %s", out_buf
);
1093 if (data
.hash_mode
== 3000)
1095 char out_buf1
[32] = { 0 };
1096 char out_buf2
[32] = { 0 };
1098 ascii_digest (out_buf1
, 0, 0);
1099 ascii_digest (out_buf2
, 0, 1);
1101 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1105 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1109 log_info ("Hash.Type......: %s", hash_type
);
1115 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1116 double speed_ms
[DEVICES_MAX
] = { 0 };
1118 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1120 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1122 if (device_param
->skipped
) continue;
1124 speed_cnt
[device_id
] = 0;
1125 speed_ms
[device_id
] = 0;
1127 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1129 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1130 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1133 speed_cnt
[device_id
] /= SPEED_CACHE
;
1134 speed_ms
[device_id
] /= SPEED_CACHE
;
1137 double hashes_all_ms
= 0;
1139 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1141 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1143 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1145 if (device_param
->skipped
) continue;
1147 hashes_dev_ms
[device_id
] = 0;
1149 if (speed_ms
[device_id
])
1151 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1153 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1161 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1163 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1165 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1167 if (device_param
->skipped
) continue;
1169 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1171 exec_all_ms
[device_id
] = exec_ms_avg
;
1178 double ms_running
= 0;
1180 hc_timer_get (data
.timer_running
, ms_running
);
1182 double ms_paused
= data
.ms_paused
;
1184 if (data
.devices_status
== STATUS_PAUSED
)
1186 double ms_paused_tmp
= 0;
1188 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1190 ms_paused
+= ms_paused_tmp
;
1195 __time64_t sec_run
= ms_running
/ 1000;
1199 time_t sec_run
= ms_running
/ 1000;
1205 char display_run
[32] = { 0 };
1209 struct tm
*tmp
= NULL
;
1213 tmp
= _gmtime64 (&sec_run
);
1217 tmp
= gmtime (&sec_run
);
1223 memset (&tm_run
, 0, sizeof (tm_run
));
1225 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1227 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1229 char *start
= ctime (&data
.proc_start
);
1231 size_t start_len
= strlen (start
);
1233 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1234 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1236 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1241 log_info ("Time.Started...: 0 secs");
1248 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1251 u64 all_rejected
= 0;
1252 u64 all_restored
= 0;
1254 u64 progress_noneed
= 0;
1256 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1258 all_done
+= data
.words_progress_done
[salt_pos
];
1259 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1260 all_restored
+= data
.words_progress_restored
[salt_pos
];
1262 // Important for ETA only
1264 if (data
.salts_shown
[salt_pos
] == 1)
1266 const u64 all
= data
.words_progress_done
[salt_pos
]
1267 + data
.words_progress_rejected
[salt_pos
]
1268 + data
.words_progress_restored
[salt_pos
];
1270 const u64 left
= data
.words_cnt
- all
;
1272 progress_noneed
+= left
;
1276 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1277 u64 progress_end
= progress_total
;
1279 u64 progress_skip
= 0;
1283 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1285 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1286 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1287 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1292 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1294 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1295 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1296 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1299 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1300 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1302 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1304 if (data
.devices_status
!= STATUS_CRACKED
)
1307 __time64_t sec_etc
= 0;
1314 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1316 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1318 sec_etc
= ms_left
/ 1000;
1323 //log_info ("Time.Estimated.: 0 secs");
1325 else if ((u64
) sec_etc
> ETC_MAX
)
1327 log_info ("Time.Estimated.: > 10 Years");
1331 char display_etc
[32] = { 0 };
1335 struct tm
*tmp
= NULL
;
1339 tmp
= _gmtime64 (&sec_etc
);
1343 tmp
= gmtime (&sec_etc
);
1349 memset (&tm_etc
, 0, sizeof (tm_etc
));
1351 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1353 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1361 char *etc
= ctime (&now
);
1363 size_t etc_len
= strlen (etc
);
1365 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1366 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1368 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1374 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1376 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1378 if (device_param
->skipped
) continue;
1380 char display_dev_cur
[16] = { 0 };
1382 strncpy (display_dev_cur
, "0.00", 4);
1384 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1386 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1389 char display_all_cur
[16] = { 0 };
1391 strncpy (display_all_cur
, "0.00", 4);
1393 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1395 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1397 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1398 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1400 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1404 if (data
.digests_cnt
> 100)
1406 time_t now
= time (NULL
);
1408 int cpt_cur_min
= 0;
1409 int cpt_cur_hour
= 0;
1410 int cpt_cur_day
= 0;
1412 for (int i
= 0; i
< CPT_BUF
; i
++)
1414 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1415 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1417 if ((timestamp
+ 60) > now
)
1419 cpt_cur_min
+= cracked
;
1422 if ((timestamp
+ 3600) > now
)
1424 cpt_cur_hour
+= cracked
;
1427 if ((timestamp
+ 86400) > now
)
1429 cpt_cur_day
+= cracked
;
1433 double ms_real
= ms_running
- ms_paused
;
1435 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1436 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1437 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1439 if ((data
.cpt_start
+ 86400) < now
)
1441 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1449 else if ((data
.cpt_start
+ 3600) < now
)
1451 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1458 else if ((data
.cpt_start
+ 60) < now
)
1460 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1468 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1477 u64 restore_point
= get_lowest_words_done ();
1479 u64 restore_total
= data
.words_base
;
1481 float percent_restore
= 0;
1483 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1485 if (progress_end_relative_skip
)
1487 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1489 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1490 float percent_rejected
= 0.0;
1494 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1497 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1498 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1500 if (data
.restore_disable
== 0)
1502 if (percent_finished
!= 1)
1504 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1511 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1513 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1516 if (data
.restore_disable
== 0)
1518 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1523 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1524 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1526 // --restore not allowed if stdin is used -- really? why?
1528 //if (data.restore_disable == 0)
1530 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1536 if (data
.gpu_temp_disable
== 0)
1538 hc_thread_mutex_lock (mux_adl
);
1540 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1542 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1544 if (device_param
->skipped
) continue;
1546 #define HM_STR_BUF_SIZE 255
1548 if (data
.hm_device
[device_id
].fan_supported
== 1)
1550 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1551 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1552 char fanspeed
[HM_STR_BUF_SIZE
] = { 0 };
1553 char corespeed
[HM_STR_BUF_SIZE
] = { 0 };
1554 char memoryspeed
[HM_STR_BUF_SIZE
] = { 0 };
1556 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1557 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1558 hm_device_val_to_str ((char *) corespeed
, HM_STR_BUF_SIZE
, "Mhz", hm_get_corespeed_with_device_id (device_id
));
1559 hm_device_val_to_str ((char *) memoryspeed
, HM_STR_BUF_SIZE
, "Mhz", hm_get_memoryspeed_with_device_id (device_id
));
1561 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
1563 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1565 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
1567 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1570 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan, %s Core, %s Mem", device_id
+ 1, utilization
, temperature
, fanspeed
, corespeed
, memoryspeed
);
1574 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1575 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1577 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1578 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1580 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id
+ 1, utilization
, temperature
);
1584 hc_thread_mutex_unlock (mux_adl
);
1586 #endif // HAVE_HWMON
1589 static void status_benchmark_automate ()
1591 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1592 double speed_ms
[DEVICES_MAX
] = { 0 };
1594 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1596 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1598 if (device_param
->skipped
) continue;
1600 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1601 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1604 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1606 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1608 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1610 if (device_param
->skipped
) continue;
1612 hashes_dev_ms
[device_id
] = 0;
1614 if (speed_ms
[device_id
])
1616 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1620 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1622 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1624 if (device_param
->skipped
) continue;
1626 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1630 static void status_benchmark ()
1632 if (data
.devices_status
== STATUS_INIT
) return;
1633 if (data
.devices_status
== STATUS_STARTING
) return;
1634 if (data
.devices_status
== STATUS_BYPASS
) return;
1636 if (data
.machine_readable
== 1)
1638 status_benchmark_automate ();
1643 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1644 double speed_ms
[DEVICES_MAX
] = { 0 };
1646 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1648 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1650 if (device_param
->skipped
) continue;
1652 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1653 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1656 double hashes_all_ms
= 0;
1658 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1660 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1662 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1664 if (device_param
->skipped
) continue;
1666 hashes_dev_ms
[device_id
] = 0;
1668 if (speed_ms
[device_id
])
1670 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1672 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1680 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1682 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1684 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1686 if (device_param
->skipped
) continue;
1688 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1690 exec_all_ms
[device_id
] = exec_ms_avg
;
1693 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1695 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1697 if (device_param
->skipped
) continue;
1699 char display_dev_cur
[16] = { 0 };
1701 strncpy (display_dev_cur
, "0.00", 4);
1703 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1705 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1708 char display_all_cur
[16] = { 0 };
1710 strncpy (display_all_cur
, "0.00", 4);
1712 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1714 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1718 * hashcat -only- functions
1721 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1723 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1725 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1726 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1727 else if (attack_kern
== ATTACK_KERN_COMBI
)
1728 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1729 else if (attack_kern
== ATTACK_KERN_BF
)
1730 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1733 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1736 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
)
1738 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1740 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1741 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1742 else if (attack_kern
== ATTACK_KERN_COMBI
)
1743 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1744 else if (attack_kern
== ATTACK_KERN_BF
)
1745 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1749 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1753 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1755 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1757 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1761 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1765 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
)
1767 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1769 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1773 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1777 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1779 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1782 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1784 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1787 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1789 if (line_len
& 1) return (line_len
); // not in hex
1791 if (data
.hex_wordlist
== 1)
1796 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1798 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1801 memset (line_buf
+ i
, 0, line_len
- i
);
1805 else if (line_len
>= 6) // $HEX[] = 6
1807 if (line_buf
[0] != '$') return (line_len
);
1808 if (line_buf
[1] != 'H') return (line_len
);
1809 if (line_buf
[2] != 'E') return (line_len
);
1810 if (line_buf
[3] != 'X') return (line_len
);
1811 if (line_buf
[4] != '[') return (line_len
);
1812 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1817 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1819 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1822 memset (line_buf
+ i
, 0, line_len
- i
);
1830 static void clear_prompt ()
1832 fputc ('\r', stdout
);
1834 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1836 fputc (' ', stdout
);
1839 fputc ('\r', stdout
);
1844 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1846 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
);
1849 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1851 char *outfile
= data
.outfile
;
1852 uint quiet
= data
.quiet
;
1853 FILE *pot_fp
= data
.pot_fp
;
1854 uint loopback
= data
.loopback
;
1855 uint debug_mode
= data
.debug_mode
;
1856 char *debug_file
= data
.debug_file
;
1858 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1859 int debug_rule_len
= 0; // -1 error
1860 uint debug_plain_len
= 0;
1862 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1866 char out_buf
[HCBUFSIZ
] = { 0 };
1868 const u32 salt_pos
= plain
->salt_pos
;
1869 const u32 digest_pos
= plain
->digest_pos
; // relative
1870 const u32 gidvid
= plain
->gidvid
;
1871 const u32 il_pos
= plain
->il_pos
;
1873 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1877 u64 crackpos
= device_param
->words_off
;
1879 uint plain_buf
[16] = { 0 };
1881 u8
*plain_ptr
= (u8
*) plain_buf
;
1883 unsigned int plain_len
= 0;
1885 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1889 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1891 for (int i
= 0; i
< 16; i
++)
1893 plain_buf
[i
] = pw
.i
[i
];
1896 plain_len
= pw
.pw_len
;
1898 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1905 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1907 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1909 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1913 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1915 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1917 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1919 debug_plain_len
= plain_len
;
1923 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1926 crackpos
*= data
.kernel_rules_cnt
;
1927 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1929 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1931 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1935 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1937 for (int i
= 0; i
< 16; i
++)
1939 plain_buf
[i
] = pw
.i
[i
];
1942 plain_len
= pw
.pw_len
;
1944 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1945 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1947 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1949 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1953 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1955 memcpy (plain_ptr
, comb_buf
, comb_len
);
1958 plain_len
+= comb_len
;
1961 crackpos
*= data
.combs_cnt
;
1962 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1964 if (data
.pw_max
!= PW_DICTMAX1
)
1966 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1969 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1971 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1972 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1974 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1975 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1977 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1978 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1980 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1981 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1983 plain_len
= data
.css_cnt
;
1986 crackpos
*= data
.bfs_cnt
;
1987 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1989 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1993 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1995 for (int i
= 0; i
< 16; i
++)
1997 plain_buf
[i
] = pw
.i
[i
];
2000 plain_len
= pw
.pw_len
;
2002 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2005 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2007 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2009 plain_len
+= start
+ stop
;
2012 crackpos
*= data
.combs_cnt
;
2013 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2015 if (data
.pw_max
!= PW_DICTMAX1
)
2017 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2020 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
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 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2040 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2042 plain_len
+= start
+ stop
;
2045 crackpos
*= data
.combs_cnt
;
2046 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2048 if (data
.pw_max
!= PW_DICTMAX1
)
2050 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2054 if (data
.attack_mode
== ATTACK_MODE_BF
)
2056 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2058 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2060 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2062 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2066 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2068 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2070 plain_ptr
[j
] = plain_ptr
[i
];
2073 plain_len
= plain_len
/ 2;
2078 // if enabled, update also the potfile
2084 fprintf (pot_fp
, "%s:", out_buf
);
2086 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2088 fputc ('\n', pot_fp
);
2092 unlock_file (pot_fp
);
2097 FILE *out_fp
= NULL
;
2099 if (outfile
!= NULL
)
2101 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2103 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2114 if (quiet
== 0) clear_prompt ();
2117 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2119 if (outfile
!= NULL
)
2121 if (out_fp
!= stdout
)
2128 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2130 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2132 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2133 if (quiet
== 0) fflush (stdout
);
2142 char *loopback_file
= data
.loopback_file
;
2146 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2150 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2152 fputc ('\n', fb_fp
);
2158 // (rule) debug mode
2160 // the next check implies that:
2161 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2164 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2166 if (debug_rule_len
< 0) debug_rule_len
= 0;
2168 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2170 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2172 if ((quiet
== 0) && (debug_file
== NULL
))
2174 fprintf (stdout
, "%s", PROMPT
);
2181 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2183 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2187 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2191 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2195 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2197 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
);
2199 uint cpt_cracked
= 0;
2201 for (uint i
= 0; i
< num_cracked
; i
++)
2203 const uint hash_pos
= cracked
[i
].hash_pos
;
2205 if (data
.digests_shown
[hash_pos
] == 1) continue;
2207 hc_thread_mutex_lock (mux_display
);
2209 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2211 data
.digests_shown
[hash_pos
] = 1;
2213 data
.digests_done
++;
2217 salt_buf
->digests_done
++;
2219 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2221 data
.salts_shown
[salt_pos
] = 1;
2227 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2229 hc_thread_mutex_unlock (mux_display
);
2231 check_hash (device_param
, &cracked
[i
]);
2236 if (cpt_cracked
> 0)
2238 hc_thread_mutex_lock (mux_display
);
2240 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2241 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2245 data
.cpt_total
+= cpt_cracked
;
2247 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2249 hc_thread_mutex_unlock (mux_display
);
2252 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2254 // we need to reset cracked state on the device
2255 // otherwise host thinks again and again the hash was cracked
2256 // and returns invalid password each time
2258 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2260 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
);
2265 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2269 static void save_hash ()
2271 char *hashfile
= data
.hashfile
;
2273 char new_hashfile
[256] = { 0 };
2274 char old_hashfile
[256] = { 0 };
2276 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2277 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2279 unlink (new_hashfile
);
2281 char separator
= data
.separator
;
2283 FILE *fp
= fopen (new_hashfile
, "wb");
2287 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2292 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2294 if (data
.salts_shown
[salt_pos
] == 1) continue;
2296 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2298 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2300 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2302 if (data
.digests_shown
[idx
] == 1) continue;
2304 if (data
.hash_mode
!= 2500)
2306 char out_buf
[HCBUFSIZ
] = { 0 };
2308 if (data
.username
== 1)
2310 user_t
*user
= data
.hash_info
[idx
]->user
;
2314 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2316 fputc (separator
, fp
);
2319 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2321 fputs (out_buf
, fp
);
2329 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2331 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2340 unlink (old_hashfile
);
2342 if (rename (hashfile
, old_hashfile
) != 0)
2344 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2351 if (rename (new_hashfile
, hashfile
) != 0)
2353 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2358 unlink (old_hashfile
);
2361 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2363 // function called only in case kernel_power_all > words_left
2365 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2367 kernel_power_div
+= kernel_power_div
/ 100;
2369 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2371 while (kernel_power_new
< total_left
)
2373 kernel_power_div
+= kernel_power_div
/ 100;
2375 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2378 if (data
.quiet
== 0)
2384 log_info ("INFO: approaching final keyspace, workload adjusted");
2387 fprintf (stdout
, "%s", PROMPT
);
2392 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2394 return kernel_power_div
;
2397 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2399 uint num_elements
= num
;
2401 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2402 device_param
->kernel_params_buf32
[31] = num
;
2404 uint kernel_threads
= device_param
->kernel_threads
;
2406 while (num_elements
% kernel_threads
) num_elements
++;
2408 cl_kernel kernel
= NULL
;
2412 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2413 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2414 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2415 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2416 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2419 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2420 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2421 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2422 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2423 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2424 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2425 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2426 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2427 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2428 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2429 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2433 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2435 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2436 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2438 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2442 if (kern_run
== KERN_RUN_2
)
2444 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2446 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2450 while (num_elements
% kernel_threads
) num_elements
++;
2452 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2453 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2455 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2458 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2460 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2464 cl_ulong time_start
;
2467 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2468 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2470 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2472 uint exec_pos
= device_param
->exec_pos
;
2474 device_param
->exec_ms
[exec_pos
] = exec_time
;
2478 if (exec_pos
== EXEC_CACHE
)
2483 device_param
->exec_pos
= exec_pos
;
2486 hc_clReleaseEvent (data
.ocl
, event
);
2488 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2491 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2493 uint num_elements
= num
;
2497 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2498 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2499 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2502 // causes problems with special threads like in bcrypt
2503 // const uint kernel_threads = device_param->kernel_threads;
2505 uint kernel_threads
= device_param
->kernel_threads
;
2507 while (num_elements
% kernel_threads
) num_elements
++;
2509 cl_kernel kernel
= NULL
;
2513 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2514 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2515 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2520 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2521 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2522 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2523 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2524 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2525 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2527 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2528 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2529 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2530 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2531 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2532 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2534 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2535 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2536 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2537 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2538 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2539 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2540 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2544 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2545 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2547 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2549 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2551 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2554 static void run_kernel_tm (hc_device_param_t
*device_param
)
2556 const uint num_elements
= 1024; // fixed
2558 uint kernel_threads
= 32;
2560 cl_kernel kernel
= device_param
->kernel_tm
;
2562 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2563 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2565 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2567 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2569 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2572 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2574 uint num_elements
= num
;
2576 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2577 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2579 // causes problems with special threads like in bcrypt
2580 // const uint kernel_threads = device_param->kernel_threads;
2582 uint kernel_threads
= device_param
->kernel_threads
;
2584 while (num_elements
% kernel_threads
) num_elements
++;
2586 cl_kernel kernel
= device_param
->kernel_amp
;
2588 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2589 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2591 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2592 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2594 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2596 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2598 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2601 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2603 const u32 num16d
= num
/ 16;
2604 const u32 num16m
= num
% 16;
2608 device_param
->kernel_params_memset_buf32
[1] = value
;
2609 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2611 uint kernel_threads
= device_param
->kernel_threads
;
2613 uint num_elements
= num16d
;
2615 while (num_elements
% kernel_threads
) num_elements
++;
2617 cl_kernel kernel
= device_param
->kernel_memset
;
2619 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2620 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2621 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2623 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2624 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2626 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2628 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2630 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2642 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2646 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2648 run_kernel_memset (device_param
, buf
, 0, size
);
2653 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2655 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2657 const cl_uchar zero = 0;
2659 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2664 // NOTE: clEnqueueFillBuffer () always fails with -59
2665 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2666 // How's that possible, OpenCL 1.2 support is advertised??
2667 // We need to workaround...
2669 #define FILLSZ 0x100000
2671 char *tmp = (char *) mymalloc (FILLSZ);
2673 for (size_t i = 0; i < size; i += FILLSZ)
2675 const size_t left = size - i;
2677 const size_t fillsz = MIN (FILLSZ, left);
2679 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2687 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
)
2689 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2691 if (attack_mode
== ATTACK_MODE_BF
)
2693 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2695 const uint size_tm
= 32 * sizeof (bs_word_t
);
2697 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2699 run_kernel_tm (device_param
);
2701 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
);
2705 if (highest_pw_len
< 16)
2707 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2709 else if (highest_pw_len
< 32)
2711 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2715 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2720 run_kernel_amp (device_param
, pws_cnt
);
2722 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2724 if (opts_type
& OPTS_TYPE_HOOK12
)
2726 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2729 uint iter
= salt_buf
->salt_iter
;
2731 uint loop_step
= device_param
->kernel_loops
;
2733 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2735 uint loop_left
= iter
- loop_pos
;
2737 loop_left
= MIN (loop_left
, loop_step
);
2739 device_param
->kernel_params_buf32
[25] = loop_pos
;
2740 device_param
->kernel_params_buf32
[26] = loop_left
;
2742 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2744 if (data
.devices_status
== STATUS_CRACKED
) break;
2745 if (data
.devices_status
== STATUS_ABORTED
) break;
2746 if (data
.devices_status
== STATUS_QUIT
) break;
2752 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2754 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2758 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2760 const u32 speed_pos
= device_param
->speed_pos
;
2762 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2764 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2766 if (data
.benchmark
== 1)
2768 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2772 if (opts_type
& OPTS_TYPE_HOOK23
)
2774 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2776 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
);
2778 // do something with data
2780 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
);
2783 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2787 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2793 else if (rule_len
== 1)
2795 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2801 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2803 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2805 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
);
2807 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2809 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2811 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2813 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2815 for (u32 i
= 0; i
< pws_cnt
; i
++)
2817 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2819 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2824 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2826 for (u32 i
= 0; i
< pws_cnt
; i
++)
2828 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2830 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2837 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2839 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2841 for (u32 i
= 0; i
< pws_cnt
; i
++)
2843 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2845 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2850 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2852 for (u32 i
= 0; i
< pws_cnt
; i
++)
2854 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2856 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2863 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
);
2865 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2867 const u64 off
= device_param
->words_off
;
2869 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2871 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2875 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2877 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2879 device_param
->kernel_params_buf32
[25] = 0;
2880 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2881 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2883 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2885 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2889 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2892 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2894 return exec_ms_prev
;
2897 static void autotune (hc_device_param_t
*device_param
)
2899 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2901 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2902 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2904 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2905 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2907 u32 kernel_accel
= kernel_accel_min
;
2908 u32 kernel_loops
= kernel_loops_min
;
2910 // in this case the user specified a fixed -u and -n on the commandline
2911 // no way to tune anything
2912 // but we need to run a few caching rounds
2914 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2916 try_run (device_param
, kernel_accel
, kernel_loops
);
2917 try_run (device_param
, kernel_accel
, kernel_loops
);
2918 try_run (device_param
, kernel_accel
, kernel_loops
);
2919 try_run (device_param
, kernel_accel
, kernel_loops
);
2921 device_param
->kernel_accel
= kernel_accel
;
2922 device_param
->kernel_loops
= kernel_loops
;
2924 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2926 device_param
->kernel_power
= kernel_power
;
2931 // from here it's clear we are allowed to autotune
2932 // so let's init some fake words
2934 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2936 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2938 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2940 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2944 for (u32 i = 0; i < kernel_power_max; i++)
2946 device_param->pws_buf[i].i[0] = i;
2947 device_param->pws_buf[i].i[1] = 0x01234567;
2948 device_param->pws_buf[i].pw_len = 7;
2951 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);
2953 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2955 run_kernel_amp (device_param, kernel_power_max);
2959 #define VERIFIER_CNT 1
2961 // first find out highest kernel-loops that stays below target_ms
2963 if (kernel_loops_min
< kernel_loops_max
)
2965 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2967 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2969 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2971 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2973 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2976 if (exec_ms
< target_ms
) break;
2980 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2982 #define STEPS_CNT 10
2984 if (kernel_accel_min
< kernel_accel_max
)
2986 for (int i
= 0; i
< STEPS_CNT
; i
++)
2988 const u32 kernel_accel_try
= 1 << i
;
2990 if (kernel_accel_try
< kernel_accel_min
) continue;
2991 if (kernel_accel_try
> kernel_accel_max
) break;
2993 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2995 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2997 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2999 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3002 if (exec_ms
> target_ms
) break;
3004 kernel_accel
= kernel_accel_try
;
3008 // at this point we want to know the actual runtime for the following reason:
3009 // we need a reference for the balancing loop following up, and this
3010 // the balancing loop can have an effect that the creates a new opportunity, for example:
3011 // if the target is 95 ms and the current runtime is 48ms the above loop
3012 // stopped the execution because the previous exec_ms was > 95ms
3013 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3014 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3016 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3018 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3020 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3022 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3025 u32 diff
= kernel_loops
- kernel_accel
;
3027 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3029 u32 kernel_accel_orig
= kernel_accel
;
3030 u32 kernel_loops_orig
= kernel_loops
;
3032 for (u32 f
= 1; f
< 1024; f
++)
3034 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3035 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3037 if (kernel_accel_try
> kernel_accel_max
) break;
3038 if (kernel_loops_try
< kernel_loops_min
) break;
3040 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3042 if (diff_new
> diff
) break;
3046 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3048 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3050 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3052 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3055 if (exec_ms
< exec_ms_pre_final
)
3057 exec_ms_pre_final
= exec_ms
;
3059 kernel_accel
= kernel_accel_try
;
3060 kernel_loops
= kernel_loops_try
;
3065 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3067 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3069 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3071 if (exec_accel_min
>= 1.0)
3073 // this is safe to not overflow kernel_accel_max because of accel_left
3075 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3078 // reset them fake words
3081 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3083 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);
3084 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);
3087 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3089 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3091 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3096 device_param
->exec_pos
= 0;
3098 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3102 device_param
->kernel_accel
= kernel_accel
;
3103 device_param
->kernel_loops
= kernel_loops
;
3105 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3107 device_param
->kernel_power
= kernel_power
;
3111 if (data
.quiet
== 0)
3115 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3116 "Device #%u: autotuned kernel-loops to %u\n",
3117 device_param
->device_id
+ 1, kernel_accel
,
3118 device_param
->device_id
+ 1, kernel_loops
);
3120 fprintf (stdout
, "%s", PROMPT
);
3128 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3130 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3134 uint speed_pos
= device_param
->speed_pos
;
3137 if (device_param
->timer_speed
.tv_sec
== 0)
3139 hc_timer_set (&device_param
->timer_speed
);
3144 if (device_param
->timer_speed
.QuadPart
== 0)
3146 hc_timer_set (&device_param
->timer_speed
);
3150 // find higest password length, this is for optimization stuff
3152 uint highest_pw_len
= 0;
3154 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3157 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3160 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3162 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3163 + device_param
->kernel_params_mp_l_buf32
[5];
3168 uint innerloop_step
= 0;
3169 uint innerloop_cnt
= 0;
3171 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3172 else innerloop_step
= 1;
3174 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3175 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3176 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3178 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3180 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3182 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3184 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3186 if (data
.devices_status
== STATUS_CRACKED
) break;
3187 if (data
.devices_status
== STATUS_ABORTED
) break;
3188 if (data
.devices_status
== STATUS_QUIT
) break;
3189 if (data
.devices_status
== STATUS_BYPASS
) break;
3191 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3193 device_param
->kernel_params_buf32
[24] = salt_pos
;
3194 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3195 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3197 FILE *combs_fp
= device_param
->combs_fp
;
3199 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3206 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3208 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3210 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3212 if (data
.devices_status
== STATUS_CRACKED
) break;
3213 if (data
.devices_status
== STATUS_ABORTED
) break;
3214 if (data
.devices_status
== STATUS_QUIT
) break;
3215 if (data
.devices_status
== STATUS_BYPASS
) break;
3217 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3219 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3221 device_param
->innerloop_pos
= innerloop_pos
;
3222 device_param
->innerloop_left
= innerloop_left
;
3224 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3226 // i think we can get rid of this
3227 if (innerloop_left
== 0)
3229 puts ("bug, how should this happen????\n");
3234 if (data
.salts_shown
[salt_pos
] == 1)
3236 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3241 // initialize amplifiers
3243 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3247 while (i
< innerloop_left
)
3249 if (feof (combs_fp
)) break;
3251 int line_len
= fgetl (combs_fp
, line_buf
);
3253 if (line_len
>= PW_MAX1
) continue;
3255 line_len
= convert_from_hex (line_buf
, line_len
);
3257 char *line_buf_new
= line_buf
;
3259 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3261 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3263 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3265 if (rule_len_out
< 0)
3267 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3272 line_len
= rule_len_out
;
3274 line_buf_new
= rule_buf_out
;
3277 line_len
= MIN (line_len
, PW_DICTMAX
);
3279 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3281 memcpy (ptr
, line_buf_new
, line_len
);
3283 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3285 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3287 uppercase (ptr
, line_len
);
3290 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3292 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3294 ptr
[line_len
] = 0x80;
3297 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3299 ptr
[line_len
] = 0x01;
3303 device_param
->combs_buf
[i
].pw_len
= line_len
;
3308 for (uint j
= i
; j
< innerloop_left
; j
++)
3310 device_param
->combs_buf
[j
].i
[0] = 0;
3311 device_param
->combs_buf
[j
].i
[1] = 0;
3312 device_param
->combs_buf
[j
].i
[2] = 0;
3313 device_param
->combs_buf
[j
].i
[3] = 0;
3314 device_param
->combs_buf
[j
].i
[4] = 0;
3315 device_param
->combs_buf
[j
].i
[5] = 0;
3316 device_param
->combs_buf
[j
].i
[6] = 0;
3317 device_param
->combs_buf
[j
].i
[7] = 0;
3319 device_param
->combs_buf
[j
].pw_len
= 0;
3324 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3326 u64 off
= innerloop_pos
;
3328 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3330 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3332 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3334 u64 off
= innerloop_pos
;
3336 device_param
->kernel_params_mp_buf64
[3] = off
;
3338 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3340 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3342 u64 off
= innerloop_pos
;
3344 device_param
->kernel_params_mp_buf64
[3] = off
;
3346 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3351 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3353 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
);
3355 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3357 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
);
3359 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3361 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
);
3363 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3365 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
);
3367 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3369 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
);
3372 if (data
.benchmark
== 1)
3374 hc_timer_set (&device_param
->timer_speed
);
3377 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3379 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3381 if (data
.devices_status
== STATUS_CRACKED
) break;
3382 if (data
.devices_status
== STATUS_ABORTED
) break;
3383 if (data
.devices_status
== STATUS_QUIT
) break;
3389 check_cracked (device_param
, salt_pos
);
3395 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3397 hc_thread_mutex_lock (mux_counter
);
3399 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3401 hc_thread_mutex_unlock (mux_counter
);
3409 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3411 hc_timer_set (&device_param
->timer_speed
);
3415 //hc_thread_mutex_lock (mux_display);
3417 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3419 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3421 //hc_thread_mutex_unlock (mux_display);
3425 if (speed_pos
== SPEED_CACHE
)
3434 if (data
.benchmark
== 1) break;
3438 device_param
->speed_pos
= speed_pos
;
3443 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3445 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3449 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3451 wl_data
->buf
[wl_data
->cnt
] = 0;
3453 if (wl_data
->cnt
== 0) return;
3455 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3459 if (wl_data
->cnt
== wl_data
->avail
)
3461 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3463 wl_data
->avail
+= wl_data
->incr
;
3466 const int c
= fgetc (fd
);
3468 if (c
== EOF
) break;
3470 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3474 if (c
== '\n') break;
3477 // ensure stream ends with a newline
3479 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3483 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3489 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3493 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3495 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3505 if (*ptr
!= '\n') continue;
3509 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3520 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3524 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3526 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3528 if (*ptr
!= '\n') continue;
3532 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3543 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3547 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3549 if (*ptr
!= '\n') continue;
3553 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3564 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3566 while (wl_data
->pos
< wl_data
->cnt
)
3571 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3573 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3575 wl_data
->pos
+= off
;
3577 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3579 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3581 int rule_len_out
= -1;
3583 if (len
< BLOCK_SIZE
)
3585 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3588 if (rule_len_out
< 0)
3593 if (rule_len_out
> PW_MAX
)
3614 fprintf (stderr
, "BUG feof()!!\n");
3619 load_segment (wl_data
, fd
);
3621 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3625 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3629 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3639 fstat (fileno (fd
), &d
.stat
);
3643 _fstat64 (fileno (fd
), &d
.stat
);
3647 d
.stat
.st_nlink
= 0;
3651 d
.stat
.st_atime
= 0;
3654 d
.stat
.st_blksize
= 0;
3655 d
.stat
.st_blocks
= 0;
3658 if (d
.stat
.st_size
== 0) return 0;
3660 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3662 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3666 u64 cnt
= d_cache
->cnt
;
3670 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3672 keyspace
*= data
.kernel_rules_cnt
;
3674 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3676 keyspace
*= data
.combs_cnt
;
3679 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
);
3680 if (data
.quiet
== 0) log_info ("");
3682 hc_signal (sigHandler_default
);
3697 load_segment (wl_data
, fd
);
3699 comp
+= wl_data
->cnt
;
3703 while (i
< wl_data
->cnt
)
3708 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3710 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3712 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3714 int rule_len_out
= -1;
3716 if (len
< BLOCK_SIZE
)
3718 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3721 if (rule_len_out
< 0)
3733 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3735 cnt
+= data
.kernel_rules_cnt
;
3737 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3739 cnt
+= data
.combs_cnt
;
3752 if ((now
- prev
) == 0) continue;
3754 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3756 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
);
3761 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
);
3762 if (data
.quiet
== 0) log_info ("");
3764 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3766 hc_signal (sigHandler_default
);
3771 static void *thread_monitor (void *p
)
3773 uint runtime_check
= 0;
3774 uint remove_check
= 0;
3775 uint status_check
= 0;
3776 uint restore_check
= 0;
3778 uint restore_left
= data
.restore_timer
;
3779 uint remove_left
= data
.remove_timer
;
3780 uint status_left
= data
.status_timer
;
3783 uint hwmon_check
= 0;
3785 int slowdown_warnings
= 0;
3787 // these variables are mainly used for fan control (AMD only)
3789 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3791 // temperature controller "loopback" values
3793 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3794 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3797 int temp_threshold
= 1; // degrees celcius
3799 int fan_speed_min
= 15; // in percentage
3800 int fan_speed_max
= 100;
3803 time_t last_temp_check_time
;
3804 #endif // HAVE_HWMON
3806 uint sleep_time
= 1;
3813 if (data
.restore_timer
)
3818 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3823 if (data
.status
== 1)
3829 if (data
.gpu_temp_disable
== 0)
3831 time (&last_temp_check_time
);
3837 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3840 if (hwmon_check
== 0)
3845 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3847 hc_sleep (sleep_time
);
3849 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3855 hc_thread_mutex_lock (mux_adl
);
3857 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3859 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3861 if (device_param
->skipped
) continue;
3863 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3865 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3867 const int threshold
= data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
;
3869 if (temperature
>= threshold
)
3871 if (slowdown_warnings
< 3)
3873 if (data
.quiet
== 0) clear_prompt ();
3875 log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold
, device_id
+ 1);
3877 if (slowdown_warnings
== 2)
3882 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3883 if (data
.quiet
== 0) fflush (stdout
);
3885 slowdown_warnings
++;
3890 slowdown_warnings
= 0;
3894 hc_thread_mutex_unlock (mux_adl
);
3897 if (hwmon_check
== 1)
3899 hc_thread_mutex_lock (mux_adl
);
3901 time_t temp_check_time
;
3903 time (&temp_check_time
);
3905 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3907 if (Ta
== 0) Ta
= 1;
3909 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3911 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3913 if (device_param
->skipped
) continue;
3915 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3917 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3919 if (temperature
> (int) data
.gpu_temp_abort
)
3921 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3923 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3929 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3931 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3933 if (data
.hm_device
[device_id
].fan_supported
== 1)
3935 int temp_cur
= temperature
;
3937 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3939 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3941 // calculate Ta value (time difference in seconds between the last check and this check)
3943 last_temp_check_time
= temp_check_time
;
3949 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3951 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
);
3953 if (abs (fan_diff_required
) >= temp_threshold
)
3955 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3957 int fan_speed_level
= fan_speed_cur
;
3959 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3961 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3963 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3964 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3966 if (fan_speed_new
!= fan_speed_cur
)
3968 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3969 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3971 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3973 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
3975 fan_speed_chgd
[device_id
] = 1;
3978 temp_diff_old
[device_id
] = temp_diff_new
;
3986 hc_thread_mutex_unlock (mux_adl
);
3988 #endif // HAVE_HWMON
3990 if (restore_check
== 1)
3994 if (restore_left
== 0)
3996 if (data
.restore_disable
== 0) cycle_restore ();
3998 restore_left
= data
.restore_timer
;
4002 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4006 time (&runtime_cur
);
4008 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4010 if (runtime_left
<= 0)
4012 if (data
.benchmark
== 0)
4014 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4017 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4021 if (remove_check
== 1)
4025 if (remove_left
== 0)
4027 if (data
.digests_saved
!= data
.digests_done
)
4029 data
.digests_saved
= data
.digests_done
;
4034 remove_left
= data
.remove_timer
;
4038 if (status_check
== 1)
4042 if (status_left
== 0)
4044 //hc_thread_mutex_lock (mux_display);
4046 if (data
.quiet
== 0) clear_prompt ();
4048 if (data
.quiet
== 0) log_info ("");
4052 if (data
.quiet
== 0) log_info ("");
4054 //hc_thread_mutex_unlock (mux_display);
4056 status_left
= data
.status_timer
;
4062 myfree (fan_speed_chgd
);
4064 myfree (temp_diff_old
);
4065 myfree (temp_diff_sum
);
4073 static void *thread_outfile_remove (void *p
)
4075 // some hash-dependent constants
4076 char *outfile_dir
= data
.outfile_check_directory
;
4077 uint dgst_size
= data
.dgst_size
;
4078 uint isSalted
= data
.isSalted
;
4079 uint esalt_size
= data
.esalt_size
;
4080 uint hash_mode
= data
.hash_mode
;
4082 uint outfile_check_timer
= data
.outfile_check_timer
;
4084 char separator
= data
.separator
;
4086 // some hash-dependent functions
4087 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4088 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4091 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4093 hash_buf
.digest
= mymalloc (dgst_size
);
4095 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4097 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4099 uint digest_buf
[64] = { 0 };
4101 outfile_data_t
*out_info
= NULL
;
4103 char **out_files
= NULL
;
4105 time_t folder_mtime
= 0;
4109 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4111 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4115 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4119 if (check_left
== 0)
4121 struct stat outfile_check_stat
;
4123 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4125 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4129 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4131 char **out_files_new
= scan_directory (outfile_dir
);
4133 int out_cnt_new
= count_dictionaries (out_files_new
);
4135 outfile_data_t
*out_info_new
= NULL
;
4137 if (out_cnt_new
> 0)
4139 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4141 for (int i
= 0; i
< out_cnt_new
; i
++)
4143 out_info_new
[i
].file_name
= out_files_new
[i
];
4145 // check if there are files that we have seen/checked before (and not changed)
4147 for (int j
= 0; j
< out_cnt
; j
++)
4149 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4151 struct stat outfile_stat
;
4153 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4155 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4157 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4158 out_info_new
[i
].seek
= out_info
[j
].seek
;
4166 local_free (out_info
);
4167 local_free (out_files
);
4169 out_files
= out_files_new
;
4170 out_cnt
= out_cnt_new
;
4171 out_info
= out_info_new
;
4173 folder_mtime
= outfile_check_stat
.st_mtime
;
4176 for (int j
= 0; j
< out_cnt
; j
++)
4178 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4182 //hc_thread_mutex_lock (mux_display);
4185 struct stat outfile_stat
;
4187 fstat (fileno (fp
), &outfile_stat
);
4191 struct stat64 outfile_stat
;
4193 _fstat64 (fileno (fp
), &outfile_stat
);
4196 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4198 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4199 out_info
[j
].seek
= 0;
4202 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4204 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4208 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4210 if (ptr
== NULL
) break;
4212 int line_len
= strlen (line_buf
);
4214 if (line_len
<= 0) continue;
4216 int iter
= MAX_CUT_TRIES
;
4218 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4220 if (line_buf
[i
] != separator
) continue;
4222 int parser_status
= PARSER_OK
;
4224 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4226 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4231 if (parser_status
== PARSER_OK
)
4233 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4235 if (data
.salts_shown
[salt_pos
] == 1) continue;
4237 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4239 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4241 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4243 if (data
.digests_shown
[idx
] == 1) continue;
4247 if (hash_mode
== 6800)
4249 if (i
== salt_buf
->salt_len
)
4251 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4254 else if (hash_mode
== 2500)
4256 // BSSID : MAC1 : MAC2 (:plain)
4257 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4259 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4261 if (!cracked
) continue;
4263 // now compare MAC1 and MAC2 too, since we have this additional info
4264 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4265 char *mac2_pos
= mac1_pos
+ 12 + 1;
4267 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4268 wpa_t
*wpa
= &wpas
[salt_pos
];
4270 // compare hex string(s) vs binary MAC address(es)
4272 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4274 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4283 if (!cracked
) continue;
4285 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4287 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4298 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4300 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4302 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4309 data
.digests_shown
[idx
] = 1;
4311 data
.digests_done
++;
4313 salt_buf
->digests_done
++;
4315 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4317 data
.salts_shown
[salt_pos
] = 1;
4321 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4326 if (data
.devices_status
== STATUS_CRACKED
) break;
4332 if (data
.devices_status
== STATUS_CRACKED
) break;
4337 if (data
.devices_status
== STATUS_CRACKED
) break;
4342 out_info
[j
].seek
= ftell (fp
);
4344 //hc_thread_mutex_unlock (mux_display);
4352 check_left
= outfile_check_timer
;
4356 if (esalt_size
) local_free (hash_buf
.esalt
);
4358 if (isSalted
) local_free (hash_buf
.salt
);
4360 local_free (hash_buf
.digest
);
4362 local_free (out_info
);
4364 local_free (out_files
);
4371 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4373 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4375 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4377 u8
*ptr
= (u8
*) pw
->i
;
4379 memcpy (ptr
, pw_buf
, pw_len
);
4381 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4383 pw
->pw_len
= pw_len
;
4385 device_param
->pws_cnt
++;
4389 fprintf (stderr
, "BUG pw_add()!!\n");
4395 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4397 hc_thread_mutex_lock (mux_dispatcher
);
4399 const u64 words_cur
= data
.words_cur
;
4400 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4402 device_param
->words_off
= words_cur
;
4404 const u64 words_left
= words_base
- words_cur
;
4408 if (data
.kernel_power_all
> words_left
)
4410 if (data
.kernel_power_div
== 0)
4412 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4416 if (data
.kernel_power_div
)
4418 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4420 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4422 if (kernel_power_new
< device_param
->kernel_power
)
4424 device_param
->kernel_power
= kernel_power_new
;
4430 const uint kernel_power
= device_param
->kernel_power
;
4432 uint work
= MIN (words_left
, kernel_power
);
4434 work
= MIN (work
, max
);
4436 data
.words_cur
+= work
;
4438 hc_thread_mutex_unlock (mux_dispatcher
);
4443 static void *thread_calc_stdin (void *p
)
4445 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4447 if (device_param
->skipped
) return NULL
;
4449 autotune (device_param
);
4451 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4453 const uint attack_kern
= data
.attack_kern
;
4455 const uint kernel_power
= device_param
->kernel_power
;
4457 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4459 hc_thread_mutex_lock (mux_dispatcher
);
4461 if (feof (stdin
) != 0)
4463 hc_thread_mutex_unlock (mux_dispatcher
);
4470 while (words_cur
< kernel_power
)
4472 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4474 if (line_buf
== NULL
) break;
4476 uint line_len
= in_superchop (line_buf
);
4478 line_len
= convert_from_hex (line_buf
, line_len
);
4480 // post-process rule engine
4482 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4484 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4486 int rule_len_out
= -1;
4488 if (line_len
< BLOCK_SIZE
)
4490 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4493 if (rule_len_out
< 0) continue;
4495 line_buf
= rule_buf_out
;
4496 line_len
= rule_len_out
;
4499 if (line_len
> PW_MAX
)
4504 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4506 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4508 hc_thread_mutex_lock (mux_counter
);
4510 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4512 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4515 hc_thread_mutex_unlock (mux_counter
);
4520 else if (attack_kern
== ATTACK_KERN_COMBI
)
4522 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4523 // since we still need to combine the plains
4525 if (line_len
> data
.pw_max
)
4527 hc_thread_mutex_lock (mux_counter
);
4529 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4531 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4534 hc_thread_mutex_unlock (mux_counter
);
4540 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4544 if (data
.devices_status
== STATUS_CRACKED
) break;
4545 if (data
.devices_status
== STATUS_ABORTED
) break;
4546 if (data
.devices_status
== STATUS_QUIT
) break;
4547 if (data
.devices_status
== STATUS_BYPASS
) break;
4550 hc_thread_mutex_unlock (mux_dispatcher
);
4552 if (data
.devices_status
== STATUS_CRACKED
) break;
4553 if (data
.devices_status
== STATUS_ABORTED
) break;
4554 if (data
.devices_status
== STATUS_QUIT
) break;
4555 if (data
.devices_status
== STATUS_BYPASS
) break;
4559 const uint pws_cnt
= device_param
->pws_cnt
;
4563 run_copy (device_param
, pws_cnt
);
4565 run_cracker (device_param
, pws_cnt
);
4567 device_param
->pws_cnt
= 0;
4571 if (attack_kern == ATTACK_KERN_STRAIGHT)
4573 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4575 else if (attack_kern == ATTACK_KERN_COMBI)
4577 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4583 device_param
->kernel_accel
= 0;
4584 device_param
->kernel_loops
= 0;
4591 static void *thread_calc (void *p
)
4593 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4595 if (device_param
->skipped
) return NULL
;
4597 autotune (device_param
);
4599 const uint attack_mode
= data
.attack_mode
;
4600 const uint attack_kern
= data
.attack_kern
;
4602 if (attack_mode
== ATTACK_MODE_BF
)
4604 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4606 const uint work
= get_work (device_param
, -1, true);
4608 if (work
== 0) break;
4610 const u64 words_off
= device_param
->words_off
;
4611 const u64 words_fin
= words_off
+ work
;
4613 const uint pws_cnt
= work
;
4615 device_param
->pws_cnt
= pws_cnt
;
4619 run_copy (device_param
, pws_cnt
);
4621 run_cracker (device_param
, pws_cnt
);
4623 device_param
->pws_cnt
= 0;
4627 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4631 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4633 if (data
.devices_status
== STATUS_CRACKED
) break;
4634 if (data
.devices_status
== STATUS_ABORTED
) break;
4635 if (data
.devices_status
== STATUS_QUIT
) break;
4636 if (data
.devices_status
== STATUS_BYPASS
) break;
4638 if (data
.benchmark
== 1) break;
4640 device_param
->words_done
= words_fin
;
4645 const uint segment_size
= data
.segment_size
;
4647 char *dictfile
= data
.dictfile
;
4649 if (attack_mode
== ATTACK_MODE_COMBI
)
4651 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4653 dictfile
= data
.dictfile2
;
4657 FILE *fd
= fopen (dictfile
, "rb");
4661 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4666 if (attack_mode
== ATTACK_MODE_COMBI
)
4668 const uint combs_mode
= data
.combs_mode
;
4670 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4672 const char *dictfilec
= data
.dictfile2
;
4674 FILE *combs_fp
= fopen (dictfilec
, "rb");
4676 if (combs_fp
== NULL
)
4678 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4685 device_param
->combs_fp
= combs_fp
;
4687 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4689 const char *dictfilec
= data
.dictfile
;
4691 FILE *combs_fp
= fopen (dictfilec
, "rb");
4693 if (combs_fp
== NULL
)
4695 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4702 device_param
->combs_fp
= combs_fp
;
4706 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4708 wl_data
->buf
= (char *) mymalloc (segment_size
);
4709 wl_data
->avail
= segment_size
;
4710 wl_data
->incr
= segment_size
;
4716 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4721 bool allow_div
= true;
4727 const uint work
= get_work (device_param
, max
, allow_div
);
4731 if (work
== 0) break;
4733 words_off
= device_param
->words_off
;
4734 words_fin
= words_off
+ work
;
4739 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4743 for ( ; words_cur
< words_fin
; words_cur
++)
4745 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4747 line_len
= convert_from_hex (line_buf
, line_len
);
4749 // post-process rule engine
4751 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4753 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4755 int rule_len_out
= -1;
4757 if (line_len
< BLOCK_SIZE
)
4759 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4762 if (rule_len_out
< 0) continue;
4764 line_buf
= rule_buf_out
;
4765 line_len
= rule_len_out
;
4768 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4770 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4774 hc_thread_mutex_lock (mux_counter
);
4776 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4778 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4781 hc_thread_mutex_unlock (mux_counter
);
4786 else if (attack_kern
== ATTACK_KERN_COMBI
)
4788 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4789 // since we still need to combine the plains
4791 if (line_len
> data
.pw_max
)
4795 hc_thread_mutex_lock (mux_counter
);
4797 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4799 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4802 hc_thread_mutex_unlock (mux_counter
);
4808 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4810 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4812 if (data
.devices_status
== STATUS_CRACKED
) break;
4813 if (data
.devices_status
== STATUS_ABORTED
) break;
4814 if (data
.devices_status
== STATUS_QUIT
) break;
4815 if (data
.devices_status
== STATUS_BYPASS
) break;
4818 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4820 if (data
.devices_status
== STATUS_CRACKED
) break;
4821 if (data
.devices_status
== STATUS_ABORTED
) break;
4822 if (data
.devices_status
== STATUS_QUIT
) break;
4823 if (data
.devices_status
== STATUS_BYPASS
) break;
4826 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4828 if (data
.devices_status
== STATUS_CRACKED
) break;
4829 if (data
.devices_status
== STATUS_ABORTED
) break;
4830 if (data
.devices_status
== STATUS_QUIT
) break;
4831 if (data
.devices_status
== STATUS_BYPASS
) break;
4837 const uint pws_cnt
= device_param
->pws_cnt
;
4841 run_copy (device_param
, pws_cnt
);
4843 run_cracker (device_param
, pws_cnt
);
4845 device_param
->pws_cnt
= 0;
4849 if (attack_kern == ATTACK_KERN_STRAIGHT)
4851 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4853 else if (attack_kern == ATTACK_KERN_COMBI)
4855 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
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;
4867 if (words_fin
== 0) break;
4869 device_param
->words_done
= words_fin
;
4872 if (attack_mode
== ATTACK_MODE_COMBI
)
4874 fclose (device_param
->combs_fp
);
4877 free (wl_data
->buf
);
4883 device_param
->kernel_accel
= 0;
4884 device_param
->kernel_loops
= 0;
4889 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4893 log_error ("ERROR: %s : Invalid argument", __func__
);
4898 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4900 device_param
->kernel_params_buf32
[24] = salt_pos
;
4901 device_param
->kernel_params_buf32
[27] = 1;
4902 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4903 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4904 device_param
->kernel_params_buf32
[30] = 0;
4905 device_param
->kernel_params_buf32
[31] = 1;
4907 char *dictfile_old
= data
.dictfile
;
4909 const char *weak_hash_check
= "weak-hash-check";
4911 data
.dictfile
= (char *) weak_hash_check
;
4913 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4915 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4921 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4923 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4927 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4929 uint loop_step
= 16;
4931 const uint iter
= salt_buf
->salt_iter
;
4933 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4935 uint loop_left
= iter
- loop_pos
;
4937 loop_left
= MIN (loop_left
, loop_step
);
4939 device_param
->kernel_params_buf32
[25] = loop_pos
;
4940 device_param
->kernel_params_buf32
[26] = loop_left
;
4942 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4945 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4952 check_cracked (device_param
, salt_pos
);
4958 device_param
->kernel_params_buf32
[24] = 0;
4959 device_param
->kernel_params_buf32
[25] = 0;
4960 device_param
->kernel_params_buf32
[26] = 0;
4961 device_param
->kernel_params_buf32
[27] = 0;
4962 device_param
->kernel_params_buf32
[28] = 0;
4963 device_param
->kernel_params_buf32
[29] = 0;
4964 device_param
->kernel_params_buf32
[30] = 0;
4965 device_param
->kernel_params_buf32
[31] = 0;
4967 data
.dictfile
= dictfile_old
;
4969 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4974 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4976 if (data
.username
== 0)
4978 *hashbuf_pos
= line_buf
;
4979 *hashbuf_len
= line_len
;
4983 char *pos
= line_buf
;
4986 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4988 if (line_buf
[i
] == data
.separator
)
5003 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5010 for (int i
= 0; i
< line_len
; i
++)
5012 if (line_buf
[i
] == data
.separator
)
5021 if (pos
== NULL
) pos
= line_buf
+ i
;
5033 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5040 for (int i
= 0; i
< line_len
; i
++)
5042 if (line_buf
[i
] == ':')
5049 if (sep_cnt
== 2) sep2_len
++;
5050 if (sep_cnt
== 3) sep3_len
++;
5053 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5058 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5065 for (int i
= 0; i
< line_len
; i
++)
5067 if (line_buf
[i
] == ':')
5074 if (data
.hash_mode
== 1000)
5078 if (pos
== NULL
) pos
= line_buf
+ i
;
5083 else if (data
.hash_mode
== 3000)
5087 if (pos
== NULL
) pos
= line_buf
+ i
;
5098 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5105 for (int i
= 0; i
< line_len
; i
++)
5107 if (line_buf
[i
] == ':')
5116 if (pos
== NULL
) pos
= line_buf
+ i
;
5128 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5132 char sep5_first
= 0;
5133 char sep6_first
= 0;
5135 for (int i
= 0; i
< line_len
; i
++)
5137 if (line_buf
[i
] == ':')
5144 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5145 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5148 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5153 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5160 for (int i
= 0; i
< line_len
; i
++)
5162 if (line_buf
[i
] == ':')
5171 if (pos
== NULL
) pos
= line_buf
+ i
;
5181 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5188 for (int i
= 0; i
< line_len
; i
++)
5190 if (line_buf
[i
] == ':')
5199 if (pos
== NULL
) pos
= line_buf
+ i
;
5211 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5215 for (int i
= 0; i
< line_len
; i
++)
5217 if (line_buf
[i
] == ':') sep_cnt
++;
5220 if (sep_cnt
== 8) return 1;
5225 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5227 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5230 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5232 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5237 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5239 switch (hashfile_format
)
5241 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5242 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5243 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5244 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5248 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5250 switch (hashfile_format
)
5252 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5253 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5254 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5255 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5259 char *strhlfmt (const uint hashfile_format
)
5261 switch (hashfile_format
)
5263 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5264 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5265 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5266 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5267 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5268 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5269 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5270 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5271 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5272 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5275 return ((char *) "Unknown");
5278 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5280 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5282 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5283 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5285 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5289 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5293 int line_len
= fgetl (fp
, line_buf
);
5295 if (line_len
== 0) continue;
5297 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5298 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5299 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5301 if (num_check
== max_check
) break;
5308 uint hashlist_format
= HLFMT_HASHCAT
;
5310 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5312 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5314 hashlist_format
= i
;
5319 return hashlist_format
;
5323 * some further helper function
5326 // wrapper around mymalloc for ADL
5328 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5329 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5331 return mymalloc (iSize
);
5335 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
)
5339 const uint dgst_pos0
= data
.dgst_pos0
;
5340 const uint dgst_pos1
= data
.dgst_pos1
;
5341 const uint dgst_pos2
= data
.dgst_pos2
;
5342 const uint dgst_pos3
= data
.dgst_pos3
;
5344 memset (bitmap_a
, 0, bitmap_size
);
5345 memset (bitmap_b
, 0, bitmap_size
);
5346 memset (bitmap_c
, 0, bitmap_size
);
5347 memset (bitmap_d
, 0, bitmap_size
);
5349 for (uint i
= 0; i
< digests_cnt
; i
++)
5351 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5353 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5355 digests_buf_ptr
+= dgst_size
;
5357 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5358 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5359 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5360 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5362 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5363 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5364 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5365 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5367 if (bitmap_a
[idx0
] & val0
) collisions
++;
5368 if (bitmap_b
[idx1
] & val1
) collisions
++;
5369 if (bitmap_c
[idx2
] & val2
) collisions
++;
5370 if (bitmap_d
[idx3
] & val3
) collisions
++;
5372 bitmap_a
[idx0
] |= val0
;
5373 bitmap_b
[idx1
] |= val1
;
5374 bitmap_c
[idx2
] |= val2
;
5375 bitmap_d
[idx3
] |= val3
;
5377 if (collisions
>= collisions_max
) return 0x7fffffff;
5388 void SetConsoleWindowSize (const int x
)
5390 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5392 if (h
== INVALID_HANDLE_VALUE
) return;
5394 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5396 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5398 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5400 sr
->Right
= MAX (sr
->Right
, x
- 1);
5404 co
.X
= sr
->Right
+ 1;
5405 co
.Y
= sr
->Bottom
+ 1;
5407 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5409 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5413 int main (int argc
, char **argv
)
5416 SetConsoleWindowSize (132);
5420 * To help users a bit
5423 char *compute
= getenv ("COMPUTE");
5427 static char display
[100];
5429 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5435 if (getenv ("DISPLAY") == NULL
)
5436 putenv ((char *) "DISPLAY=:0");
5439 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5440 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5442 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5443 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5445 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5446 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5448 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5449 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5451 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5452 putenv ((char *) "POCL_KERNEL_CACHE=0");
5460 memset (&data
, 0, sizeof (hc_global_data_t
));
5466 data
.proc_start
= proc_start
;
5469 char **myargv
= argv
;
5471 hc_thread_mutex_init (mux_dispatcher
);
5472 hc_thread_mutex_init (mux_counter
);
5473 hc_thread_mutex_init (mux_display
);
5474 hc_thread_mutex_init (mux_adl
);
5477 * commandline parameters
5481 uint version
= VERSION
;
5483 uint benchmark
= BENCHMARK
;
5486 uint username
= USERNAME
;
5487 uint remove
= REMOVE
;
5488 uint remove_timer
= REMOVE_TIMER
;
5491 uint keyspace
= KEYSPACE
;
5492 uint potfile_disable
= POTFILE_DISABLE
;
5493 char *potfile_path
= NULL
;
5494 uint debug_mode
= DEBUG_MODE
;
5495 char *debug_file
= NULL
;
5496 char *induction_dir
= NULL
;
5497 char *outfile_check_dir
= NULL
;
5499 uint runtime
= RUNTIME
;
5500 uint hash_mode
= HASH_MODE
;
5501 uint attack_mode
= ATTACK_MODE
;
5502 uint markov_disable
= MARKOV_DISABLE
;
5503 uint markov_classic
= MARKOV_CLASSIC
;
5504 uint markov_threshold
= MARKOV_THRESHOLD
;
5505 char *markov_hcstat
= NULL
;
5506 char *outfile
= NULL
;
5507 uint outfile_format
= OUTFILE_FORMAT
;
5508 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5509 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5510 uint restore
= RESTORE
;
5511 uint restore_timer
= RESTORE_TIMER
;
5512 uint restore_disable
= RESTORE_DISABLE
;
5513 uint status
= STATUS
;
5514 uint status_timer
= STATUS_TIMER
;
5515 uint machine_readable
= MACHINE_READABLE
;
5516 uint loopback
= LOOPBACK
;
5517 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5518 char *session
= NULL
;
5519 uint hex_charset
= HEX_CHARSET
;
5520 uint hex_salt
= HEX_SALT
;
5521 uint hex_wordlist
= HEX_WORDLIST
;
5522 uint rp_gen
= RP_GEN
;
5523 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5524 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5525 uint rp_gen_seed
= RP_GEN_SEED
;
5526 char *rule_buf_l
= (char *) RULE_BUF_L
;
5527 char *rule_buf_r
= (char *) RULE_BUF_R
;
5528 uint increment
= INCREMENT
;
5529 uint increment_min
= INCREMENT_MIN
;
5530 uint increment_max
= INCREMENT_MAX
;
5531 char *cpu_affinity
= NULL
;
5532 OCL_PTR
*ocl
= NULL
;
5533 char *opencl_devices
= NULL
;
5534 char *opencl_platforms
= NULL
;
5535 char *opencl_device_types
= NULL
;
5536 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5537 char *truecrypt_keyfiles
= NULL
;
5538 char *veracrypt_keyfiles
= NULL
;
5539 uint veracrypt_pim
= 0;
5540 uint workload_profile
= WORKLOAD_PROFILE
;
5541 uint kernel_accel
= KERNEL_ACCEL
;
5542 uint kernel_loops
= KERNEL_LOOPS
;
5543 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5545 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5546 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5548 uint powertune_enable
= POWERTUNE_ENABLE
;
5551 uint logfile_disable
= LOGFILE_DISABLE
;
5552 uint segment_size
= SEGMENT_SIZE
;
5553 uint scrypt_tmto
= SCRYPT_TMTO
;
5554 char separator
= SEPARATOR
;
5555 uint bitmap_min
= BITMAP_MIN
;
5556 uint bitmap_max
= BITMAP_MAX
;
5557 char *custom_charset_1
= NULL
;
5558 char *custom_charset_2
= NULL
;
5559 char *custom_charset_3
= NULL
;
5560 char *custom_charset_4
= NULL
;
5562 #define IDX_HELP 'h'
5563 #define IDX_VERSION 'V'
5564 #define IDX_VERSION_LOWER 'v'
5565 #define IDX_QUIET 0xff02
5566 #define IDX_SHOW 0xff03
5567 #define IDX_LEFT 0xff04
5568 #define IDX_REMOVE 0xff05
5569 #define IDX_REMOVE_TIMER 0xff37
5570 #define IDX_SKIP 's'
5571 #define IDX_LIMIT 'l'
5572 #define IDX_KEYSPACE 0xff35
5573 #define IDX_POTFILE_DISABLE 0xff06
5574 #define IDX_POTFILE_PATH 0xffe0
5575 #define IDX_DEBUG_MODE 0xff43
5576 #define IDX_DEBUG_FILE 0xff44
5577 #define IDX_INDUCTION_DIR 0xff46
5578 #define IDX_OUTFILE_CHECK_DIR 0xff47
5579 #define IDX_USERNAME 0xff07
5580 #define IDX_FORCE 0xff08
5581 #define IDX_RUNTIME 0xff09
5582 #define IDX_BENCHMARK 'b'
5583 #define IDX_HASH_MODE 'm'
5584 #define IDX_ATTACK_MODE 'a'
5585 #define IDX_RP_FILE 'r'
5586 #define IDX_RP_GEN 'g'
5587 #define IDX_RP_GEN_FUNC_MIN 0xff10
5588 #define IDX_RP_GEN_FUNC_MAX 0xff11
5589 #define IDX_RP_GEN_SEED 0xff34
5590 #define IDX_RULE_BUF_L 'j'
5591 #define IDX_RULE_BUF_R 'k'
5592 #define IDX_INCREMENT 'i'
5593 #define IDX_INCREMENT_MIN 0xff12
5594 #define IDX_INCREMENT_MAX 0xff13
5595 #define IDX_OUTFILE 'o'
5596 #define IDX_OUTFILE_FORMAT 0xff14
5597 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5598 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5599 #define IDX_RESTORE 0xff15
5600 #define IDX_RESTORE_DISABLE 0xff27
5601 #define IDX_STATUS 0xff17
5602 #define IDX_STATUS_TIMER 0xff18
5603 #define IDX_MACHINE_READABLE 0xff50
5604 #define IDX_LOOPBACK 0xff38
5605 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5606 #define IDX_SESSION 0xff19
5607 #define IDX_HEX_CHARSET 0xff20
5608 #define IDX_HEX_SALT 0xff21
5609 #define IDX_HEX_WORDLIST 0xff40
5610 #define IDX_MARKOV_DISABLE 0xff22
5611 #define IDX_MARKOV_CLASSIC 0xff23
5612 #define IDX_MARKOV_THRESHOLD 't'
5613 #define IDX_MARKOV_HCSTAT 0xff24
5614 #define IDX_CPU_AFFINITY 0xff25
5615 #define IDX_OPENCL_DEVICES 'd'
5616 #define IDX_OPENCL_PLATFORMS 0xff72
5617 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5618 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5619 #define IDX_WORKLOAD_PROFILE 'w'
5620 #define IDX_KERNEL_ACCEL 'n'
5621 #define IDX_KERNEL_LOOPS 'u'
5622 #define IDX_GPU_TEMP_DISABLE 0xff29
5623 #define IDX_GPU_TEMP_ABORT 0xff30
5624 #define IDX_GPU_TEMP_RETAIN 0xff31
5625 #define IDX_POWERTUNE_ENABLE 0xff41
5626 #define IDX_LOGFILE_DISABLE 0xff51
5627 #define IDX_TRUECRYPT_KEYFILES 0xff52
5628 #define IDX_VERACRYPT_KEYFILES 0xff53
5629 #define IDX_VERACRYPT_PIM 0xff54
5630 #define IDX_SCRYPT_TMTO 0xff61
5631 #define IDX_SEGMENT_SIZE 'c'
5632 #define IDX_SEPARATOR 'p'
5633 #define IDX_BITMAP_MIN 0xff70
5634 #define IDX_BITMAP_MAX 0xff71
5635 #define IDX_CUSTOM_CHARSET_1 '1'
5636 #define IDX_CUSTOM_CHARSET_2 '2'
5637 #define IDX_CUSTOM_CHARSET_3 '3'
5638 #define IDX_CUSTOM_CHARSET_4 '4'
5640 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5642 struct option long_options
[] =
5644 {"help", no_argument
, 0, IDX_HELP
},
5645 {"version", no_argument
, 0, IDX_VERSION
},
5646 {"quiet", no_argument
, 0, IDX_QUIET
},
5647 {"show", no_argument
, 0, IDX_SHOW
},
5648 {"left", no_argument
, 0, IDX_LEFT
},
5649 {"username", no_argument
, 0, IDX_USERNAME
},
5650 {"remove", no_argument
, 0, IDX_REMOVE
},
5651 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5652 {"skip", required_argument
, 0, IDX_SKIP
},
5653 {"limit", required_argument
, 0, IDX_LIMIT
},
5654 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5655 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5656 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5657 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5658 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5659 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5660 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5661 {"force", no_argument
, 0, IDX_FORCE
},
5662 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5663 {"restore", no_argument
, 0, IDX_RESTORE
},
5664 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5665 {"status", no_argument
, 0, IDX_STATUS
},
5666 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5667 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5668 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5669 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5670 {"session", required_argument
, 0, IDX_SESSION
},
5671 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5672 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5673 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5674 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5675 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5676 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5677 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5678 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5679 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5680 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5681 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5682 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5683 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5684 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5685 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5686 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5687 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5688 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5689 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5690 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5691 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5692 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5693 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5694 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5695 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5696 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5697 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5698 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5699 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5700 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5702 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5703 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5705 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5707 #endif // HAVE_HWMON
5708 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5709 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5710 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5711 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5712 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5713 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5714 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5715 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5716 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5717 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5718 {"increment", no_argument
, 0, IDX_INCREMENT
},
5719 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5720 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5721 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5722 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5723 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5724 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5728 uint rp_files_cnt
= 0;
5730 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5732 int option_index
= 0;
5738 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5742 case IDX_HELP
: usage
= 1; break;
5744 case IDX_VERSION_LOWER
: version
= 1; break;
5745 case IDX_RESTORE
: restore
= 1; break;
5746 case IDX_SESSION
: session
= optarg
; break;
5747 case IDX_SHOW
: show
= 1; break;
5748 case IDX_LEFT
: left
= 1; break;
5749 case '?': return (-1);
5755 log_error ("ERROR: Invalid argument specified");
5766 log_info ("%s", VERSION_TAG
);
5773 usage_big_print (PROGNAME
);
5779 * session needs to be set, always!
5782 if (session
== NULL
) session
= (char *) PROGNAME
;
5785 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5788 char *exec_path
= get_exec_path ();
5792 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5793 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5795 char *install_dir
= get_install_dir (resolved_exec_path
);
5796 char *profile_dir
= NULL
;
5797 char *session_dir
= NULL
;
5798 char *shared_dir
= NULL
;
5800 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5802 struct passwd
*pw
= getpwuid (getuid ());
5804 const char *homedir
= pw
->pw_dir
;
5806 profile_dir
= get_profile_dir (homedir
);
5807 session_dir
= get_session_dir (profile_dir
);
5808 shared_dir
= strdup (SHARED_FOLDER
);
5810 mkdir (profile_dir
, 0700);
5811 mkdir (session_dir
, 0700);
5815 profile_dir
= install_dir
;
5816 session_dir
= install_dir
;
5817 shared_dir
= install_dir
;
5820 myfree (resolved_install_folder
);
5821 myfree (resolved_exec_path
);
5825 char *install_dir
= get_install_dir (exec_path
);
5826 char *profile_dir
= install_dir
;
5827 char *session_dir
= install_dir
;
5828 char *shared_dir
= install_dir
;
5832 data
.install_dir
= install_dir
;
5833 data
.profile_dir
= profile_dir
;
5834 data
.session_dir
= session_dir
;
5835 data
.shared_dir
= shared_dir
;
5840 * kernel cache, we need to make sure folder exist
5843 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5845 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5847 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5849 mkdir (kernels_folder
, 0700);
5851 myfree (kernels_folder
);
5857 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5859 data
.session
= session
;
5861 char *eff_restore_file
= (char *) mymalloc (session_size
);
5862 char *new_restore_file
= (char *) mymalloc (session_size
);
5864 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5865 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5867 data
.eff_restore_file
= eff_restore_file
;
5868 data
.new_restore_file
= new_restore_file
;
5870 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5872 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5873 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5878 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5879 if ((show
== 1) || (left
== 1))
5881 restore_disable
= 1;
5886 data
.restore_disable
= restore_disable
;
5888 restore_data_t
*rd
= init_restore (argc
, argv
);
5898 read_restore (eff_restore_file
, rd
);
5900 if (rd
->version_bin
< RESTORE_MIN
)
5902 log_error ("ERROR: Incompatible restore-file version");
5911 rd
->pid
= getpid ();
5913 rd
->pid
= GetCurrentProcessId ();
5917 uint hash_mode_chgd
= 0;
5918 uint runtime_chgd
= 0;
5919 uint kernel_loops_chgd
= 0;
5920 uint kernel_accel_chgd
= 0;
5921 uint attack_mode_chgd
= 0;
5922 uint outfile_format_chgd
= 0;
5923 uint rp_gen_seed_chgd
= 0;
5924 uint remove_timer_chgd
= 0;
5925 uint increment_min_chgd
= 0;
5926 uint increment_max_chgd
= 0;
5927 uint workload_profile_chgd
= 0;
5928 uint opencl_vector_width_chgd
= 0;
5930 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5931 uint gpu_temp_retain_chgd
= 0;
5932 uint gpu_temp_abort_chgd
= 0;
5939 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5943 //case IDX_HELP: usage = 1; break;
5944 //case IDX_VERSION: version = 1; break;
5945 //case IDX_RESTORE: restore = 1; break;
5946 case IDX_QUIET
: quiet
= 1; break;
5947 //case IDX_SHOW: show = 1; break;
5948 case IDX_SHOW
: break;
5949 //case IDX_LEFT: left = 1; break;
5950 case IDX_LEFT
: break;
5951 case IDX_USERNAME
: username
= 1; break;
5952 case IDX_REMOVE
: remove
= 1; break;
5953 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5954 remove_timer_chgd
= 1; break;
5955 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5956 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5957 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5958 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5959 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5960 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5961 case IDX_FORCE
: force
= 1; break;
5962 case IDX_SKIP
: skip
= atoll (optarg
); break;
5963 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5964 case IDX_KEYSPACE
: keyspace
= 1; break;
5965 case IDX_BENCHMARK
: benchmark
= 1; break;
5966 case IDX_RESTORE
: break;
5967 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5968 case IDX_STATUS
: status
= 1; break;
5969 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5970 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5971 case IDX_LOOPBACK
: loopback
= 1; break;
5972 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5973 //case IDX_SESSION: session = optarg; break;
5974 case IDX_SESSION
: break;
5975 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5976 hash_mode_chgd
= 1; break;
5977 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5978 runtime_chgd
= 1; break;
5979 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5980 attack_mode_chgd
= 1; break;
5981 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5982 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5983 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5984 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5985 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5986 rp_gen_seed_chgd
= 1; break;
5987 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5988 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5989 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5990 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5991 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5992 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5993 case IDX_OUTFILE
: outfile
= optarg
; break;
5994 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5995 outfile_format_chgd
= 1; break;
5996 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
5997 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
5998 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5999 case IDX_HEX_SALT
: hex_salt
= 1; break;
6000 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6001 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6002 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6003 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6004 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6005 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6006 opencl_vector_width_chgd
= 1; break;
6007 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6008 workload_profile_chgd
= 1; break;
6009 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6010 kernel_accel_chgd
= 1; break;
6011 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6012 kernel_loops_chgd
= 1; break;
6013 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6015 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
6017 gpu_temp_abort_chgd
= 1;
6020 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
6022 gpu_temp_retain_chgd
= 1;
6026 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6028 #endif // HAVE_HWMON
6029 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6030 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6031 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6032 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6033 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6034 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6035 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6036 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6037 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6038 case IDX_INCREMENT
: increment
= 1; break;
6039 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6040 increment_min_chgd
= 1; break;
6041 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6042 increment_max_chgd
= 1; break;
6043 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6044 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6045 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6046 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6049 log_error ("ERROR: Invalid argument specified");
6056 log_error ("ERROR: Invalid argument specified");
6062 * Inform user things getting started,
6063 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6064 * - we do not need to check algorithm_pos
6071 if (machine_readable
== 0)
6073 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6078 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6081 else if (restore
== 1)
6083 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6088 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6097 if (attack_mode
> 7)
6099 log_error ("ERROR: Invalid attack-mode specified");
6104 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6106 log_error ("ERROR: Invalid runtime specified");
6111 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6113 log_error ("ERROR: Invalid hash-type specified");
6118 // renamed hash modes
6132 log_error ("Old -m specified, use -m %d instead", n
);
6140 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6142 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6148 if (outfile_format
> 16)
6150 log_error ("ERROR: Invalid outfile-format specified");
6157 if (outfile_format_chgd
== 1)
6159 if (outfile_format
> 1)
6161 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6168 outfile_format
= OUTFILE_FMT_HASH
;
6174 if (outfile_format_chgd
== 1)
6176 if ((outfile_format
> 7) && (outfile_format
< 16))
6178 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6185 if (increment_min
< INCREMENT_MIN
)
6187 log_error ("ERROR: Invalid increment-min specified");
6192 if (increment_max
> INCREMENT_MAX
)
6194 log_error ("ERROR: Invalid increment-max specified");
6199 if (increment_min
> increment_max
)
6201 log_error ("ERROR: Invalid increment-min specified");
6206 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6208 log_error ("ERROR: increment is not allowed in attack-mode 0");
6213 if ((increment
== 0) && (increment_min_chgd
== 1))
6215 log_error ("ERROR: increment-min is only supported together with increment switch");
6220 if ((increment
== 0) && (increment_max_chgd
== 1))
6222 log_error ("ERROR: increment-max is only supported together with increment switch");
6227 if (rp_files_cnt
&& rp_gen
)
6229 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6234 if (rp_files_cnt
|| rp_gen
)
6236 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6238 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6244 if (rp_gen_func_min
> rp_gen_func_max
)
6246 log_error ("ERROR: Invalid rp-gen-func-min specified");
6251 if (kernel_accel_chgd
== 1)
6255 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6256 log_info ("Please consider using the option -w instead");
6257 log_info ("You can use --force to override this but do not post error reports if you do so");
6263 if (kernel_accel
< 1)
6265 log_error ("ERROR: Invalid kernel-accel specified");
6270 if (kernel_accel
> 1024)
6272 log_error ("ERROR: Invalid kernel-accel specified");
6278 if (kernel_loops_chgd
== 1)
6282 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6283 log_info ("Please consider using the option -w instead");
6284 log_info ("You can use --force to override this but do not post error reports if you do so");
6290 if (kernel_loops
< 1)
6292 log_error ("ERROR: Invalid kernel-loops specified");
6297 if (kernel_loops
> 1024)
6299 log_error ("ERROR: Invalid kernel-loops specified");
6305 if ((workload_profile
< 1) || (workload_profile
> 4))
6307 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6312 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6314 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6319 if (show
== 1 || left
== 1)
6321 attack_mode
= ATTACK_MODE_NONE
;
6325 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6330 if (potfile_disable
== 1)
6332 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6338 uint attack_kern
= ATTACK_KERN_NONE
;
6340 switch (attack_mode
)
6342 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6343 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6344 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6345 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6346 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6353 int num_additional_params
= 1;
6355 if (attack_kern
== ATTACK_KERN_COMBI
)
6357 num_additional_params
= 2;
6360 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6362 if (keyspace_wordlist_specified
== 0) optind
--;
6365 if (attack_kern
== ATTACK_KERN_NONE
)
6367 if ((optind
+ 1) != myargc
)
6369 usage_mini_print (myargv
[0]);
6374 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6376 if ((optind
+ 1) > myargc
)
6378 usage_mini_print (myargv
[0]);
6383 else if (attack_kern
== ATTACK_KERN_COMBI
)
6385 if ((optind
+ 3) != myargc
)
6387 usage_mini_print (myargv
[0]);
6392 else if (attack_kern
== ATTACK_KERN_BF
)
6394 if ((optind
+ 1) > myargc
)
6396 usage_mini_print (myargv
[0]);
6403 usage_mini_print (myargv
[0]);
6410 if (myargv
[optind
] != 0)
6412 log_error ("ERROR: Invalid argument for benchmark mode specified");
6417 if (attack_mode_chgd
== 1)
6419 if (attack_mode
!= ATTACK_MODE_BF
)
6421 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6428 if (skip
!= 0 && limit
!= 0)
6437 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6443 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6448 potfile_disable
= 1;
6450 restore_disable
= 1;
6454 weak_hash_threshold
= 0;
6459 if (remove_timer_chgd
== 1)
6463 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6468 if (remove_timer
< 1)
6470 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6478 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6480 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6482 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6489 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6497 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6499 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6504 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6506 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6514 log_error ("ERROR: Invalid debug-mode specified");
6519 if (debug_file
!= NULL
)
6523 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6529 if (induction_dir
!= NULL
)
6531 if (attack_mode
== ATTACK_MODE_BF
)
6533 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6539 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6541 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6543 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6548 weak_hash_threshold
= 0;
6552 * induction directory
6555 char *induction_directory
= NULL
;
6557 if (attack_mode
!= ATTACK_MODE_BF
)
6559 if (induction_dir
== NULL
)
6561 induction_directory
= (char *) mymalloc (session_size
);
6563 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6565 // create induction folder if it does not already exist
6569 if (rmdir (induction_directory
) == -1)
6571 if (errno
== ENOENT
)
6573 // good, we can ignore
6575 else if (errno
== ENOTEMPTY
)
6577 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6579 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6581 if (rename (induction_directory
, induction_directory_mv
) != 0)
6583 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6590 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6596 if (mkdir (induction_directory
, 0700) == -1)
6598 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6606 induction_directory
= induction_dir
;
6610 data
.induction_directory
= induction_directory
;
6616 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6618 char *loopback_file
= (char *) mymalloc (loopback_size
);
6624 char tuning_db_file
[256] = { 0 };
6626 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6628 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6631 * outfile-check directory
6634 char *outfile_check_directory
= NULL
;
6636 if (outfile_check_dir
== NULL
)
6638 outfile_check_directory
= (char *) mymalloc (session_size
);
6640 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6644 outfile_check_directory
= outfile_check_dir
;
6647 data
.outfile_check_directory
= outfile_check_directory
;
6651 struct stat outfile_check_stat
;
6653 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6655 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6659 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6664 else if (outfile_check_dir
== NULL
)
6666 if (mkdir (outfile_check_directory
, 0700) == -1)
6668 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6676 * special other stuff
6679 if (hash_mode
== 9710)
6682 outfile_format_chgd
= 1;
6685 if (hash_mode
== 9810)
6688 outfile_format_chgd
= 1;
6691 if (hash_mode
== 10410)
6694 outfile_format_chgd
= 1;
6701 data
.hash_mode
= hash_mode
;
6702 data
.restore
= restore
;
6703 data
.restore_timer
= restore_timer
;
6704 data
.restore_disable
= restore_disable
;
6705 data
.status
= status
;
6706 data
.status_timer
= status_timer
;
6707 data
.machine_readable
= machine_readable
;
6708 data
.loopback
= loopback
;
6709 data
.runtime
= runtime
;
6710 data
.remove
= remove
;
6711 data
.remove_timer
= remove_timer
;
6712 data
.debug_mode
= debug_mode
;
6713 data
.debug_file
= debug_file
;
6714 data
.username
= username
;
6716 data
.outfile
= outfile
;
6717 data
.outfile_format
= outfile_format
;
6718 data
.outfile_autohex
= outfile_autohex
;
6719 data
.hex_charset
= hex_charset
;
6720 data
.hex_salt
= hex_salt
;
6721 data
.hex_wordlist
= hex_wordlist
;
6722 data
.separator
= separator
;
6723 data
.rp_files
= rp_files
;
6724 data
.rp_files_cnt
= rp_files_cnt
;
6725 data
.rp_gen
= rp_gen
;
6726 data
.rp_gen_seed
= rp_gen_seed
;
6728 data
.benchmark
= benchmark
;
6733 data
.powertune_enable
= powertune_enable
;
6736 data
.logfile_disable
= logfile_disable
;
6737 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6738 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6739 data
.veracrypt_pim
= veracrypt_pim
;
6740 data
.scrypt_tmto
= scrypt_tmto
;
6741 data
.workload_profile
= workload_profile
;
6749 set_cpu_affinity (cpu_affinity
);
6752 if (rp_gen_seed_chgd
== 0)
6758 srand (rp_gen_seed
);
6765 if (logfile_disable
== 0)
6767 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6769 char *logfile
= (char *) mymalloc (logfile_size
);
6771 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6773 data
.logfile
= logfile
;
6775 char *topid
= logfile_generate_topid ();
6780 // logfile_append() checks for logfile_disable internally to make it easier from here
6782 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6783 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6784 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6785 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6786 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6787 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6788 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6789 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6790 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6791 #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));
6793 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6794 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6795 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6796 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6797 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6798 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6799 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6800 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6802 logfile_top_msg ("START");
6804 logfile_top_uint (attack_mode
);
6805 logfile_top_uint (attack_kern
);
6806 logfile_top_uint (benchmark
);
6807 logfile_top_uint (bitmap_min
);
6808 logfile_top_uint (bitmap_max
);
6809 logfile_top_uint (debug_mode
);
6810 logfile_top_uint (force
);
6811 logfile_top_uint (kernel_accel
);
6812 logfile_top_uint (kernel_loops
);
6813 logfile_top_uint (gpu_temp_disable
);
6815 logfile_top_uint (gpu_temp_abort
);
6816 logfile_top_uint (gpu_temp_retain
);
6818 logfile_top_uint (hash_mode
);
6819 logfile_top_uint (hex_charset
);
6820 logfile_top_uint (hex_salt
);
6821 logfile_top_uint (hex_wordlist
);
6822 logfile_top_uint (increment
);
6823 logfile_top_uint (increment_max
);
6824 logfile_top_uint (increment_min
);
6825 logfile_top_uint (keyspace
);
6826 logfile_top_uint (left
);
6827 logfile_top_uint (logfile_disable
);
6828 logfile_top_uint (loopback
);
6829 logfile_top_uint (markov_classic
);
6830 logfile_top_uint (markov_disable
);
6831 logfile_top_uint (markov_threshold
);
6832 logfile_top_uint (outfile_autohex
);
6833 logfile_top_uint (outfile_check_timer
);
6834 logfile_top_uint (outfile_format
);
6835 logfile_top_uint (potfile_disable
);
6836 logfile_top_string (potfile_path
);
6837 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6838 logfile_top_uint (powertune_enable
);
6840 logfile_top_uint (scrypt_tmto
);
6841 logfile_top_uint (quiet
);
6842 logfile_top_uint (remove
);
6843 logfile_top_uint (remove_timer
);
6844 logfile_top_uint (restore
);
6845 logfile_top_uint (restore_disable
);
6846 logfile_top_uint (restore_timer
);
6847 logfile_top_uint (rp_gen
);
6848 logfile_top_uint (rp_gen_func_max
);
6849 logfile_top_uint (rp_gen_func_min
);
6850 logfile_top_uint (rp_gen_seed
);
6851 logfile_top_uint (runtime
);
6852 logfile_top_uint (segment_size
);
6853 logfile_top_uint (show
);
6854 logfile_top_uint (status
);
6855 logfile_top_uint (machine_readable
);
6856 logfile_top_uint (status_timer
);
6857 logfile_top_uint (usage
);
6858 logfile_top_uint (username
);
6859 logfile_top_uint (version
);
6860 logfile_top_uint (weak_hash_threshold
);
6861 logfile_top_uint (workload_profile
);
6862 logfile_top_uint64 (limit
);
6863 logfile_top_uint64 (skip
);
6864 logfile_top_char (separator
);
6865 logfile_top_string (cpu_affinity
);
6866 logfile_top_string (custom_charset_1
);
6867 logfile_top_string (custom_charset_2
);
6868 logfile_top_string (custom_charset_3
);
6869 logfile_top_string (custom_charset_4
);
6870 logfile_top_string (debug_file
);
6871 logfile_top_string (opencl_devices
);
6872 logfile_top_string (opencl_platforms
);
6873 logfile_top_string (opencl_device_types
);
6874 logfile_top_uint (opencl_vector_width
);
6875 logfile_top_string (induction_dir
);
6876 logfile_top_string (markov_hcstat
);
6877 logfile_top_string (outfile
);
6878 logfile_top_string (outfile_check_dir
);
6879 logfile_top_string (rule_buf_l
);
6880 logfile_top_string (rule_buf_r
);
6881 logfile_top_string (session
);
6882 logfile_top_string (truecrypt_keyfiles
);
6883 logfile_top_string (veracrypt_keyfiles
);
6884 logfile_top_uint (veracrypt_pim
);
6887 * Init OpenCL library loader
6892 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6900 * OpenCL platform selection
6903 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6906 * OpenCL device selection
6909 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6912 * OpenCL device type selection
6915 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6924 * disable useless stuff for benchmark
6929 restore_disable
= 1;
6930 potfile_disable
= 1;
6931 weak_hash_threshold
= 0;
6932 gpu_temp_disable
= 1;
6936 powertune_enable
= 1;
6940 data
.status_timer
= status_timer
;
6941 data
.restore_timer
= restore_timer
;
6942 data
.restore_disable
= restore_disable
;
6945 * force attack mode to be bruteforce
6948 attack_mode
= ATTACK_MODE_BF
;
6949 attack_kern
= ATTACK_KERN_BF
;
6951 if (workload_profile_chgd
== 0)
6953 workload_profile
= 3;
6955 data
.workload_profile
= workload_profile
;
6965 uint attack_exec
= 0;
6969 uint esalt_size
= 0;
6971 uint dgst_pos0
= -1;
6972 uint dgst_pos1
= -1;
6973 uint dgst_pos2
= -1;
6974 uint dgst_pos3
= -1;
6976 int (*parse_func
) (char *, uint
, hash_t
*);
6977 int (*sort_by_digest
) (const void *, const void *);
6979 uint algorithm_pos
= 0;
6980 uint algorithm_max
= 1;
6982 uint
*algorithms
= default_benchmark_algorithms
;
6984 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6986 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6989 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6990 * the following algos are skipped entirely
6993 if (algorithm_pos
> 0)
6997 rd
= init_restore (argc
, argv
);
7003 * update hash_mode in case of multihash benchmark
7008 if (hash_mode_chgd
== 0)
7010 hash_mode
= algorithms
[algorithm_pos
];
7012 data
.hash_mode
= hash_mode
;
7022 case 0: hash_type
= HASH_TYPE_MD5
;
7023 salt_type
= SALT_TYPE_NONE
;
7024 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7025 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7026 | OPTS_TYPE_PT_ADD80
7027 | OPTS_TYPE_PT_ADDBITS14
;
7028 kern_type
= KERN_TYPE_MD5
;
7029 dgst_size
= DGST_SIZE_4_4
;
7030 parse_func
= md5_parse_hash
;
7031 sort_by_digest
= sort_by_digest_4_4
;
7032 opti_type
= OPTI_TYPE_ZERO_BYTE
7033 | OPTI_TYPE_PRECOMPUTE_INIT
7034 | OPTI_TYPE_PRECOMPUTE_MERKLE
7035 | OPTI_TYPE_MEET_IN_MIDDLE
7036 | OPTI_TYPE_EARLY_SKIP
7037 | OPTI_TYPE_NOT_ITERATED
7038 | OPTI_TYPE_NOT_SALTED
7039 | OPTI_TYPE_RAW_HASH
;
7046 case 10: hash_type
= HASH_TYPE_MD5
;
7047 salt_type
= SALT_TYPE_INTERN
;
7048 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7049 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7050 | OPTS_TYPE_ST_ADD80
7051 | OPTS_TYPE_ST_ADDBITS14
;
7052 kern_type
= KERN_TYPE_MD5_PWSLT
;
7053 dgst_size
= DGST_SIZE_4_4
;
7054 parse_func
= md5s_parse_hash
;
7055 sort_by_digest
= sort_by_digest_4_4
;
7056 opti_type
= OPTI_TYPE_ZERO_BYTE
7057 | OPTI_TYPE_PRECOMPUTE_INIT
7058 | OPTI_TYPE_PRECOMPUTE_MERKLE
7059 | OPTI_TYPE_MEET_IN_MIDDLE
7060 | OPTI_TYPE_EARLY_SKIP
7061 | OPTI_TYPE_NOT_ITERATED
7062 | OPTI_TYPE_APPENDED_SALT
7063 | OPTI_TYPE_RAW_HASH
;
7070 case 11: hash_type
= HASH_TYPE_MD5
;
7071 salt_type
= SALT_TYPE_INTERN
;
7072 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7073 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7074 | OPTS_TYPE_ST_ADD80
7075 | OPTS_TYPE_ST_ADDBITS14
;
7076 kern_type
= KERN_TYPE_MD5_PWSLT
;
7077 dgst_size
= DGST_SIZE_4_4
;
7078 parse_func
= joomla_parse_hash
;
7079 sort_by_digest
= sort_by_digest_4_4
;
7080 opti_type
= OPTI_TYPE_ZERO_BYTE
7081 | OPTI_TYPE_PRECOMPUTE_INIT
7082 | OPTI_TYPE_PRECOMPUTE_MERKLE
7083 | OPTI_TYPE_MEET_IN_MIDDLE
7084 | OPTI_TYPE_EARLY_SKIP
7085 | OPTI_TYPE_NOT_ITERATED
7086 | OPTI_TYPE_APPENDED_SALT
7087 | OPTI_TYPE_RAW_HASH
;
7094 case 12: hash_type
= HASH_TYPE_MD5
;
7095 salt_type
= SALT_TYPE_INTERN
;
7096 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7097 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7098 | OPTS_TYPE_ST_ADD80
7099 | OPTS_TYPE_ST_ADDBITS14
;
7100 kern_type
= KERN_TYPE_MD5_PWSLT
;
7101 dgst_size
= DGST_SIZE_4_4
;
7102 parse_func
= postgresql_parse_hash
;
7103 sort_by_digest
= sort_by_digest_4_4
;
7104 opti_type
= OPTI_TYPE_ZERO_BYTE
7105 | OPTI_TYPE_PRECOMPUTE_INIT
7106 | OPTI_TYPE_PRECOMPUTE_MERKLE
7107 | OPTI_TYPE_MEET_IN_MIDDLE
7108 | OPTI_TYPE_EARLY_SKIP
7109 | OPTI_TYPE_NOT_ITERATED
7110 | OPTI_TYPE_APPENDED_SALT
7111 | OPTI_TYPE_RAW_HASH
;
7118 case 20: hash_type
= HASH_TYPE_MD5
;
7119 salt_type
= SALT_TYPE_INTERN
;
7120 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7122 | OPTS_TYPE_PT_ADD80
7123 | OPTS_TYPE_PT_ADDBITS14
;
7124 kern_type
= KERN_TYPE_MD5_SLTPW
;
7125 dgst_size
= DGST_SIZE_4_4
;
7126 parse_func
= md5s_parse_hash
;
7127 sort_by_digest
= sort_by_digest_4_4
;
7128 opti_type
= OPTI_TYPE_ZERO_BYTE
7129 | OPTI_TYPE_PRECOMPUTE_INIT
7130 | OPTI_TYPE_PRECOMPUTE_MERKLE
7131 | OPTI_TYPE_EARLY_SKIP
7132 | OPTI_TYPE_NOT_ITERATED
7133 | OPTI_TYPE_PREPENDED_SALT
7134 | OPTI_TYPE_RAW_HASH
;
7141 case 21: hash_type
= HASH_TYPE_MD5
;
7142 salt_type
= SALT_TYPE_INTERN
;
7143 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7144 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7145 | OPTS_TYPE_PT_ADD80
7146 | OPTS_TYPE_PT_ADDBITS14
;
7147 kern_type
= KERN_TYPE_MD5_SLTPW
;
7148 dgst_size
= DGST_SIZE_4_4
;
7149 parse_func
= osc_parse_hash
;
7150 sort_by_digest
= sort_by_digest_4_4
;
7151 opti_type
= OPTI_TYPE_ZERO_BYTE
7152 | OPTI_TYPE_PRECOMPUTE_INIT
7153 | OPTI_TYPE_PRECOMPUTE_MERKLE
7154 | OPTI_TYPE_EARLY_SKIP
7155 | OPTI_TYPE_NOT_ITERATED
7156 | OPTI_TYPE_PREPENDED_SALT
7157 | OPTI_TYPE_RAW_HASH
;
7164 case 22: hash_type
= HASH_TYPE_MD5
;
7165 salt_type
= SALT_TYPE_EMBEDDED
;
7166 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7167 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7168 | OPTS_TYPE_PT_ADD80
7169 | OPTS_TYPE_PT_ADDBITS14
;
7170 kern_type
= KERN_TYPE_MD5_SLTPW
;
7171 dgst_size
= DGST_SIZE_4_4
;
7172 parse_func
= netscreen_parse_hash
;
7173 sort_by_digest
= sort_by_digest_4_4
;
7174 opti_type
= OPTI_TYPE_ZERO_BYTE
7175 | OPTI_TYPE_PRECOMPUTE_INIT
7176 | OPTI_TYPE_PRECOMPUTE_MERKLE
7177 | OPTI_TYPE_EARLY_SKIP
7178 | OPTI_TYPE_NOT_ITERATED
7179 | OPTI_TYPE_PREPENDED_SALT
7180 | OPTI_TYPE_RAW_HASH
;
7187 case 23: hash_type
= HASH_TYPE_MD5
;
7188 salt_type
= SALT_TYPE_EMBEDDED
;
7189 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7190 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7191 | OPTS_TYPE_PT_ADD80
7192 | OPTS_TYPE_PT_ADDBITS14
;
7193 kern_type
= KERN_TYPE_MD5_SLTPW
;
7194 dgst_size
= DGST_SIZE_4_4
;
7195 parse_func
= skype_parse_hash
;
7196 sort_by_digest
= sort_by_digest_4_4
;
7197 opti_type
= OPTI_TYPE_ZERO_BYTE
7198 | OPTI_TYPE_PRECOMPUTE_INIT
7199 | OPTI_TYPE_PRECOMPUTE_MERKLE
7200 | OPTI_TYPE_EARLY_SKIP
7201 | OPTI_TYPE_NOT_ITERATED
7202 | OPTI_TYPE_PREPENDED_SALT
7203 | OPTI_TYPE_RAW_HASH
;
7210 case 30: hash_type
= HASH_TYPE_MD5
;
7211 salt_type
= SALT_TYPE_INTERN
;
7212 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7213 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7214 | OPTS_TYPE_PT_UNICODE
7215 | OPTS_TYPE_ST_ADD80
7216 | OPTS_TYPE_ST_ADDBITS14
;
7217 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7218 dgst_size
= DGST_SIZE_4_4
;
7219 parse_func
= md5s_parse_hash
;
7220 sort_by_digest
= sort_by_digest_4_4
;
7221 opti_type
= OPTI_TYPE_ZERO_BYTE
7222 | OPTI_TYPE_PRECOMPUTE_INIT
7223 | OPTI_TYPE_PRECOMPUTE_MERKLE
7224 | OPTI_TYPE_MEET_IN_MIDDLE
7225 | OPTI_TYPE_EARLY_SKIP
7226 | OPTI_TYPE_NOT_ITERATED
7227 | OPTI_TYPE_APPENDED_SALT
7228 | OPTI_TYPE_RAW_HASH
;
7235 case 40: hash_type
= HASH_TYPE_MD5
;
7236 salt_type
= SALT_TYPE_INTERN
;
7237 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7238 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7239 | OPTS_TYPE_PT_ADD80
7240 | OPTS_TYPE_PT_ADDBITS14
7241 | OPTS_TYPE_PT_UNICODE
;
7242 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7243 dgst_size
= DGST_SIZE_4_4
;
7244 parse_func
= md5s_parse_hash
;
7245 sort_by_digest
= sort_by_digest_4_4
;
7246 opti_type
= OPTI_TYPE_ZERO_BYTE
7247 | OPTI_TYPE_PRECOMPUTE_INIT
7248 | OPTI_TYPE_PRECOMPUTE_MERKLE
7249 | OPTI_TYPE_EARLY_SKIP
7250 | OPTI_TYPE_NOT_ITERATED
7251 | OPTI_TYPE_PREPENDED_SALT
7252 | OPTI_TYPE_RAW_HASH
;
7259 case 50: hash_type
= HASH_TYPE_MD5
;
7260 salt_type
= SALT_TYPE_INTERN
;
7261 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7262 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7263 | OPTS_TYPE_ST_ADD80
7264 | OPTS_TYPE_ST_ADDBITS14
;
7265 kern_type
= KERN_TYPE_HMACMD5_PW
;
7266 dgst_size
= DGST_SIZE_4_4
;
7267 parse_func
= hmacmd5_parse_hash
;
7268 sort_by_digest
= sort_by_digest_4_4
;
7269 opti_type
= OPTI_TYPE_ZERO_BYTE
7270 | OPTI_TYPE_NOT_ITERATED
;
7277 case 60: hash_type
= HASH_TYPE_MD5
;
7278 salt_type
= SALT_TYPE_INTERN
;
7279 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7280 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7281 | OPTS_TYPE_PT_ADD80
7282 | OPTS_TYPE_PT_ADDBITS14
;
7283 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7284 dgst_size
= DGST_SIZE_4_4
;
7285 parse_func
= hmacmd5_parse_hash
;
7286 sort_by_digest
= sort_by_digest_4_4
;
7287 opti_type
= OPTI_TYPE_ZERO_BYTE
7288 | OPTI_TYPE_NOT_ITERATED
;
7295 case 100: hash_type
= HASH_TYPE_SHA1
;
7296 salt_type
= SALT_TYPE_NONE
;
7297 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7298 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7299 | OPTS_TYPE_PT_ADD80
7300 | OPTS_TYPE_PT_ADDBITS15
;
7301 kern_type
= KERN_TYPE_SHA1
;
7302 dgst_size
= DGST_SIZE_4_5
;
7303 parse_func
= sha1_parse_hash
;
7304 sort_by_digest
= sort_by_digest_4_5
;
7305 opti_type
= OPTI_TYPE_ZERO_BYTE
7306 | OPTI_TYPE_PRECOMPUTE_INIT
7307 | OPTI_TYPE_PRECOMPUTE_MERKLE
7308 | OPTI_TYPE_EARLY_SKIP
7309 | OPTI_TYPE_NOT_ITERATED
7310 | OPTI_TYPE_NOT_SALTED
7311 | OPTI_TYPE_RAW_HASH
;
7318 case 101: hash_type
= HASH_TYPE_SHA1
;
7319 salt_type
= SALT_TYPE_NONE
;
7320 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7321 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7322 | OPTS_TYPE_PT_ADD80
7323 | OPTS_TYPE_PT_ADDBITS15
;
7324 kern_type
= KERN_TYPE_SHA1
;
7325 dgst_size
= DGST_SIZE_4_5
;
7326 parse_func
= sha1b64_parse_hash
;
7327 sort_by_digest
= sort_by_digest_4_5
;
7328 opti_type
= OPTI_TYPE_ZERO_BYTE
7329 | OPTI_TYPE_PRECOMPUTE_INIT
7330 | OPTI_TYPE_PRECOMPUTE_MERKLE
7331 | OPTI_TYPE_EARLY_SKIP
7332 | OPTI_TYPE_NOT_ITERATED
7333 | OPTI_TYPE_NOT_SALTED
7334 | OPTI_TYPE_RAW_HASH
;
7341 case 110: hash_type
= HASH_TYPE_SHA1
;
7342 salt_type
= SALT_TYPE_INTERN
;
7343 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7344 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7345 | OPTS_TYPE_ST_ADD80
7346 | OPTS_TYPE_ST_ADDBITS15
;
7347 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7348 dgst_size
= DGST_SIZE_4_5
;
7349 parse_func
= sha1s_parse_hash
;
7350 sort_by_digest
= sort_by_digest_4_5
;
7351 opti_type
= OPTI_TYPE_ZERO_BYTE
7352 | OPTI_TYPE_PRECOMPUTE_INIT
7353 | OPTI_TYPE_PRECOMPUTE_MERKLE
7354 | OPTI_TYPE_EARLY_SKIP
7355 | OPTI_TYPE_NOT_ITERATED
7356 | OPTI_TYPE_APPENDED_SALT
7357 | OPTI_TYPE_RAW_HASH
;
7364 case 111: hash_type
= HASH_TYPE_SHA1
;
7365 salt_type
= SALT_TYPE_EMBEDDED
;
7366 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7367 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7368 | OPTS_TYPE_ST_ADD80
7369 | OPTS_TYPE_ST_ADDBITS15
;
7370 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7371 dgst_size
= DGST_SIZE_4_5
;
7372 parse_func
= sha1b64s_parse_hash
;
7373 sort_by_digest
= sort_by_digest_4_5
;
7374 opti_type
= OPTI_TYPE_ZERO_BYTE
7375 | OPTI_TYPE_PRECOMPUTE_INIT
7376 | OPTI_TYPE_PRECOMPUTE_MERKLE
7377 | OPTI_TYPE_EARLY_SKIP
7378 | OPTI_TYPE_NOT_ITERATED
7379 | OPTI_TYPE_APPENDED_SALT
7380 | OPTI_TYPE_RAW_HASH
;
7387 case 112: hash_type
= HASH_TYPE_SHA1
;
7388 salt_type
= SALT_TYPE_INTERN
;
7389 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7390 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7391 | OPTS_TYPE_ST_ADD80
7392 | OPTS_TYPE_ST_ADDBITS15
7394 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7395 dgst_size
= DGST_SIZE_4_5
;
7396 parse_func
= oracles_parse_hash
;
7397 sort_by_digest
= sort_by_digest_4_5
;
7398 opti_type
= OPTI_TYPE_ZERO_BYTE
7399 | OPTI_TYPE_PRECOMPUTE_INIT
7400 | OPTI_TYPE_PRECOMPUTE_MERKLE
7401 | OPTI_TYPE_EARLY_SKIP
7402 | OPTI_TYPE_NOT_ITERATED
7403 | OPTI_TYPE_APPENDED_SALT
7404 | OPTI_TYPE_RAW_HASH
;
7411 case 120: hash_type
= HASH_TYPE_SHA1
;
7412 salt_type
= SALT_TYPE_INTERN
;
7413 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7414 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7415 | OPTS_TYPE_PT_ADD80
7416 | OPTS_TYPE_PT_ADDBITS15
;
7417 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7418 dgst_size
= DGST_SIZE_4_5
;
7419 parse_func
= sha1s_parse_hash
;
7420 sort_by_digest
= sort_by_digest_4_5
;
7421 opti_type
= OPTI_TYPE_ZERO_BYTE
7422 | OPTI_TYPE_PRECOMPUTE_INIT
7423 | OPTI_TYPE_PRECOMPUTE_MERKLE
7424 | OPTI_TYPE_EARLY_SKIP
7425 | OPTI_TYPE_NOT_ITERATED
7426 | OPTI_TYPE_PREPENDED_SALT
7427 | OPTI_TYPE_RAW_HASH
;
7434 case 121: hash_type
= HASH_TYPE_SHA1
;
7435 salt_type
= SALT_TYPE_INTERN
;
7436 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7437 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7438 | OPTS_TYPE_PT_ADD80
7439 | OPTS_TYPE_PT_ADDBITS15
7440 | OPTS_TYPE_ST_LOWER
;
7441 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7442 dgst_size
= DGST_SIZE_4_5
;
7443 parse_func
= smf_parse_hash
;
7444 sort_by_digest
= sort_by_digest_4_5
;
7445 opti_type
= OPTI_TYPE_ZERO_BYTE
7446 | OPTI_TYPE_PRECOMPUTE_INIT
7447 | OPTI_TYPE_PRECOMPUTE_MERKLE
7448 | OPTI_TYPE_EARLY_SKIP
7449 | OPTI_TYPE_NOT_ITERATED
7450 | OPTI_TYPE_PREPENDED_SALT
7451 | OPTI_TYPE_RAW_HASH
;
7458 case 122: hash_type
= HASH_TYPE_SHA1
;
7459 salt_type
= SALT_TYPE_EMBEDDED
;
7460 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7461 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7462 | OPTS_TYPE_PT_ADD80
7463 | OPTS_TYPE_PT_ADDBITS15
7465 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7466 dgst_size
= DGST_SIZE_4_5
;
7467 parse_func
= osx1_parse_hash
;
7468 sort_by_digest
= sort_by_digest_4_5
;
7469 opti_type
= OPTI_TYPE_ZERO_BYTE
7470 | OPTI_TYPE_PRECOMPUTE_INIT
7471 | OPTI_TYPE_PRECOMPUTE_MERKLE
7472 | OPTI_TYPE_EARLY_SKIP
7473 | OPTI_TYPE_NOT_ITERATED
7474 | OPTI_TYPE_PREPENDED_SALT
7475 | OPTI_TYPE_RAW_HASH
;
7482 case 124: hash_type
= HASH_TYPE_SHA1
;
7483 salt_type
= SALT_TYPE_EMBEDDED
;
7484 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7485 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7486 | OPTS_TYPE_PT_ADD80
7487 | OPTS_TYPE_PT_ADDBITS15
;
7488 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7489 dgst_size
= DGST_SIZE_4_5
;
7490 parse_func
= djangosha1_parse_hash
;
7491 sort_by_digest
= sort_by_digest_4_5
;
7492 opti_type
= OPTI_TYPE_ZERO_BYTE
7493 | OPTI_TYPE_PRECOMPUTE_INIT
7494 | OPTI_TYPE_PRECOMPUTE_MERKLE
7495 | OPTI_TYPE_EARLY_SKIP
7496 | OPTI_TYPE_NOT_ITERATED
7497 | OPTI_TYPE_PREPENDED_SALT
7498 | OPTI_TYPE_RAW_HASH
;
7505 case 125: hash_type
= HASH_TYPE_SHA1
;
7506 salt_type
= SALT_TYPE_EMBEDDED
;
7507 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7508 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7509 | OPTS_TYPE_PT_ADD80
7510 | OPTS_TYPE_PT_ADDBITS15
7512 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7513 dgst_size
= DGST_SIZE_4_5
;
7514 parse_func
= arubaos_parse_hash
;
7515 sort_by_digest
= sort_by_digest_4_5
;
7516 opti_type
= OPTI_TYPE_ZERO_BYTE
7517 | OPTI_TYPE_PRECOMPUTE_INIT
7518 | OPTI_TYPE_PRECOMPUTE_MERKLE
7519 | OPTI_TYPE_EARLY_SKIP
7520 | OPTI_TYPE_NOT_ITERATED
7521 | OPTI_TYPE_PREPENDED_SALT
7522 | OPTI_TYPE_RAW_HASH
;
7529 case 130: hash_type
= HASH_TYPE_SHA1
;
7530 salt_type
= SALT_TYPE_INTERN
;
7531 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7532 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7533 | OPTS_TYPE_PT_UNICODE
7534 | OPTS_TYPE_ST_ADD80
7535 | OPTS_TYPE_ST_ADDBITS15
;
7536 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7537 dgst_size
= DGST_SIZE_4_5
;
7538 parse_func
= sha1s_parse_hash
;
7539 sort_by_digest
= sort_by_digest_4_5
;
7540 opti_type
= OPTI_TYPE_ZERO_BYTE
7541 | OPTI_TYPE_PRECOMPUTE_INIT
7542 | OPTI_TYPE_PRECOMPUTE_MERKLE
7543 | OPTI_TYPE_EARLY_SKIP
7544 | OPTI_TYPE_NOT_ITERATED
7545 | OPTI_TYPE_APPENDED_SALT
7546 | OPTI_TYPE_RAW_HASH
;
7553 case 131: hash_type
= HASH_TYPE_SHA1
;
7554 salt_type
= SALT_TYPE_EMBEDDED
;
7555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7557 | OPTS_TYPE_PT_UNICODE
7558 | OPTS_TYPE_PT_UPPER
7559 | OPTS_TYPE_ST_ADD80
7560 | OPTS_TYPE_ST_ADDBITS15
7562 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7563 dgst_size
= DGST_SIZE_4_5
;
7564 parse_func
= mssql2000_parse_hash
;
7565 sort_by_digest
= sort_by_digest_4_5
;
7566 opti_type
= OPTI_TYPE_ZERO_BYTE
7567 | OPTI_TYPE_PRECOMPUTE_INIT
7568 | OPTI_TYPE_PRECOMPUTE_MERKLE
7569 | OPTI_TYPE_EARLY_SKIP
7570 | OPTI_TYPE_NOT_ITERATED
7571 | OPTI_TYPE_APPENDED_SALT
7572 | OPTI_TYPE_RAW_HASH
;
7579 case 132: hash_type
= HASH_TYPE_SHA1
;
7580 salt_type
= SALT_TYPE_EMBEDDED
;
7581 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7582 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7583 | OPTS_TYPE_PT_UNICODE
7584 | OPTS_TYPE_ST_ADD80
7585 | OPTS_TYPE_ST_ADDBITS15
7587 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7588 dgst_size
= DGST_SIZE_4_5
;
7589 parse_func
= mssql2005_parse_hash
;
7590 sort_by_digest
= sort_by_digest_4_5
;
7591 opti_type
= OPTI_TYPE_ZERO_BYTE
7592 | OPTI_TYPE_PRECOMPUTE_INIT
7593 | OPTI_TYPE_PRECOMPUTE_MERKLE
7594 | OPTI_TYPE_EARLY_SKIP
7595 | OPTI_TYPE_NOT_ITERATED
7596 | OPTI_TYPE_APPENDED_SALT
7597 | OPTI_TYPE_RAW_HASH
;
7604 case 133: hash_type
= HASH_TYPE_SHA1
;
7605 salt_type
= SALT_TYPE_EMBEDDED
;
7606 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7607 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7608 | OPTS_TYPE_PT_UNICODE
7609 | OPTS_TYPE_ST_ADD80
7610 | OPTS_TYPE_ST_ADDBITS15
;
7611 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7612 dgst_size
= DGST_SIZE_4_5
;
7613 parse_func
= peoplesoft_parse_hash
;
7614 sort_by_digest
= sort_by_digest_4_5
;
7615 opti_type
= OPTI_TYPE_ZERO_BYTE
7616 | OPTI_TYPE_PRECOMPUTE_INIT
7617 | OPTI_TYPE_PRECOMPUTE_MERKLE
7618 | OPTI_TYPE_EARLY_SKIP
7619 | OPTI_TYPE_NOT_ITERATED
7620 | OPTI_TYPE_APPENDED_SALT
7621 | OPTI_TYPE_RAW_HASH
;
7628 case 140: hash_type
= HASH_TYPE_SHA1
;
7629 salt_type
= SALT_TYPE_INTERN
;
7630 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7631 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7632 | OPTS_TYPE_PT_ADD80
7633 | OPTS_TYPE_PT_ADDBITS15
7634 | OPTS_TYPE_PT_UNICODE
;
7635 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7636 dgst_size
= DGST_SIZE_4_5
;
7637 parse_func
= sha1s_parse_hash
;
7638 sort_by_digest
= sort_by_digest_4_5
;
7639 opti_type
= OPTI_TYPE_ZERO_BYTE
7640 | OPTI_TYPE_PRECOMPUTE_INIT
7641 | OPTI_TYPE_PRECOMPUTE_MERKLE
7642 | OPTI_TYPE_EARLY_SKIP
7643 | OPTI_TYPE_NOT_ITERATED
7644 | OPTI_TYPE_PREPENDED_SALT
7645 | OPTI_TYPE_RAW_HASH
;
7652 case 141: hash_type
= HASH_TYPE_SHA1
;
7653 salt_type
= SALT_TYPE_EMBEDDED
;
7654 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7655 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7656 | OPTS_TYPE_PT_ADD80
7657 | OPTS_TYPE_PT_ADDBITS15
7658 | OPTS_TYPE_PT_UNICODE
7659 | OPTS_TYPE_ST_BASE64
;
7660 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7661 dgst_size
= DGST_SIZE_4_5
;
7662 parse_func
= episerver_parse_hash
;
7663 sort_by_digest
= sort_by_digest_4_5
;
7664 opti_type
= OPTI_TYPE_ZERO_BYTE
7665 | OPTI_TYPE_PRECOMPUTE_INIT
7666 | OPTI_TYPE_PRECOMPUTE_MERKLE
7667 | OPTI_TYPE_EARLY_SKIP
7668 | OPTI_TYPE_NOT_ITERATED
7669 | OPTI_TYPE_PREPENDED_SALT
7670 | OPTI_TYPE_RAW_HASH
;
7677 case 150: hash_type
= HASH_TYPE_SHA1
;
7678 salt_type
= SALT_TYPE_INTERN
;
7679 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7680 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7681 | OPTS_TYPE_ST_ADD80
7682 | OPTS_TYPE_ST_ADDBITS15
;
7683 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7684 dgst_size
= DGST_SIZE_4_5
;
7685 parse_func
= hmacsha1_parse_hash
;
7686 sort_by_digest
= sort_by_digest_4_5
;
7687 opti_type
= OPTI_TYPE_ZERO_BYTE
7688 | OPTI_TYPE_NOT_ITERATED
;
7695 case 160: hash_type
= HASH_TYPE_SHA1
;
7696 salt_type
= SALT_TYPE_INTERN
;
7697 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7698 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7699 | OPTS_TYPE_PT_ADD80
7700 | OPTS_TYPE_PT_ADDBITS15
;
7701 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7702 dgst_size
= DGST_SIZE_4_5
;
7703 parse_func
= hmacsha1_parse_hash
;
7704 sort_by_digest
= sort_by_digest_4_5
;
7705 opti_type
= OPTI_TYPE_ZERO_BYTE
7706 | OPTI_TYPE_NOT_ITERATED
;
7713 case 190: hash_type
= HASH_TYPE_SHA1
;
7714 salt_type
= SALT_TYPE_NONE
;
7715 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7716 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7717 | OPTS_TYPE_PT_ADD80
7718 | OPTS_TYPE_PT_ADDBITS15
;
7719 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7720 dgst_size
= DGST_SIZE_4_5
;
7721 parse_func
= sha1linkedin_parse_hash
;
7722 sort_by_digest
= sort_by_digest_4_5
;
7723 opti_type
= OPTI_TYPE_ZERO_BYTE
7724 | OPTI_TYPE_PRECOMPUTE_INIT
7725 | OPTI_TYPE_EARLY_SKIP
7726 | OPTI_TYPE_NOT_ITERATED
7727 | OPTI_TYPE_NOT_SALTED
;
7734 case 200: hash_type
= HASH_TYPE_MYSQL
;
7735 salt_type
= SALT_TYPE_NONE
;
7736 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7738 kern_type
= KERN_TYPE_MYSQL
;
7739 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7740 parse_func
= mysql323_parse_hash
;
7741 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7742 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7749 case 300: hash_type
= HASH_TYPE_SHA1
;
7750 salt_type
= SALT_TYPE_NONE
;
7751 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7752 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7753 | OPTS_TYPE_PT_ADD80
7754 | OPTS_TYPE_PT_ADDBITS15
;
7755 kern_type
= KERN_TYPE_MYSQL41
;
7756 dgst_size
= DGST_SIZE_4_5
;
7757 parse_func
= sha1_parse_hash
;
7758 sort_by_digest
= sort_by_digest_4_5
;
7759 opti_type
= OPTI_TYPE_ZERO_BYTE
7760 | OPTI_TYPE_PRECOMPUTE_INIT
7761 | OPTI_TYPE_PRECOMPUTE_MERKLE
7762 | OPTI_TYPE_EARLY_SKIP
7763 | OPTI_TYPE_NOT_ITERATED
7764 | OPTI_TYPE_NOT_SALTED
;
7771 case 400: hash_type
= HASH_TYPE_MD5
;
7772 salt_type
= SALT_TYPE_EMBEDDED
;
7773 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7774 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7775 kern_type
= KERN_TYPE_PHPASS
;
7776 dgst_size
= DGST_SIZE_4_4
;
7777 parse_func
= phpass_parse_hash
;
7778 sort_by_digest
= sort_by_digest_4_4
;
7779 opti_type
= OPTI_TYPE_ZERO_BYTE
7780 | OPTI_TYPE_SLOW_HASH_SIMD
;
7787 case 500: hash_type
= HASH_TYPE_MD5
;
7788 salt_type
= SALT_TYPE_EMBEDDED
;
7789 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7790 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7791 kern_type
= KERN_TYPE_MD5CRYPT
;
7792 dgst_size
= DGST_SIZE_4_4
;
7793 parse_func
= md5crypt_parse_hash
;
7794 sort_by_digest
= sort_by_digest_4_4
;
7795 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7802 case 501: hash_type
= HASH_TYPE_MD5
;
7803 salt_type
= SALT_TYPE_EMBEDDED
;
7804 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7805 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7806 | OPTS_TYPE_HASH_COPY
;
7807 kern_type
= KERN_TYPE_MD5CRYPT
;
7808 dgst_size
= DGST_SIZE_4_4
;
7809 parse_func
= juniper_parse_hash
;
7810 sort_by_digest
= sort_by_digest_4_4
;
7811 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7818 case 900: hash_type
= HASH_TYPE_MD4
;
7819 salt_type
= SALT_TYPE_NONE
;
7820 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7821 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7822 | OPTS_TYPE_PT_ADD80
7823 | OPTS_TYPE_PT_ADDBITS14
;
7824 kern_type
= KERN_TYPE_MD4
;
7825 dgst_size
= DGST_SIZE_4_4
;
7826 parse_func
= md4_parse_hash
;
7827 sort_by_digest
= sort_by_digest_4_4
;
7828 opti_type
= OPTI_TYPE_ZERO_BYTE
7829 | OPTI_TYPE_PRECOMPUTE_INIT
7830 | OPTI_TYPE_PRECOMPUTE_MERKLE
7831 | OPTI_TYPE_MEET_IN_MIDDLE
7832 | OPTI_TYPE_EARLY_SKIP
7833 | OPTI_TYPE_NOT_ITERATED
7834 | OPTI_TYPE_NOT_SALTED
7835 | OPTI_TYPE_RAW_HASH
;
7842 case 1000: hash_type
= HASH_TYPE_MD4
;
7843 salt_type
= SALT_TYPE_NONE
;
7844 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7845 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7846 | OPTS_TYPE_PT_ADD80
7847 | OPTS_TYPE_PT_ADDBITS14
7848 | OPTS_TYPE_PT_UNICODE
;
7849 kern_type
= KERN_TYPE_MD4_PWU
;
7850 dgst_size
= DGST_SIZE_4_4
;
7851 parse_func
= md4_parse_hash
;
7852 sort_by_digest
= sort_by_digest_4_4
;
7853 opti_type
= OPTI_TYPE_ZERO_BYTE
7854 | OPTI_TYPE_PRECOMPUTE_INIT
7855 | OPTI_TYPE_PRECOMPUTE_MERKLE
7856 | OPTI_TYPE_MEET_IN_MIDDLE
7857 | OPTI_TYPE_EARLY_SKIP
7858 | OPTI_TYPE_NOT_ITERATED
7859 | OPTI_TYPE_NOT_SALTED
7860 | OPTI_TYPE_RAW_HASH
;
7867 case 1100: hash_type
= HASH_TYPE_MD4
;
7868 salt_type
= SALT_TYPE_INTERN
;
7869 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7871 | OPTS_TYPE_PT_ADD80
7872 | OPTS_TYPE_PT_ADDBITS14
7873 | OPTS_TYPE_PT_UNICODE
7874 | OPTS_TYPE_ST_ADD80
7875 | OPTS_TYPE_ST_UNICODE
7876 | OPTS_TYPE_ST_LOWER
;
7877 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7878 dgst_size
= DGST_SIZE_4_4
;
7879 parse_func
= dcc_parse_hash
;
7880 sort_by_digest
= sort_by_digest_4_4
;
7881 opti_type
= OPTI_TYPE_ZERO_BYTE
7882 | OPTI_TYPE_PRECOMPUTE_INIT
7883 | OPTI_TYPE_PRECOMPUTE_MERKLE
7884 | OPTI_TYPE_EARLY_SKIP
7885 | OPTI_TYPE_NOT_ITERATED
;
7892 case 1400: hash_type
= HASH_TYPE_SHA256
;
7893 salt_type
= SALT_TYPE_NONE
;
7894 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7895 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7896 | OPTS_TYPE_PT_ADD80
7897 | OPTS_TYPE_PT_ADDBITS15
;
7898 kern_type
= KERN_TYPE_SHA256
;
7899 dgst_size
= DGST_SIZE_4_8
;
7900 parse_func
= sha256_parse_hash
;
7901 sort_by_digest
= sort_by_digest_4_8
;
7902 opti_type
= OPTI_TYPE_ZERO_BYTE
7903 | OPTI_TYPE_PRECOMPUTE_INIT
7904 | OPTI_TYPE_PRECOMPUTE_MERKLE
7905 | OPTI_TYPE_EARLY_SKIP
7906 | OPTI_TYPE_NOT_ITERATED
7907 | OPTI_TYPE_NOT_SALTED
7908 | OPTI_TYPE_RAW_HASH
;
7915 case 1410: hash_type
= HASH_TYPE_SHA256
;
7916 salt_type
= SALT_TYPE_INTERN
;
7917 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7918 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7919 | OPTS_TYPE_ST_ADD80
7920 | OPTS_TYPE_ST_ADDBITS15
;
7921 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7922 dgst_size
= DGST_SIZE_4_8
;
7923 parse_func
= sha256s_parse_hash
;
7924 sort_by_digest
= sort_by_digest_4_8
;
7925 opti_type
= OPTI_TYPE_ZERO_BYTE
7926 | OPTI_TYPE_PRECOMPUTE_INIT
7927 | OPTI_TYPE_PRECOMPUTE_MERKLE
7928 | OPTI_TYPE_EARLY_SKIP
7929 | OPTI_TYPE_NOT_ITERATED
7930 | OPTI_TYPE_APPENDED_SALT
7931 | OPTI_TYPE_RAW_HASH
;
7938 case 1420: hash_type
= HASH_TYPE_SHA256
;
7939 salt_type
= SALT_TYPE_INTERN
;
7940 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7941 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7942 | OPTS_TYPE_PT_ADD80
7943 | OPTS_TYPE_PT_ADDBITS15
;
7944 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7945 dgst_size
= DGST_SIZE_4_8
;
7946 parse_func
= sha256s_parse_hash
;
7947 sort_by_digest
= sort_by_digest_4_8
;
7948 opti_type
= OPTI_TYPE_ZERO_BYTE
7949 | OPTI_TYPE_PRECOMPUTE_INIT
7950 | OPTI_TYPE_PRECOMPUTE_MERKLE
7951 | OPTI_TYPE_EARLY_SKIP
7952 | OPTI_TYPE_NOT_ITERATED
7953 | OPTI_TYPE_PREPENDED_SALT
7954 | OPTI_TYPE_RAW_HASH
;
7961 case 1421: hash_type
= HASH_TYPE_SHA256
;
7962 salt_type
= SALT_TYPE_EMBEDDED
;
7963 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7964 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7965 | OPTS_TYPE_PT_ADD80
7966 | OPTS_TYPE_PT_ADDBITS15
;
7967 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7968 dgst_size
= DGST_SIZE_4_8
;
7969 parse_func
= hmailserver_parse_hash
;
7970 sort_by_digest
= sort_by_digest_4_8
;
7971 opti_type
= OPTI_TYPE_ZERO_BYTE
7972 | OPTI_TYPE_PRECOMPUTE_INIT
7973 | OPTI_TYPE_PRECOMPUTE_MERKLE
7974 | OPTI_TYPE_EARLY_SKIP
7975 | OPTI_TYPE_NOT_ITERATED
7976 | OPTI_TYPE_PREPENDED_SALT
7977 | OPTI_TYPE_RAW_HASH
;
7984 case 1430: hash_type
= HASH_TYPE_SHA256
;
7985 salt_type
= SALT_TYPE_INTERN
;
7986 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7987 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7988 | OPTS_TYPE_PT_UNICODE
7989 | OPTS_TYPE_ST_ADD80
7990 | OPTS_TYPE_ST_ADDBITS15
;
7991 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7992 dgst_size
= DGST_SIZE_4_8
;
7993 parse_func
= sha256s_parse_hash
;
7994 sort_by_digest
= sort_by_digest_4_8
;
7995 opti_type
= OPTI_TYPE_ZERO_BYTE
7996 | OPTI_TYPE_PRECOMPUTE_INIT
7997 | OPTI_TYPE_PRECOMPUTE_MERKLE
7998 | OPTI_TYPE_EARLY_SKIP
7999 | OPTI_TYPE_NOT_ITERATED
8000 | OPTI_TYPE_APPENDED_SALT
8001 | OPTI_TYPE_RAW_HASH
;
8008 case 1440: hash_type
= HASH_TYPE_SHA256
;
8009 salt_type
= SALT_TYPE_INTERN
;
8010 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8011 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8012 | OPTS_TYPE_PT_ADD80
8013 | OPTS_TYPE_PT_ADDBITS15
8014 | OPTS_TYPE_PT_UNICODE
;
8015 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8016 dgst_size
= DGST_SIZE_4_8
;
8017 parse_func
= sha256s_parse_hash
;
8018 sort_by_digest
= sort_by_digest_4_8
;
8019 opti_type
= OPTI_TYPE_ZERO_BYTE
8020 | OPTI_TYPE_PRECOMPUTE_INIT
8021 | OPTI_TYPE_PRECOMPUTE_MERKLE
8022 | OPTI_TYPE_EARLY_SKIP
8023 | OPTI_TYPE_NOT_ITERATED
8024 | OPTI_TYPE_PREPENDED_SALT
8025 | OPTI_TYPE_RAW_HASH
;
8032 case 1441: hash_type
= HASH_TYPE_SHA256
;
8033 salt_type
= SALT_TYPE_EMBEDDED
;
8034 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8035 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8036 | OPTS_TYPE_PT_ADD80
8037 | OPTS_TYPE_PT_ADDBITS15
8038 | OPTS_TYPE_PT_UNICODE
8039 | OPTS_TYPE_ST_BASE64
;
8040 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8041 dgst_size
= DGST_SIZE_4_8
;
8042 parse_func
= episerver4_parse_hash
;
8043 sort_by_digest
= sort_by_digest_4_8
;
8044 opti_type
= OPTI_TYPE_ZERO_BYTE
8045 | OPTI_TYPE_PRECOMPUTE_INIT
8046 | OPTI_TYPE_PRECOMPUTE_MERKLE
8047 | OPTI_TYPE_EARLY_SKIP
8048 | OPTI_TYPE_NOT_ITERATED
8049 | OPTI_TYPE_PREPENDED_SALT
8050 | OPTI_TYPE_RAW_HASH
;
8057 case 1450: hash_type
= HASH_TYPE_SHA256
;
8058 salt_type
= SALT_TYPE_INTERN
;
8059 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8060 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8061 | OPTS_TYPE_ST_ADD80
;
8062 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8063 dgst_size
= DGST_SIZE_4_8
;
8064 parse_func
= hmacsha256_parse_hash
;
8065 sort_by_digest
= sort_by_digest_4_8
;
8066 opti_type
= OPTI_TYPE_ZERO_BYTE
8067 | OPTI_TYPE_NOT_ITERATED
;
8074 case 1460: hash_type
= HASH_TYPE_SHA256
;
8075 salt_type
= SALT_TYPE_INTERN
;
8076 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8077 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8078 | OPTS_TYPE_PT_ADD80
8079 | OPTS_TYPE_PT_ADDBITS15
;
8080 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8081 dgst_size
= DGST_SIZE_4_8
;
8082 parse_func
= hmacsha256_parse_hash
;
8083 sort_by_digest
= sort_by_digest_4_8
;
8084 opti_type
= OPTI_TYPE_ZERO_BYTE
8085 | OPTI_TYPE_NOT_ITERATED
;
8092 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8093 salt_type
= SALT_TYPE_EMBEDDED
;
8094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8095 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8096 | OPTS_TYPE_PT_BITSLICE
;
8097 kern_type
= KERN_TYPE_DESCRYPT
;
8098 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8099 parse_func
= descrypt_parse_hash
;
8100 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8101 opti_type
= OPTI_TYPE_ZERO_BYTE
8102 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8109 case 1600: hash_type
= HASH_TYPE_MD5
;
8110 salt_type
= SALT_TYPE_EMBEDDED
;
8111 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8112 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8113 kern_type
= KERN_TYPE_APR1CRYPT
;
8114 dgst_size
= DGST_SIZE_4_4
;
8115 parse_func
= md5apr1_parse_hash
;
8116 sort_by_digest
= sort_by_digest_4_4
;
8117 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8124 case 1700: hash_type
= HASH_TYPE_SHA512
;
8125 salt_type
= SALT_TYPE_NONE
;
8126 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8127 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8128 | OPTS_TYPE_PT_ADD80
8129 | OPTS_TYPE_PT_ADDBITS15
;
8130 kern_type
= KERN_TYPE_SHA512
;
8131 dgst_size
= DGST_SIZE_8_8
;
8132 parse_func
= sha512_parse_hash
;
8133 sort_by_digest
= sort_by_digest_8_8
;
8134 opti_type
= OPTI_TYPE_ZERO_BYTE
8135 | OPTI_TYPE_PRECOMPUTE_INIT
8136 | OPTI_TYPE_PRECOMPUTE_MERKLE
8137 | OPTI_TYPE_EARLY_SKIP
8138 | OPTI_TYPE_NOT_ITERATED
8139 | OPTI_TYPE_NOT_SALTED
8140 | OPTI_TYPE_USES_BITS_64
8141 | OPTI_TYPE_RAW_HASH
;
8148 case 1710: hash_type
= HASH_TYPE_SHA512
;
8149 salt_type
= SALT_TYPE_INTERN
;
8150 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8151 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8152 | OPTS_TYPE_ST_ADD80
8153 | OPTS_TYPE_ST_ADDBITS15
;
8154 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8155 dgst_size
= DGST_SIZE_8_8
;
8156 parse_func
= sha512s_parse_hash
;
8157 sort_by_digest
= sort_by_digest_8_8
;
8158 opti_type
= OPTI_TYPE_ZERO_BYTE
8159 | OPTI_TYPE_PRECOMPUTE_INIT
8160 | OPTI_TYPE_PRECOMPUTE_MERKLE
8161 | OPTI_TYPE_EARLY_SKIP
8162 | OPTI_TYPE_NOT_ITERATED
8163 | OPTI_TYPE_APPENDED_SALT
8164 | OPTI_TYPE_USES_BITS_64
8165 | OPTI_TYPE_RAW_HASH
;
8172 case 1711: hash_type
= HASH_TYPE_SHA512
;
8173 salt_type
= SALT_TYPE_EMBEDDED
;
8174 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8175 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8176 | OPTS_TYPE_ST_ADD80
8177 | OPTS_TYPE_ST_ADDBITS15
;
8178 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8179 dgst_size
= DGST_SIZE_8_8
;
8180 parse_func
= sha512b64s_parse_hash
;
8181 sort_by_digest
= sort_by_digest_8_8
;
8182 opti_type
= OPTI_TYPE_ZERO_BYTE
8183 | OPTI_TYPE_PRECOMPUTE_INIT
8184 | OPTI_TYPE_PRECOMPUTE_MERKLE
8185 | OPTI_TYPE_EARLY_SKIP
8186 | OPTI_TYPE_NOT_ITERATED
8187 | OPTI_TYPE_APPENDED_SALT
8188 | OPTI_TYPE_USES_BITS_64
8189 | OPTI_TYPE_RAW_HASH
;
8196 case 1720: hash_type
= HASH_TYPE_SHA512
;
8197 salt_type
= SALT_TYPE_INTERN
;
8198 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8199 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8200 | OPTS_TYPE_PT_ADD80
8201 | OPTS_TYPE_PT_ADDBITS15
;
8202 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8203 dgst_size
= DGST_SIZE_8_8
;
8204 parse_func
= sha512s_parse_hash
;
8205 sort_by_digest
= sort_by_digest_8_8
;
8206 opti_type
= OPTI_TYPE_ZERO_BYTE
8207 | OPTI_TYPE_PRECOMPUTE_INIT
8208 | OPTI_TYPE_PRECOMPUTE_MERKLE
8209 | OPTI_TYPE_EARLY_SKIP
8210 | OPTI_TYPE_NOT_ITERATED
8211 | OPTI_TYPE_PREPENDED_SALT
8212 | OPTI_TYPE_USES_BITS_64
8213 | OPTI_TYPE_RAW_HASH
;
8220 case 1722: hash_type
= HASH_TYPE_SHA512
;
8221 salt_type
= SALT_TYPE_EMBEDDED
;
8222 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8223 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8224 | OPTS_TYPE_PT_ADD80
8225 | OPTS_TYPE_PT_ADDBITS15
8227 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8228 dgst_size
= DGST_SIZE_8_8
;
8229 parse_func
= osx512_parse_hash
;
8230 sort_by_digest
= sort_by_digest_8_8
;
8231 opti_type
= OPTI_TYPE_ZERO_BYTE
8232 | OPTI_TYPE_PRECOMPUTE_INIT
8233 | OPTI_TYPE_PRECOMPUTE_MERKLE
8234 | OPTI_TYPE_EARLY_SKIP
8235 | OPTI_TYPE_NOT_ITERATED
8236 | OPTI_TYPE_PREPENDED_SALT
8237 | OPTI_TYPE_USES_BITS_64
8238 | OPTI_TYPE_RAW_HASH
;
8245 case 1730: hash_type
= HASH_TYPE_SHA512
;
8246 salt_type
= SALT_TYPE_INTERN
;
8247 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8248 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8249 | OPTS_TYPE_PT_UNICODE
8250 | OPTS_TYPE_ST_ADD80
8251 | OPTS_TYPE_ST_ADDBITS15
;
8252 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8253 dgst_size
= DGST_SIZE_8_8
;
8254 parse_func
= sha512s_parse_hash
;
8255 sort_by_digest
= sort_by_digest_8_8
;
8256 opti_type
= OPTI_TYPE_ZERO_BYTE
8257 | OPTI_TYPE_PRECOMPUTE_INIT
8258 | OPTI_TYPE_PRECOMPUTE_MERKLE
8259 | OPTI_TYPE_EARLY_SKIP
8260 | OPTI_TYPE_NOT_ITERATED
8261 | OPTI_TYPE_APPENDED_SALT
8262 | OPTI_TYPE_USES_BITS_64
8263 | OPTI_TYPE_RAW_HASH
;
8270 case 1731: hash_type
= HASH_TYPE_SHA512
;
8271 salt_type
= SALT_TYPE_EMBEDDED
;
8272 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8273 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8274 | OPTS_TYPE_PT_UNICODE
8275 | OPTS_TYPE_ST_ADD80
8276 | OPTS_TYPE_ST_ADDBITS15
8278 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8279 dgst_size
= DGST_SIZE_8_8
;
8280 parse_func
= mssql2012_parse_hash
;
8281 sort_by_digest
= sort_by_digest_8_8
;
8282 opti_type
= OPTI_TYPE_ZERO_BYTE
8283 | OPTI_TYPE_PRECOMPUTE_INIT
8284 | OPTI_TYPE_PRECOMPUTE_MERKLE
8285 | OPTI_TYPE_EARLY_SKIP
8286 | OPTI_TYPE_NOT_ITERATED
8287 | OPTI_TYPE_APPENDED_SALT
8288 | OPTI_TYPE_USES_BITS_64
8289 | OPTI_TYPE_RAW_HASH
;
8296 case 1740: hash_type
= HASH_TYPE_SHA512
;
8297 salt_type
= SALT_TYPE_INTERN
;
8298 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8299 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8300 | OPTS_TYPE_PT_ADD80
8301 | OPTS_TYPE_PT_ADDBITS15
8302 | OPTS_TYPE_PT_UNICODE
;
8303 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8304 dgst_size
= DGST_SIZE_8_8
;
8305 parse_func
= sha512s_parse_hash
;
8306 sort_by_digest
= sort_by_digest_8_8
;
8307 opti_type
= OPTI_TYPE_ZERO_BYTE
8308 | OPTI_TYPE_PRECOMPUTE_INIT
8309 | OPTI_TYPE_PRECOMPUTE_MERKLE
8310 | OPTI_TYPE_EARLY_SKIP
8311 | OPTI_TYPE_NOT_ITERATED
8312 | OPTI_TYPE_PREPENDED_SALT
8313 | OPTI_TYPE_USES_BITS_64
8314 | OPTI_TYPE_RAW_HASH
;
8321 case 1750: hash_type
= HASH_TYPE_SHA512
;
8322 salt_type
= SALT_TYPE_INTERN
;
8323 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8325 | OPTS_TYPE_ST_ADD80
;
8326 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8327 dgst_size
= DGST_SIZE_8_8
;
8328 parse_func
= hmacsha512_parse_hash
;
8329 sort_by_digest
= sort_by_digest_8_8
;
8330 opti_type
= OPTI_TYPE_ZERO_BYTE
8331 | OPTI_TYPE_USES_BITS_64
8332 | OPTI_TYPE_NOT_ITERATED
;
8339 case 1760: hash_type
= HASH_TYPE_SHA512
;
8340 salt_type
= SALT_TYPE_INTERN
;
8341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8342 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8343 | OPTS_TYPE_PT_ADD80
8344 | OPTS_TYPE_PT_ADDBITS15
;
8345 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8346 dgst_size
= DGST_SIZE_8_8
;
8347 parse_func
= hmacsha512_parse_hash
;
8348 sort_by_digest
= sort_by_digest_8_8
;
8349 opti_type
= OPTI_TYPE_ZERO_BYTE
8350 | OPTI_TYPE_USES_BITS_64
8351 | OPTI_TYPE_NOT_ITERATED
;
8358 case 1800: hash_type
= HASH_TYPE_SHA512
;
8359 salt_type
= SALT_TYPE_EMBEDDED
;
8360 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8362 kern_type
= KERN_TYPE_SHA512CRYPT
;
8363 dgst_size
= DGST_SIZE_8_8
;
8364 parse_func
= sha512crypt_parse_hash
;
8365 sort_by_digest
= sort_by_digest_8_8
;
8366 opti_type
= OPTI_TYPE_ZERO_BYTE
8367 | OPTI_TYPE_USES_BITS_64
;
8374 case 2100: hash_type
= HASH_TYPE_DCC2
;
8375 salt_type
= SALT_TYPE_EMBEDDED
;
8376 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8378 | OPTS_TYPE_ST_LOWER
8379 | OPTS_TYPE_ST_UNICODE
;
8380 kern_type
= KERN_TYPE_DCC2
;
8381 dgst_size
= DGST_SIZE_4_4
;
8382 parse_func
= dcc2_parse_hash
;
8383 sort_by_digest
= sort_by_digest_4_4
;
8384 opti_type
= OPTI_TYPE_ZERO_BYTE
8385 | OPTI_TYPE_SLOW_HASH_SIMD
;
8392 case 2400: hash_type
= HASH_TYPE_MD5
;
8393 salt_type
= SALT_TYPE_NONE
;
8394 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8395 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8396 kern_type
= KERN_TYPE_MD5PIX
;
8397 dgst_size
= DGST_SIZE_4_4
;
8398 parse_func
= md5pix_parse_hash
;
8399 sort_by_digest
= sort_by_digest_4_4
;
8400 opti_type
= OPTI_TYPE_ZERO_BYTE
8401 | OPTI_TYPE_PRECOMPUTE_INIT
8402 | OPTI_TYPE_PRECOMPUTE_MERKLE
8403 | OPTI_TYPE_EARLY_SKIP
8404 | OPTI_TYPE_NOT_ITERATED
8405 | OPTI_TYPE_NOT_SALTED
;
8412 case 2410: hash_type
= HASH_TYPE_MD5
;
8413 salt_type
= SALT_TYPE_INTERN
;
8414 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8415 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8416 kern_type
= KERN_TYPE_MD5ASA
;
8417 dgst_size
= DGST_SIZE_4_4
;
8418 parse_func
= md5asa_parse_hash
;
8419 sort_by_digest
= sort_by_digest_4_4
;
8420 opti_type
= OPTI_TYPE_ZERO_BYTE
8421 | OPTI_TYPE_PRECOMPUTE_INIT
8422 | OPTI_TYPE_PRECOMPUTE_MERKLE
8423 | OPTI_TYPE_EARLY_SKIP
8424 | OPTI_TYPE_NOT_ITERATED
;
8431 case 2500: hash_type
= HASH_TYPE_WPA
;
8432 salt_type
= SALT_TYPE_EMBEDDED
;
8433 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8434 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8435 kern_type
= KERN_TYPE_WPA
;
8436 dgst_size
= DGST_SIZE_4_4
;
8437 parse_func
= wpa_parse_hash
;
8438 sort_by_digest
= sort_by_digest_4_4
;
8439 opti_type
= OPTI_TYPE_ZERO_BYTE
8440 | OPTI_TYPE_SLOW_HASH_SIMD
;
8447 case 2600: hash_type
= HASH_TYPE_MD5
;
8448 salt_type
= SALT_TYPE_VIRTUAL
;
8449 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8450 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8451 | OPTS_TYPE_PT_ADD80
8452 | OPTS_TYPE_PT_ADDBITS14
8453 | OPTS_TYPE_ST_ADD80
;
8454 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8455 dgst_size
= DGST_SIZE_4_4
;
8456 parse_func
= md5md5_parse_hash
;
8457 sort_by_digest
= sort_by_digest_4_4
;
8458 opti_type
= OPTI_TYPE_ZERO_BYTE
8459 | OPTI_TYPE_PRECOMPUTE_INIT
8460 | OPTI_TYPE_PRECOMPUTE_MERKLE
8461 | OPTI_TYPE_EARLY_SKIP
;
8468 case 2611: hash_type
= HASH_TYPE_MD5
;
8469 salt_type
= SALT_TYPE_INTERN
;
8470 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8471 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8472 | OPTS_TYPE_PT_ADD80
8473 | OPTS_TYPE_PT_ADDBITS14
8474 | OPTS_TYPE_ST_ADD80
;
8475 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8476 dgst_size
= DGST_SIZE_4_4
;
8477 parse_func
= vb3_parse_hash
;
8478 sort_by_digest
= sort_by_digest_4_4
;
8479 opti_type
= OPTI_TYPE_ZERO_BYTE
8480 | OPTI_TYPE_PRECOMPUTE_INIT
8481 | OPTI_TYPE_PRECOMPUTE_MERKLE
8482 | OPTI_TYPE_EARLY_SKIP
;
8489 case 2612: hash_type
= HASH_TYPE_MD5
;
8490 salt_type
= SALT_TYPE_EMBEDDED
;
8491 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8492 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8493 | OPTS_TYPE_PT_ADD80
8494 | OPTS_TYPE_PT_ADDBITS14
8495 | OPTS_TYPE_ST_ADD80
8497 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8498 dgst_size
= DGST_SIZE_4_4
;
8499 parse_func
= phps_parse_hash
;
8500 sort_by_digest
= sort_by_digest_4_4
;
8501 opti_type
= OPTI_TYPE_ZERO_BYTE
8502 | OPTI_TYPE_PRECOMPUTE_INIT
8503 | OPTI_TYPE_PRECOMPUTE_MERKLE
8504 | OPTI_TYPE_EARLY_SKIP
;
8511 case 2711: hash_type
= HASH_TYPE_MD5
;
8512 salt_type
= SALT_TYPE_INTERN
;
8513 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8515 | OPTS_TYPE_PT_ADD80
8516 | OPTS_TYPE_PT_ADDBITS14
8517 | OPTS_TYPE_ST_ADD80
;
8518 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8519 dgst_size
= DGST_SIZE_4_4
;
8520 parse_func
= vb30_parse_hash
;
8521 sort_by_digest
= sort_by_digest_4_4
;
8522 opti_type
= OPTI_TYPE_ZERO_BYTE
8523 | OPTI_TYPE_PRECOMPUTE_INIT
8524 | OPTI_TYPE_EARLY_SKIP
;
8531 case 2811: hash_type
= HASH_TYPE_MD5
;
8532 salt_type
= SALT_TYPE_INTERN
;
8533 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8534 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8535 | OPTS_TYPE_PT_ADD80
8536 | OPTS_TYPE_PT_ADDBITS14
;
8537 kern_type
= KERN_TYPE_MD55_SLTPW
;
8538 dgst_size
= DGST_SIZE_4_4
;
8539 parse_func
= ipb2_parse_hash
;
8540 sort_by_digest
= sort_by_digest_4_4
;
8541 opti_type
= OPTI_TYPE_ZERO_BYTE
8542 | OPTI_TYPE_PRECOMPUTE_INIT
8543 | OPTI_TYPE_EARLY_SKIP
;
8550 case 3000: hash_type
= HASH_TYPE_LM
;
8551 salt_type
= SALT_TYPE_NONE
;
8552 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8554 | OPTS_TYPE_PT_UPPER
8555 | OPTS_TYPE_PT_BITSLICE
;
8556 kern_type
= KERN_TYPE_LM
;
8557 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8558 parse_func
= lm_parse_hash
;
8559 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8560 opti_type
= OPTI_TYPE_ZERO_BYTE
8561 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8568 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8569 salt_type
= SALT_TYPE_INTERN
;
8570 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8571 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8572 | OPTS_TYPE_PT_UPPER
8573 | OPTS_TYPE_ST_UPPER
;
8574 kern_type
= KERN_TYPE_ORACLEH
;
8575 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8576 parse_func
= oracleh_parse_hash
;
8577 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8578 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8585 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8586 salt_type
= SALT_TYPE_EMBEDDED
;
8587 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8588 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8589 | OPTS_TYPE_ST_GENERATE_LE
;
8590 kern_type
= KERN_TYPE_BCRYPT
;
8591 dgst_size
= DGST_SIZE_4_6
;
8592 parse_func
= bcrypt_parse_hash
;
8593 sort_by_digest
= sort_by_digest_4_6
;
8594 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8601 case 3710: hash_type
= HASH_TYPE_MD5
;
8602 salt_type
= SALT_TYPE_INTERN
;
8603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8605 | OPTS_TYPE_PT_ADD80
8606 | OPTS_TYPE_PT_ADDBITS14
;
8607 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8608 dgst_size
= DGST_SIZE_4_4
;
8609 parse_func
= md5s_parse_hash
;
8610 sort_by_digest
= sort_by_digest_4_4
;
8611 opti_type
= OPTI_TYPE_ZERO_BYTE
8612 | OPTI_TYPE_PRECOMPUTE_INIT
8613 | OPTI_TYPE_PRECOMPUTE_MERKLE
8614 | OPTI_TYPE_EARLY_SKIP
;
8621 case 3711: hash_type
= HASH_TYPE_MD5
;
8622 salt_type
= SALT_TYPE_EMBEDDED
;
8623 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8624 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8625 | OPTS_TYPE_PT_ADD80
8626 | OPTS_TYPE_PT_ADDBITS14
;
8627 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8628 dgst_size
= DGST_SIZE_4_4
;
8629 parse_func
= mediawiki_b_parse_hash
;
8630 sort_by_digest
= sort_by_digest_4_4
;
8631 opti_type
= OPTI_TYPE_ZERO_BYTE
8632 | OPTI_TYPE_PRECOMPUTE_INIT
8633 | OPTI_TYPE_PRECOMPUTE_MERKLE
8634 | OPTI_TYPE_EARLY_SKIP
;
8641 case 3800: hash_type
= HASH_TYPE_MD5
;
8642 salt_type
= SALT_TYPE_INTERN
;
8643 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8645 | OPTS_TYPE_ST_ADDBITS14
;
8646 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8647 dgst_size
= DGST_SIZE_4_4
;
8648 parse_func
= md5s_parse_hash
;
8649 sort_by_digest
= sort_by_digest_4_4
;
8650 opti_type
= OPTI_TYPE_ZERO_BYTE
8651 | OPTI_TYPE_PRECOMPUTE_INIT
8652 | OPTI_TYPE_PRECOMPUTE_MERKLE
8653 | OPTI_TYPE_EARLY_SKIP
8654 | OPTI_TYPE_NOT_ITERATED
8655 | OPTI_TYPE_RAW_HASH
;
8662 case 4300: hash_type
= HASH_TYPE_MD5
;
8663 salt_type
= SALT_TYPE_VIRTUAL
;
8664 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8666 | OPTS_TYPE_PT_ADD80
8667 | OPTS_TYPE_PT_ADDBITS14
8668 | OPTS_TYPE_ST_ADD80
;
8669 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8670 dgst_size
= DGST_SIZE_4_4
;
8671 parse_func
= md5md5_parse_hash
;
8672 sort_by_digest
= sort_by_digest_4_4
;
8673 opti_type
= OPTI_TYPE_ZERO_BYTE
8674 | OPTI_TYPE_PRECOMPUTE_INIT
8675 | OPTI_TYPE_PRECOMPUTE_MERKLE
8676 | OPTI_TYPE_EARLY_SKIP
;
8684 case 4400: hash_type
= HASH_TYPE_MD5
;
8685 salt_type
= SALT_TYPE_NONE
;
8686 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8687 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8688 | OPTS_TYPE_PT_ADD80
8689 | OPTS_TYPE_PT_ADDBITS15
;
8690 kern_type
= KERN_TYPE_MD5_SHA1
;
8691 dgst_size
= DGST_SIZE_4_4
;
8692 parse_func
= md5_parse_hash
;
8693 sort_by_digest
= sort_by_digest_4_4
;
8694 opti_type
= OPTI_TYPE_ZERO_BYTE
8695 | OPTI_TYPE_PRECOMPUTE_INIT
8696 | OPTI_TYPE_PRECOMPUTE_MERKLE
8697 | OPTI_TYPE_EARLY_SKIP
8698 | OPTI_TYPE_NOT_ITERATED
8699 | OPTI_TYPE_NOT_SALTED
8700 | OPTI_TYPE_RAW_HASH
;
8707 case 4500: hash_type
= HASH_TYPE_SHA1
;
8708 salt_type
= SALT_TYPE_NONE
;
8709 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8710 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8711 | OPTS_TYPE_PT_ADD80
8712 | OPTS_TYPE_PT_ADDBITS15
;
8713 kern_type
= KERN_TYPE_SHA11
;
8714 dgst_size
= DGST_SIZE_4_5
;
8715 parse_func
= sha1_parse_hash
;
8716 sort_by_digest
= sort_by_digest_4_5
;
8717 opti_type
= OPTI_TYPE_ZERO_BYTE
8718 | OPTI_TYPE_PRECOMPUTE_INIT
8719 | OPTI_TYPE_PRECOMPUTE_MERKLE
8720 | OPTI_TYPE_EARLY_SKIP
8721 | OPTI_TYPE_NOT_SALTED
;
8728 case 4700: hash_type
= HASH_TYPE_SHA1
;
8729 salt_type
= SALT_TYPE_NONE
;
8730 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8731 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8732 | OPTS_TYPE_PT_ADD80
8733 | OPTS_TYPE_PT_ADDBITS14
;
8734 kern_type
= KERN_TYPE_SHA1_MD5
;
8735 dgst_size
= DGST_SIZE_4_5
;
8736 parse_func
= sha1_parse_hash
;
8737 sort_by_digest
= sort_by_digest_4_5
;
8738 opti_type
= OPTI_TYPE_ZERO_BYTE
8739 | OPTI_TYPE_PRECOMPUTE_INIT
8740 | OPTI_TYPE_PRECOMPUTE_MERKLE
8741 | OPTI_TYPE_EARLY_SKIP
8742 | OPTI_TYPE_NOT_ITERATED
8743 | OPTI_TYPE_NOT_SALTED
8744 | OPTI_TYPE_RAW_HASH
;
8751 case 4800: hash_type
= HASH_TYPE_MD5
;
8752 salt_type
= SALT_TYPE_EMBEDDED
;
8753 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8754 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8755 | OPTS_TYPE_PT_ADDBITS14
;
8756 kern_type
= KERN_TYPE_MD5_CHAP
;
8757 dgst_size
= DGST_SIZE_4_4
;
8758 parse_func
= chap_parse_hash
;
8759 sort_by_digest
= sort_by_digest_4_4
;
8760 opti_type
= OPTI_TYPE_ZERO_BYTE
8761 | OPTI_TYPE_PRECOMPUTE_INIT
8762 | OPTI_TYPE_PRECOMPUTE_MERKLE
8763 | OPTI_TYPE_MEET_IN_MIDDLE
8764 | OPTI_TYPE_EARLY_SKIP
8765 | OPTI_TYPE_NOT_ITERATED
8766 | OPTI_TYPE_RAW_HASH
;
8773 case 4900: hash_type
= HASH_TYPE_SHA1
;
8774 salt_type
= SALT_TYPE_INTERN
;
8775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8777 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8778 dgst_size
= DGST_SIZE_4_5
;
8779 parse_func
= sha1s_parse_hash
;
8780 sort_by_digest
= sort_by_digest_4_5
;
8781 opti_type
= OPTI_TYPE_ZERO_BYTE
8782 | OPTI_TYPE_PRECOMPUTE_INIT
8783 | OPTI_TYPE_PRECOMPUTE_MERKLE
8784 | OPTI_TYPE_EARLY_SKIP
;
8791 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8792 salt_type
= SALT_TYPE_EMBEDDED
;
8793 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8794 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8795 | OPTS_TYPE_PT_ADD01
;
8796 kern_type
= KERN_TYPE_KECCAK
;
8797 dgst_size
= DGST_SIZE_8_25
;
8798 parse_func
= keccak_parse_hash
;
8799 sort_by_digest
= sort_by_digest_8_25
;
8800 opti_type
= OPTI_TYPE_ZERO_BYTE
8801 | OPTI_TYPE_USES_BITS_64
8802 | OPTI_TYPE_RAW_HASH
;
8809 case 5100: hash_type
= HASH_TYPE_MD5H
;
8810 salt_type
= SALT_TYPE_NONE
;
8811 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8812 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8813 | OPTS_TYPE_PT_ADD80
8814 | OPTS_TYPE_PT_ADDBITS14
;
8815 kern_type
= KERN_TYPE_MD5H
;
8816 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8817 parse_func
= md5half_parse_hash
;
8818 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8819 opti_type
= OPTI_TYPE_ZERO_BYTE
8820 | OPTI_TYPE_RAW_HASH
;
8827 case 5200: hash_type
= HASH_TYPE_SHA256
;
8828 salt_type
= SALT_TYPE_EMBEDDED
;
8829 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8830 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8831 kern_type
= KERN_TYPE_PSAFE3
;
8832 dgst_size
= DGST_SIZE_4_8
;
8833 parse_func
= psafe3_parse_hash
;
8834 sort_by_digest
= sort_by_digest_4_8
;
8835 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8842 case 5300: hash_type
= HASH_TYPE_MD5
;
8843 salt_type
= SALT_TYPE_EMBEDDED
;
8844 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8845 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8846 | OPTS_TYPE_ST_ADD80
;
8847 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8848 dgst_size
= DGST_SIZE_4_4
;
8849 parse_func
= ikepsk_md5_parse_hash
;
8850 sort_by_digest
= sort_by_digest_4_4
;
8851 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8858 case 5400: hash_type
= HASH_TYPE_SHA1
;
8859 salt_type
= SALT_TYPE_EMBEDDED
;
8860 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8861 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8862 | OPTS_TYPE_ST_ADD80
;
8863 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8864 dgst_size
= DGST_SIZE_4_5
;
8865 parse_func
= ikepsk_sha1_parse_hash
;
8866 sort_by_digest
= sort_by_digest_4_5
;
8867 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8874 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8875 salt_type
= SALT_TYPE_EMBEDDED
;
8876 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8877 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8878 | OPTS_TYPE_PT_ADD80
8879 | OPTS_TYPE_PT_ADDBITS14
8880 | OPTS_TYPE_PT_UNICODE
8882 kern_type
= KERN_TYPE_NETNTLMv1
;
8883 dgst_size
= DGST_SIZE_4_4
;
8884 parse_func
= netntlmv1_parse_hash
;
8885 sort_by_digest
= sort_by_digest_4_4
;
8886 opti_type
= OPTI_TYPE_ZERO_BYTE
8887 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8894 case 5600: hash_type
= HASH_TYPE_MD5
;
8895 salt_type
= SALT_TYPE_EMBEDDED
;
8896 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8897 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8898 | OPTS_TYPE_PT_ADD80
8899 | OPTS_TYPE_PT_ADDBITS14
8900 | OPTS_TYPE_PT_UNICODE
;
8901 kern_type
= KERN_TYPE_NETNTLMv2
;
8902 dgst_size
= DGST_SIZE_4_4
;
8903 parse_func
= netntlmv2_parse_hash
;
8904 sort_by_digest
= sort_by_digest_4_4
;
8905 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8912 case 5700: hash_type
= HASH_TYPE_SHA256
;
8913 salt_type
= SALT_TYPE_NONE
;
8914 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8915 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8916 | OPTS_TYPE_PT_ADD80
8917 | OPTS_TYPE_PT_ADDBITS15
;
8918 kern_type
= KERN_TYPE_SHA256
;
8919 dgst_size
= DGST_SIZE_4_8
;
8920 parse_func
= cisco4_parse_hash
;
8921 sort_by_digest
= sort_by_digest_4_8
;
8922 opti_type
= OPTI_TYPE_ZERO_BYTE
8923 | OPTI_TYPE_PRECOMPUTE_INIT
8924 | OPTI_TYPE_PRECOMPUTE_MERKLE
8925 | OPTI_TYPE_EARLY_SKIP
8926 | OPTI_TYPE_NOT_ITERATED
8927 | OPTI_TYPE_NOT_SALTED
8928 | OPTI_TYPE_RAW_HASH
;
8935 case 5800: hash_type
= HASH_TYPE_SHA1
;
8936 salt_type
= SALT_TYPE_INTERN
;
8937 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8938 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8939 | OPTS_TYPE_ST_ADD80
;
8940 kern_type
= KERN_TYPE_ANDROIDPIN
;
8941 dgst_size
= DGST_SIZE_4_5
;
8942 parse_func
= androidpin_parse_hash
;
8943 sort_by_digest
= sort_by_digest_4_5
;
8944 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8951 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8952 salt_type
= SALT_TYPE_NONE
;
8953 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8954 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8955 | OPTS_TYPE_PT_ADD80
;
8956 kern_type
= KERN_TYPE_RIPEMD160
;
8957 dgst_size
= DGST_SIZE_4_5
;
8958 parse_func
= ripemd160_parse_hash
;
8959 sort_by_digest
= sort_by_digest_4_5
;
8960 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8967 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8968 salt_type
= SALT_TYPE_NONE
;
8969 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8970 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8971 | OPTS_TYPE_PT_ADD80
;
8972 kern_type
= KERN_TYPE_WHIRLPOOL
;
8973 dgst_size
= DGST_SIZE_4_16
;
8974 parse_func
= whirlpool_parse_hash
;
8975 sort_by_digest
= sort_by_digest_4_16
;
8976 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8983 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8984 salt_type
= SALT_TYPE_EMBEDDED
;
8985 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8986 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8987 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8988 dgst_size
= DGST_SIZE_4_5
;
8989 parse_func
= truecrypt_parse_hash_2k
;
8990 sort_by_digest
= sort_by_digest_4_5
;
8991 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8998 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8999 salt_type
= SALT_TYPE_EMBEDDED
;
9000 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9001 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9002 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9003 dgst_size
= DGST_SIZE_4_5
;
9004 parse_func
= truecrypt_parse_hash_2k
;
9005 sort_by_digest
= sort_by_digest_4_5
;
9006 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9013 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9014 salt_type
= SALT_TYPE_EMBEDDED
;
9015 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9016 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9017 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9018 dgst_size
= DGST_SIZE_4_5
;
9019 parse_func
= truecrypt_parse_hash_2k
;
9020 sort_by_digest
= sort_by_digest_4_5
;
9021 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9028 case 6221: hash_type
= HASH_TYPE_SHA512
;
9029 salt_type
= SALT_TYPE_EMBEDDED
;
9030 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9031 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9032 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9033 dgst_size
= DGST_SIZE_8_8
;
9034 parse_func
= truecrypt_parse_hash_1k
;
9035 sort_by_digest
= sort_by_digest_8_8
;
9036 opti_type
= OPTI_TYPE_ZERO_BYTE
9037 | OPTI_TYPE_USES_BITS_64
;
9044 case 6222: hash_type
= HASH_TYPE_SHA512
;
9045 salt_type
= SALT_TYPE_EMBEDDED
;
9046 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9047 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9048 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9049 dgst_size
= DGST_SIZE_8_8
;
9050 parse_func
= truecrypt_parse_hash_1k
;
9051 sort_by_digest
= sort_by_digest_8_8
;
9052 opti_type
= OPTI_TYPE_ZERO_BYTE
9053 | OPTI_TYPE_USES_BITS_64
;
9060 case 6223: hash_type
= HASH_TYPE_SHA512
;
9061 salt_type
= SALT_TYPE_EMBEDDED
;
9062 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9063 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9064 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9065 dgst_size
= DGST_SIZE_8_8
;
9066 parse_func
= truecrypt_parse_hash_1k
;
9067 sort_by_digest
= sort_by_digest_8_8
;
9068 opti_type
= OPTI_TYPE_ZERO_BYTE
9069 | OPTI_TYPE_USES_BITS_64
;
9076 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9077 salt_type
= SALT_TYPE_EMBEDDED
;
9078 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9079 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9080 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9081 dgst_size
= DGST_SIZE_4_8
;
9082 parse_func
= truecrypt_parse_hash_1k
;
9083 sort_by_digest
= sort_by_digest_4_8
;
9084 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9091 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9092 salt_type
= SALT_TYPE_EMBEDDED
;
9093 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9094 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9095 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9096 dgst_size
= DGST_SIZE_4_8
;
9097 parse_func
= truecrypt_parse_hash_1k
;
9098 sort_by_digest
= sort_by_digest_4_8
;
9099 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9106 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9107 salt_type
= SALT_TYPE_EMBEDDED
;
9108 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9109 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9110 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9111 dgst_size
= DGST_SIZE_4_8
;
9112 parse_func
= truecrypt_parse_hash_1k
;
9113 sort_by_digest
= sort_by_digest_4_8
;
9114 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9121 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9122 salt_type
= SALT_TYPE_EMBEDDED
;
9123 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9124 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9125 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9126 dgst_size
= DGST_SIZE_4_5
;
9127 parse_func
= truecrypt_parse_hash_1k
;
9128 sort_by_digest
= sort_by_digest_4_5
;
9129 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9136 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9137 salt_type
= SALT_TYPE_EMBEDDED
;
9138 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9139 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9140 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9141 dgst_size
= DGST_SIZE_4_5
;
9142 parse_func
= truecrypt_parse_hash_1k
;
9143 sort_by_digest
= sort_by_digest_4_5
;
9144 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9151 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9152 salt_type
= SALT_TYPE_EMBEDDED
;
9153 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9154 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9155 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9156 dgst_size
= DGST_SIZE_4_5
;
9157 parse_func
= truecrypt_parse_hash_1k
;
9158 sort_by_digest
= sort_by_digest_4_5
;
9159 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9166 case 6300: hash_type
= HASH_TYPE_MD5
;
9167 salt_type
= SALT_TYPE_EMBEDDED
;
9168 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9169 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9170 kern_type
= KERN_TYPE_MD5AIX
;
9171 dgst_size
= DGST_SIZE_4_4
;
9172 parse_func
= md5aix_parse_hash
;
9173 sort_by_digest
= sort_by_digest_4_4
;
9174 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9181 case 6400: hash_type
= HASH_TYPE_SHA256
;
9182 salt_type
= SALT_TYPE_EMBEDDED
;
9183 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9184 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9185 kern_type
= KERN_TYPE_SHA256AIX
;
9186 dgst_size
= DGST_SIZE_4_8
;
9187 parse_func
= sha256aix_parse_hash
;
9188 sort_by_digest
= sort_by_digest_4_8
;
9189 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9196 case 6500: hash_type
= HASH_TYPE_SHA512
;
9197 salt_type
= SALT_TYPE_EMBEDDED
;
9198 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9199 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9200 kern_type
= KERN_TYPE_SHA512AIX
;
9201 dgst_size
= DGST_SIZE_8_8
;
9202 parse_func
= sha512aix_parse_hash
;
9203 sort_by_digest
= sort_by_digest_8_8
;
9204 opti_type
= OPTI_TYPE_ZERO_BYTE
9205 | OPTI_TYPE_USES_BITS_64
;
9212 case 6600: hash_type
= HASH_TYPE_AES
;
9213 salt_type
= SALT_TYPE_EMBEDDED
;
9214 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9216 kern_type
= KERN_TYPE_AGILEKEY
;
9217 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9218 parse_func
= agilekey_parse_hash
;
9219 sort_by_digest
= sort_by_digest_4_5
;
9220 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9227 case 6700: hash_type
= HASH_TYPE_SHA1
;
9228 salt_type
= SALT_TYPE_EMBEDDED
;
9229 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9230 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9231 kern_type
= KERN_TYPE_SHA1AIX
;
9232 dgst_size
= DGST_SIZE_4_5
;
9233 parse_func
= sha1aix_parse_hash
;
9234 sort_by_digest
= sort_by_digest_4_5
;
9235 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9242 case 6800: hash_type
= HASH_TYPE_AES
;
9243 salt_type
= SALT_TYPE_EMBEDDED
;
9244 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9245 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9246 kern_type
= KERN_TYPE_LASTPASS
;
9247 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9248 parse_func
= lastpass_parse_hash
;
9249 sort_by_digest
= sort_by_digest_4_8
;
9250 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9257 case 6900: hash_type
= HASH_TYPE_GOST
;
9258 salt_type
= SALT_TYPE_NONE
;
9259 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9260 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9261 kern_type
= KERN_TYPE_GOST
;
9262 dgst_size
= DGST_SIZE_4_8
;
9263 parse_func
= gost_parse_hash
;
9264 sort_by_digest
= sort_by_digest_4_8
;
9265 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9272 case 7100: hash_type
= HASH_TYPE_SHA512
;
9273 salt_type
= SALT_TYPE_EMBEDDED
;
9274 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9275 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9276 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9277 dgst_size
= DGST_SIZE_8_16
;
9278 parse_func
= sha512osx_parse_hash
;
9279 sort_by_digest
= sort_by_digest_8_16
;
9280 opti_type
= OPTI_TYPE_ZERO_BYTE
9281 | OPTI_TYPE_USES_BITS_64
9282 | OPTI_TYPE_SLOW_HASH_SIMD
;
9289 case 7200: hash_type
= HASH_TYPE_SHA512
;
9290 salt_type
= SALT_TYPE_EMBEDDED
;
9291 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9292 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9293 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9294 dgst_size
= DGST_SIZE_8_16
;
9295 parse_func
= sha512grub_parse_hash
;
9296 sort_by_digest
= sort_by_digest_8_16
;
9297 opti_type
= OPTI_TYPE_ZERO_BYTE
9298 | OPTI_TYPE_USES_BITS_64
9299 | OPTI_TYPE_SLOW_HASH_SIMD
;
9306 case 7300: hash_type
= HASH_TYPE_SHA1
;
9307 salt_type
= SALT_TYPE_EMBEDDED
;
9308 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9309 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9310 | OPTS_TYPE_ST_ADD80
9311 | OPTS_TYPE_ST_ADDBITS15
;
9312 kern_type
= KERN_TYPE_RAKP
;
9313 dgst_size
= DGST_SIZE_4_5
;
9314 parse_func
= rakp_parse_hash
;
9315 sort_by_digest
= sort_by_digest_4_5
;
9316 opti_type
= OPTI_TYPE_ZERO_BYTE
9317 | OPTI_TYPE_NOT_ITERATED
;
9324 case 7400: hash_type
= HASH_TYPE_SHA256
;
9325 salt_type
= SALT_TYPE_EMBEDDED
;
9326 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9327 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9328 kern_type
= KERN_TYPE_SHA256CRYPT
;
9329 dgst_size
= DGST_SIZE_4_8
;
9330 parse_func
= sha256crypt_parse_hash
;
9331 sort_by_digest
= sort_by_digest_4_8
;
9332 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9339 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9340 salt_type
= SALT_TYPE_EMBEDDED
;
9341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9343 kern_type
= KERN_TYPE_KRB5PA
;
9344 dgst_size
= DGST_SIZE_4_4
;
9345 parse_func
= krb5pa_parse_hash
;
9346 sort_by_digest
= sort_by_digest_4_4
;
9347 opti_type
= OPTI_TYPE_ZERO_BYTE
9348 | OPTI_TYPE_NOT_ITERATED
;
9355 case 7600: hash_type
= HASH_TYPE_SHA1
;
9356 salt_type
= SALT_TYPE_INTERN
;
9357 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9358 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9359 | OPTS_TYPE_PT_ADD80
9360 | OPTS_TYPE_PT_ADDBITS15
;
9361 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9362 dgst_size
= DGST_SIZE_4_5
;
9363 parse_func
= redmine_parse_hash
;
9364 sort_by_digest
= sort_by_digest_4_5
;
9365 opti_type
= OPTI_TYPE_ZERO_BYTE
9366 | OPTI_TYPE_PRECOMPUTE_INIT
9367 | OPTI_TYPE_EARLY_SKIP
9368 | OPTI_TYPE_NOT_ITERATED
9369 | OPTI_TYPE_PREPENDED_SALT
;
9376 case 7700: hash_type
= HASH_TYPE_SAPB
;
9377 salt_type
= SALT_TYPE_EMBEDDED
;
9378 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9379 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9380 | OPTS_TYPE_PT_UPPER
9381 | OPTS_TYPE_ST_UPPER
;
9382 kern_type
= KERN_TYPE_SAPB
;
9383 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9384 parse_func
= sapb_parse_hash
;
9385 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9386 opti_type
= OPTI_TYPE_ZERO_BYTE
9387 | OPTI_TYPE_PRECOMPUTE_INIT
9388 | OPTI_TYPE_NOT_ITERATED
;
9395 case 7800: hash_type
= HASH_TYPE_SAPG
;
9396 salt_type
= SALT_TYPE_EMBEDDED
;
9397 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9398 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9399 | OPTS_TYPE_ST_ADD80
9400 | OPTS_TYPE_ST_UPPER
;
9401 kern_type
= KERN_TYPE_SAPG
;
9402 dgst_size
= DGST_SIZE_4_5
;
9403 parse_func
= sapg_parse_hash
;
9404 sort_by_digest
= sort_by_digest_4_5
;
9405 opti_type
= OPTI_TYPE_ZERO_BYTE
9406 | OPTI_TYPE_PRECOMPUTE_INIT
9407 | OPTI_TYPE_NOT_ITERATED
;
9414 case 7900: hash_type
= HASH_TYPE_SHA512
;
9415 salt_type
= SALT_TYPE_EMBEDDED
;
9416 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9417 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9418 kern_type
= KERN_TYPE_DRUPAL7
;
9419 dgst_size
= DGST_SIZE_8_8
;
9420 parse_func
= drupal7_parse_hash
;
9421 sort_by_digest
= sort_by_digest_8_8
;
9422 opti_type
= OPTI_TYPE_ZERO_BYTE
9423 | OPTI_TYPE_USES_BITS_64
;
9430 case 8000: hash_type
= HASH_TYPE_SHA256
;
9431 salt_type
= SALT_TYPE_EMBEDDED
;
9432 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9433 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9434 | OPTS_TYPE_PT_UNICODE
9435 | OPTS_TYPE_ST_ADD80
9437 kern_type
= KERN_TYPE_SYBASEASE
;
9438 dgst_size
= DGST_SIZE_4_8
;
9439 parse_func
= sybasease_parse_hash
;
9440 sort_by_digest
= sort_by_digest_4_8
;
9441 opti_type
= OPTI_TYPE_ZERO_BYTE
9442 | OPTI_TYPE_PRECOMPUTE_INIT
9443 | OPTI_TYPE_EARLY_SKIP
9444 | OPTI_TYPE_NOT_ITERATED
9445 | OPTI_TYPE_RAW_HASH
;
9452 case 8100: hash_type
= HASH_TYPE_SHA1
;
9453 salt_type
= SALT_TYPE_EMBEDDED
;
9454 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9455 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9456 kern_type
= KERN_TYPE_NETSCALER
;
9457 dgst_size
= DGST_SIZE_4_5
;
9458 parse_func
= netscaler_parse_hash
;
9459 sort_by_digest
= sort_by_digest_4_5
;
9460 opti_type
= OPTI_TYPE_ZERO_BYTE
9461 | OPTI_TYPE_PRECOMPUTE_INIT
9462 | OPTI_TYPE_PRECOMPUTE_MERKLE
9463 | OPTI_TYPE_EARLY_SKIP
9464 | OPTI_TYPE_NOT_ITERATED
9465 | OPTI_TYPE_PREPENDED_SALT
9466 | OPTI_TYPE_RAW_HASH
;
9473 case 8200: hash_type
= HASH_TYPE_SHA256
;
9474 salt_type
= SALT_TYPE_EMBEDDED
;
9475 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9477 kern_type
= KERN_TYPE_CLOUDKEY
;
9478 dgst_size
= DGST_SIZE_4_8
;
9479 parse_func
= cloudkey_parse_hash
;
9480 sort_by_digest
= sort_by_digest_4_8
;
9481 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9488 case 8300: hash_type
= HASH_TYPE_SHA1
;
9489 salt_type
= SALT_TYPE_EMBEDDED
;
9490 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9491 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9493 | OPTS_TYPE_ST_ADD80
;
9494 kern_type
= KERN_TYPE_NSEC3
;
9495 dgst_size
= DGST_SIZE_4_5
;
9496 parse_func
= nsec3_parse_hash
;
9497 sort_by_digest
= sort_by_digest_4_5
;
9498 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9505 case 8400: hash_type
= HASH_TYPE_SHA1
;
9506 salt_type
= SALT_TYPE_INTERN
;
9507 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9508 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9509 | OPTS_TYPE_PT_ADD80
9510 | OPTS_TYPE_PT_ADDBITS15
;
9511 kern_type
= KERN_TYPE_WBB3
;
9512 dgst_size
= DGST_SIZE_4_5
;
9513 parse_func
= wbb3_parse_hash
;
9514 sort_by_digest
= sort_by_digest_4_5
;
9515 opti_type
= OPTI_TYPE_ZERO_BYTE
9516 | OPTI_TYPE_PRECOMPUTE_INIT
9517 | OPTI_TYPE_NOT_ITERATED
;
9524 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9525 salt_type
= SALT_TYPE_EMBEDDED
;
9526 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9527 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9528 | OPTS_TYPE_ST_UPPER
;
9529 kern_type
= KERN_TYPE_RACF
;
9530 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9531 parse_func
= racf_parse_hash
;
9532 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9533 opti_type
= OPTI_TYPE_ZERO_BYTE
9534 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9541 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9542 salt_type
= SALT_TYPE_NONE
;
9543 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9544 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9545 kern_type
= KERN_TYPE_LOTUS5
;
9546 dgst_size
= DGST_SIZE_4_4
;
9547 parse_func
= lotus5_parse_hash
;
9548 sort_by_digest
= sort_by_digest_4_4
;
9549 opti_type
= OPTI_TYPE_EARLY_SKIP
9550 | OPTI_TYPE_NOT_ITERATED
9551 | OPTI_TYPE_NOT_SALTED
9552 | OPTI_TYPE_RAW_HASH
;
9559 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9560 salt_type
= SALT_TYPE_EMBEDDED
;
9561 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9563 kern_type
= KERN_TYPE_LOTUS6
;
9564 dgst_size
= DGST_SIZE_4_4
;
9565 parse_func
= lotus6_parse_hash
;
9566 sort_by_digest
= sort_by_digest_4_4
;
9567 opti_type
= OPTI_TYPE_EARLY_SKIP
9568 | OPTI_TYPE_NOT_ITERATED
9569 | OPTI_TYPE_RAW_HASH
;
9576 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9577 salt_type
= SALT_TYPE_EMBEDDED
;
9578 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9579 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9580 kern_type
= KERN_TYPE_ANDROIDFDE
;
9581 dgst_size
= DGST_SIZE_4_4
;
9582 parse_func
= androidfde_parse_hash
;
9583 sort_by_digest
= sort_by_digest_4_4
;
9584 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9591 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9592 salt_type
= SALT_TYPE_EMBEDDED
;
9593 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9594 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9595 kern_type
= KERN_TYPE_SCRYPT
;
9596 dgst_size
= DGST_SIZE_4_8
;
9597 parse_func
= scrypt_parse_hash
;
9598 sort_by_digest
= sort_by_digest_4_8
;
9599 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9606 case 9000: hash_type
= HASH_TYPE_SHA1
;
9607 salt_type
= SALT_TYPE_EMBEDDED
;
9608 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9609 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9610 | OPTS_TYPE_ST_GENERATE_LE
;
9611 kern_type
= KERN_TYPE_PSAFE2
;
9612 dgst_size
= DGST_SIZE_4_5
;
9613 parse_func
= psafe2_parse_hash
;
9614 sort_by_digest
= sort_by_digest_4_5
;
9615 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9622 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9623 salt_type
= SALT_TYPE_EMBEDDED
;
9624 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9625 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9626 kern_type
= KERN_TYPE_LOTUS8
;
9627 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9628 parse_func
= lotus8_parse_hash
;
9629 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9630 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9637 case 9200: hash_type
= HASH_TYPE_SHA256
;
9638 salt_type
= SALT_TYPE_EMBEDDED
;
9639 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9640 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9641 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9642 dgst_size
= DGST_SIZE_4_32
;
9643 parse_func
= cisco8_parse_hash
;
9644 sort_by_digest
= sort_by_digest_4_32
;
9645 opti_type
= OPTI_TYPE_ZERO_BYTE
9646 | OPTI_TYPE_SLOW_HASH_SIMD
;
9653 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9654 salt_type
= SALT_TYPE_EMBEDDED
;
9655 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9656 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9657 kern_type
= KERN_TYPE_SCRYPT
;
9658 dgst_size
= DGST_SIZE_4_8
;
9659 parse_func
= cisco9_parse_hash
;
9660 sort_by_digest
= sort_by_digest_4_8
;
9661 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9668 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9669 salt_type
= SALT_TYPE_EMBEDDED
;
9670 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9671 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9672 kern_type
= KERN_TYPE_OFFICE2007
;
9673 dgst_size
= DGST_SIZE_4_4
;
9674 parse_func
= office2007_parse_hash
;
9675 sort_by_digest
= sort_by_digest_4_4
;
9676 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9683 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9684 salt_type
= SALT_TYPE_EMBEDDED
;
9685 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9686 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9687 kern_type
= KERN_TYPE_OFFICE2010
;
9688 dgst_size
= DGST_SIZE_4_4
;
9689 parse_func
= office2010_parse_hash
;
9690 sort_by_digest
= sort_by_digest_4_4
;
9691 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9698 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9699 salt_type
= SALT_TYPE_EMBEDDED
;
9700 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9701 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9702 kern_type
= KERN_TYPE_OFFICE2013
;
9703 dgst_size
= DGST_SIZE_4_4
;
9704 parse_func
= office2013_parse_hash
;
9705 sort_by_digest
= sort_by_digest_4_4
;
9706 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9713 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9714 salt_type
= SALT_TYPE_EMBEDDED
;
9715 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9716 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9717 | OPTS_TYPE_PT_ADD80
9718 | OPTS_TYPE_PT_UNICODE
;
9719 kern_type
= KERN_TYPE_OLDOFFICE01
;
9720 dgst_size
= DGST_SIZE_4_4
;
9721 parse_func
= oldoffice01_parse_hash
;
9722 sort_by_digest
= sort_by_digest_4_4
;
9723 opti_type
= OPTI_TYPE_ZERO_BYTE
9724 | OPTI_TYPE_PRECOMPUTE_INIT
9725 | OPTI_TYPE_NOT_ITERATED
;
9732 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9733 salt_type
= SALT_TYPE_EMBEDDED
;
9734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9735 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9736 | OPTS_TYPE_PT_ADD80
;
9737 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9738 dgst_size
= DGST_SIZE_4_4
;
9739 parse_func
= oldoffice01cm1_parse_hash
;
9740 sort_by_digest
= sort_by_digest_4_4
;
9741 opti_type
= OPTI_TYPE_ZERO_BYTE
9742 | OPTI_TYPE_PRECOMPUTE_INIT
9743 | OPTI_TYPE_NOT_ITERATED
;
9750 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9751 salt_type
= SALT_TYPE_EMBEDDED
;
9752 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9753 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9754 | OPTS_TYPE_PT_ADD80
9755 | OPTS_TYPE_PT_UNICODE
9756 | OPTS_TYPE_PT_NEVERCRACK
;
9757 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9758 dgst_size
= DGST_SIZE_4_4
;
9759 parse_func
= oldoffice01cm2_parse_hash
;
9760 sort_by_digest
= sort_by_digest_4_4
;
9761 opti_type
= OPTI_TYPE_ZERO_BYTE
9762 | OPTI_TYPE_PRECOMPUTE_INIT
9763 | OPTI_TYPE_NOT_ITERATED
;
9770 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9771 salt_type
= SALT_TYPE_EMBEDDED
;
9772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9773 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9774 | OPTS_TYPE_PT_ADD80
9775 | OPTS_TYPE_PT_UNICODE
;
9776 kern_type
= KERN_TYPE_OLDOFFICE34
;
9777 dgst_size
= DGST_SIZE_4_4
;
9778 parse_func
= oldoffice34_parse_hash
;
9779 sort_by_digest
= sort_by_digest_4_4
;
9780 opti_type
= OPTI_TYPE_ZERO_BYTE
9781 | OPTI_TYPE_PRECOMPUTE_INIT
9782 | OPTI_TYPE_NOT_ITERATED
;
9789 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9790 salt_type
= SALT_TYPE_EMBEDDED
;
9791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9793 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9794 dgst_size
= DGST_SIZE_4_4
;
9795 parse_func
= oldoffice34cm1_parse_hash
;
9796 sort_by_digest
= sort_by_digest_4_4
;
9797 opti_type
= OPTI_TYPE_ZERO_BYTE
9798 | OPTI_TYPE_PRECOMPUTE_INIT
9799 | OPTI_TYPE_NOT_ITERATED
;
9806 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9807 salt_type
= SALT_TYPE_EMBEDDED
;
9808 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9809 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9810 | OPTS_TYPE_PT_ADD80
9811 | OPTS_TYPE_PT_UNICODE
9812 | OPTS_TYPE_PT_NEVERCRACK
;
9813 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9814 dgst_size
= DGST_SIZE_4_4
;
9815 parse_func
= oldoffice34cm2_parse_hash
;
9816 sort_by_digest
= sort_by_digest_4_4
;
9817 opti_type
= OPTI_TYPE_ZERO_BYTE
9818 | OPTI_TYPE_PRECOMPUTE_INIT
9819 | OPTI_TYPE_NOT_ITERATED
;
9826 case 9900: hash_type
= HASH_TYPE_MD5
;
9827 salt_type
= SALT_TYPE_NONE
;
9828 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9829 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9830 kern_type
= KERN_TYPE_RADMIN2
;
9831 dgst_size
= DGST_SIZE_4_4
;
9832 parse_func
= radmin2_parse_hash
;
9833 sort_by_digest
= sort_by_digest_4_4
;
9834 opti_type
= OPTI_TYPE_ZERO_BYTE
9835 | OPTI_TYPE_PRECOMPUTE_INIT
9836 | OPTI_TYPE_EARLY_SKIP
9837 | OPTI_TYPE_NOT_ITERATED
9838 | OPTI_TYPE_NOT_SALTED
;
9845 case 10000: hash_type
= HASH_TYPE_SHA256
;
9846 salt_type
= SALT_TYPE_EMBEDDED
;
9847 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9848 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9849 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9850 dgst_size
= DGST_SIZE_4_32
;
9851 parse_func
= djangopbkdf2_parse_hash
;
9852 sort_by_digest
= sort_by_digest_4_32
;
9853 opti_type
= OPTI_TYPE_ZERO_BYTE
9854 | OPTI_TYPE_SLOW_HASH_SIMD
;
9861 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9862 salt_type
= SALT_TYPE_EMBEDDED
;
9863 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9864 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9865 kern_type
= KERN_TYPE_SIPHASH
;
9866 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9867 parse_func
= siphash_parse_hash
;
9868 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9869 opti_type
= OPTI_TYPE_ZERO_BYTE
9870 | OPTI_TYPE_NOT_ITERATED
9871 | OPTI_TYPE_RAW_HASH
;
9878 case 10200: hash_type
= HASH_TYPE_MD5
;
9879 salt_type
= SALT_TYPE_EMBEDDED
;
9880 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9882 | OPTS_TYPE_ST_ADD80
9883 | OPTS_TYPE_ST_ADDBITS14
;
9884 kern_type
= KERN_TYPE_HMACMD5_PW
;
9885 dgst_size
= DGST_SIZE_4_4
;
9886 parse_func
= crammd5_parse_hash
;
9887 sort_by_digest
= sort_by_digest_4_4
;
9888 opti_type
= OPTI_TYPE_ZERO_BYTE
9889 | OPTI_TYPE_NOT_ITERATED
;
9896 case 10300: hash_type
= HASH_TYPE_SHA1
;
9897 salt_type
= SALT_TYPE_EMBEDDED
;
9898 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9899 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9900 kern_type
= KERN_TYPE_SAPH_SHA1
;
9901 dgst_size
= DGST_SIZE_4_5
;
9902 parse_func
= saph_sha1_parse_hash
;
9903 sort_by_digest
= sort_by_digest_4_5
;
9904 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9911 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9912 salt_type
= SALT_TYPE_EMBEDDED
;
9913 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9914 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9915 kern_type
= KERN_TYPE_PDF11
;
9916 dgst_size
= DGST_SIZE_4_4
;
9917 parse_func
= pdf11_parse_hash
;
9918 sort_by_digest
= sort_by_digest_4_4
;
9919 opti_type
= OPTI_TYPE_ZERO_BYTE
9920 | OPTI_TYPE_NOT_ITERATED
;
9927 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9928 salt_type
= SALT_TYPE_EMBEDDED
;
9929 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9931 kern_type
= KERN_TYPE_PDF11CM1
;
9932 dgst_size
= DGST_SIZE_4_4
;
9933 parse_func
= pdf11cm1_parse_hash
;
9934 sort_by_digest
= sort_by_digest_4_4
;
9935 opti_type
= OPTI_TYPE_ZERO_BYTE
9936 | OPTI_TYPE_NOT_ITERATED
;
9943 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9944 salt_type
= SALT_TYPE_EMBEDDED
;
9945 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9946 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9947 kern_type
= KERN_TYPE_PDF11CM2
;
9948 dgst_size
= DGST_SIZE_4_4
;
9949 parse_func
= pdf11cm2_parse_hash
;
9950 sort_by_digest
= sort_by_digest_4_4
;
9951 opti_type
= OPTI_TYPE_ZERO_BYTE
9952 | OPTI_TYPE_NOT_ITERATED
;
9959 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9960 salt_type
= SALT_TYPE_EMBEDDED
;
9961 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9962 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9963 kern_type
= KERN_TYPE_PDF14
;
9964 dgst_size
= DGST_SIZE_4_4
;
9965 parse_func
= pdf14_parse_hash
;
9966 sort_by_digest
= sort_by_digest_4_4
;
9967 opti_type
= OPTI_TYPE_ZERO_BYTE
9968 | OPTI_TYPE_NOT_ITERATED
;
9975 case 10600: hash_type
= HASH_TYPE_SHA256
;
9976 salt_type
= SALT_TYPE_EMBEDDED
;
9977 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9978 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9979 | OPTS_TYPE_ST_ADD80
9980 | OPTS_TYPE_ST_ADDBITS15
9981 | OPTS_TYPE_HASH_COPY
;
9982 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9983 dgst_size
= DGST_SIZE_4_8
;
9984 parse_func
= pdf17l3_parse_hash
;
9985 sort_by_digest
= sort_by_digest_4_8
;
9986 opti_type
= OPTI_TYPE_ZERO_BYTE
9987 | OPTI_TYPE_PRECOMPUTE_INIT
9988 | OPTI_TYPE_PRECOMPUTE_MERKLE
9989 | OPTI_TYPE_EARLY_SKIP
9990 | OPTI_TYPE_NOT_ITERATED
9991 | OPTI_TYPE_APPENDED_SALT
9992 | OPTI_TYPE_RAW_HASH
;
9999 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10000 salt_type
= SALT_TYPE_EMBEDDED
;
10001 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10002 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10003 | OPTS_TYPE_HASH_COPY
;
10004 kern_type
= KERN_TYPE_PDF17L8
;
10005 dgst_size
= DGST_SIZE_4_8
;
10006 parse_func
= pdf17l8_parse_hash
;
10007 sort_by_digest
= sort_by_digest_4_8
;
10008 opti_type
= OPTI_TYPE_ZERO_BYTE
10009 | OPTI_TYPE_NOT_ITERATED
;
10016 case 10800: hash_type
= HASH_TYPE_SHA384
;
10017 salt_type
= SALT_TYPE_NONE
;
10018 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10019 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10020 | OPTS_TYPE_PT_ADD80
10021 | OPTS_TYPE_PT_ADDBITS15
;
10022 kern_type
= KERN_TYPE_SHA384
;
10023 dgst_size
= DGST_SIZE_8_8
;
10024 parse_func
= sha384_parse_hash
;
10025 sort_by_digest
= sort_by_digest_8_8
;
10026 opti_type
= OPTI_TYPE_ZERO_BYTE
10027 | OPTI_TYPE_PRECOMPUTE_INIT
10028 | OPTI_TYPE_PRECOMPUTE_MERKLE
10029 | OPTI_TYPE_EARLY_SKIP
10030 | OPTI_TYPE_NOT_ITERATED
10031 | OPTI_TYPE_NOT_SALTED
10032 | OPTI_TYPE_USES_BITS_64
10033 | OPTI_TYPE_RAW_HASH
;
10040 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10041 salt_type
= SALT_TYPE_EMBEDDED
;
10042 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10043 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10044 | OPTS_TYPE_ST_BASE64
10045 | OPTS_TYPE_HASH_COPY
;
10046 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10047 dgst_size
= DGST_SIZE_4_32
;
10048 parse_func
= pbkdf2_sha256_parse_hash
;
10049 sort_by_digest
= sort_by_digest_4_32
;
10050 opti_type
= OPTI_TYPE_ZERO_BYTE
10051 | OPTI_TYPE_SLOW_HASH_SIMD
;
10058 case 11000: hash_type
= HASH_TYPE_MD5
;
10059 salt_type
= SALT_TYPE_INTERN
;
10060 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10062 | OPTS_TYPE_PT_ADD80
;
10063 kern_type
= KERN_TYPE_PRESTASHOP
;
10064 dgst_size
= DGST_SIZE_4_4
;
10065 parse_func
= prestashop_parse_hash
;
10066 sort_by_digest
= sort_by_digest_4_4
;
10067 opti_type
= OPTI_TYPE_ZERO_BYTE
10068 | OPTI_TYPE_PRECOMPUTE_INIT
10069 | OPTI_TYPE_NOT_ITERATED
10070 | OPTI_TYPE_PREPENDED_SALT
;
10077 case 11100: hash_type
= HASH_TYPE_MD5
;
10078 salt_type
= SALT_TYPE_EMBEDDED
;
10079 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10081 | OPTS_TYPE_ST_ADD80
;
10082 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10083 dgst_size
= DGST_SIZE_4_4
;
10084 parse_func
= postgresql_auth_parse_hash
;
10085 sort_by_digest
= sort_by_digest_4_4
;
10086 opti_type
= OPTI_TYPE_ZERO_BYTE
10087 | OPTI_TYPE_PRECOMPUTE_INIT
10088 | OPTI_TYPE_PRECOMPUTE_MERKLE
10089 | OPTI_TYPE_EARLY_SKIP
;
10096 case 11200: hash_type
= HASH_TYPE_SHA1
;
10097 salt_type
= SALT_TYPE_EMBEDDED
;
10098 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10099 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10100 | OPTS_TYPE_PT_ADD80
10101 | OPTS_TYPE_ST_HEX
;
10102 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10103 dgst_size
= DGST_SIZE_4_5
;
10104 parse_func
= mysql_auth_parse_hash
;
10105 sort_by_digest
= sort_by_digest_4_5
;
10106 opti_type
= OPTI_TYPE_ZERO_BYTE
10107 | OPTI_TYPE_EARLY_SKIP
;
10114 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10115 salt_type
= SALT_TYPE_EMBEDDED
;
10116 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10117 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10119 | OPTS_TYPE_ST_ADD80
;
10120 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10121 dgst_size
= DGST_SIZE_4_4
;
10122 parse_func
= bitcoin_wallet_parse_hash
;
10123 sort_by_digest
= sort_by_digest_4_4
;
10124 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10131 case 11400: hash_type
= HASH_TYPE_MD5
;
10132 salt_type
= SALT_TYPE_EMBEDDED
;
10133 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10134 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10135 | OPTS_TYPE_PT_ADD80
10136 | OPTS_TYPE_HASH_COPY
;
10137 kern_type
= KERN_TYPE_SIP_AUTH
;
10138 dgst_size
= DGST_SIZE_4_4
;
10139 parse_func
= sip_auth_parse_hash
;
10140 sort_by_digest
= sort_by_digest_4_4
;
10141 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10148 case 11500: hash_type
= HASH_TYPE_CRC32
;
10149 salt_type
= SALT_TYPE_INTERN
;
10150 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10151 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10152 | OPTS_TYPE_ST_GENERATE_LE
10153 | OPTS_TYPE_ST_HEX
;
10154 kern_type
= KERN_TYPE_CRC32
;
10155 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10156 parse_func
= crc32_parse_hash
;
10157 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10158 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10165 case 11600: hash_type
= HASH_TYPE_AES
;
10166 salt_type
= SALT_TYPE_EMBEDDED
;
10167 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10168 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10169 | OPTS_TYPE_PT_NEVERCRACK
;
10170 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10171 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10172 parse_func
= seven_zip_parse_hash
;
10173 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10174 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10181 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10182 salt_type
= SALT_TYPE_NONE
;
10183 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10184 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10185 | OPTS_TYPE_PT_ADD01
;
10186 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10187 dgst_size
= DGST_SIZE_4_8
;
10188 parse_func
= gost2012sbog_256_parse_hash
;
10189 sort_by_digest
= sort_by_digest_4_8
;
10190 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10197 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10198 salt_type
= SALT_TYPE_NONE
;
10199 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10200 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10201 | OPTS_TYPE_PT_ADD01
;
10202 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10203 dgst_size
= DGST_SIZE_4_16
;
10204 parse_func
= gost2012sbog_512_parse_hash
;
10205 sort_by_digest
= sort_by_digest_4_16
;
10206 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10213 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10214 salt_type
= SALT_TYPE_EMBEDDED
;
10215 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10216 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10217 | OPTS_TYPE_ST_BASE64
10218 | OPTS_TYPE_HASH_COPY
;
10219 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10220 dgst_size
= DGST_SIZE_4_32
;
10221 parse_func
= pbkdf2_md5_parse_hash
;
10222 sort_by_digest
= sort_by_digest_4_32
;
10223 opti_type
= OPTI_TYPE_ZERO_BYTE
10224 | OPTI_TYPE_SLOW_HASH_SIMD
;
10231 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10232 salt_type
= SALT_TYPE_EMBEDDED
;
10233 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10235 | OPTS_TYPE_ST_BASE64
10236 | OPTS_TYPE_HASH_COPY
;
10237 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10238 dgst_size
= DGST_SIZE_4_32
;
10239 parse_func
= pbkdf2_sha1_parse_hash
;
10240 sort_by_digest
= sort_by_digest_4_32
;
10241 opti_type
= OPTI_TYPE_ZERO_BYTE
10242 | OPTI_TYPE_SLOW_HASH_SIMD
;
10249 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10250 salt_type
= SALT_TYPE_EMBEDDED
;
10251 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10252 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10253 | OPTS_TYPE_ST_BASE64
10254 | OPTS_TYPE_HASH_COPY
;
10255 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10256 dgst_size
= DGST_SIZE_8_16
;
10257 parse_func
= pbkdf2_sha512_parse_hash
;
10258 sort_by_digest
= sort_by_digest_8_16
;
10259 opti_type
= OPTI_TYPE_ZERO_BYTE
10260 | OPTI_TYPE_USES_BITS_64
10261 | OPTI_TYPE_SLOW_HASH_SIMD
;
10268 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10269 salt_type
= SALT_TYPE_EMBEDDED
;
10270 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10271 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10272 kern_type
= KERN_TYPE_ECRYPTFS
;
10273 dgst_size
= DGST_SIZE_8_8
;
10274 parse_func
= ecryptfs_parse_hash
;
10275 sort_by_digest
= sort_by_digest_8_8
;
10276 opti_type
= OPTI_TYPE_ZERO_BYTE
10277 | OPTI_TYPE_USES_BITS_64
;
10284 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10285 salt_type
= SALT_TYPE_EMBEDDED
;
10286 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10287 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10288 kern_type
= KERN_TYPE_ORACLET
;
10289 dgst_size
= DGST_SIZE_8_16
;
10290 parse_func
= oraclet_parse_hash
;
10291 sort_by_digest
= sort_by_digest_8_16
;
10292 opti_type
= OPTI_TYPE_ZERO_BYTE
10293 | OPTI_TYPE_USES_BITS_64
;
10300 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10301 salt_type
= SALT_TYPE_EMBEDDED
;
10302 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10303 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10304 kern_type
= KERN_TYPE_BSDICRYPT
;
10305 dgst_size
= DGST_SIZE_4_4
;
10306 parse_func
= bsdicrypt_parse_hash
;
10307 sort_by_digest
= sort_by_digest_4_4
;
10308 opti_type
= OPTI_TYPE_ZERO_BYTE
10309 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10316 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10317 salt_type
= SALT_TYPE_EMBEDDED
;
10318 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10319 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10320 kern_type
= KERN_TYPE_RAR3
;
10321 dgst_size
= DGST_SIZE_4_4
;
10322 parse_func
= rar3hp_parse_hash
;
10323 sort_by_digest
= sort_by_digest_4_4
;
10324 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10331 case 12600: hash_type
= HASH_TYPE_SHA256
;
10332 salt_type
= SALT_TYPE_INTERN
;
10333 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10334 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10335 | OPTS_TYPE_PT_ADD80
;
10336 kern_type
= KERN_TYPE_CF10
;
10337 dgst_size
= DGST_SIZE_4_8
;
10338 parse_func
= cf10_parse_hash
;
10339 sort_by_digest
= sort_by_digest_4_8
;
10340 opti_type
= OPTI_TYPE_ZERO_BYTE
10341 | OPTI_TYPE_PRECOMPUTE_INIT
10342 | OPTI_TYPE_EARLY_SKIP
10343 | OPTI_TYPE_NOT_ITERATED
;
10350 case 12700: hash_type
= HASH_TYPE_AES
;
10351 salt_type
= SALT_TYPE_EMBEDDED
;
10352 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10353 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10354 | OPTS_TYPE_HASH_COPY
;
10355 kern_type
= KERN_TYPE_MYWALLET
;
10356 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10357 parse_func
= mywallet_parse_hash
;
10358 sort_by_digest
= sort_by_digest_4_5
;
10359 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10366 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10367 salt_type
= SALT_TYPE_EMBEDDED
;
10368 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10369 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10370 kern_type
= KERN_TYPE_MS_DRSR
;
10371 dgst_size
= DGST_SIZE_4_8
;
10372 parse_func
= ms_drsr_parse_hash
;
10373 sort_by_digest
= sort_by_digest_4_8
;
10374 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10381 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10382 salt_type
= SALT_TYPE_EMBEDDED
;
10383 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10384 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10385 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10386 dgst_size
= DGST_SIZE_4_8
;
10387 parse_func
= androidfde_samsung_parse_hash
;
10388 sort_by_digest
= sort_by_digest_4_8
;
10389 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10396 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10397 salt_type
= SALT_TYPE_EMBEDDED
;
10398 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10399 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10400 kern_type
= KERN_TYPE_RAR5
;
10401 dgst_size
= DGST_SIZE_4_4
;
10402 parse_func
= rar5_parse_hash
;
10403 sort_by_digest
= sort_by_digest_4_4
;
10404 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10411 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10412 salt_type
= SALT_TYPE_EMBEDDED
;
10413 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10414 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10415 kern_type
= KERN_TYPE_KRB5TGS
;
10416 dgst_size
= DGST_SIZE_4_4
;
10417 parse_func
= krb5tgs_parse_hash
;
10418 sort_by_digest
= sort_by_digest_4_4
;
10419 opti_type
= OPTI_TYPE_ZERO_BYTE
10420 | OPTI_TYPE_NOT_ITERATED
;
10427 case 13200: hash_type
= HASH_TYPE_AES
;
10428 salt_type
= SALT_TYPE_EMBEDDED
;
10429 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10430 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10431 kern_type
= KERN_TYPE_AXCRYPT
;
10432 dgst_size
= DGST_SIZE_4_4
;
10433 parse_func
= axcrypt_parse_hash
;
10434 sort_by_digest
= sort_by_digest_4_4
;
10435 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10442 case 13300: hash_type
= HASH_TYPE_SHA1
;
10443 salt_type
= SALT_TYPE_NONE
;
10444 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10445 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10446 | OPTS_TYPE_PT_ADD80
10447 | OPTS_TYPE_PT_ADDBITS15
;
10448 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10449 dgst_size
= DGST_SIZE_4_5
;
10450 parse_func
= sha1axcrypt_parse_hash
;
10451 sort_by_digest
= sort_by_digest_4_5
;
10452 opti_type
= OPTI_TYPE_ZERO_BYTE
10453 | OPTI_TYPE_PRECOMPUTE_INIT
10454 | OPTI_TYPE_EARLY_SKIP
10455 | OPTI_TYPE_NOT_ITERATED
10456 | OPTI_TYPE_NOT_SALTED
;
10463 case 13400: hash_type
= HASH_TYPE_AES
;
10464 salt_type
= SALT_TYPE_EMBEDDED
;
10465 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10466 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10467 kern_type
= KERN_TYPE_KEEPASS
;
10468 dgst_size
= DGST_SIZE_4_4
;
10469 parse_func
= keepass_parse_hash
;
10470 sort_by_digest
= sort_by_digest_4_4
;
10471 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10478 case 13500: hash_type
= HASH_TYPE_SHA1
;
10479 salt_type
= SALT_TYPE_EMBEDDED
;
10480 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10481 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10482 | OPTS_TYPE_PT_UNICODE
10483 | OPTS_TYPE_PT_ADD80
;
10484 kern_type
= KERN_TYPE_PSTOKEN
;
10485 dgst_size
= DGST_SIZE_4_5
;
10486 parse_func
= pstoken_parse_hash
;
10487 sort_by_digest
= sort_by_digest_4_5
;
10488 opti_type
= OPTI_TYPE_ZERO_BYTE
10489 | OPTI_TYPE_PRECOMPUTE_INIT
10490 | OPTI_TYPE_EARLY_SKIP
10491 | OPTI_TYPE_NOT_ITERATED
10492 | OPTI_TYPE_PREPENDED_SALT
10493 | OPTI_TYPE_RAW_HASH
;
10500 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10501 salt_type
= SALT_TYPE_EMBEDDED
;
10502 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10503 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10504 kern_type
= KERN_TYPE_ZIP2
;
10505 dgst_size
= DGST_SIZE_4_4
;
10506 parse_func
= zip2_parse_hash
;
10507 sort_by_digest
= sort_by_digest_4_4
;
10508 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10515 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10516 salt_type
= SALT_TYPE_EMBEDDED
;
10517 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10518 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10519 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10520 dgst_size
= DGST_SIZE_4_5
;
10521 parse_func
= veracrypt_parse_hash_655331
;
10522 sort_by_digest
= sort_by_digest_4_5
;
10523 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10530 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10531 salt_type
= SALT_TYPE_EMBEDDED
;
10532 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10533 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10534 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10535 dgst_size
= DGST_SIZE_4_5
;
10536 parse_func
= veracrypt_parse_hash_655331
;
10537 sort_by_digest
= sort_by_digest_4_5
;
10538 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10545 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10546 salt_type
= SALT_TYPE_EMBEDDED
;
10547 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10548 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10549 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10550 dgst_size
= DGST_SIZE_4_5
;
10551 parse_func
= veracrypt_parse_hash_655331
;
10552 sort_by_digest
= sort_by_digest_4_5
;
10553 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10560 case 13721: hash_type
= HASH_TYPE_SHA512
;
10561 salt_type
= SALT_TYPE_EMBEDDED
;
10562 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10563 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10564 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10565 dgst_size
= DGST_SIZE_8_8
;
10566 parse_func
= veracrypt_parse_hash_500000
;
10567 sort_by_digest
= sort_by_digest_8_8
;
10568 opti_type
= OPTI_TYPE_ZERO_BYTE
10569 | OPTI_TYPE_USES_BITS_64
;
10576 case 13722: hash_type
= HASH_TYPE_SHA512
;
10577 salt_type
= SALT_TYPE_EMBEDDED
;
10578 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10579 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10580 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10581 dgst_size
= DGST_SIZE_8_8
;
10582 parse_func
= veracrypt_parse_hash_500000
;
10583 sort_by_digest
= sort_by_digest_8_8
;
10584 opti_type
= OPTI_TYPE_ZERO_BYTE
10585 | OPTI_TYPE_USES_BITS_64
;
10592 case 13723: hash_type
= HASH_TYPE_SHA512
;
10593 salt_type
= SALT_TYPE_EMBEDDED
;
10594 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10595 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10596 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10597 dgst_size
= DGST_SIZE_8_8
;
10598 parse_func
= veracrypt_parse_hash_500000
;
10599 sort_by_digest
= sort_by_digest_8_8
;
10600 opti_type
= OPTI_TYPE_ZERO_BYTE
10601 | OPTI_TYPE_USES_BITS_64
;
10608 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10609 salt_type
= SALT_TYPE_EMBEDDED
;
10610 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10611 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10612 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10613 dgst_size
= DGST_SIZE_4_8
;
10614 parse_func
= veracrypt_parse_hash_500000
;
10615 sort_by_digest
= sort_by_digest_4_8
;
10616 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10623 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10624 salt_type
= SALT_TYPE_EMBEDDED
;
10625 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10627 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10628 dgst_size
= DGST_SIZE_4_8
;
10629 parse_func
= veracrypt_parse_hash_500000
;
10630 sort_by_digest
= sort_by_digest_4_8
;
10631 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10638 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10639 salt_type
= SALT_TYPE_EMBEDDED
;
10640 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10641 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10642 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10643 dgst_size
= DGST_SIZE_4_8
;
10644 parse_func
= veracrypt_parse_hash_500000
;
10645 sort_by_digest
= sort_by_digest_4_8
;
10646 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10653 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10654 salt_type
= SALT_TYPE_EMBEDDED
;
10655 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10656 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10657 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10658 dgst_size
= DGST_SIZE_4_5
;
10659 parse_func
= veracrypt_parse_hash_327661
;
10660 sort_by_digest
= sort_by_digest_4_5
;
10661 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10668 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10669 salt_type
= SALT_TYPE_EMBEDDED
;
10670 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10671 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10672 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10673 dgst_size
= DGST_SIZE_4_5
;
10674 parse_func
= veracrypt_parse_hash_327661
;
10675 sort_by_digest
= sort_by_digest_4_5
;
10676 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10683 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10684 salt_type
= SALT_TYPE_EMBEDDED
;
10685 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10686 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10687 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10688 dgst_size
= DGST_SIZE_4_5
;
10689 parse_func
= veracrypt_parse_hash_327661
;
10690 sort_by_digest
= sort_by_digest_4_5
;
10691 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10698 case 13751: hash_type
= HASH_TYPE_SHA256
;
10699 salt_type
= SALT_TYPE_EMBEDDED
;
10700 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10701 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10702 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10703 dgst_size
= DGST_SIZE_4_8
;
10704 parse_func
= veracrypt_parse_hash_500000
;
10705 sort_by_digest
= sort_by_digest_4_8
;
10706 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10713 case 13752: hash_type
= HASH_TYPE_SHA256
;
10714 salt_type
= SALT_TYPE_EMBEDDED
;
10715 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10716 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10717 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10718 dgst_size
= DGST_SIZE_4_8
;
10719 parse_func
= veracrypt_parse_hash_500000
;
10720 sort_by_digest
= sort_by_digest_4_8
;
10721 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10728 case 13753: hash_type
= HASH_TYPE_SHA256
;
10729 salt_type
= SALT_TYPE_EMBEDDED
;
10730 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10731 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10732 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10733 dgst_size
= DGST_SIZE_4_8
;
10734 parse_func
= veracrypt_parse_hash_500000
;
10735 sort_by_digest
= sort_by_digest_4_8
;
10736 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10743 case 13761: hash_type
= HASH_TYPE_SHA256
;
10744 salt_type
= SALT_TYPE_EMBEDDED
;
10745 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10746 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10747 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10748 dgst_size
= DGST_SIZE_4_8
;
10749 parse_func
= veracrypt_parse_hash_200000
;
10750 sort_by_digest
= sort_by_digest_4_8
;
10751 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10758 case 13762: hash_type
= HASH_TYPE_SHA256
;
10759 salt_type
= SALT_TYPE_EMBEDDED
;
10760 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10761 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10762 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10763 dgst_size
= DGST_SIZE_4_8
;
10764 parse_func
= veracrypt_parse_hash_200000
;
10765 sort_by_digest
= sort_by_digest_4_8
;
10766 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10773 case 13763: hash_type
= HASH_TYPE_SHA256
;
10774 salt_type
= SALT_TYPE_EMBEDDED
;
10775 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10777 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10778 dgst_size
= DGST_SIZE_4_8
;
10779 parse_func
= veracrypt_parse_hash_200000
;
10780 sort_by_digest
= sort_by_digest_4_8
;
10781 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10789 default: usage_mini_print (PROGNAME
); return (-1);
10796 data
.parse_func
= parse_func
;
10804 if (salt_type
== SALT_TYPE_INTERN
)
10806 opts_type
|= OPTS_TYPE_ST_HEX
;
10810 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10816 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10817 | (salt_type
== SALT_TYPE_EXTERN
)
10818 | (salt_type
== SALT_TYPE_EMBEDDED
)
10819 | (salt_type
== SALT_TYPE_VIRTUAL
));
10821 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10823 data
.hash_type
= hash_type
;
10824 data
.attack_mode
= attack_mode
;
10825 data
.attack_kern
= attack_kern
;
10826 data
.attack_exec
= attack_exec
;
10827 data
.kern_type
= kern_type
;
10828 data
.opts_type
= opts_type
;
10829 data
.dgst_size
= dgst_size
;
10830 data
.salt_type
= salt_type
;
10831 data
.isSalted
= isSalted
;
10832 data
.sort_by_digest
= sort_by_digest
;
10833 data
.dgst_pos0
= dgst_pos0
;
10834 data
.dgst_pos1
= dgst_pos1
;
10835 data
.dgst_pos2
= dgst_pos2
;
10836 data
.dgst_pos3
= dgst_pos3
;
10842 case 2500: esalt_size
= sizeof (wpa_t
); break;
10843 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10844 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10845 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10846 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10847 case 6211: esalt_size
= sizeof (tc_t
); break;
10848 case 6212: esalt_size
= sizeof (tc_t
); break;
10849 case 6213: esalt_size
= sizeof (tc_t
); break;
10850 case 6221: esalt_size
= sizeof (tc_t
); break;
10851 case 6222: esalt_size
= sizeof (tc_t
); break;
10852 case 6223: esalt_size
= sizeof (tc_t
); break;
10853 case 6231: esalt_size
= sizeof (tc_t
); break;
10854 case 6232: esalt_size
= sizeof (tc_t
); break;
10855 case 6233: esalt_size
= sizeof (tc_t
); break;
10856 case 6241: esalt_size
= sizeof (tc_t
); break;
10857 case 6242: esalt_size
= sizeof (tc_t
); break;
10858 case 6243: esalt_size
= sizeof (tc_t
); break;
10859 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10860 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10861 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10862 case 7300: esalt_size
= sizeof (rakp_t
); break;
10863 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10864 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10865 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10866 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10867 case 9400: esalt_size
= sizeof (office2007_t
); break;
10868 case 9500: esalt_size
= sizeof (office2010_t
); break;
10869 case 9600: esalt_size
= sizeof (office2013_t
); break;
10870 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10871 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10872 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10873 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10874 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10875 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10876 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10877 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10878 case 10400: esalt_size
= sizeof (pdf_t
); break;
10879 case 10410: esalt_size
= sizeof (pdf_t
); break;
10880 case 10420: esalt_size
= sizeof (pdf_t
); break;
10881 case 10500: esalt_size
= sizeof (pdf_t
); break;
10882 case 10600: esalt_size
= sizeof (pdf_t
); break;
10883 case 10700: esalt_size
= sizeof (pdf_t
); break;
10884 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10885 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10886 case 11400: esalt_size
= sizeof (sip_t
); break;
10887 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10888 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10889 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10890 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10891 case 13000: esalt_size
= sizeof (rar5_t
); break;
10892 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10893 case 13400: esalt_size
= sizeof (keepass_t
); break;
10894 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10895 case 13600: esalt_size
= sizeof (zip2_t
); break;
10896 case 13711: esalt_size
= sizeof (tc_t
); break;
10897 case 13712: esalt_size
= sizeof (tc_t
); break;
10898 case 13713: esalt_size
= sizeof (tc_t
); break;
10899 case 13721: esalt_size
= sizeof (tc_t
); break;
10900 case 13722: esalt_size
= sizeof (tc_t
); break;
10901 case 13723: esalt_size
= sizeof (tc_t
); break;
10902 case 13731: esalt_size
= sizeof (tc_t
); break;
10903 case 13732: esalt_size
= sizeof (tc_t
); break;
10904 case 13733: esalt_size
= sizeof (tc_t
); break;
10905 case 13741: esalt_size
= sizeof (tc_t
); break;
10906 case 13742: esalt_size
= sizeof (tc_t
); break;
10907 case 13743: esalt_size
= sizeof (tc_t
); break;
10908 case 13751: esalt_size
= sizeof (tc_t
); break;
10909 case 13752: esalt_size
= sizeof (tc_t
); break;
10910 case 13753: esalt_size
= sizeof (tc_t
); break;
10911 case 13761: esalt_size
= sizeof (tc_t
); break;
10912 case 13762: esalt_size
= sizeof (tc_t
); break;
10913 case 13763: esalt_size
= sizeof (tc_t
); break;
10916 data
.esalt_size
= esalt_size
;
10919 * choose dictionary parser
10922 if (hash_type
== HASH_TYPE_LM
)
10924 get_next_word_func
= get_next_word_lm
;
10926 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10928 get_next_word_func
= get_next_word_uc
;
10932 get_next_word_func
= get_next_word_std
;
10939 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10942 size_t dictstat_nmemb
= 0;
10946 uint dictstat_nmemb
= 0;
10949 char dictstat
[256] = { 0 };
10951 FILE *dictstat_fp
= NULL
;
10955 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10957 dictstat_fp
= fopen (dictstat
, "rb");
10962 struct stat tmpstat
;
10964 fstat (fileno (dictstat_fp
), &tmpstat
);
10968 struct stat64 tmpstat
;
10970 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10973 if (tmpstat
.st_mtime
< COMPTIME
)
10975 /* with v0.15 the format changed so we have to ensure user is using a good version
10976 since there is no version-header in the dictstat file */
10978 fclose (dictstat_fp
);
10984 while (!feof (dictstat_fp
))
10988 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
10990 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
10992 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
10994 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11000 fclose (dictstat_fp
);
11009 char potfile
[256] = { 0 };
11011 if (potfile_path
== NULL
)
11013 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11017 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11020 data
.pot_fp
= NULL
;
11022 FILE *out_fp
= NULL
;
11023 FILE *pot_fp
= NULL
;
11025 if (show
== 1 || left
== 1)
11027 pot_fp
= fopen (potfile
, "rb");
11029 if (pot_fp
== NULL
)
11031 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11036 if (outfile
!= NULL
)
11038 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11040 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11054 if (potfile_disable
== 0)
11056 pot_fp
= fopen (potfile
, "ab");
11058 if (pot_fp
== NULL
)
11060 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11065 data
.pot_fp
= pot_fp
;
11072 uint pot_avail
= 0;
11074 if (show
== 1 || left
== 1)
11076 SUPPRESS_OUTPUT
= 1;
11078 pot_avail
= count_lines (pot_fp
);
11082 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11084 uint pot_hashes_avail
= 0;
11088 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11090 while (!feof (pot_fp
))
11094 int line_len
= fgetl (pot_fp
, line_buf
);
11096 if (line_len
== 0) continue;
11098 char *plain_buf
= line_buf
+ line_len
;
11100 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11102 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11104 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11105 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11107 if (pot_cnt
== pot_hashes_avail
)
11111 for (pos
= 0; pos
< INCR_POT
; pos
++)
11113 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11115 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11117 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11119 tmp_hash
->digest
= mymalloc (dgst_size
);
11123 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11128 tmp_hash
->esalt
= mymalloc (esalt_size
);
11131 pot_hashes_avail
++;
11139 int iter
= MAX_CUT_TRIES
;
11143 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11145 if (line_buf
[i
] == ':')
11153 if (data
.hash_mode
!= 2500)
11155 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11159 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11161 if (line_len
> max_salt_size
)
11163 parser_status
= PARSER_GLOBAL_LENGTH
;
11167 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11169 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11171 hashes_buf
->salt
->salt_len
= line_len
;
11173 parser_status
= PARSER_OK
;
11177 // if NOT parsed without error, we add the ":" to the plain
11179 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11185 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11187 if (parser_status
< PARSER_GLOBAL_ZERO
)
11189 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11194 if (plain_len
>= 255) continue;
11196 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11198 pot_ptr
->plain_len
= plain_len
;
11207 SUPPRESS_OUTPUT
= 0;
11209 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11216 uint pw_min
= PW_MIN
;
11217 uint pw_max
= PW_MAX
;
11221 case 125: if (pw_max
> 32) pw_max
= 32;
11223 case 400: if (pw_max
> 40) pw_max
= 40;
11225 case 500: if (pw_max
> 16) pw_max
= 16;
11227 case 1500: if (pw_max
> 8) pw_max
= 8;
11229 case 1600: if (pw_max
> 16) pw_max
= 16;
11231 case 1800: if (pw_max
> 16) pw_max
= 16;
11233 case 2100: if (pw_max
> 16) pw_max
= 16;
11235 case 2500: if (pw_min
< 8) pw_min
= 8;
11237 case 3000: if (pw_max
> 7) pw_max
= 7;
11239 case 5200: if (pw_max
> 24) pw_max
= 24;
11241 case 5800: if (pw_max
> 16) pw_max
= 16;
11243 case 6300: if (pw_max
> 16) pw_max
= 16;
11245 case 7400: if (pw_max
> 16) pw_max
= 16;
11247 case 7500: if (pw_max
> 8) pw_max
= 8;
11249 case 7900: if (pw_max
> 48) pw_max
= 48;
11251 case 8500: if (pw_max
> 8) pw_max
= 8;
11253 case 8600: if (pw_max
> 16) pw_max
= 16;
11255 case 9710: pw_min
= 5;
11258 case 9810: pw_min
= 5;
11261 case 10410: pw_min
= 5;
11264 case 10300: if (pw_max
< 3) pw_min
= 3;
11265 if (pw_max
> 40) pw_max
= 40;
11267 case 10500: if (pw_max
< 3) pw_min
= 3;
11268 if (pw_max
> 40) pw_max
= 40;
11270 case 10700: if (pw_max
> 16) pw_max
= 16;
11272 case 11300: if (pw_max
> 40) pw_max
= 40;
11274 case 11600: if (pw_max
> 32) pw_max
= 32;
11276 case 12500: if (pw_max
> 20) pw_max
= 20;
11278 case 12800: if (pw_max
> 24) pw_max
= 24;
11282 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11284 switch (attack_kern
)
11286 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11288 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11294 * charsets : keep them together for more easy maintainnce
11297 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11298 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11300 mp_setup_sys (mp_sys
);
11302 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11303 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11304 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11305 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11308 * load hashes, part I: find input mode, count hashes
11311 uint hashlist_mode
= 0;
11312 uint hashlist_format
= HLFMT_HASHCAT
;
11314 uint hashes_avail
= 0;
11316 if (benchmark
== 0)
11320 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11322 if ((hash_mode
== 2500) ||
11323 (hash_mode
== 5200) ||
11324 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11325 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11326 (hash_mode
== 9000))
11328 hashlist_mode
= HL_MODE_ARG
;
11330 char *hashfile
= myargv
[optind
];
11332 data
.hashfile
= hashfile
;
11334 logfile_top_var_string ("target", hashfile
);
11337 if (hashlist_mode
== HL_MODE_ARG
)
11339 if (hash_mode
== 2500)
11343 if (stat (data
.hashfile
, &st
) == -1)
11345 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11350 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11357 else if (hashlist_mode
== HL_MODE_FILE
)
11359 char *hashfile
= myargv
[optind
];
11361 data
.hashfile
= hashfile
;
11363 logfile_top_var_string ("target", hashfile
);
11367 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11369 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11374 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11376 hashes_avail
= count_lines (fp
);
11380 if (hashes_avail
== 0)
11382 log_error ("ERROR: hashfile is empty or corrupt");
11389 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11391 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11393 log_error ("ERROR: remove not supported in native hashfile-format mode");
11405 hashlist_mode
= HL_MODE_ARG
;
11410 if (hash_mode
== 3000) hashes_avail
*= 2;
11412 data
.hashlist_mode
= hashlist_mode
;
11413 data
.hashlist_format
= hashlist_format
;
11415 logfile_top_uint (hashlist_mode
);
11416 logfile_top_uint (hashlist_format
);
11419 * load hashes, part II: allocate required memory, set pointers
11422 hash_t
*hashes_buf
= NULL
;
11423 void *digests_buf
= NULL
;
11424 salt_t
*salts_buf
= NULL
;
11425 void *esalts_buf
= NULL
;
11427 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11429 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11431 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11435 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11437 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11439 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11441 if (username
&& (remove
|| show
|| left
))
11443 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11448 hash_info
->orighash
= (char *) mymalloc (256);
11455 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11459 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11464 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11467 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11469 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11473 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11477 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11482 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11487 * load hashes, part III: parse hashes or generate them if benchmark
11490 uint hashes_cnt
= 0;
11492 if (benchmark
== 0)
11496 // useless to read hash file for keyspace, cheat a little bit w/ optind
11498 else if (hashes_avail
== 0)
11501 else if (hashlist_mode
== HL_MODE_ARG
)
11503 char *input_buf
= myargv
[optind
];
11505 uint input_len
= strlen (input_buf
);
11507 logfile_top_var_string ("target", input_buf
);
11509 char *hash_buf
= NULL
;
11512 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11514 bool hash_fmt_error
= 0;
11516 if (hash_len
< 1) hash_fmt_error
= 1;
11517 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11519 if (hash_fmt_error
)
11521 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11525 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11527 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11529 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11534 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11537 int parser_status
= PARSER_OK
;
11539 if (hash_mode
== 2500)
11543 log_error ("ERROR: hccap file not specified");
11548 hashlist_mode
= HL_MODE_FILE
;
11550 data
.hashlist_mode
= hashlist_mode
;
11552 FILE *fp
= fopen (hash_buf
, "rb");
11556 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11561 if (hashes_avail
< 1)
11563 log_error ("ERROR: hccap file is empty or corrupt");
11570 uint hccap_size
= sizeof (hccap_t
);
11572 char *in
= (char *) mymalloc (hccap_size
);
11576 int n
= fread (in
, hccap_size
, 1, fp
);
11580 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11585 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11587 if (parser_status
!= PARSER_OK
)
11589 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11594 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11596 if ((show
== 1) || (left
== 1))
11598 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11600 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11602 int cur_pos
= tmp_salt
->salt_len
;
11603 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11605 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11607 // do the appending task
11609 snprintf (salt_ptr
+ cur_pos
,
11611 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11623 wpa
->orig_mac2
[5]);
11625 // memset () the remaining part of the salt
11627 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11628 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11630 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11632 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11635 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
);
11636 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
);
11645 else if (hash_mode
== 3000)
11647 if (hash_len
== 32)
11649 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11651 hash_t
*lm_hash_left
= NULL
;
11653 if (parser_status
== PARSER_OK
)
11655 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11661 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11664 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11666 hash_t
*lm_hash_right
= NULL
;
11668 if (parser_status
== PARSER_OK
)
11670 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11676 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11681 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11683 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
);
11684 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
);
11689 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11691 if (parser_status
== PARSER_OK
)
11693 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11694 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11697 if (parser_status
== PARSER_OK
)
11703 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11709 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11711 if (parser_status
== PARSER_OK
)
11713 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11714 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11717 if (parser_status
== PARSER_OK
)
11723 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11728 else if (hashlist_mode
== HL_MODE_FILE
)
11730 char *hashfile
= data
.hashfile
;
11734 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11736 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11743 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11749 int line_len
= fgetl (fp
, line_buf
);
11751 if (line_len
== 0) continue;
11753 char *hash_buf
= NULL
;
11756 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11758 bool hash_fmt_error
= 0;
11760 if (hash_len
< 1) hash_fmt_error
= 1;
11761 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11763 if (hash_fmt_error
)
11765 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11772 char *user_buf
= NULL
;
11775 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11777 if (remove
|| show
)
11779 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11781 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11783 user_t
*user_ptr
= *user
;
11785 if (user_buf
!= NULL
)
11787 user_ptr
->user_name
= mystrdup (user_buf
);
11791 user_ptr
->user_name
= mystrdup ("");
11794 user_ptr
->user_len
= user_len
;
11798 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11800 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11802 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11807 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11810 if (hash_mode
== 3000)
11812 if (hash_len
== 32)
11814 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11816 if (parser_status
< PARSER_GLOBAL_ZERO
)
11818 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11823 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11827 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11829 if (parser_status
< PARSER_GLOBAL_ZERO
)
11831 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11836 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11838 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);
11844 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
);
11845 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
);
11849 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11851 if (parser_status
< PARSER_GLOBAL_ZERO
)
11853 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11858 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11860 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11861 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11868 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11870 if (parser_status
< PARSER_GLOBAL_ZERO
)
11872 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11877 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);
11879 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11880 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11890 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11892 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11899 hashes_buf
[0].salt
->salt_len
= 8;
11901 // special salt handling
11905 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11906 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11908 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11910 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11912 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11914 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11916 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11918 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11920 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11922 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11924 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11926 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11927 hashes_buf
[0].salt
->scrypt_N
= 1024;
11928 hashes_buf
[0].salt
->scrypt_r
= 1;
11929 hashes_buf
[0].salt
->scrypt_p
= 1;
11931 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11933 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11934 hashes_buf
[0].salt
->scrypt_N
= 16384;
11935 hashes_buf
[0].salt
->scrypt_r
= 1;
11936 hashes_buf
[0].salt
->scrypt_p
= 1;
11938 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11940 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11942 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11944 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11946 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11948 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11950 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11952 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11954 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11956 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11958 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11960 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11962 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11964 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11966 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11970 // special esalt handling
11974 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11976 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11977 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11979 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11980 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11982 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11983 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11984 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11985 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11987 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11988 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11989 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11990 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11992 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
11994 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11995 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11996 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11998 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11999 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12000 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12002 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12003 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12004 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12006 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12007 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12008 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12010 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12011 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12012 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12014 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12015 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12016 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12018 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12019 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12020 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12022 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12024 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12026 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12027 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12028 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12037 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12039 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12041 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12043 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12045 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12047 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12049 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12051 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12053 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12055 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12057 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12059 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12061 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12063 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12065 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12067 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12069 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12071 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12073 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12075 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12077 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12079 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12081 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12083 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12085 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12087 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12089 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12091 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12093 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12095 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12097 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12099 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12101 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12103 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12105 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12107 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12111 // set default iterations
12115 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12117 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12119 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12121 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12123 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12125 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12127 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12129 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12131 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12133 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12135 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12137 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12139 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12141 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12143 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12145 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12147 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12149 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12151 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12153 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12155 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12157 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12159 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12161 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12163 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12165 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12167 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12169 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12171 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12173 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12175 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12177 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12179 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12181 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12183 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12185 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12187 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12189 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12191 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12193 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12195 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12197 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12199 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12201 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12203 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12205 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12207 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12209 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12211 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12213 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12215 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12217 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12219 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12221 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12223 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12225 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12227 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12229 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12231 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12233 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12235 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12237 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12239 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12241 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12243 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12245 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12247 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12249 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12251 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12253 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12255 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12257 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12259 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12261 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12263 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12265 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12267 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12269 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12271 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12273 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12275 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12277 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12284 if (show
== 1 || left
== 1)
12286 for (uint i
= 0; i
< pot_cnt
; i
++)
12288 pot_t
*pot_ptr
= &pot
[i
];
12290 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12292 local_free (hashes_buf
->digest
);
12296 local_free (hashes_buf
->salt
);
12302 if (data
.quiet
== 0) log_info_nn ("");
12309 if (hashes_cnt
== 0)
12311 log_error ("ERROR: No hashes loaded");
12318 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12321 if (data
.outfile
!= NULL
)
12323 if (data
.hashfile
!= NULL
)
12326 struct stat tmpstat_outfile
;
12327 struct stat tmpstat_hashfile
;
12331 struct stat64 tmpstat_outfile
;
12332 struct stat64 tmpstat_hashfile
;
12335 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12337 if (tmp_outfile_fp
)
12340 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12344 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12347 fclose (tmp_outfile_fp
);
12350 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12352 if (tmp_hashfile_fp
)
12355 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12359 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12362 fclose (tmp_hashfile_fp
);
12365 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12367 tmpstat_outfile
.st_mode
= 0;
12368 tmpstat_outfile
.st_nlink
= 0;
12369 tmpstat_outfile
.st_uid
= 0;
12370 tmpstat_outfile
.st_gid
= 0;
12371 tmpstat_outfile
.st_rdev
= 0;
12372 tmpstat_outfile
.st_atime
= 0;
12374 tmpstat_hashfile
.st_mode
= 0;
12375 tmpstat_hashfile
.st_nlink
= 0;
12376 tmpstat_hashfile
.st_uid
= 0;
12377 tmpstat_hashfile
.st_gid
= 0;
12378 tmpstat_hashfile
.st_rdev
= 0;
12379 tmpstat_hashfile
.st_atime
= 0;
12382 tmpstat_outfile
.st_blksize
= 0;
12383 tmpstat_outfile
.st_blocks
= 0;
12385 tmpstat_hashfile
.st_blksize
= 0;
12386 tmpstat_hashfile
.st_blocks
= 0;
12390 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12392 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12399 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12401 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12411 * Remove duplicates
12414 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12418 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12422 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12425 uint hashes_cnt_orig
= hashes_cnt
;
12429 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12433 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12435 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12440 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12443 if (hashes_pos
> hashes_cnt
)
12445 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12455 uint potfile_remove_cracks
= 0;
12457 if (potfile_disable
== 0)
12461 hash_buf
.digest
= mymalloc (dgst_size
);
12462 hash_buf
.salt
= NULL
;
12463 hash_buf
.esalt
= NULL
;
12464 hash_buf
.hash_info
= NULL
;
12465 hash_buf
.cracked
= 0;
12469 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12474 hash_buf
.esalt
= mymalloc (esalt_size
);
12477 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12479 // no solution for these special hash types (for instane because they use hashfile in output etc)
12480 if ((hash_mode
!= 5200) &&
12481 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12482 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12483 (hash_mode
!= 9000))
12485 FILE *fp
= fopen (potfile
, "rb");
12489 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12491 // to be safe work with a copy (because of line_len loop, i etc)
12492 // moved up here because it's easier to handle continue case
12495 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12499 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12501 if (ptr
== NULL
) break;
12503 int line_len
= strlen (line_buf
);
12505 if (line_len
== 0) continue;
12507 int iter
= MAX_CUT_TRIES
;
12509 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12511 if (line_buf
[i
] != ':') continue;
12515 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12518 hash_t
*found
= NULL
;
12520 if (hash_mode
== 6800)
12522 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12524 // manipulate salt_buf
12525 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12527 hash_buf
.salt
->salt_len
= i
;
12529 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12532 else if (hash_mode
== 2500)
12534 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12536 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12537 // manipulate salt_buf
12539 memcpy (line_buf_cpy
, line_buf
, i
);
12541 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12543 if (mac2_pos
== NULL
) continue;
12548 if (strlen (mac2_pos
) != 12) continue;
12550 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12552 if (mac1_pos
== NULL
) continue;
12557 if (strlen (mac1_pos
) != 12) continue;
12559 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12561 // here we need the ESSID
12562 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12564 hash_buf
.salt
->salt_len
= essid_length
;
12566 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12570 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12572 // compare hex string(s) vs binary MAC address(es)
12574 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12576 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12585 if (!found
) continue;
12587 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12589 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12601 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12603 if (parser_status
== PARSER_OK
)
12607 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12611 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12616 if (found
== NULL
) continue;
12618 if (!found
->cracked
) potfile_remove_cracks
++;
12620 found
->cracked
= 1;
12628 myfree (line_buf_cpy
);
12638 local_free (hash_buf
.esalt
);
12643 local_free (hash_buf
.salt
);
12646 local_free (hash_buf
.digest
);
12650 * Now generate all the buffers required for later
12653 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12655 salt_t
*salts_buf_new
= NULL
;
12656 void *esalts_buf_new
= NULL
;
12660 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12664 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12669 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12672 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12674 uint digests_cnt
= hashes_cnt
;
12675 uint digests_done
= 0;
12677 size_t size_digests
= digests_cnt
* dgst_size
;
12678 size_t size_shown
= digests_cnt
* sizeof (uint
);
12680 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12681 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12683 uint salts_cnt
= 0;
12684 uint salts_done
= 0;
12686 hashinfo_t
**hash_info
= NULL
;
12688 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12690 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12692 if (username
&& (remove
|| show
))
12696 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12698 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12700 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12705 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12710 // copied from inner loop
12712 salt_buf
= &salts_buf_new
[salts_cnt
];
12714 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12718 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12721 salt_buf
->digests_cnt
= 0;
12722 salt_buf
->digests_done
= 0;
12723 salt_buf
->digests_offset
= 0;
12728 if (hashes_buf
[0].cracked
== 1)
12730 digests_shown
[0] = 1;
12734 salt_buf
->digests_done
++;
12737 salt_buf
->digests_cnt
++;
12739 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12741 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12743 hash_info
[0] = hashes_buf
[0].hash_info
;
12746 // copy from inner loop
12748 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12752 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12754 salt_buf
= &salts_buf_new
[salts_cnt
];
12756 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12760 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12763 salt_buf
->digests_cnt
= 0;
12764 salt_buf
->digests_done
= 0;
12765 salt_buf
->digests_offset
= hashes_pos
;
12771 if (hashes_buf
[hashes_pos
].cracked
== 1)
12773 digests_shown
[hashes_pos
] = 1;
12777 salt_buf
->digests_done
++;
12780 salt_buf
->digests_cnt
++;
12782 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12784 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12786 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12790 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12792 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12794 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12796 salts_shown
[salt_pos
] = 1;
12801 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12804 local_free (digests_buf
);
12805 local_free (salts_buf
);
12806 local_free (esalts_buf
);
12808 digests_buf
= digests_buf_new
;
12809 salts_buf
= salts_buf_new
;
12810 esalts_buf
= esalts_buf_new
;
12812 local_free (hashes_buf
);
12815 * special modification not set from parser
12820 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12821 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12822 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12823 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12824 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12825 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12826 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12827 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12828 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12829 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12830 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12831 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12832 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12833 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12834 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12835 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12836 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12837 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12838 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12839 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12840 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12841 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12842 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12843 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12844 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12845 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12846 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12847 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12848 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12849 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12852 if (truecrypt_keyfiles
)
12854 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12856 char *keyfiles
= strdup (truecrypt_keyfiles
);
12858 char *keyfile
= strtok (keyfiles
, ",");
12862 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12864 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12869 if (veracrypt_keyfiles
)
12871 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12873 char *keyfiles
= strdup (veracrypt_keyfiles
);
12875 char *keyfile
= strtok (keyfiles
, ",");
12879 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12881 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12886 data
.digests_cnt
= digests_cnt
;
12887 data
.digests_done
= digests_done
;
12888 data
.digests_buf
= digests_buf
;
12889 data
.digests_shown
= digests_shown
;
12890 data
.digests_shown_tmp
= digests_shown_tmp
;
12892 data
.salts_cnt
= salts_cnt
;
12893 data
.salts_done
= salts_done
;
12894 data
.salts_buf
= salts_buf
;
12895 data
.salts_shown
= salts_shown
;
12897 data
.esalts_buf
= esalts_buf
;
12898 data
.hash_info
= hash_info
;
12901 * Automatic Optimizers
12904 if (salts_cnt
== 1)
12905 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12907 if (digests_cnt
== 1)
12908 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12910 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12911 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12913 if (attack_mode
== ATTACK_MODE_BF
)
12914 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12916 data
.opti_type
= opti_type
;
12918 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12920 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12922 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12924 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12926 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12927 opts_type
|= OPTS_TYPE_PT_ADD80
;
12930 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12932 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12933 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12936 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12938 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12939 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12946 * Some algorithm, like descrypt, can benefit from JIT compilation
12949 int force_jit_compilation
= -1;
12951 if (hash_mode
== 8900)
12953 force_jit_compilation
= 8900;
12955 else if (hash_mode
== 9300)
12957 force_jit_compilation
= 8900;
12959 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12961 force_jit_compilation
= 1500;
12965 * generate bitmap tables
12968 const uint bitmap_shift1
= 5;
12969 const uint bitmap_shift2
= 13;
12971 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12973 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12974 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12975 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12976 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12977 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12978 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12979 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12980 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12987 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12989 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12991 bitmap_nums
= 1 << bitmap_bits
;
12993 bitmap_mask
= bitmap_nums
- 1;
12995 bitmap_size
= bitmap_nums
* sizeof (uint
);
12997 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12999 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;
13000 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;
13005 bitmap_nums
= 1 << bitmap_bits
;
13007 bitmap_mask
= bitmap_nums
- 1;
13009 bitmap_size
= bitmap_nums
* sizeof (uint
);
13011 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);
13012 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);
13015 * prepare quick rule
13018 data
.rule_buf_l
= rule_buf_l
;
13019 data
.rule_buf_r
= rule_buf_r
;
13021 int rule_len_l
= (int) strlen (rule_buf_l
);
13022 int rule_len_r
= (int) strlen (rule_buf_r
);
13024 data
.rule_len_l
= rule_len_l
;
13025 data
.rule_len_r
= rule_len_r
;
13031 uint
*all_kernel_rules_cnt
= NULL
;
13033 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13037 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13039 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13042 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13046 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13048 uint kernel_rules_avail
= 0;
13050 uint kernel_rules_cnt
= 0;
13052 kernel_rule_t
*kernel_rules_buf
= NULL
;
13054 char *rp_file
= rp_files
[i
];
13056 char in
[BLOCK_SIZE
] = { 0 };
13057 char out
[BLOCK_SIZE
] = { 0 };
13061 uint rule_line
= 0;
13063 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13065 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13072 memset (rule_buf
, 0, HCBUFSIZ
);
13074 rule_len
= fgetl (fp
, rule_buf
);
13078 if (rule_len
== 0) continue;
13080 if (rule_buf
[0] == '#') continue;
13082 if (kernel_rules_avail
== kernel_rules_cnt
)
13084 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13086 kernel_rules_avail
+= INCR_RULES
;
13089 memset (in
, 0, BLOCK_SIZE
);
13090 memset (out
, 0, BLOCK_SIZE
);
13092 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13096 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13101 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13103 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13105 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13111 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13113 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13119 kernel_rules_cnt
++;
13124 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13126 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13130 * merge rules or automatic rule generator
13133 uint kernel_rules_cnt
= 0;
13135 kernel_rule_t
*kernel_rules_buf
= NULL
;
13137 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13141 kernel_rules_cnt
= 1;
13143 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13145 repeats
[0] = kernel_rules_cnt
;
13147 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13149 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13151 repeats
[i
+ 1] = kernel_rules_cnt
;
13154 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13156 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13158 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13162 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13164 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13166 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13169 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13171 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13173 if (out_pos
== RULES_MAX
- 1)
13175 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13180 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13185 local_free (repeats
);
13189 uint kernel_rules_avail
= 0;
13191 while (kernel_rules_cnt
< rp_gen
)
13193 if (kernel_rules_avail
== kernel_rules_cnt
)
13195 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13197 kernel_rules_avail
+= INCR_RULES
;
13200 memset (rule_buf
, 0, HCBUFSIZ
);
13202 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13204 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13206 kernel_rules_cnt
++;
13214 * generate NOP rules
13217 if (kernel_rules_cnt
== 0)
13219 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13221 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13223 kernel_rules_cnt
++;
13226 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13227 data
.kernel_rules_buf
= kernel_rules_buf
;
13230 * OpenCL platforms: detect
13233 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13234 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13236 cl_uint platforms_cnt
= 0;
13237 cl_uint platform_devices_cnt
= 0;
13241 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13243 if (platforms_cnt
== 0)
13246 log_info ("ATTENTION! No OpenCL compatible platform found");
13248 log_info ("You're probably missing the OpenCL runtime installation");
13249 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13250 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13251 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13257 if (opencl_platforms_filter
!= (uint
) -1)
13259 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13261 if (opencl_platforms_filter
> platform_cnt_mask
)
13263 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13271 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13274 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13276 cl_platform_id platform
= platforms
[platform_id
];
13278 char platform_vendor
[INFOSZ
] = { 0 };
13280 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13283 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13284 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13286 // make sure that we do not directly control the fan for NVidia
13288 gpu_temp_retain
= 0;
13290 data
.gpu_temp_retain
= gpu_temp_retain
;
13292 #endif // HAVE_NVML || HAVE_NVAPI
13297 * OpenCL device types:
13298 * 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.
13299 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13302 if (opencl_device_types
== NULL
)
13304 cl_device_type device_types_all
= 0;
13306 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13308 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13310 cl_platform_id platform
= platforms
[platform_id
];
13312 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13314 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13316 cl_device_id device
= platform_devices
[platform_devices_id
];
13318 cl_device_type device_type
;
13320 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13322 device_types_all
|= device_type
;
13326 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13328 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13333 * OpenCL devices: simply push all devices from all platforms into the same device array
13336 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13338 data
.devices_param
= devices_param
;
13340 uint devices_cnt
= 0;
13342 uint devices_active
= 0;
13344 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13346 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13348 cl_platform_id platform
= platforms
[platform_id
];
13350 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13352 char platform_vendor
[INFOSZ
] = { 0 };
13354 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13356 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13357 // this causes trouble with vendor id based macros
13358 // we'll assign generic to those without special optimization available
13360 cl_uint platform_vendor_id
= 0;
13362 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13364 platform_vendor_id
= VENDOR_ID_AMD
;
13366 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13368 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13370 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13372 platform_vendor_id
= VENDOR_ID_APPLE
;
13374 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13376 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13378 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13380 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13382 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13384 platform_vendor_id
= VENDOR_ID_MESA
;
13386 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13388 platform_vendor_id
= VENDOR_ID_NV
;
13390 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13392 platform_vendor_id
= VENDOR_ID_POCL
;
13396 platform_vendor_id
= VENDOR_ID_GENERIC
;
13399 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13401 size_t param_value_size
= 0;
13403 const uint device_id
= devices_cnt
;
13405 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13407 device_param
->platform_vendor_id
= platform_vendor_id
;
13409 device_param
->device
= platform_devices
[platform_devices_id
];
13411 device_param
->device_id
= device_id
;
13413 device_param
->platform_devices_id
= platform_devices_id
;
13417 cl_device_type device_type
;
13419 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13421 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13423 device_param
->device_type
= device_type
;
13427 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13429 char *device_name
= (char *) mymalloc (param_value_size
);
13431 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13433 device_param
->device_name
= device_name
;
13437 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13439 char *device_vendor
= (char *) mymalloc (param_value_size
);
13441 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13443 device_param
->device_vendor
= device_vendor
;
13445 cl_uint device_vendor_id
= 0;
13447 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13449 device_vendor_id
= VENDOR_ID_AMD
;
13451 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13453 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13455 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13457 device_vendor_id
= VENDOR_ID_APPLE
;
13459 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13461 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13463 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13465 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13467 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13469 device_vendor_id
= VENDOR_ID_MESA
;
13471 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13473 device_vendor_id
= VENDOR_ID_NV
;
13475 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13477 device_vendor_id
= VENDOR_ID_POCL
;
13481 device_vendor_id
= VENDOR_ID_GENERIC
;
13484 device_param
->device_vendor_id
= device_vendor_id
;
13488 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13492 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13494 char *device_version
= (char *) mymalloc (param_value_size
);
13496 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13498 device_param
->device_version
= device_version
;
13500 // device_opencl_version
13502 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13504 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13506 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13508 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13510 myfree (device_opencl_version
);
13514 cl_uint vector_width
;
13516 if (opencl_vector_width_chgd
== 0)
13518 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13520 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13522 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13526 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13531 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13536 vector_width
= opencl_vector_width
;
13539 if (vector_width
> 16) vector_width
= 16;
13541 device_param
->vector_width
= vector_width
;
13543 // max_compute_units
13545 cl_uint device_processors
;
13547 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13549 device_param
->device_processors
= device_processors
;
13551 // device_maxmem_alloc
13552 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13554 cl_ulong device_maxmem_alloc
;
13556 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13558 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13560 // device_global_mem
13562 cl_ulong device_global_mem
;
13564 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13566 device_param
->device_global_mem
= device_global_mem
;
13568 // max_work_group_size
13570 size_t device_maxworkgroup_size
;
13572 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13574 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13576 // max_clock_frequency
13578 cl_uint device_maxclock_frequency
;
13580 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13582 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13584 // device_endian_little
13586 cl_bool device_endian_little
;
13588 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13590 if (device_endian_little
== CL_FALSE
)
13592 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13594 device_param
->skipped
= 1;
13597 // device_available
13599 cl_bool device_available
;
13601 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13603 if (device_available
== CL_FALSE
)
13605 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13607 device_param
->skipped
= 1;
13610 // device_compiler_available
13612 cl_bool device_compiler_available
;
13614 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13616 if (device_compiler_available
== CL_FALSE
)
13618 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13620 device_param
->skipped
= 1;
13623 // device_execution_capabilities
13625 cl_device_exec_capabilities device_execution_capabilities
;
13627 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13629 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13631 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13633 device_param
->skipped
= 1;
13636 // device_extensions
13638 size_t device_extensions_size
;
13640 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13642 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13644 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13646 if (strstr (device_extensions
, "base_atomics") == 0)
13648 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13650 device_param
->skipped
= 1;
13653 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13655 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13657 device_param
->skipped
= 1;
13660 myfree (device_extensions
);
13662 // device_local_mem_size
13664 cl_ulong device_local_mem_size
;
13666 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13668 if (device_local_mem_size
< 32768)
13670 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13672 device_param
->skipped
= 1;
13675 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13676 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13677 // This results in both utilizing it for 50%
13678 // However, Intel has much better SIMD control over their own hardware
13679 // It makes sense to give them full control over their own hardware
13681 if (device_type
& CL_DEVICE_TYPE_CPU
)
13683 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13685 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13687 device_param
->skipped
= 1;
13693 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13694 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13698 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13700 char *driver_version
= (char *) mymalloc (param_value_size
);
13702 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13704 device_param
->driver_version
= driver_version
;
13706 // device_name_chksum
13708 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13711 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
);
13713 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
);
13716 uint device_name_digest
[4] = { 0 };
13718 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13720 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13722 device_param
->device_name_chksum
= device_name_chksum
;
13724 // device_processor_cores
13726 if (device_type
& CL_DEVICE_TYPE_CPU
)
13728 cl_uint device_processor_cores
= 1;
13730 device_param
->device_processor_cores
= device_processor_cores
;
13733 if (device_type
& CL_DEVICE_TYPE_GPU
)
13735 if (device_vendor_id
== VENDOR_ID_AMD
)
13737 cl_uint device_processor_cores
= 0;
13739 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13741 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13743 device_param
->device_processor_cores
= device_processor_cores
;
13745 else if (device_vendor_id
== VENDOR_ID_NV
)
13747 cl_uint kernel_exec_timeout
= 0;
13749 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13751 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13753 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13755 cl_uint device_processor_cores
= 0;
13757 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13759 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13761 device_param
->device_processor_cores
= device_processor_cores
;
13763 cl_uint sm_minor
= 0;
13764 cl_uint sm_major
= 0;
13766 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13767 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13769 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13770 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13772 device_param
->sm_minor
= sm_minor
;
13773 device_param
->sm_major
= sm_major
;
13777 cl_uint device_processor_cores
= 1;
13779 device_param
->device_processor_cores
= device_processor_cores
;
13785 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13787 if (machine_readable
== 0)
13789 if (device_param
->skipped
== 0)
13791 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13794 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13795 (unsigned int) (device_global_mem
/ 1024 / 1024),
13796 (unsigned int) device_processors
);
13800 log_info ("Device #%u: %s, skipped",
13807 // common driver check
13809 if (device_param
->skipped
== 0)
13811 if (device_type
& CL_DEVICE_TYPE_GPU
)
13813 if (platform_vendor_id
== VENDOR_ID_AMD
)
13815 int catalyst_check
= (force
== 1) ? 0 : 1;
13817 int catalyst_warn
= 0;
13819 int catalyst_broken
= 0;
13821 if (catalyst_check
== 1)
13825 // v14.9 and higher
13826 if (atoi (device_param
->driver_version
) >= 1573)
13831 catalyst_check
= 0;
13834 if (catalyst_broken
== 1)
13837 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13838 log_info ("It will pass over cracked hashes and does not report them as cracked");
13839 log_info ("You are STRONGLY encouraged not to use it");
13840 log_info ("You can use --force to override this but do not post error reports if you do so");
13846 if (catalyst_warn
== 1)
13849 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13850 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13851 log_info ("See hashcat's homepage for official supported catalyst drivers");
13853 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13855 log_info ("You can use --force to override this but do not post error reports if you do so");
13861 else if (platform_vendor_id
== VENDOR_ID_NV
)
13863 if (device_param
->kernel_exec_timeout
!= 0)
13865 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);
13866 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13871 /* turns out pocl still creates segfaults (because of llvm)
13872 if (device_type & CL_DEVICE_TYPE_CPU)
13874 if (platform_vendor_id == VENDOR_ID_AMD)
13879 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13880 log_info ("You are STRONGLY encouraged not to use it");
13881 log_info ("You can use --force to override this but do not post error reports if you do so");
13882 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13892 * kernel accel and loops tuning db adjustment
13895 device_param
->kernel_accel_min
= 1;
13896 device_param
->kernel_accel_max
= 1024;
13898 device_param
->kernel_loops_min
= 1;
13899 device_param
->kernel_loops_max
= 1024;
13901 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13903 if (tuningdb_entry
)
13905 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13906 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13910 device_param
->kernel_accel_min
= _kernel_accel
;
13911 device_param
->kernel_accel_max
= _kernel_accel
;
13916 if (workload_profile
== 1)
13918 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13920 else if (workload_profile
== 2)
13922 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13925 device_param
->kernel_loops_min
= _kernel_loops
;
13926 device_param
->kernel_loops_max
= _kernel_loops
;
13930 // commandline parameters overwrite tuningdb entries
13934 device_param
->kernel_accel_min
= kernel_accel
;
13935 device_param
->kernel_accel_max
= kernel_accel
;
13940 device_param
->kernel_loops_min
= kernel_loops
;
13941 device_param
->kernel_loops_max
= kernel_loops
;
13957 if (keyspace
== 0 && devices_active
== 0)
13959 log_error ("ERROR: No devices found/left");
13964 // 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)
13966 if (devices_filter
!= (uint
) -1)
13968 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13970 if (devices_filter
> devices_cnt_mask
)
13972 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13978 data
.devices_cnt
= devices_cnt
;
13980 data
.devices_active
= devices_active
;
13982 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13984 if (machine_readable
== 0)
13995 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13996 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
14000 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0 } };
14003 if (gpu_temp_disable
== 0)
14005 #if defined(WIN) && defined(HAVE_NVAPI)
14006 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14008 if (nvapi_init (nvapi
) == 0)
14009 data
.hm_nv
= nvapi
;
14013 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
14015 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14017 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14021 for (int i
= 0; i
< tmp_in
; i
++)
14023 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14026 for (int i
= 0; i
< tmp_out
; i
++)
14028 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
14030 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
14032 if (hm_NvAPI_GPU_GetCoolerSettings (data
.hm_nv
, hm_adapters_nv
[i
].adapter_index
.nv
, 0, &pCoolerSettings
) != NVAPI_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
14036 #endif // WIN && HAVE_NVAPI
14038 #if defined(LINUX) && defined(HAVE_NVML)
14039 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14041 if (nvml_init (nvml
) == 0)
14046 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
14048 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14050 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14054 for (int i
= 0; i
< tmp_in
; i
++)
14056 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14059 for (int i
= 0; i
< tmp_out
; i
++)
14061 unsigned int speed
;
14063 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nv
, 1, hm_adapters_nv
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
14067 #endif // LINUX && HAVE_NVML
14069 data
.hm_amd
= NULL
;
14072 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14074 if (adl_init (adl
) == 0)
14079 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14081 // total number of adapters
14083 int hm_adapters_num
;
14085 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14089 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14091 if (lpAdapterInfo
== NULL
) return (-1);
14093 // get a list (of ids of) valid/usable adapters
14095 int num_adl_adapters
= 0;
14097 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14099 if (num_adl_adapters
> 0)
14101 hc_thread_mutex_lock (mux_adl
);
14103 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14105 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14107 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14108 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14110 hc_thread_mutex_unlock (mux_adl
);
14113 myfree (valid_adl_device_list
);
14114 myfree (lpAdapterInfo
);
14119 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14121 gpu_temp_disable
= 1;
14126 * OpenCL devices: allocate buffer for device specific information
14130 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14133 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14135 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14140 * enable custom signal handler(s)
14143 if (benchmark
== 0)
14145 hc_signal (sigHandler_default
);
14149 hc_signal (sigHandler_benchmark
);
14153 * User-defined GPU temp handling
14157 if (gpu_temp_disable
== 1)
14159 gpu_temp_abort
= 0;
14160 gpu_temp_retain
= 0;
14163 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14165 if (gpu_temp_abort
< gpu_temp_retain
)
14167 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14173 data
.gpu_temp_disable
= gpu_temp_disable
;
14174 data
.gpu_temp_abort
= gpu_temp_abort
;
14175 data
.gpu_temp_retain
= gpu_temp_retain
;
14182 if (data
.quiet
== 0)
14184 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14186 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
);
14188 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14190 log_info ("Rules: %u", kernel_rules_cnt
);
14195 log_info ("Applicable Optimizers:");
14197 for (uint i
= 0; i
< 32; i
++)
14199 const uint opti_bit
= 1u << i
;
14201 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14206 * Watchdog and Temperature balance
14210 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14212 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14215 if (gpu_temp_abort
== 0)
14217 log_info ("Watchdog: Temperature abort trigger disabled");
14221 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14224 if (gpu_temp_retain
== 0)
14226 log_info ("Watchdog: Temperature retain trigger disabled");
14230 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14233 if (data
.quiet
== 0) log_info ("");
14241 if (gpu_temp_disable
== 0)
14243 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14245 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14247 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14249 if (device_param
->skipped
) continue;
14251 const uint platform_devices_id
= device_param
->platform_devices_id
;
14253 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14254 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14256 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[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_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14271 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14272 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14273 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14274 * Driver / ADL bug?
14278 if (powertune_enable
== 1)
14280 hc_thread_mutex_lock (mux_adl
);
14282 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14284 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14286 if (device_param
->skipped
) continue;
14288 if (data
.hm_device
[device_id
].od_version
== 6)
14290 // set powertune value only
14292 int powertune_supported
= 0;
14296 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14298 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14303 if (powertune_supported
!= 0)
14306 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14308 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14310 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14315 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14317 log_error ("ERROR: Failed to set new ADL PowerControl values");
14325 hc_thread_mutex_unlock (mux_adl
);
14328 #endif // HAVE_HWMON
14331 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14334 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14336 uint kernel_power_all
= 0;
14338 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14344 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14346 if (device_param
->skipped
) continue;
14349 * device properties
14352 const char *device_name_chksum
= device_param
->device_name_chksum
;
14353 const u32 device_processors
= device_param
->device_processors
;
14354 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14357 * create context for each device
14360 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14363 * create command-queue
14366 // not supported with NV
14367 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14369 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14372 * kernel threads: some algorithms need a fixed kernel-threads count
14373 * because of shared memory usage or bitslice
14374 * there needs to be some upper limit, otherwise there's too much overhead
14377 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14379 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14381 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14384 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14385 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14386 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14387 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14388 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14389 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14390 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14391 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14392 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14393 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14394 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14395 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14396 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14399 * create input buffers on device : calculate size of fixed memory buffers
14402 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14403 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14405 device_param
->size_root_css
= size_root_css
;
14406 device_param
->size_markov_css
= size_markov_css
;
14408 size_t size_results
= sizeof (uint
);
14410 device_param
->size_results
= size_results
;
14412 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14413 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14415 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14416 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14417 size_t size_esalts
= salts_cnt
* esalt_size
;
14419 device_param
->size_plains
= size_plains
;
14420 device_param
->size_digests
= size_digests
;
14421 device_param
->size_shown
= size_shown
;
14422 device_param
->size_salts
= size_salts
;
14424 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14425 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14426 size_t size_tm
= 32 * sizeof (bs_word_t
);
14430 size_t size_scryptV
= 1;
14432 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14434 uint tmto_start
= 0;
14435 uint tmto_stop
= 10;
14439 tmto_start
= scrypt_tmto
;
14443 // in case the user did not specify the tmto manually
14444 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14445 // but set the lower end only in case the user has a device with too less memory
14447 if (hash_mode
== 8900)
14449 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14453 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14458 else if (hash_mode
== 9300)
14460 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14464 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14471 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14473 // TODO: in theory the following calculation needs to be done per salt, not global
14474 // we assume all hashes have the same scrypt settings
14476 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14478 size_scryptV
/= 1 << tmto
;
14480 size_scryptV
*= device_processors
* device_processor_cores
;
14482 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14484 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14489 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14491 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14492 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14498 if (data
.salts_buf
[0].scrypt_phy
== 0)
14500 log_error ("ERROR: can't allocate enough device memory");
14505 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14509 * some algorithms need a fixed kernel-loops count
14512 if (hash_mode
== 1500)
14514 const u32 kernel_loops_fixed
= 1024;
14516 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14517 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14520 if (hash_mode
== 3000)
14522 const u32 kernel_loops_fixed
= 1024;
14524 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14525 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14528 if (hash_mode
== 8900)
14530 const u32 kernel_loops_fixed
= 1;
14532 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14533 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14536 if (hash_mode
== 9300)
14538 const u32 kernel_loops_fixed
= 1;
14540 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14541 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14544 if (hash_mode
== 12500)
14546 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14548 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14549 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14553 * some algorithms have a maximum kernel-loops count
14556 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14558 u32 innerloop_cnt
= 0;
14560 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14562 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14563 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14564 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14568 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14571 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14572 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14574 device_param
->kernel_loops_max
= innerloop_cnt
;
14578 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14579 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14581 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14583 size_t size_pws
= 4;
14584 size_t size_tmps
= 4;
14585 size_t size_hooks
= 4;
14587 while (kernel_accel_max
>= kernel_accel_min
)
14589 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14593 size_pws
= kernel_power_max
* sizeof (pw_t
);
14599 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14600 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14601 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14602 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14603 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14604 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14605 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14606 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14607 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14608 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14609 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14610 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14611 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14612 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14613 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14614 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14615 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14616 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14617 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14618 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14619 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14620 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14621 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14622 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14623 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14624 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14625 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14626 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14627 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14628 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14629 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14630 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14631 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14632 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14633 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14634 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14635 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14636 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14637 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14638 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14639 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14640 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14641 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14642 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14643 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14644 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14645 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14646 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14647 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14648 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14649 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14650 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14651 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14652 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14653 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14654 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14655 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14656 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14657 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14658 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14659 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14660 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14661 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14662 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14663 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14664 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14665 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14666 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14667 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14668 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14669 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14670 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14671 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14672 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14673 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14674 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14675 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14676 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14677 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14678 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14679 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14680 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14685 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14690 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14691 // if not, decrease amplifier and try again
14695 const u64 size_total
14712 + size_pws
// not a bug
14723 // Don't ask me, ask AMD!
14725 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14726 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14730 kernel_accel_max
--;
14739 if (kernel_accel_max == 0)
14741 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14747 device_param
->kernel_accel_min
= kernel_accel_min
;
14748 device_param
->kernel_accel_max
= kernel_accel_max
;
14751 if (kernel_accel_max < kernel_accel)
14753 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14755 device_param->kernel_accel = kernel_accel_max;
14759 device_param
->size_bfs
= size_bfs
;
14760 device_param
->size_combs
= size_combs
;
14761 device_param
->size_rules
= size_rules
;
14762 device_param
->size_rules_c
= size_rules_c
;
14763 device_param
->size_pws
= size_pws
;
14764 device_param
->size_tmps
= size_tmps
;
14765 device_param
->size_hooks
= size_hooks
;
14767 // do not confuse kernel_accel_max with kernel_accel here
14769 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14771 device_param
->kernel_threads
= kernel_threads
;
14772 device_param
->kernel_power_user
= kernel_power
;
14774 kernel_power_all
+= kernel_power
;
14777 * default building options
14780 char build_opts
[1024] = { 0 };
14782 // we don't have sm_* on vendors not NV but it doesn't matter
14785 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
);
14787 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
);
14790 char build_opts_new
[1024] = { 0 };
14792 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
);
14794 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14797 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14799 // we do vectorizing much better than the auto-vectorizer
14801 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14803 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14808 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14817 * kernel source filename
14820 char source_file
[256] = { 0 };
14822 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14826 if (stat (source_file
, &sst
) == -1)
14828 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14834 * kernel cached filename
14837 char cached_file
[256] = { 0 };
14839 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14845 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14851 * kernel compile or load
14854 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14856 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14858 if (force_jit_compilation
== -1)
14862 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14864 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14866 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14868 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14871 size_t build_log_size
= 0;
14873 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14875 if (build_log_size
> 1)
14877 char *build_log
= (char *) malloc (build_log_size
+ 1);
14879 memset (build_log
, 0, build_log_size
+ 1);
14881 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14891 device_param
->skipped
= true;
14893 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14898 size_t binary_size
;
14900 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14902 u8
*binary
= (u8
*) mymalloc (binary_size
);
14904 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14906 writeProgramBin (cached_file
, binary
, binary_size
);
14908 local_free (binary
);
14913 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14916 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14918 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14920 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14926 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14929 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14931 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14933 char build_opts_update
[1024] = { 0 };
14935 if (force_jit_compilation
== 1500)
14937 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14939 else if (force_jit_compilation
== 8900)
14941 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
);
14945 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14948 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14951 size_t build_log_size
= 0;
14953 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14955 if (build_log_size
> 1)
14957 char *build_log
= (char *) malloc (build_log_size
+ 1);
14959 memset (build_log
, 0, build_log_size
+ 1);
14961 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14971 device_param
->skipped
= true;
14973 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14977 local_free (kernel_lengths
);
14978 local_free (kernel_sources
[0]);
14979 local_free (kernel_sources
);
14983 * word generator kernel
14986 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14989 * kernel mp source filename
14992 char source_file
[256] = { 0 };
14994 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14998 if (stat (source_file
, &sst
) == -1)
15000 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15006 * kernel mp cached filename
15009 char cached_file
[256] = { 0 };
15011 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15017 if (stat (cached_file
, &cst
) == -1)
15023 * kernel compile or load
15026 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15028 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15032 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15033 if (quiet
== 0) log_info ("");
15035 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15037 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15039 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15043 device_param
->skipped
= true;
15045 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15050 size_t binary_size
;
15052 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15054 u8
*binary
= (u8
*) mymalloc (binary_size
);
15056 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15058 writeProgramBin (cached_file
, binary
, binary_size
);
15060 local_free (binary
);
15065 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15068 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15070 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15072 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15075 local_free (kernel_lengths
);
15076 local_free (kernel_sources
[0]);
15077 local_free (kernel_sources
);
15084 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15091 * kernel amp source filename
15094 char source_file
[256] = { 0 };
15096 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15100 if (stat (source_file
, &sst
) == -1)
15102 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15108 * kernel amp cached filename
15111 char cached_file
[256] = { 0 };
15113 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15119 if (stat (cached_file
, &cst
) == -1)
15125 * kernel compile or load
15128 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15130 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15134 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15135 if (quiet
== 0) log_info ("");
15137 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15139 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15141 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15145 device_param
->skipped
= true;
15147 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15152 size_t binary_size
;
15154 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15156 u8
*binary
= (u8
*) mymalloc (binary_size
);
15158 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15160 writeProgramBin (cached_file
, binary
, binary_size
);
15162 local_free (binary
);
15167 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15170 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15172 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15174 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15177 local_free (kernel_lengths
);
15178 local_free (kernel_sources
[0]);
15179 local_free (kernel_sources
);
15182 // some algorithm collide too fast, make that impossible
15184 if (benchmark
== 1)
15186 ((uint
*) digests_buf
)[0] = -1;
15187 ((uint
*) digests_buf
)[1] = -1;
15188 ((uint
*) digests_buf
)[2] = -1;
15189 ((uint
*) digests_buf
)[3] = -1;
15196 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15197 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15198 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15199 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15200 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15201 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15202 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15203 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15204 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15205 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15206 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15207 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15208 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15209 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15210 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15211 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15212 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15213 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15215 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
);
15216 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
);
15217 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
);
15218 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
);
15219 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
);
15220 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
);
15221 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
);
15222 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
);
15223 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15224 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15225 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15231 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15233 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15234 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15236 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15238 else if (attack_kern
== ATTACK_KERN_COMBI
)
15240 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15241 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15242 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15243 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15245 else if (attack_kern
== ATTACK_KERN_BF
)
15247 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15248 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15249 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15250 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15251 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15256 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15258 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15265 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15267 device_param
->pws_buf
= pws_buf
;
15269 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15271 device_param
->combs_buf
= combs_buf
;
15273 void *hooks_buf
= mymalloc (size_hooks
);
15275 device_param
->hooks_buf
= hooks_buf
;
15281 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15282 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15283 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15284 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15285 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15286 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15287 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15288 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15289 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15290 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15291 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15293 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15294 ? &device_param
->d_pws_buf
15295 : &device_param
->d_pws_amp_buf
;
15296 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15297 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15298 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15299 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15300 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15301 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15302 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15303 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15304 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15305 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15306 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15307 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15308 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15309 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15310 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15311 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15312 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15313 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15314 device_param
->kernel_params
[19] = &device_param
->d_result
;
15315 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15316 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15317 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15318 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15319 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15320 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15321 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15322 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15323 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15324 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15325 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15326 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15328 device_param
->kernel_params_mp_buf64
[3] = 0;
15329 device_param
->kernel_params_mp_buf32
[4] = 0;
15330 device_param
->kernel_params_mp_buf32
[5] = 0;
15331 device_param
->kernel_params_mp_buf32
[6] = 0;
15332 device_param
->kernel_params_mp_buf32
[7] = 0;
15333 device_param
->kernel_params_mp_buf32
[8] = 0;
15335 device_param
->kernel_params_mp
[0] = NULL
;
15336 device_param
->kernel_params_mp
[1] = NULL
;
15337 device_param
->kernel_params_mp
[2] = NULL
;
15338 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15339 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15340 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15341 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15342 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15343 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15345 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15346 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15347 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15348 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15349 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15350 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15351 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15353 device_param
->kernel_params_mp_l
[0] = NULL
;
15354 device_param
->kernel_params_mp_l
[1] = NULL
;
15355 device_param
->kernel_params_mp_l
[2] = NULL
;
15356 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15357 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15358 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15359 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15360 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15361 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15362 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15364 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15365 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15366 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15367 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15368 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15369 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15371 device_param
->kernel_params_mp_r
[0] = NULL
;
15372 device_param
->kernel_params_mp_r
[1] = NULL
;
15373 device_param
->kernel_params_mp_r
[2] = NULL
;
15374 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15375 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15376 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15377 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15378 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15379 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15381 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15382 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15384 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15385 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15386 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15387 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15388 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15389 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15390 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15392 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15393 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15395 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15396 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15398 device_param
->kernel_params_memset
[0] = NULL
;
15399 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15400 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15406 size_t kernel_wgs_tmp
;
15408 char kernel_name
[64] = { 0 };
15410 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15412 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15414 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15416 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15418 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15420 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15422 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15424 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15428 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15430 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15432 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15434 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15436 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15438 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15441 if (data
.attack_mode
== ATTACK_MODE_BF
)
15443 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15445 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15447 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15449 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
);
15455 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15457 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15459 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15461 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15463 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15465 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15467 if (opts_type
& OPTS_TYPE_HOOK12
)
15469 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15471 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15473 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
);
15476 if (opts_type
& OPTS_TYPE_HOOK23
)
15478 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15480 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15482 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
);
15486 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
);
15487 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
);
15488 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
);
15490 for (uint i
= 0; i
<= 20; i
++)
15492 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15493 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15494 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15496 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15497 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15500 for (uint i
= 21; i
<= 31; i
++)
15502 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15503 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15504 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15506 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15507 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15512 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15514 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
);
15516 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15517 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15518 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15522 if (attack_mode
== ATTACK_MODE_BF
)
15524 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15525 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15527 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
);
15528 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
);
15530 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15532 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15533 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15536 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15538 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15540 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
);
15542 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15544 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15546 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
);
15549 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15555 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15557 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
);
15560 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15566 for (uint i
= 0; i
< 5; i
++)
15568 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15571 for (uint i
= 5; i
< 7; i
++)
15573 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15577 // maybe this has been updated by clGetKernelWorkGroupInfo()
15578 // value can only be decreased, so we don't need to reallocate buffers
15580 device_param
->kernel_threads
= kernel_threads
;
15582 // zero some data buffers
15584 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15585 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15586 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15587 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15588 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15589 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15595 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15597 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15599 else if (attack_kern
== ATTACK_KERN_COMBI
)
15601 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15602 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15603 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15604 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15606 else if (attack_kern
== ATTACK_KERN_BF
)
15608 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15609 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15610 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15611 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15612 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15616 * Store thermal target temperature so we can send a notice to user
15619 #if defined(HAVE_HWMON)
15620 if (gpu_temp_disable
== 0)
15622 const int gpu_temp_threshold_slowdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15624 data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
= (gpu_temp_threshold_slowdown
== -1) ? 100000 : gpu_temp_threshold_slowdown
;
15629 * Store initial fanspeed if gpu_temp_retain is enabled
15632 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15633 int gpu_temp_retain_set
= 0;
15635 if (gpu_temp_disable
== 0)
15637 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15639 hc_thread_mutex_lock (mux_adl
);
15641 if (data
.hm_device
[device_id
].fan_supported
== 1)
15643 if (gpu_temp_retain_chgd
== 0)
15646 uint default_temp
= 0;
15648 int ADL_rc
= hm_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
15650 if (ADL_rc
== ADL_OK
)
15652 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15654 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15656 // special case with multi gpu setups: always use minimum retain
15658 if (gpu_temp_retain_set
== 0)
15660 gpu_temp_retain
= gpu_temp_retain_target
;
15661 gpu_temp_retain_set
= 1;
15665 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15668 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15672 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15674 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15676 if (fan_speed
== -1)
15678 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15680 temp_retain_fanspeed_value
[device_id
] = 0;
15684 hc_thread_mutex_unlock (mux_adl
);
15689 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15692 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15694 hc_thread_mutex_lock (mux_adl
);
15696 if (data
.hm_device
[device_id
].od_version
== 6)
15700 // check powertune capabilities first, if not available then skip device
15702 int powertune_supported
= 0;
15704 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15706 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15711 if (powertune_supported
!= 0)
15713 // powercontrol settings
15715 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15717 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15719 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15722 if (ADL_rc
!= ADL_OK
)
15724 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15729 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15731 log_error ("ERROR: Failed to set new ADL PowerControl values");
15738 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15740 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15742 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15744 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15749 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15751 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15753 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15755 log_error ("ERROR: Failed to get ADL device capabilities");
15760 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15761 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15763 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15764 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15766 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15767 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15769 // warning if profile has too low max values
15771 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15773 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15776 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15778 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15781 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15783 performance_state
->iNumberOfPerformanceLevels
= 2;
15785 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15786 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15787 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15788 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15790 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15792 log_info ("ERROR: Failed to set ADL performance state");
15797 local_free (performance_state
);
15801 hc_thread_mutex_unlock (mux_adl
);
15803 #endif // HAVE_HWMON && HAVE_ADL
15806 data
.kernel_power_all
= kernel_power_all
;
15808 if (data
.quiet
== 0) log_info_nn ("");
15811 * In benchmark-mode, inform user which algorithm is checked
15814 if (benchmark
== 1)
15816 if (machine_readable
== 0)
15820 data
.quiet
= quiet
;
15822 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15824 log_info ("Hashtype: %s", hash_type
);
15830 * keep track of the progress
15833 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15834 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15835 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15842 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15844 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15849 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15851 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15856 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15858 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15868 segment_size
*= (1024 * 1024);
15870 data
.segment_size
= segment_size
;
15872 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15874 wl_data
->buf
= (char *) mymalloc (segment_size
);
15875 wl_data
->avail
= segment_size
;
15876 wl_data
->incr
= segment_size
;
15880 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15882 data
.wordlist_mode
= wordlist_mode
;
15884 cs_t
*css_buf
= NULL
;
15888 char **masks
= NULL
;
15889 char **dictfiles
= NULL
;
15891 uint mask_from_file
= 0;
15893 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15895 if (wordlist_mode
== WL_MODE_FILE
)
15897 int wls_left
= myargc
- (optind
+ 1);
15899 for (int i
= 0; i
< wls_left
; i
++)
15901 char *l0_filename
= myargv
[optind
+ 1 + i
];
15903 struct stat l0_stat
;
15905 if (stat (l0_filename
, &l0_stat
) == -1)
15907 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15912 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15916 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15920 dictfiles
[dictcnt
- 1] = l0_filename
;
15924 // do not allow --keyspace w/ a directory
15928 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15933 char **dictionary_files
= NULL
;
15935 dictionary_files
= scan_directory (l0_filename
);
15937 if (dictionary_files
!= NULL
)
15939 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15941 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15943 char *l1_filename
= dictionary_files
[d
];
15945 struct stat l1_stat
;
15947 if (stat (l1_filename
, &l1_stat
) == -1)
15949 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15954 if (S_ISREG (l1_stat
.st_mode
))
15956 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15960 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15965 local_free (dictionary_files
);
15971 log_error ("ERROR: No usable dictionary file found.");
15976 else if (wordlist_mode
== WL_MODE_STDIN
)
15981 else if (attack_mode
== ATTACK_MODE_COMBI
)
15985 char *dictfile1
= myargv
[optind
+ 1 + 0];
15986 char *dictfile2
= myargv
[optind
+ 1 + 1];
15988 // find the bigger dictionary and use as base
15993 struct stat tmp_stat
;
15995 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15997 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16002 if (stat (dictfile1
, &tmp_stat
) == -1)
16004 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16011 if (S_ISDIR (tmp_stat
.st_mode
))
16013 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16020 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16022 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16029 if (stat (dictfile2
, &tmp_stat
) == -1)
16031 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16039 if (S_ISDIR (tmp_stat
.st_mode
))
16041 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16049 data
.combs_cnt
= 1;
16053 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16055 data
.quiet
= quiet
;
16057 if (words1_cnt
== 0)
16059 log_error ("ERROR: %s: empty file", dictfile1
);
16067 data
.combs_cnt
= 1;
16071 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16073 data
.quiet
= quiet
;
16075 if (words2_cnt
== 0)
16077 log_error ("ERROR: %s: empty file", dictfile2
);
16088 data
.dictfile
= dictfile1
;
16089 data
.dictfile2
= dictfile2
;
16091 if (words1_cnt
>= words2_cnt
)
16093 data
.combs_cnt
= words2_cnt
;
16094 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16096 dictfiles
= &data
.dictfile
;
16102 data
.combs_cnt
= words1_cnt
;
16103 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16105 dictfiles
= &data
.dictfile2
;
16109 // we also have to switch wordlist related rules!
16111 char *tmpc
= data
.rule_buf_l
;
16113 data
.rule_buf_l
= data
.rule_buf_r
;
16114 data
.rule_buf_r
= tmpc
;
16116 int tmpi
= data
.rule_len_l
;
16118 data
.rule_len_l
= data
.rule_len_r
;
16119 data
.rule_len_r
= tmpi
;
16122 else if (attack_mode
== ATTACK_MODE_BF
)
16128 if (benchmark
== 0)
16130 mask
= myargv
[optind
+ 1];
16132 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16134 if ((optind
+ 2) <= myargc
)
16136 struct stat file_stat
;
16138 if (stat (mask
, &file_stat
) == -1)
16142 masks
[maskcnt
- 1] = mystrdup (mask
);
16146 int wls_left
= myargc
- (optind
+ 1);
16148 uint masks_avail
= INCR_MASKS
;
16150 for (int i
= 0; i
< wls_left
; i
++)
16154 mask
= myargv
[optind
+ 1 + i
];
16156 if (stat (mask
, &file_stat
) == -1)
16158 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16164 uint is_file
= S_ISREG (file_stat
.st_mode
);
16170 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16172 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16177 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16179 while (!feof (mask_fp
))
16181 memset (line_buf
, 0, HCBUFSIZ
);
16183 int line_len
= fgetl (mask_fp
, line_buf
);
16185 if (line_len
== 0) continue;
16187 if (line_buf
[0] == '#') continue;
16189 if (masks_avail
== maskcnt
)
16191 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16193 masks_avail
+= INCR_MASKS
;
16196 masks
[maskcnt
] = mystrdup (line_buf
);
16207 log_error ("ERROR: %s: unsupported file-type", mask
);
16213 mask_from_file
= 1;
16218 custom_charset_1
= (char *) "?l?d?u";
16219 custom_charset_2
= (char *) "?l?d";
16220 custom_charset_3
= (char *) "?l?d*!$@_";
16222 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16223 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16224 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16226 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16228 wordlist_mode
= WL_MODE_MASK
;
16230 data
.wordlist_mode
= wordlist_mode
;
16240 * generate full masks and charsets
16243 masks
= (char **) mymalloc (sizeof (char *));
16247 case 1731: pw_min
= 5;
16249 mask
= mystrdup ("?b?b?b?b?b");
16251 case 12500: pw_min
= 5;
16253 mask
= mystrdup ("?b?b?b?b?b");
16255 default: pw_min
= 7;
16257 mask
= mystrdup ("?b?b?b?b?b?b?b");
16263 masks
[maskcnt
- 1] = mystrdup (mask
);
16265 wordlist_mode
= WL_MODE_MASK
;
16267 data
.wordlist_mode
= wordlist_mode
;
16272 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16276 if (increment_min
> pw_min
) pw_min
= increment_min
;
16278 if (increment_max
< pw_max
) pw_max
= increment_max
;
16281 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16283 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16287 char *mask
= myargv
[myargc
- 1];
16291 masks
= (char **) mymalloc (1 * sizeof (char *));
16295 struct stat file_stat
;
16297 if (stat (mask
, &file_stat
) == -1)
16301 masks
[maskcnt
- 1] = mystrdup (mask
);
16305 uint is_file
= S_ISREG (file_stat
.st_mode
);
16311 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16313 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16318 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16320 uint masks_avail
= 1;
16322 while (!feof (mask_fp
))
16324 memset (line_buf
, 0, HCBUFSIZ
);
16326 int line_len
= fgetl (mask_fp
, line_buf
);
16328 if (line_len
== 0) continue;
16330 if (line_buf
[0] == '#') continue;
16332 if (masks_avail
== maskcnt
)
16334 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16336 masks_avail
+= INCR_MASKS
;
16339 masks
[maskcnt
] = mystrdup (line_buf
);
16348 mask_from_file
= 1;
16354 masks
[maskcnt
- 1] = mystrdup (mask
);
16360 int wls_left
= myargc
- (optind
+ 2);
16362 for (int i
= 0; i
< wls_left
; i
++)
16364 char *filename
= myargv
[optind
+ 1 + i
];
16366 struct stat file_stat
;
16368 if (stat (filename
, &file_stat
) == -1)
16370 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16375 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16379 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16383 dictfiles
[dictcnt
- 1] = filename
;
16387 // do not allow --keyspace w/ a directory
16391 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16396 char **dictionary_files
= NULL
;
16398 dictionary_files
= scan_directory (filename
);
16400 if (dictionary_files
!= NULL
)
16402 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16404 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16406 char *l1_filename
= dictionary_files
[d
];
16408 struct stat l1_stat
;
16410 if (stat (l1_filename
, &l1_stat
) == -1)
16412 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16417 if (S_ISREG (l1_stat
.st_mode
))
16419 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16423 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16428 local_free (dictionary_files
);
16434 log_error ("ERROR: No usable dictionary file found.");
16443 uint mask_min
= increment_min
; // we can't reject smaller masks here
16444 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16446 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16448 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16450 if (cur_mask
== NULL
) break;
16452 masks
[maskcnt
] = cur_mask
;
16456 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16460 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16462 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16466 char *mask
= myargv
[optind
+ 1 + 0];
16470 masks
= (char **) mymalloc (1 * sizeof (char *));
16474 struct stat file_stat
;
16476 if (stat (mask
, &file_stat
) == -1)
16480 masks
[maskcnt
- 1] = mystrdup (mask
);
16484 uint is_file
= S_ISREG (file_stat
.st_mode
);
16490 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16492 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16497 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16499 uint masks_avail
= 1;
16501 while (!feof (mask_fp
))
16503 memset (line_buf
, 0, HCBUFSIZ
);
16505 int line_len
= fgetl (mask_fp
, line_buf
);
16507 if (line_len
== 0) continue;
16509 if (line_buf
[0] == '#') continue;
16511 if (masks_avail
== maskcnt
)
16513 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16515 masks_avail
+= INCR_MASKS
;
16518 masks
[maskcnt
] = mystrdup (line_buf
);
16527 mask_from_file
= 1;
16533 masks
[maskcnt
- 1] = mystrdup (mask
);
16539 int wls_left
= myargc
- (optind
+ 2);
16541 for (int i
= 0; i
< wls_left
; i
++)
16543 char *filename
= myargv
[optind
+ 2 + i
];
16545 struct stat file_stat
;
16547 if (stat (filename
, &file_stat
) == -1)
16549 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16554 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16558 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16562 dictfiles
[dictcnt
- 1] = filename
;
16566 // do not allow --keyspace w/ a directory
16570 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16575 char **dictionary_files
= NULL
;
16577 dictionary_files
= scan_directory (filename
);
16579 if (dictionary_files
!= NULL
)
16581 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16583 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16585 char *l1_filename
= dictionary_files
[d
];
16587 struct stat l1_stat
;
16589 if (stat (l1_filename
, &l1_stat
) == -1)
16591 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16596 if (S_ISREG (l1_stat
.st_mode
))
16598 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16602 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16607 local_free (dictionary_files
);
16613 log_error ("ERROR: No usable dictionary file found.");
16622 uint mask_min
= increment_min
; // we can't reject smaller masks here
16623 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16625 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16627 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16629 if (cur_mask
== NULL
) break;
16631 masks
[maskcnt
] = cur_mask
;
16635 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16640 data
.pw_min
= pw_min
;
16641 data
.pw_max
= pw_max
;
16647 if (weak_hash_threshold
>= salts_cnt
)
16649 hc_device_param_t
*device_param
= NULL
;
16651 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16653 device_param
= &data
.devices_param
[device_id
];
16655 if (device_param
->skipped
) continue;
16660 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16662 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16664 weak_hash_check (device_param
, salt_pos
);
16667 // Display hack, guarantee that there is at least one \r before real start
16669 //if (data.quiet == 0) log_info ("");
16673 * status and monitor threads
16676 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16678 hc_thread_t i_thread
= 0;
16680 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16682 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16685 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16687 uint ni_threads_cnt
= 0;
16689 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16691 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16701 if (outfile_check_timer
!= 0)
16703 if (data
.outfile_check_directory
!= NULL
)
16705 if ((hash_mode
!= 5200) &&
16706 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16707 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16708 (hash_mode
!= 9000))
16710 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16716 outfile_check_timer
= 0;
16721 outfile_check_timer
= 0;
16727 * Inform the user if we got some hashes remove because of the pot file remove feature
16730 if (data
.quiet
== 0)
16732 if (potfile_remove_cracks
> 0)
16734 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16735 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16739 data
.outfile_check_timer
= outfile_check_timer
;
16745 char **induction_dictionaries
= NULL
;
16747 int induction_dictionaries_cnt
= 0;
16749 hcstat_table_t
*root_table_buf
= NULL
;
16750 hcstat_table_t
*markov_table_buf
= NULL
;
16752 uint initial_restore_done
= 0;
16754 data
.maskcnt
= maskcnt
;
16756 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16758 if (data
.devices_status
== STATUS_CRACKED
) break;
16760 data
.devices_status
= STATUS_INIT
;
16762 if (maskpos
> rd
->maskpos
)
16767 rd
->maskpos
= maskpos
;
16768 data
.maskpos
= maskpos
;
16770 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16772 char *mask
= masks
[maskpos
];
16774 if (mask_from_file
== 1)
16776 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16781 uint mask_offset
= 0;
16783 uint separator_cnt
;
16785 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16787 str_ptr
= strstr (mask
+ mask_offset
, ",");
16789 if (str_ptr
== NULL
) break;
16791 str_pos
= str_ptr
- mask
;
16793 // escaped separator, i.e. "\,"
16797 if (mask
[str_pos
- 1] == '\\')
16801 mask_offset
= str_pos
+ 1;
16807 // reset the offset
16811 mask
[str_pos
] = '\0';
16813 switch (separator_cnt
)
16816 mp_reset_usr (mp_usr
, 0);
16818 custom_charset_1
= mask
;
16819 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16823 mp_reset_usr (mp_usr
, 1);
16825 custom_charset_2
= mask
;
16826 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16830 mp_reset_usr (mp_usr
, 2);
16832 custom_charset_3
= mask
;
16833 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16837 mp_reset_usr (mp_usr
, 3);
16839 custom_charset_4
= mask
;
16840 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16844 mask
= mask
+ str_pos
+ 1;
16848 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16852 local_free (css_buf
);
16853 local_free (data
.root_css_buf
);
16854 local_free (data
.markov_css_buf
);
16856 local_free (masks
[maskpos
- 1]);
16859 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16862 data
.css_cnt
= css_cnt
;
16863 data
.css_buf
= css_buf
;
16865 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16867 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16869 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16870 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16872 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16874 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16876 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16877 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16879 data
.root_css_buf
= root_css_buf
;
16880 data
.markov_css_buf
= markov_css_buf
;
16882 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16884 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16886 local_free (root_table_buf
);
16887 local_free (markov_table_buf
);
16891 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16893 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16895 if (device_param
->skipped
) continue;
16897 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16898 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16899 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16901 device_param
->kernel_params_mp_buf64
[3] = 0;
16902 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16903 device_param
->kernel_params_mp_buf32
[5] = 0;
16904 device_param
->kernel_params_mp_buf32
[6] = 0;
16905 device_param
->kernel_params_mp_buf32
[7] = 0;
16907 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16909 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16910 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16911 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16912 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16914 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16916 device_param
->kernel_params_mp_buf32
[5] = 0;
16917 device_param
->kernel_params_mp_buf32
[6] = 0;
16918 device_param
->kernel_params_mp_buf32
[7] = 0;
16921 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
]);
16922 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
]);
16923 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
]);
16925 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
);
16926 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
);
16929 else if (attack_mode
== ATTACK_MODE_BF
)
16931 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16935 for (uint i
= 0; i
< dictcnt
; i
++)
16937 local_free (dictfiles
[i
]);
16940 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16942 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16944 if (l1_filename
== NULL
) break;
16948 dictfiles
[dictcnt
- 1] = l1_filename
;
16955 dictfiles
[dictcnt
- 1] = mask
;
16960 log_error ("ERROR: Mask is too small");
16967 free (induction_dictionaries
);
16969 // induction_dictionaries_cnt = 0; // implied
16971 if (attack_mode
!= ATTACK_MODE_BF
)
16975 induction_dictionaries
= scan_directory (induction_directory
);
16977 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16981 if (induction_dictionaries_cnt
)
16983 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16987 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16991 if ((maskcnt
> 1) || (dictcnt
> 1))
16993 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16999 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
17001 char *subid
= logfile_generate_subid ();
17003 data
.subid
= subid
;
17005 logfile_sub_msg ("START");
17007 data
.devices_status
= STATUS_INIT
;
17009 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17010 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17011 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17013 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17017 data
.cpt_start
= time (NULL
);
17019 data
.cpt_total
= 0;
17021 if (data
.restore
== 0)
17023 rd
->words_cur
= skip
;
17030 data
.ms_paused
= 0;
17032 data
.words_cur
= rd
->words_cur
;
17034 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17036 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17038 if (device_param
->skipped
) continue;
17040 device_param
->speed_pos
= 0;
17042 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17043 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17045 device_param
->exec_pos
= 0;
17047 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17049 device_param
->kernel_power
= device_param
->kernel_power_user
;
17051 device_param
->outerloop_pos
= 0;
17052 device_param
->outerloop_left
= 0;
17053 device_param
->innerloop_pos
= 0;
17054 device_param
->innerloop_left
= 0;
17056 // some more resets:
17058 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17060 device_param
->pws_cnt
= 0;
17062 device_param
->words_off
= 0;
17063 device_param
->words_done
= 0;
17066 data
.kernel_power_div
= 0;
17068 // figure out some workload
17070 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17072 if (data
.wordlist_mode
== WL_MODE_FILE
)
17074 char *dictfile
= NULL
;
17076 if (induction_dictionaries_cnt
)
17078 dictfile
= induction_dictionaries
[0];
17082 dictfile
= dictfiles
[dictpos
];
17085 data
.dictfile
= dictfile
;
17087 logfile_sub_string (dictfile
);
17089 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17091 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17094 FILE *fd2
= fopen (dictfile
, "rb");
17098 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17103 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17107 if (data
.words_cnt
== 0)
17109 if (data
.devices_status
== STATUS_CRACKED
) break;
17110 if (data
.devices_status
== STATUS_ABORTED
) break;
17118 else if (attack_mode
== ATTACK_MODE_COMBI
)
17120 char *dictfile
= data
.dictfile
;
17121 char *dictfile2
= data
.dictfile2
;
17123 logfile_sub_string (dictfile
);
17124 logfile_sub_string (dictfile2
);
17126 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17128 FILE *fd2
= fopen (dictfile
, "rb");
17132 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17137 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17141 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17143 FILE *fd2
= fopen (dictfile2
, "rb");
17147 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17152 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17157 if (data
.words_cnt
== 0)
17159 if (data
.devices_status
== STATUS_CRACKED
) break;
17160 if (data
.devices_status
== STATUS_ABORTED
) break;
17167 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17169 char *dictfile
= NULL
;
17171 if (induction_dictionaries_cnt
)
17173 dictfile
= induction_dictionaries
[0];
17177 dictfile
= dictfiles
[dictpos
];
17180 data
.dictfile
= dictfile
;
17182 char *mask
= data
.mask
;
17184 logfile_sub_string (dictfile
);
17185 logfile_sub_string (mask
);
17187 FILE *fd2
= fopen (dictfile
, "rb");
17191 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17196 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17200 if (data
.words_cnt
== 0)
17202 if (data
.devices_status
== STATUS_CRACKED
) break;
17203 if (data
.devices_status
== STATUS_ABORTED
) break;
17210 else if (attack_mode
== ATTACK_MODE_BF
)
17212 local_free (css_buf
);
17213 local_free (data
.root_css_buf
);
17214 local_free (data
.markov_css_buf
);
17216 char *mask
= dictfiles
[dictpos
];
17218 logfile_sub_string (mask
);
17222 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17224 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17226 uint css_cnt_unicode
= css_cnt
* 2;
17228 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17230 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17232 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17234 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17235 css_buf_unicode
[j
+ 1].cs_len
= 1;
17240 css_buf
= css_buf_unicode
;
17241 css_cnt
= css_cnt_unicode
;
17244 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17246 uint mask_min
= pw_min
;
17247 uint mask_max
= pw_max
;
17249 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17255 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17257 if (css_cnt
< mask_min
)
17259 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17262 if (css_cnt
> mask_max
)
17264 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17267 // skip to next mask
17271 rd
->dictpos
= dictpos
;
17273 logfile_sub_msg ("STOP");
17278 uint save_css_cnt
= css_cnt
;
17280 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17282 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17284 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17285 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17287 uint css_cnt_salt
= css_cnt
+ salt_len
;
17289 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17291 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17293 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17295 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17296 css_buf_salt
[j
].cs_len
= 1;
17301 css_buf
= css_buf_salt
;
17302 css_cnt
= css_cnt_salt
;
17307 data
.css_cnt
= css_cnt
;
17308 data
.css_buf
= css_buf
;
17310 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17312 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17314 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17316 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17317 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17319 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17321 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17323 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17324 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17326 data
.root_css_buf
= root_css_buf
;
17327 data
.markov_css_buf
= markov_css_buf
;
17329 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17331 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17333 local_free (root_table_buf
);
17334 local_free (markov_table_buf
);
17338 uint css_cnt_l
= css_cnt
;
17341 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17343 if (save_css_cnt
< 6)
17347 else if (save_css_cnt
== 6)
17353 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17355 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17366 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17381 /* unfinished code?
17382 int sum = css_buf[css_cnt_r - 1].cs_len;
17384 for (uint i = 1; i < 4 && i < css_cnt; i++)
17386 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17390 sum *= css_buf[css_cnt_r - 1].cs_len;
17395 css_cnt_l
-= css_cnt_r
;
17397 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17399 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17401 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17403 if (device_param
->skipped
) continue;
17405 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17406 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17407 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17409 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17410 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17411 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17412 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17413 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17414 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17416 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17417 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17418 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17419 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17421 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17422 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17423 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17425 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17426 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17427 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17428 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17429 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17431 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
]);
17432 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
]);
17433 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
]);
17435 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
]);
17436 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
]);
17437 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
]);
17439 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
);
17440 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
);
17444 u64 words_base
= data
.words_cnt
;
17446 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17448 if (data
.kernel_rules_cnt
)
17450 words_base
/= data
.kernel_rules_cnt
;
17453 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17455 if (data
.combs_cnt
)
17457 words_base
/= data
.combs_cnt
;
17460 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17464 words_base
/= data
.bfs_cnt
;
17468 data
.words_base
= words_base
;
17472 log_info ("%llu", (unsigned long long int) words_base
);
17477 if (data
.words_cur
> data
.words_base
)
17479 log_error ("ERROR: restore value greater keyspace");
17484 if (data
.words_cur
)
17486 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17488 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17490 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17493 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17495 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17497 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17500 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17502 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17504 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17510 * Inform user about possible slow speeds
17513 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17515 if (data
.words_base
< kernel_power_all
)
17519 log_info ("ATTENTION!");
17520 log_info (" The wordlist or mask you are using is too small.");
17521 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17522 log_info (" The cracking speed will drop.");
17523 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17530 * Update loopback file
17539 uint random_num
= get_random_num (0, 9999);
17541 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17543 data
.loopback_file
= loopback_file
;
17547 * Update dictionary statistic
17552 dictstat_fp
= fopen (dictstat
, "wb");
17556 lock_file (dictstat_fp
);
17558 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17560 fclose (dictstat_fp
);
17564 data
.devices_status
= STATUS_RUNNING
;
17566 if (initial_restore_done
== 0)
17568 if (data
.restore_disable
== 0) cycle_restore ();
17570 initial_restore_done
= 1;
17573 hc_timer_set (&data
.timer_running
);
17575 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17577 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17579 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17580 if (quiet
== 0) fflush (stdout
);
17583 else if (wordlist_mode
== WL_MODE_STDIN
)
17585 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17586 if (data
.quiet
== 0) log_info ("");
17589 time_t runtime_start
;
17591 time (&runtime_start
);
17593 data
.runtime_start
= runtime_start
;
17596 * create cracker threads
17599 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17601 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17603 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17605 if (wordlist_mode
== WL_MODE_STDIN
)
17607 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17611 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17615 // wait for crack threads to exit
17617 hc_thread_wait (data
.devices_cnt
, c_threads
);
17619 local_free (c_threads
);
17625 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17627 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17629 if (data
.devices_status
== STATUS_CRACKED
) break;
17630 if (data
.devices_status
== STATUS_ABORTED
) break;
17632 if (data
.devices_status
== STATUS_BYPASS
)
17634 data
.devices_status
= STATUS_RUNNING
;
17637 if (induction_dictionaries_cnt
)
17639 unlink (induction_dictionaries
[0]);
17642 free (induction_dictionaries
);
17644 if (attack_mode
!= ATTACK_MODE_BF
)
17646 induction_dictionaries
= scan_directory (induction_directory
);
17648 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17651 if (benchmark
== 0)
17653 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17655 if (quiet
== 0) clear_prompt ();
17657 if (quiet
== 0) log_info ("");
17665 if (quiet
== 0) status_display ();
17668 if (quiet
== 0) log_info ("");
17672 if (attack_mode
== ATTACK_MODE_BF
)
17676 rd
->dictpos
= dictpos
;
17680 if (induction_dictionaries_cnt
)
17682 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17688 rd
->dictpos
= dictpos
;
17692 time_t runtime_stop
;
17694 time (&runtime_stop
);
17696 data
.runtime_stop
= runtime_stop
;
17698 logfile_sub_uint (runtime_start
);
17699 logfile_sub_uint (runtime_stop
);
17701 logfile_sub_msg ("STOP");
17703 global_free (subid
);
17706 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17708 if (data
.devices_status
== STATUS_CRACKED
) break;
17709 if (data
.devices_status
== STATUS_ABORTED
) break;
17710 if (data
.devices_status
== STATUS_QUIT
) break;
17712 if (data
.devices_status
== STATUS_BYPASS
)
17714 data
.devices_status
= STATUS_RUNNING
;
17718 // 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
17720 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17722 if (data
.wordlist_mode
== WL_MODE_FILE
)
17724 if (data
.dictfile
== NULL
)
17726 if (dictfiles
!= NULL
)
17728 data
.dictfile
= dictfiles
[0];
17730 hc_timer_set (&data
.timer_running
);
17735 // NOTE: combi is okay because it is already set beforehand
17736 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17738 if (data
.dictfile
== NULL
)
17740 if (dictfiles
!= NULL
)
17742 hc_timer_set (&data
.timer_running
);
17744 data
.dictfile
= dictfiles
[0];
17748 else if (attack_mode
== ATTACK_MODE_BF
)
17750 if (data
.mask
== NULL
)
17752 hc_timer_set (&data
.timer_running
);
17754 data
.mask
= masks
[0];
17758 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17760 data
.devices_status
= STATUS_EXHAUSTED
;
17763 // if cracked / aborted remove last induction dictionary
17765 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17767 struct stat induct_stat
;
17769 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17771 unlink (induction_dictionaries
[file_pos
]);
17775 // wait for non-interactive threads
17777 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17779 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17782 local_free (ni_threads
);
17784 // wait for interactive threads
17786 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17788 hc_thread_wait (1, &i_thread
);
17791 // we dont need restore file anymore
17792 if (data
.restore_disable
== 0)
17794 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17796 unlink (eff_restore_file
);
17797 unlink (new_restore_file
);
17805 // finally save left hashes
17807 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17816 if (benchmark
== 1)
17818 status_benchmark ();
17820 if (machine_readable
== 0)
17827 if (quiet
== 0) clear_prompt ();
17829 if (quiet
== 0) log_info ("");
17837 if (quiet
== 0) status_display ();
17840 if (quiet
== 0) log_info ("");
17843 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17845 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17847 if (device_param
->skipped
) continue;
17849 local_free (device_param
->combs_buf
);
17851 local_free (device_param
->hooks_buf
);
17853 local_free (device_param
->device_name
);
17855 local_free (device_param
->device_name_chksum
);
17857 local_free (device_param
->device_version
);
17859 local_free (device_param
->driver_version
);
17861 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17862 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17863 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17864 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17865 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17866 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17867 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17868 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17869 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17870 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17871 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17872 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17873 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17874 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17875 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17876 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17877 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17878 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17879 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17880 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17881 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17882 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17883 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17884 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17885 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17886 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17887 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17888 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17889 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17891 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17892 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17893 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17894 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17895 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17896 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17897 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17898 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17899 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17900 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17901 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17903 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17904 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17905 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17907 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17908 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17911 // reset default fan speed
17914 if (gpu_temp_disable
== 0)
17917 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17919 hc_thread_mutex_lock (mux_adl
);
17921 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17923 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17925 if (device_param
->skipped
) continue;
17927 if (data
.hm_device
[device_id
].fan_supported
== 1)
17929 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17931 if (fanspeed
== -1) continue;
17933 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17935 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17939 hc_thread_mutex_unlock (mux_adl
);
17945 // reset power tuning
17947 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17949 hc_thread_mutex_lock (mux_adl
);
17951 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17953 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17955 if (device_param
->skipped
) continue;
17957 if (data
.hm_device
[device_id
].od_version
== 6)
17959 // check powertune capabilities first, if not available then skip device
17961 int powertune_supported
= 0;
17963 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17965 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17970 if (powertune_supported
!= 0)
17972 // powercontrol settings
17974 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, od_power_control_status
[device_id
])) != ADL_OK
)
17976 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17983 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17985 performance_state
->iNumberOfPerformanceLevels
= 2;
17987 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17988 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17989 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17990 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17992 if ((hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
17994 log_info ("ERROR: Failed to restore ADL performance state");
17999 local_free (performance_state
);
18004 hc_thread_mutex_unlock (mux_adl
);
18008 if (gpu_temp_disable
== 0)
18010 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
18013 #if defined(LINUX) && defined(HAVE_NVML)
18015 hm_NVML_nvmlShutdown (data
.hm_nv
);
18017 nvml_close (data
.hm_nv
);
18019 #elif defined(WIN) && (HAVE_NVAPI)
18021 hm_NvAPI_Unload (data
.hm_nv
);
18023 nvapi_close (data
.hm_nv
);
18034 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
18036 adl_close (data
.hm_amd
);
18037 data
.hm_amd
= NULL
;
18041 #endif // HAVE_HWMON
18045 local_free (masks
);
18047 local_free (dictstat_base
);
18049 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18051 pot_t
*pot_ptr
= &pot
[pot_pos
];
18053 hash_t
*hash
= &pot_ptr
->hash
;
18055 local_free (hash
->digest
);
18059 local_free (hash
->salt
);
18065 local_free (all_kernel_rules_cnt
);
18066 local_free (all_kernel_rules_buf
);
18068 local_free (wl_data
->buf
);
18069 local_free (wl_data
);
18071 local_free (bitmap_s1_a
);
18072 local_free (bitmap_s1_b
);
18073 local_free (bitmap_s1_c
);
18074 local_free (bitmap_s1_d
);
18075 local_free (bitmap_s2_a
);
18076 local_free (bitmap_s2_b
);
18077 local_free (bitmap_s2_c
);
18078 local_free (bitmap_s2_d
);
18081 local_free (temp_retain_fanspeed_value
);
18083 local_free (od_clock_mem_status
);
18084 local_free (od_power_control_status
);
18088 global_free (devices_param
);
18090 global_free (kernel_rules_buf
);
18092 global_free (root_css_buf
);
18093 global_free (markov_css_buf
);
18095 global_free (digests_buf
);
18096 global_free (digests_shown
);
18097 global_free (digests_shown_tmp
);
18099 global_free (salts_buf
);
18100 global_free (salts_shown
);
18102 global_free (esalts_buf
);
18104 global_free (words_progress_done
);
18105 global_free (words_progress_rejected
);
18106 global_free (words_progress_restored
);
18108 if (pot_fp
) fclose (pot_fp
);
18110 if (data
.devices_status
== STATUS_QUIT
) break;
18113 // destroy others mutex
18115 hc_thread_mutex_delete (mux_dispatcher
);
18116 hc_thread_mutex_delete (mux_counter
);
18117 hc_thread_mutex_delete (mux_display
);
18118 hc_thread_mutex_delete (mux_adl
);
18122 local_free (eff_restore_file
);
18123 local_free (new_restore_file
);
18129 tuning_db_destroy (tuning_db
);
18133 local_free (loopback_file
);
18135 if (loopback
== 1) unlink (loopback_file
);
18137 // induction directory
18139 if (induction_dir
== NULL
)
18141 if (attack_mode
!= ATTACK_MODE_BF
)
18143 if (rmdir (induction_directory
) == -1)
18145 if (errno
== ENOENT
)
18147 // good, we can ignore
18149 else if (errno
== ENOTEMPTY
)
18151 // good, we can ignore
18155 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18161 local_free (induction_directory
);
18165 // outfile-check directory
18167 if (outfile_check_dir
== NULL
)
18169 if (rmdir (outfile_check_directory
) == -1)
18171 if (errno
== ENOENT
)
18173 // good, we can ignore
18175 else if (errno
== ENOTEMPTY
)
18177 // good, we can ignore
18181 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18187 local_free (outfile_check_directory
);
18194 logfile_top_uint (proc_start
);
18195 logfile_top_uint (proc_stop
);
18197 logfile_top_msg ("STOP");
18199 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18200 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18202 if (data
.ocl
) ocl_close (data
.ocl
);
18204 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18205 if (data
.devices_status
== STATUS_QUIT
) return 2;
18206 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18207 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18208 if (data
.devices_status
== STATUS_CRACKED
) return 0;