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
38 #define RESTORE_TIMER 60
39 #define RESTORE_DISABLE 0
41 #define STATUS_TIMER 10
42 #define MACHINE_READABLE 0
44 #define WEAK_HASH_THRESHOLD 100
49 #define REMOVE_TIMER 60
53 #define POTFILE_DISABLE 0
56 #define RP_GEN_FUNC_MIN 1
57 #define RP_GEN_FUNC_MAX 4
59 #define RULE_BUF_L ":"
60 #define RULE_BUF_R ":"
65 #define HEX_WORDLIST 0
66 #define OUTFILE_FORMAT 3
67 #define OUTFILE_AUTOHEX 1
68 #define OUTFILE_CHECK_TIMER 5
71 #define SEGMENT_SIZE 32
73 #define INCREMENT_MIN 1
74 #define INCREMENT_MAX PW_MAX
78 #define NVIDIA_SPIN_DAMP 100
79 #define GPU_TEMP_DISABLE 0
80 #define GPU_TEMP_ABORT 90
81 #define GPU_TEMP_RETAIN 75
82 #define WORKLOAD_PROFILE 2
83 #define KERNEL_ACCEL 0
84 #define KERNEL_LOOPS 0
85 #define KERNEL_RULES 1024
86 #define KERNEL_COMBS 1024
87 #define KERNEL_BFS 1024
88 #define KERNEL_THREADS_MAX 256
89 #define KERNEL_THREADS_MAX_CPU 16
90 #define POWERTUNE_ENABLE 0
91 #define LOGFILE_DISABLE 0
93 #define OPENCL_VECTOR_WIDTH 0
95 #define WL_MODE_STDIN 1
96 #define WL_MODE_FILE 2
97 #define WL_MODE_MASK 3
99 #define HL_MODE_FILE 4
100 #define HL_MODE_ARG 5
102 #define HLFMTS_CNT 11
103 #define HLFMT_HASHCAT 0
104 #define HLFMT_PWDUMP 1
105 #define HLFMT_PASSWD 2
106 #define HLFMT_SHADOW 3
109 #define HLFMT_NETNTLM1 7
110 #define HLFMT_NETNTLM2 8
111 #define HLFMT_NSLDAP 9
112 #define HLFMT_NSLDAPS 10
114 #define HLFMT_TEXT_HASHCAT "native hashcat"
115 #define HLFMT_TEXT_PWDUMP "pwdump"
116 #define HLFMT_TEXT_PASSWD "passwd"
117 #define HLFMT_TEXT_SHADOW "shadow"
118 #define HLFMT_TEXT_DCC "DCC"
119 #define HLFMT_TEXT_DCC2 "DCC 2"
120 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
121 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
122 #define HLFMT_TEXT_NSLDAP "nsldap"
123 #define HLFMT_TEXT_NSLDAPS "nsldaps"
125 #define ATTACK_MODE_STRAIGHT 0
126 #define ATTACK_MODE_COMBI 1
127 #define ATTACK_MODE_TOGGLE 2
128 #define ATTACK_MODE_BF 3
129 #define ATTACK_MODE_PERM 4
130 #define ATTACK_MODE_TABLE 5
131 #define ATTACK_MODE_HYBRID1 6
132 #define ATTACK_MODE_HYBRID2 7
133 #define ATTACK_MODE_NONE 100
135 #define ATTACK_KERN_STRAIGHT 0
136 #define ATTACK_KERN_COMBI 1
137 #define ATTACK_KERN_BF 3
138 #define ATTACK_KERN_NONE 100
140 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
141 #define ATTACK_EXEC_INSIDE_KERNEL 11
143 #define COMBINATOR_MODE_BASE_LEFT 10001
144 #define COMBINATOR_MODE_BASE_RIGHT 10002
146 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
147 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
149 #define MAX_CUT_TRIES 4
151 #define MAX_DICTSTAT 10000
153 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
155 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
157 #define global_free(attr) \
159 myfree ((void *) data.attr); \
164 #define local_free(attr) \
166 myfree ((void *) attr); \
171 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
172 #define HC_API_CALL __stdcall
177 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
328 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
334 static unsigned int full01
= 0x01010101;
335 static unsigned int full80
= 0x80808080;
337 int SUPPRESS_OUTPUT
= 0;
339 hc_thread_mutex_t mux_adl
;
340 hc_thread_mutex_t mux_counter
;
341 hc_thread_mutex_t mux_dispatcher
;
342 hc_thread_mutex_t mux_display
;
344 hc_global_data_t data
;
346 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
348 const char *USAGE_MINI
[] =
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
352 "Try --help for more help.",
356 const char *USAGE_BIG
[] =
358 "%s, advanced password recovery",
360 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
364 " Options Short / Long | Type | Description | Example",
365 "===============================+======+======================================================+=======================",
366 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
367 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
368 " -V, --version | | Print version |",
369 " -h, --help | | Print help |",
370 " --quiet | | Suppress output |",
371 " --hex-charset | | Assume charset is given in hex |",
372 " --hex-salt | | Assume salt is given in hex |",
373 " --hex-wordlist | | Assume words in wordlist is given in hex |",
374 " --force | | Ignore warnings |",
375 " --status | | Enable automatic update of the status-screen |",
376 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
377 " --machine-readable | | Display the status view in a machine readable format |",
378 " --loopback | | Add new plains to induct directory |",
379 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
380 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
381 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
382 " --markov-classic | | Enables classic markov-chains, no per-position |",
383 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
384 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
385 " --session | Str | Define specific session name | --session=mysession",
386 " --restore | | Restore session from --session |",
387 " --restore-disable | | Do not write restore file |",
388 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
389 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
390 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
391 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
392 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
393 " --stdout | | Do not crack a hash, instead print candidates only |",
394 " --show | | Compare hashlist with potfile; Show cracked hashes |",
395 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
396 " --username | | Enable ignoring of usernames in hashfile |",
397 " --remove | | Enable remove of hash once it is cracked |",
398 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
399 " --potfile-disable | | Do not write potfile |",
400 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
401 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
402 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
403 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
404 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
405 " --logfile-disable | | Disable the logfile |",
406 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
407 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
408 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
409 " -b, --benchmark | | Run benchmark |",
410 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
411 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
412 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
413 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
414 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
415 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
416 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
417 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
418 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
419 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
420 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
421 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
422 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
424 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
425 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
426 " --powertune-enable | | Enable power tuning, restores settings when finished |",
428 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
429 " -s, --skip | Num | Skip X words from the start | -s 1000000",
430 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
431 " --keyspace | | Show keyspace base:mod values and quit |",
432 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
433 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
434 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
435 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
436 " --generate-rules-func-min | Num | Force min X funcs per rule |",
437 " --generate-rules-func-max | Num | Force max X funcs per rule |",
438 " --generate-rules-seed | Num | Force RNG seed set to X |",
439 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
440 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
441 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
442 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
443 " -i, --increment | | Enable mask increment mode |",
444 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
445 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
447 "- [ Hash modes ] -",
449 " # | Name | Category",
450 " ======+==================================================+======================================",
451 " 900 | MD4 | Raw Hash",
452 " 0 | MD5 | Raw Hash",
453 " 5100 | Half MD5 | Raw Hash",
454 " 100 | SHA1 | Raw Hash",
455 " 10800 | SHA-384 | Raw Hash",
456 " 1400 | SHA-256 | Raw Hash",
457 " 1700 | SHA-512 | Raw Hash",
458 " 5000 | SHA-3(Keccak) | Raw Hash",
459 " 10100 | SipHash | Raw Hash",
460 " 6000 | RipeMD160 | Raw Hash",
461 " 6100 | Whirlpool | Raw Hash",
462 " 6900 | GOST R 34.11-94 | Raw Hash",
463 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
464 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
465 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
466 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
467 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
468 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
469 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
471 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
472 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
473 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
474 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
475 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
476 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
477 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
478 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
479 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
480 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
481 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
482 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
483 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
484 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
485 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
486 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
487 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
488 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
489 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
490 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
491 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
492 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
493 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
494 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
495 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
496 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
497 " 400 | phpass | Generic KDF",
498 " 8900 | scrypt | Generic KDF",
499 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
500 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
501 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
502 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
503 " 23 | Skype | Network protocols",
504 " 2500 | WPA/WPA2 | Network protocols",
505 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
506 " 5300 | IKE-PSK MD5 | Network protocols",
507 " 5400 | IKE-PSK SHA1 | Network protocols",
508 " 5500 | NetNTLMv1 | Network protocols",
509 " 5500 | NetNTLMv1 + ESS | Network protocols",
510 " 5600 | NetNTLMv2 | Network protocols",
511 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
512 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
513 " 8300 | DNSSEC (NSEC3) | Network protocols",
514 " 10200 | Cram MD5 | Network protocols",
515 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
516 " 11200 | MySQL CRAM (SHA1) | Network protocols",
517 " 11400 | SIP digest authentication (MD5) | Network protocols",
518 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
519 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
520 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
521 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
522 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
523 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
524 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
525 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
526 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
527 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
528 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
529 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
530 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
531 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
532 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
533 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
534 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
535 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
536 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
537 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
538 " 12 | PostgreSQL | Database Server",
539 " 131 | MSSQL(2000) | Database Server",
540 " 132 | MSSQL(2005) | Database Server",
541 " 1731 | MSSQL(2012) | Database Server",
542 " 1731 | MSSQL(2014) | Database Server",
543 " 200 | MySQL323 | Database Server",
544 " 300 | MySQL4.1/MySQL5 | Database Server",
545 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
546 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
547 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
548 " 8000 | Sybase ASE | Database Server",
549 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
550 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
551 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
552 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
553 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
554 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
555 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
556 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
557 " 11500 | CRC32 | Checksums",
558 " 3000 | LM | Operating-Systems",
559 " 1000 | NTLM | Operating-Systems",
560 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
561 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
562 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
563 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
564 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
565 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
566 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
567 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
568 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
569 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
570 " 1722 | OSX v10.7 | Operating-Systems",
571 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
572 " 6300 | AIX {smd5} | Operating-Systems",
573 " 6700 | AIX {ssha1} | Operating-Systems",
574 " 6400 | AIX {ssha256} | Operating-Systems",
575 " 6500 | AIX {ssha512} | Operating-Systems",
576 " 2400 | Cisco-PIX | Operating-Systems",
577 " 2410 | Cisco-ASA | Operating-Systems",
578 " 500 | Cisco-IOS $1$ | Operating-Systems",
579 " 5700 | Cisco-IOS $4$ | Operating-Systems",
580 " 9200 | Cisco-IOS $8$ | Operating-Systems",
581 " 9300 | Cisco-IOS $9$ | Operating-Systems",
582 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
583 " 501 | Juniper IVE | Operating-Systems",
584 " 5800 | Android PIN | Operating-Systems",
585 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
586 " 8100 | Citrix Netscaler | Operating-Systems",
587 " 8500 | RACF | Operating-Systems",
588 " 7200 | GRUB 2 | Operating-Systems",
589 " 9900 | Radmin2 | Operating-Systems",
590 " 125 | ArubaOS | Operating-Systems",
591 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
592 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
593 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
594 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
595 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
596 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
597 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
598 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
599 " 11600 | 7-Zip | Archives",
600 " 12500 | RAR3-hp | Archives",
601 " 13000 | RAR5 | Archives",
602 " 13200 | AxCrypt | Archives",
603 " 13300 | AxCrypt in memory SHA1 | Archives",
604 " 13600 | WinZip | Archives",
605 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
606 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
607 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
608 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
609 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
610 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
611 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
612 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
613 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
614 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
615 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
616 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
617 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
618 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
619 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
620 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
621 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
622 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
623 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
624 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
625 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
626 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
627 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
628 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
629 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
630 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
631 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
632 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
633 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
634 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
635 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
636 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
637 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
638 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
639 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
640 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
641 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
642 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
643 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
644 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
645 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
646 " 9400 | MS Office 2007 | Documents",
647 " 9500 | MS Office 2010 | Documents",
648 " 9600 | MS Office 2013 | Documents",
649 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
650 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
651 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
652 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
653 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
654 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
655 " 9000 | Password Safe v2 | Password Managers",
656 " 5200 | Password Safe v3 | Password Managers",
657 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
658 " 6600 | 1Password, agilekeychain | Password Managers",
659 " 8200 | 1Password, cloudkeychain | Password Managers",
660 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
661 " 12700 | Blockchain, My Wallet | Password Managers",
662 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
664 "- [ Outfile Formats ] -",
670 " 3 | hash[:salt]:plain",
672 " 5 | hash[:salt]:hex_plain",
673 " 6 | plain:hex_plain",
674 " 7 | hash[:salt]:plain:hex_plain",
676 " 9 | hash[:salt]:crack_pos",
677 " 10 | plain:crack_pos",
678 " 11 | hash[:salt]:plain:crack_pos",
679 " 12 | hex_plain:crack_pos",
680 " 13 | hash[:salt]:hex_plain:crack_pos",
681 " 14 | plain:hex_plain:crack_pos",
682 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
684 "- [ Rule Debugging Modes ] -",
689 " 2 | Original-Word",
690 " 3 | Original-Word:Finding-Rule",
691 " 4 | Original-Word:Finding-Rule:Processed-Word",
693 "- [ Attack Modes ] -",
700 " 6 | Hybrid Wordlist + Mask",
701 " 7 | Hybrid Mask + Wordlist",
703 "- [ Built-in Charsets ] -",
707 " l | abcdefghijklmnopqrstuvwxyz",
708 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
710 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
714 "- [ OpenCL Device Types ] -",
717 " ===+=============",
720 " 3 | FPGA, DSP, Co-Processor",
722 "- [ Workload Profiles ] -",
724 " # | Performance | Runtime | Power Consumption | Desktop Impact",
725 " ===+=============+=========+===================+=================",
726 " 1 | Low | 2 ms | Low | Minimal",
727 " 2 | Default | 12 ms | Economic | Noticeable",
728 " 3 | High | 96 ms | High | Unresponsive",
729 " 4 | Nightmare | 480 ms | Insane | Headless",
731 "- [ Basic Examples ] -",
733 " Attack- | Hash- |",
734 " Mode | Type | Example command",
735 " ==================+=======+==================================================================",
736 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
737 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
738 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
739 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
741 "If you still have no idea what just happened try following pages:",
743 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
744 "* https://hashcat.net/wiki/#frequently_asked_questions",
749 * hashcat specific functions
752 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
754 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
756 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
758 double exec_ms_sum
= 0;
762 for (int i
= 0; i
< last_num_entries
; i
++)
764 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
768 exec_ms_sum
+= exec_ms
;
774 if (exec_ms_cnt
== 0) return 0;
776 return exec_ms_sum
/ exec_ms_cnt
;
779 void status_display_machine_readable ()
783 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
789 fprintf (out
, "SPEED\t");
791 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
793 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
795 if (device_param
->skipped
) continue;
800 for (int i
= 0; i
< SPEED_CACHE
; i
++)
802 speed_cnt
+= device_param
->speed_cnt
[i
];
803 speed_ms
+= device_param
->speed_ms
[i
];
806 speed_cnt
/= SPEED_CACHE
;
807 speed_ms
/= SPEED_CACHE
;
809 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
816 fprintf (out
, "EXEC_RUNTIME\t");
818 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
820 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
822 if (device_param
->skipped
) continue;
824 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
826 fprintf (out
, "%f\t", exec_ms_avg
);
833 u64 words_cur
= get_lowest_words_done ();
835 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
841 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
844 u64 all_rejected
= 0;
845 u64 all_restored
= 0;
847 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
849 all_done
+= data
.words_progress_done
[salt_pos
];
850 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
851 all_restored
+= data
.words_progress_restored
[salt_pos
];
854 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
855 u64 progress_end
= progress_total
;
857 u64 progress_skip
= 0;
861 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
863 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
864 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
865 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
870 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
872 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
873 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
874 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
877 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
878 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
880 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
886 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
887 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
894 if (data
.gpu_temp_disable
== 0)
896 fprintf (out
, "TEMP\t");
898 hc_thread_mutex_lock (mux_adl
);
900 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
902 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
904 if (device_param
->skipped
) continue;
906 int temp
= hm_get_temperature_with_device_id (device_id
);
908 fprintf (out
, "%d\t", temp
);
911 hc_thread_mutex_unlock (mux_adl
);
923 void status_display ()
925 if (data
.devices_status
== STATUS_INIT
) return;
926 if (data
.devices_status
== STATUS_STARTING
) return;
928 if (data
.machine_readable
== 1)
930 status_display_machine_readable ();
935 char tmp_buf
[1000] = { 0 };
939 log_info ("Session.Name...: %s", data
.session
);
941 char *status_type
= strstatus (data
.devices_status
);
943 uint hash_mode
= data
.hash_mode
;
945 char *hash_type
= strhashtype (hash_mode
); // not a bug
947 log_info ("Status.........: %s", status_type
);
953 if (data
.rp_files_cnt
)
957 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
959 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
962 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
964 log_info ("Rules.Type.....: %s", tmp_buf
);
971 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
973 if (data
.rp_gen_seed
)
975 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
983 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
985 if (data
.wordlist_mode
== WL_MODE_FILE
)
987 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
989 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
991 log_info ("Input.Mode.....: Pipe");
994 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
996 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
997 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
999 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1001 char *mask
= data
.mask
;
1005 uint mask_len
= data
.css_cnt
;
1007 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1011 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1013 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1015 mask_len
-= data
.salts_buf
[0].salt_len
;
1019 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1021 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1024 if (data
.maskcnt
> 1)
1026 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1028 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1031 log_info ("Input.Mode.....: %s", tmp_buf
);
1036 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1038 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1039 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1041 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1043 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1044 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1047 if (data
.digests_cnt
== 1)
1049 if (data
.hash_mode
== 2500)
1051 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1053 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1054 (char *) data
.salts_buf
[0].salt_buf
,
1068 else if (data
.hash_mode
== 5200)
1070 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1072 else if (data
.hash_mode
== 9000)
1074 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1076 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1078 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1080 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1082 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1086 char out_buf
[HCBUFSIZ
] = { 0 };
1088 ascii_digest (out_buf
, 0, 0);
1091 if (strlen (out_buf
) > 40)
1099 log_info ("Hash.Target....: %s", out_buf
);
1104 if (data
.hash_mode
== 3000)
1106 char out_buf1
[32] = { 0 };
1107 char out_buf2
[32] = { 0 };
1109 ascii_digest (out_buf1
, 0, 0);
1110 ascii_digest (out_buf2
, 0, 1);
1112 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1116 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1120 log_info ("Hash.Type......: %s", hash_type
);
1126 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1127 double speed_ms
[DEVICES_MAX
] = { 0 };
1129 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1131 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1133 if (device_param
->skipped
) continue;
1135 speed_cnt
[device_id
] = 0;
1136 speed_ms
[device_id
] = 0;
1138 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1140 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1141 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1144 speed_cnt
[device_id
] /= SPEED_CACHE
;
1145 speed_ms
[device_id
] /= SPEED_CACHE
;
1148 double hashes_all_ms
= 0;
1150 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1152 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1154 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1156 if (device_param
->skipped
) continue;
1158 hashes_dev_ms
[device_id
] = 0;
1160 if (speed_ms
[device_id
])
1162 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1164 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1172 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1174 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1176 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1178 if (device_param
->skipped
) continue;
1180 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1182 exec_all_ms
[device_id
] = exec_ms_avg
;
1189 double ms_running
= 0;
1191 hc_timer_get (data
.timer_running
, ms_running
);
1193 double ms_paused
= data
.ms_paused
;
1195 if (data
.devices_status
== STATUS_PAUSED
)
1197 double ms_paused_tmp
= 0;
1199 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1201 ms_paused
+= ms_paused_tmp
;
1206 __time64_t sec_run
= ms_running
/ 1000;
1210 time_t sec_run
= ms_running
/ 1000;
1216 char display_run
[32] = { 0 };
1220 struct tm
*tmp
= NULL
;
1224 tmp
= _gmtime64 (&sec_run
);
1228 tmp
= gmtime (&sec_run
);
1234 memset (&tm_run
, 0, sizeof (tm_run
));
1236 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1238 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1240 char *start
= ctime (&data
.proc_start
);
1242 size_t start_len
= strlen (start
);
1244 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1245 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1247 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1252 log_info ("Time.Started...: 0 secs");
1259 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1262 u64 all_rejected
= 0;
1263 u64 all_restored
= 0;
1265 u64 progress_noneed
= 0;
1267 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1269 all_done
+= data
.words_progress_done
[salt_pos
];
1270 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1271 all_restored
+= data
.words_progress_restored
[salt_pos
];
1273 // Important for ETA only
1275 if (data
.salts_shown
[salt_pos
] == 1)
1277 const u64 all
= data
.words_progress_done
[salt_pos
]
1278 + data
.words_progress_rejected
[salt_pos
]
1279 + data
.words_progress_restored
[salt_pos
];
1281 const u64 left
= data
.words_cnt
- all
;
1283 progress_noneed
+= left
;
1287 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1288 u64 progress_end
= progress_total
;
1290 u64 progress_skip
= 0;
1294 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1296 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1297 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1298 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1303 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1305 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1306 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1307 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1310 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1311 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1313 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1315 if (data
.devices_status
!= STATUS_CRACKED
)
1318 __time64_t sec_etc
= 0;
1325 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1327 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1329 sec_etc
= ms_left
/ 1000;
1334 //log_info ("Time.Estimated.: 0 secs");
1336 else if ((u64
) sec_etc
> ETC_MAX
)
1338 log_info ("Time.Estimated.: > 10 Years");
1342 char display_etc
[32] = { 0 };
1346 struct tm
*tmp
= NULL
;
1350 tmp
= _gmtime64 (&sec_etc
);
1354 tmp
= gmtime (&sec_etc
);
1360 memset (&tm_etc
, 0, sizeof (tm_etc
));
1362 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1364 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1372 char *etc
= ctime (&now
);
1374 size_t etc_len
= strlen (etc
);
1376 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1377 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1379 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1385 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1387 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1389 if (device_param
->skipped
) continue;
1391 char display_dev_cur
[16] = { 0 };
1393 strncpy (display_dev_cur
, "0.00", 4);
1395 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1397 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1400 char display_all_cur
[16] = { 0 };
1402 strncpy (display_all_cur
, "0.00", 4);
1404 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1406 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1408 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1409 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1411 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);
1415 if (data
.digests_cnt
> 100)
1417 time_t now
= time (NULL
);
1419 int cpt_cur_min
= 0;
1420 int cpt_cur_hour
= 0;
1421 int cpt_cur_day
= 0;
1423 for (int i
= 0; i
< CPT_BUF
; i
++)
1425 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1426 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1428 if ((timestamp
+ 60) > now
)
1430 cpt_cur_min
+= cracked
;
1433 if ((timestamp
+ 3600) > now
)
1435 cpt_cur_hour
+= cracked
;
1438 if ((timestamp
+ 86400) > now
)
1440 cpt_cur_day
+= cracked
;
1444 double ms_real
= ms_running
- ms_paused
;
1446 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1447 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1448 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1450 if ((data
.cpt_start
+ 86400) < now
)
1452 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1460 else if ((data
.cpt_start
+ 3600) < now
)
1462 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1469 else if ((data
.cpt_start
+ 60) < now
)
1471 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1479 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1488 u64 restore_point
= get_lowest_words_done ();
1490 u64 restore_total
= data
.words_base
;
1492 float percent_restore
= 0;
1494 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1496 if (progress_end_relative_skip
)
1498 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1500 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1501 float percent_rejected
= 0.0;
1505 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1508 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);
1509 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1511 if (data
.restore_disable
== 0)
1513 if (percent_finished
!= 1)
1515 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1522 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1524 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1525 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1527 if (data
.restore_disable
== 0)
1529 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1534 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1535 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1537 // --restore not allowed if stdin is used -- really? why?
1539 //if (data.restore_disable == 0)
1541 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1548 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1549 if (data
.devices_status
== STATUS_CRACKED
) return;
1550 if (data
.devices_status
== STATUS_ABORTED
) return;
1551 if (data
.devices_status
== STATUS_QUIT
) return;
1553 if (data
.gpu_temp_disable
== 0)
1555 hc_thread_mutex_lock (mux_adl
);
1557 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1559 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1561 if (device_param
->skipped
) continue;
1563 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1564 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1565 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1566 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1567 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1568 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1569 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1571 char output_buf
[256] = { 0 };
1575 if (num_temperature
>= 0)
1577 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1579 output_len
= strlen (output_buf
);
1582 if (num_fanspeed
>= 0)
1584 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1586 output_len
= strlen (output_buf
);
1589 if (num_utilization
>= 0)
1591 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1593 output_len
= strlen (output_buf
);
1596 if (num_corespeed
>= 0)
1598 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1600 output_len
= strlen (output_buf
);
1603 if (num_memoryspeed
>= 0)
1605 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1607 output_len
= strlen (output_buf
);
1610 if (num_buslanes
>= 0)
1612 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1614 output_len
= strlen (output_buf
);
1617 if (num_throttle
== 1)
1619 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1621 output_len
= strlen (output_buf
);
1624 if (output_len
== 0)
1626 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1628 output_len
= strlen (output_buf
);
1631 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1634 hc_thread_mutex_unlock (mux_adl
);
1637 #endif // HAVE_HWMON
1640 static void status_benchmark_automate ()
1642 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1643 double speed_ms
[DEVICES_MAX
] = { 0 };
1645 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1647 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1649 if (device_param
->skipped
) continue;
1651 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1652 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1655 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1657 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1659 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1661 if (device_param
->skipped
) continue;
1663 hashes_dev_ms
[device_id
] = 0;
1665 if (speed_ms
[device_id
])
1667 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1671 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1673 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1675 if (device_param
->skipped
) continue;
1677 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1681 static void status_benchmark ()
1683 if (data
.devices_status
== STATUS_INIT
) return;
1684 if (data
.devices_status
== STATUS_STARTING
) return;
1686 if (data
.machine_readable
== 1)
1688 status_benchmark_automate ();
1693 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1694 double speed_ms
[DEVICES_MAX
] = { 0 };
1696 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1698 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1700 if (device_param
->skipped
) continue;
1702 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1703 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1706 double hashes_all_ms
= 0;
1708 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1710 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1712 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1714 if (device_param
->skipped
) continue;
1716 hashes_dev_ms
[device_id
] = 0;
1718 if (speed_ms
[device_id
])
1720 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1722 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1730 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1732 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1734 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1736 if (device_param
->skipped
) continue;
1738 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1740 exec_all_ms
[device_id
] = exec_ms_avg
;
1743 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1745 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1747 if (device_param
->skipped
) continue;
1749 char display_dev_cur
[16] = { 0 };
1751 strncpy (display_dev_cur
, "0.00", 4);
1753 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1755 if (data
.devices_active
>= 10)
1757 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1761 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1765 char display_all_cur
[16] = { 0 };
1767 strncpy (display_all_cur
, "0.00", 4);
1769 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1771 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1775 * hashcat -only- functions
1778 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1780 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1782 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1783 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1784 else if (attack_kern
== ATTACK_KERN_COMBI
)
1785 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1786 else if (attack_kern
== ATTACK_KERN_BF
)
1787 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1790 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1793 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
)
1795 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1797 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1798 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1799 else if (attack_kern
== ATTACK_KERN_COMBI
)
1800 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1801 else if (attack_kern
== ATTACK_KERN_BF
)
1802 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1806 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1810 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1812 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1814 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1818 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1822 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
)
1824 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1826 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1830 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1834 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1836 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1839 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1841 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1844 static char *filename_from_filepath (char *filepath
)
1848 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1852 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1864 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1866 if (line_len
& 1) return (line_len
); // not in hex
1868 if (data
.hex_wordlist
== 1)
1873 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1875 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1878 memset (line_buf
+ i
, 0, line_len
- i
);
1882 else if (line_len
>= 6) // $HEX[] = 6
1884 if (line_buf
[0] != '$') return (line_len
);
1885 if (line_buf
[1] != 'H') return (line_len
);
1886 if (line_buf
[2] != 'E') return (line_len
);
1887 if (line_buf
[3] != 'X') return (line_len
);
1888 if (line_buf
[4] != '[') return (line_len
);
1889 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1894 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1896 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1899 memset (line_buf
+ i
, 0, line_len
- i
);
1907 static void clear_prompt ()
1909 fputc ('\r', stdout
);
1911 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1913 fputc (' ', stdout
);
1916 fputc ('\r', stdout
);
1921 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1923 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
);
1926 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1928 char *outfile
= data
.outfile
;
1929 uint quiet
= data
.quiet
;
1930 FILE *pot_fp
= data
.pot_fp
;
1931 uint loopback
= data
.loopback
;
1932 uint debug_mode
= data
.debug_mode
;
1933 char *debug_file
= data
.debug_file
;
1935 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1936 int debug_rule_len
= 0; // -1 error
1937 uint debug_plain_len
= 0;
1939 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1943 char out_buf
[HCBUFSIZ
] = { 0 };
1945 const u32 salt_pos
= plain
->salt_pos
;
1946 const u32 digest_pos
= plain
->digest_pos
; // relative
1947 const u32 gidvid
= plain
->gidvid
;
1948 const u32 il_pos
= plain
->il_pos
;
1950 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1954 u64 crackpos
= device_param
->words_off
;
1956 uint plain_buf
[16] = { 0 };
1958 u8
*plain_ptr
= (u8
*) plain_buf
;
1960 unsigned int plain_len
= 0;
1962 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1966 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1968 for (int i
= 0; i
< 16; i
++)
1970 plain_buf
[i
] = pw
.i
[i
];
1973 plain_len
= pw
.pw_len
;
1975 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1982 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1984 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1986 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1990 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1992 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1994 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1996 debug_plain_len
= plain_len
;
2000 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2003 crackpos
*= data
.kernel_rules_cnt
;
2004 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2006 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2008 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2012 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2014 for (int i
= 0; i
< 16; i
++)
2016 plain_buf
[i
] = pw
.i
[i
];
2019 plain_len
= pw
.pw_len
;
2021 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2022 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2024 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2026 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2030 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2032 memcpy (plain_ptr
, comb_buf
, comb_len
);
2035 plain_len
+= comb_len
;
2038 crackpos
*= data
.combs_cnt
;
2039 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2041 if (data
.pw_max
!= PW_DICTMAX1
)
2043 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2046 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2048 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2049 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2051 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2052 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2054 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2055 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2057 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2058 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2060 plain_len
= data
.css_cnt
;
2063 crackpos
*= data
.bfs_cnt
;
2064 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2066 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2070 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2072 for (int i
= 0; i
< 16; i
++)
2074 plain_buf
[i
] = pw
.i
[i
];
2077 plain_len
= pw
.pw_len
;
2079 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2082 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2084 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2086 plain_len
+= start
+ stop
;
2089 crackpos
*= data
.combs_cnt
;
2090 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2092 if (data
.pw_max
!= PW_DICTMAX1
)
2094 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2097 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2101 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2103 for (int i
= 0; i
< 16; i
++)
2105 plain_buf
[i
] = pw
.i
[i
];
2108 plain_len
= pw
.pw_len
;
2110 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2113 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2115 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2117 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2119 plain_len
+= start
+ stop
;
2122 crackpos
*= data
.combs_cnt
;
2123 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2125 if (data
.pw_max
!= PW_DICTMAX1
)
2127 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2131 if (data
.attack_mode
== ATTACK_MODE_BF
)
2133 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2135 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2137 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2139 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2143 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2145 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2147 plain_ptr
[j
] = plain_ptr
[i
];
2150 plain_len
= plain_len
/ 2;
2155 // if enabled, update also the potfile
2161 fprintf (pot_fp
, "%s:", out_buf
);
2163 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2165 fputc ('\n', pot_fp
);
2169 unlock_file (pot_fp
);
2174 FILE *out_fp
= NULL
;
2176 if (outfile
!= NULL
)
2178 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2180 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2191 if (quiet
== 0) clear_prompt ();
2194 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2196 if (outfile
!= NULL
)
2198 if (out_fp
!= stdout
)
2205 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2207 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2209 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2210 if (quiet
== 0) fflush (stdout
);
2219 char *loopback_file
= data
.loopback_file
;
2223 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2227 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2229 fputc ('\n', fb_fp
);
2235 // (rule) debug mode
2237 // the next check implies that:
2238 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2241 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2243 if (debug_rule_len
< 0) debug_rule_len
= 0;
2245 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2247 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2249 if ((quiet
== 0) && (debug_file
== NULL
))
2251 fprintf (stdout
, "%s", PROMPT
);
2258 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2260 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2264 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2268 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2272 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2274 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
);
2276 uint cpt_cracked
= 0;
2278 hc_thread_mutex_lock (mux_display
);
2280 for (uint i
= 0; i
< num_cracked
; i
++)
2282 const uint hash_pos
= cracked
[i
].hash_pos
;
2284 if (data
.digests_shown
[hash_pos
] == 1) continue;
2286 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2288 data
.digests_shown
[hash_pos
] = 1;
2290 data
.digests_done
++;
2294 salt_buf
->digests_done
++;
2296 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2298 data
.salts_shown
[salt_pos
] = 1;
2304 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2306 check_hash (device_param
, &cracked
[i
]);
2309 hc_thread_mutex_unlock (mux_display
);
2313 if (cpt_cracked
> 0)
2315 hc_thread_mutex_lock (mux_display
);
2317 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2318 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2322 data
.cpt_total
+= cpt_cracked
;
2324 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2326 hc_thread_mutex_unlock (mux_display
);
2329 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2331 // we need to reset cracked state on the device
2332 // otherwise host thinks again and again the hash was cracked
2333 // and returns invalid password each time
2335 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2337 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
);
2342 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2346 // stolen from princeprocessor ;)
2357 static void out_flush (out_t
*out
)
2359 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2364 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2366 char *ptr
= out
->buf
+ out
->len
;
2368 memcpy (ptr
, pw_buf
, pw_len
);
2372 out
->len
+= pw_len
+ 1;
2374 if (out
->len
>= BUFSIZ
- 100)
2380 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2387 uint plain_buf
[16] = { 0 };
2389 u8
*plain_ptr
= (u8
*) plain_buf
;
2393 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2395 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2399 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2401 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2403 const uint pos
= device_param
->innerloop_pos
;
2405 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2407 for (int i
= 0; i
< 8; i
++)
2409 plain_buf
[i
] = pw
.i
[i
];
2412 plain_len
= pw
.pw_len
;
2414 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2416 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2418 out_push (&out
, plain_ptr
, plain_len
);
2422 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2426 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2428 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2430 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2432 for (int i
= 0; i
< 8; i
++)
2434 plain_buf
[i
] = pw
.i
[i
];
2437 plain_len
= pw
.pw_len
;
2439 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2440 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2442 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2444 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2448 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2450 memcpy (plain_ptr
, comb_buf
, comb_len
);
2453 plain_len
+= comb_len
;
2455 if (data
.pw_max
!= PW_DICTMAX1
)
2457 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2460 out_push (&out
, plain_ptr
, plain_len
);
2464 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2466 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2468 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2470 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2471 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2473 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2474 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2476 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2477 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2479 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2480 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2482 plain_len
= data
.css_cnt
;
2484 out_push (&out
, plain_ptr
, plain_len
);
2488 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2492 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2494 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2496 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2498 for (int i
= 0; i
< 8; i
++)
2500 plain_buf
[i
] = pw
.i
[i
];
2503 plain_len
= pw
.pw_len
;
2505 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2508 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2510 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2512 plain_len
+= start
+ stop
;
2514 out_push (&out
, plain_ptr
, plain_len
);
2518 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2522 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2524 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2526 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2528 for (int i
= 0; i
< 8; i
++)
2530 plain_buf
[i
] = pw
.i
[i
];
2533 plain_len
= pw
.pw_len
;
2535 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2538 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2540 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2542 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2544 plain_len
+= start
+ stop
;
2546 out_push (&out
, plain_ptr
, plain_len
);
2554 static void save_hash ()
2556 char *hashfile
= data
.hashfile
;
2558 char new_hashfile
[256] = { 0 };
2559 char old_hashfile
[256] = { 0 };
2561 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2562 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2564 unlink (new_hashfile
);
2566 char separator
= data
.separator
;
2568 FILE *fp
= fopen (new_hashfile
, "wb");
2572 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2577 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2579 if (data
.salts_shown
[salt_pos
] == 1) continue;
2581 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2583 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2585 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2587 if (data
.digests_shown
[idx
] == 1) continue;
2589 if (data
.hash_mode
!= 2500)
2591 if (data
.username
== 1)
2593 user_t
*user
= data
.hash_info
[idx
]->user
;
2597 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2599 fputc (separator
, fp
);
2602 char out_buf
[HCBUFSIZ
]; // scratch buffer
2606 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2608 fputs (out_buf
, fp
);
2616 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2618 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2627 unlink (old_hashfile
);
2629 if (rename (hashfile
, old_hashfile
) != 0)
2631 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2638 if (rename (new_hashfile
, hashfile
) != 0)
2640 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2645 unlink (old_hashfile
);
2648 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2650 uint num_elements
= num
;
2652 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2653 device_param
->kernel_params_buf32
[34] = num
;
2655 uint kernel_threads
= device_param
->kernel_threads
;
2657 while (num_elements
% kernel_threads
) num_elements
++;
2659 cl_kernel kernel
= NULL
;
2663 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2664 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2665 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2666 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2667 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2670 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2671 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2672 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2673 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2674 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2675 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2676 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2677 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2678 hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2679 hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2680 hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2684 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2686 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2687 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2689 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2693 if (kern_run
== KERN_RUN_2
)
2695 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2697 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2701 while (num_elements
% kernel_threads
) num_elements
++;
2703 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2704 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2706 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2709 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2711 if (device_param
->nvidia_spin_damp
)
2713 if (data
.devices_status
== STATUS_RUNNING
)
2715 if (iteration
< EXPECTED_ITERATIONS
)
2719 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2720 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2721 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2727 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2729 cl_ulong time_start
;
2732 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2733 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2735 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2737 if (data
.devices_status
== STATUS_RUNNING
)
2739 if (iteration
< EXPECTED_ITERATIONS
)
2743 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2744 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2745 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2752 uint exec_pos
= device_param
->exec_pos
;
2754 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2758 if (exec_pos
== EXEC_CACHE
)
2763 device_param
->exec_pos
= exec_pos
;
2766 hc_clReleaseEvent (data
.ocl
, event
);
2768 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2771 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2773 uint num_elements
= num
;
2777 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2778 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2779 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2782 // causes problems with special threads like in bcrypt
2783 // const uint kernel_threads = device_param->kernel_threads;
2785 uint kernel_threads
= device_param
->kernel_threads
;
2787 while (num_elements
% kernel_threads
) num_elements
++;
2789 cl_kernel kernel
= NULL
;
2793 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2794 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2795 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2800 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2801 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2802 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2803 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2804 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2805 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2807 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2808 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2809 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2810 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2811 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2812 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2814 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2815 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2816 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2817 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2818 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2819 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2820 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2824 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2825 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2827 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2829 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2831 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2834 static void run_kernel_tm (hc_device_param_t
*device_param
)
2836 const uint num_elements
= 1024; // fixed
2838 uint kernel_threads
= 32;
2840 cl_kernel kernel
= device_param
->kernel_tm
;
2842 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2843 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2845 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2847 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2849 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2852 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2854 uint num_elements
= num
;
2856 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2857 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2859 // causes problems with special threads like in bcrypt
2860 // const uint kernel_threads = device_param->kernel_threads;
2862 uint kernel_threads
= device_param
->kernel_threads
;
2864 while (num_elements
% kernel_threads
) num_elements
++;
2866 cl_kernel kernel
= device_param
->kernel_amp
;
2868 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2869 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2871 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2872 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2874 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2876 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2878 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2881 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2883 const u32 num16d
= num
/ 16;
2884 const u32 num16m
= num
% 16;
2888 device_param
->kernel_params_memset_buf32
[1] = value
;
2889 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2891 uint kernel_threads
= device_param
->kernel_threads
;
2893 uint num_elements
= num16d
;
2895 while (num_elements
% kernel_threads
) num_elements
++;
2897 cl_kernel kernel
= device_param
->kernel_memset
;
2899 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2900 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2901 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2903 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2904 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2906 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2908 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2910 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2922 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2926 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2928 run_kernel_memset (device_param
, buf
, 0, size
);
2933 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2935 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2937 const cl_uchar zero = 0;
2939 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2944 // NOTE: clEnqueueFillBuffer () always fails with -59
2945 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2946 // How's that possible, OpenCL 1.2 support is advertised??
2947 // We need to workaround...
2949 #define FILLSZ 0x100000
2951 char *tmp = (char *) mymalloc (FILLSZ);
2953 for (size_t i = 0; i < size; i += FILLSZ)
2955 const size_t left = size - i;
2957 const size_t fillsz = MIN (FILLSZ, left);
2959 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2967 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
, const uint fast_iteration
)
2969 if (data
.hash_mode
== 2000)
2971 process_stdout (device_param
, pws_cnt
);
2976 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2978 if (attack_mode
== ATTACK_MODE_BF
)
2980 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2982 const uint size_tm
= 32 * sizeof (bs_word_t
);
2984 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2986 run_kernel_tm (device_param
);
2988 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
);
2992 if (highest_pw_len
< 16)
2994 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
2996 else if (highest_pw_len
< 32)
2998 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3002 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3007 run_kernel_amp (device_param
, pws_cnt
);
3009 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3011 if (opts_type
& OPTS_TYPE_HOOK12
)
3013 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3015 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
);
3017 // do something with data
3019 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
);
3022 uint iter
= salt_buf
->salt_iter
;
3024 uint loop_step
= device_param
->kernel_loops
;
3026 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3028 uint loop_left
= iter
- loop_pos
;
3030 loop_left
= MIN (loop_left
, loop_step
);
3032 device_param
->kernel_params_buf32
[28] = loop_pos
;
3033 device_param
->kernel_params_buf32
[29] = loop_left
;
3035 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3037 if (data
.devices_status
== STATUS_CRACKED
) break;
3038 if (data
.devices_status
== STATUS_ABORTED
) break;
3039 if (data
.devices_status
== STATUS_QUIT
) break;
3040 if (data
.devices_status
== STATUS_BYPASS
) break;
3046 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3048 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3052 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3054 const u32 speed_pos
= device_param
->speed_pos
;
3056 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3058 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3060 if (data
.benchmark
== 1)
3062 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3066 if (opts_type
& OPTS_TYPE_HOOK23
)
3068 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3070 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
);
3072 // do something with data
3074 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
);
3077 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3081 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3087 else if (rule_len
== 1)
3089 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3095 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3097 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3099 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
);
3101 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3103 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3105 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3107 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3109 for (u32 i
= 0; i
< pws_cnt
; i
++)
3111 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3113 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3118 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3120 for (u32 i
= 0; i
< pws_cnt
; i
++)
3122 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3124 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3131 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3133 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3135 for (u32 i
= 0; i
< pws_cnt
; i
++)
3137 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3139 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3144 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3146 for (u32 i
= 0; i
< pws_cnt
; i
++)
3148 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3150 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3157 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
);
3159 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3161 const u64 off
= device_param
->words_off
;
3163 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3165 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3169 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3171 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3173 device_param
->kernel_params_buf32
[28] = 0;
3174 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3175 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3177 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3179 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3183 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3186 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3188 return exec_ms_prev
;
3191 static void autotune (hc_device_param_t
*device_param
)
3193 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3195 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3196 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3198 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3199 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3201 u32 kernel_accel
= kernel_accel_min
;
3202 u32 kernel_loops
= kernel_loops_min
;
3204 // in this case the user specified a fixed -u and -n on the commandline
3205 // no way to tune anything
3206 // but we need to run a few caching rounds
3208 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3210 if (data
.hash_mode
!= 2000)
3212 try_run (device_param
, kernel_accel
, kernel_loops
);
3213 try_run (device_param
, kernel_accel
, kernel_loops
);
3214 try_run (device_param
, kernel_accel
, kernel_loops
);
3215 try_run (device_param
, kernel_accel
, kernel_loops
);
3218 device_param
->kernel_accel
= kernel_accel
;
3219 device_param
->kernel_loops
= kernel_loops
;
3221 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3223 device_param
->kernel_power
= kernel_power
;
3228 // from here it's clear we are allowed to autotune
3229 // so let's init some fake words
3231 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3233 if (data
.attack_kern
== ATTACK_KERN_BF
)
3235 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3239 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3241 device_param
->pws_buf
[i
].i
[0] = i
;
3242 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3243 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3246 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
);
3249 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3251 if (data
.kernel_rules_cnt
> 1)
3253 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3258 run_kernel_amp (device_param
, kernel_power_max
);
3261 #define VERIFIER_CNT 1
3263 // first find out highest kernel-loops that stays below target_ms
3265 if (kernel_loops_min
< kernel_loops_max
)
3267 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3269 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3271 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3273 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3275 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3278 if (exec_ms
< target_ms
) break;
3282 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3284 #define STEPS_CNT 10
3286 if (kernel_accel_min
< kernel_accel_max
)
3288 for (int i
= 0; i
< STEPS_CNT
; i
++)
3290 const u32 kernel_accel_try
= 1 << i
;
3292 if (kernel_accel_try
< kernel_accel_min
) continue;
3293 if (kernel_accel_try
> kernel_accel_max
) break;
3295 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3297 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3299 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3301 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3304 if (exec_ms
> target_ms
) break;
3306 kernel_accel
= kernel_accel_try
;
3310 // at this point we want to know the actual runtime for the following reason:
3311 // we need a reference for the balancing loop following up, and this
3312 // the balancing loop can have an effect that the creates a new opportunity, for example:
3313 // if the target is 95 ms and the current runtime is 48ms the above loop
3314 // stopped the execution because the previous exec_ms was > 95ms
3315 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3316 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3318 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3320 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3322 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3324 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3327 u32 diff
= kernel_loops
- kernel_accel
;
3329 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3331 u32 kernel_accel_orig
= kernel_accel
;
3332 u32 kernel_loops_orig
= kernel_loops
;
3334 for (u32 f
= 1; f
< 1024; f
++)
3336 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3337 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3339 if (kernel_accel_try
> kernel_accel_max
) break;
3340 if (kernel_loops_try
< kernel_loops_min
) break;
3342 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3344 if (diff_new
> diff
) break;
3348 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3350 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3352 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3354 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3357 if (exec_ms
< exec_ms_pre_final
)
3359 exec_ms_pre_final
= exec_ms
;
3361 kernel_accel
= kernel_accel_try
;
3362 kernel_loops
= kernel_loops_try
;
3367 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3369 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3371 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3373 if (exec_accel_min
>= 1.0)
3375 // this is safe to not overflow kernel_accel_max because of accel_left
3377 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3380 // reset them fake words
3383 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3385 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);
3386 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);
3389 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3391 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3393 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3398 device_param
->exec_pos
= 0;
3400 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3402 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3403 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3404 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3408 device_param
->kernel_accel
= kernel_accel
;
3409 device_param
->kernel_loops
= kernel_loops
;
3411 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3413 device_param
->kernel_power
= kernel_power
;
3417 if (data
.quiet
== 0)
3421 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3422 "- Device #%u: autotuned kernel-loops to %u\n",
3423 device_param
->device_id
+ 1, kernel_accel
,
3424 device_param
->device_id
+ 1, kernel_loops
);
3426 fprintf (stdout
, "%s", PROMPT
);
3434 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3436 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3440 uint speed_pos
= device_param
->speed_pos
;
3443 if (device_param
->timer_speed
.tv_sec
== 0)
3445 hc_timer_set (&device_param
->timer_speed
);
3450 if (device_param
->timer_speed
.QuadPart
== 0)
3452 hc_timer_set (&device_param
->timer_speed
);
3456 // find higest password length, this is for optimization stuff
3458 uint highest_pw_len
= 0;
3460 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3463 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3466 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3468 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3469 + device_param
->kernel_params_mp_l_buf32
[5];
3474 uint innerloop_step
= 0;
3475 uint innerloop_cnt
= 0;
3477 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3478 else innerloop_step
= 1;
3480 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3481 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3482 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3484 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3486 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3488 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3490 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3492 if (data
.devices_status
== STATUS_CRACKED
) break;
3493 if (data
.devices_status
== STATUS_ABORTED
) break;
3494 if (data
.devices_status
== STATUS_QUIT
) break;
3495 if (data
.devices_status
== STATUS_BYPASS
) break;
3497 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3499 device_param
->kernel_params_buf32
[27] = salt_pos
;
3500 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3501 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3503 FILE *combs_fp
= device_param
->combs_fp
;
3505 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3512 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3514 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3516 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3518 if (data
.devices_status
== STATUS_CRACKED
) break;
3519 if (data
.devices_status
== STATUS_ABORTED
) break;
3520 if (data
.devices_status
== STATUS_QUIT
) break;
3521 if (data
.devices_status
== STATUS_BYPASS
) break;
3523 uint fast_iteration
= 0;
3525 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3527 if (innerloop_left
> innerloop_step
)
3529 innerloop_left
= innerloop_step
;
3534 device_param
->innerloop_pos
= innerloop_pos
;
3535 device_param
->innerloop_left
= innerloop_left
;
3537 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3539 // i think we can get rid of this
3540 if (innerloop_left
== 0)
3542 puts ("bug, how should this happen????\n");
3547 if (data
.salts_shown
[salt_pos
] == 1)
3549 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3554 // initialize amplifiers
3556 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3560 while (i
< innerloop_left
)
3562 if (feof (combs_fp
)) break;
3564 int line_len
= fgetl (combs_fp
, line_buf
);
3566 if (line_len
>= PW_MAX1
) continue;
3568 line_len
= convert_from_hex (line_buf
, line_len
);
3570 char *line_buf_new
= line_buf
;
3572 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3574 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3576 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3578 if (rule_len_out
< 0)
3580 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3585 line_len
= rule_len_out
;
3587 line_buf_new
= rule_buf_out
;
3590 line_len
= MIN (line_len
, PW_DICTMAX
);
3592 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3594 memcpy (ptr
, line_buf_new
, line_len
);
3596 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3598 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3600 uppercase (ptr
, line_len
);
3603 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3605 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3607 ptr
[line_len
] = 0x80;
3610 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3612 ptr
[line_len
] = 0x01;
3616 device_param
->combs_buf
[i
].pw_len
= line_len
;
3621 for (uint j
= i
; j
< innerloop_left
; j
++)
3623 device_param
->combs_buf
[j
].i
[0] = 0;
3624 device_param
->combs_buf
[j
].i
[1] = 0;
3625 device_param
->combs_buf
[j
].i
[2] = 0;
3626 device_param
->combs_buf
[j
].i
[3] = 0;
3627 device_param
->combs_buf
[j
].i
[4] = 0;
3628 device_param
->combs_buf
[j
].i
[5] = 0;
3629 device_param
->combs_buf
[j
].i
[6] = 0;
3630 device_param
->combs_buf
[j
].i
[7] = 0;
3632 device_param
->combs_buf
[j
].pw_len
= 0;
3637 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3639 u64 off
= innerloop_pos
;
3641 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3643 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3645 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3647 u64 off
= innerloop_pos
;
3649 device_param
->kernel_params_mp_buf64
[3] = off
;
3651 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3653 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3655 u64 off
= innerloop_pos
;
3657 device_param
->kernel_params_mp_buf64
[3] = off
;
3659 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3664 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3666 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
);
3668 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3670 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
);
3672 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3674 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
);
3676 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3678 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
);
3680 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3682 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
);
3685 if (data
.benchmark
== 1)
3687 hc_timer_set (&device_param
->timer_speed
);
3690 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
3692 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3694 if (data
.devices_status
== STATUS_CRACKED
) break;
3695 if (data
.devices_status
== STATUS_ABORTED
) break;
3696 if (data
.devices_status
== STATUS_QUIT
) break;
3697 if (data
.devices_status
== STATUS_BYPASS
) break;
3703 if (data
.benchmark
== 0)
3705 check_cracked (device_param
, salt_pos
);
3712 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3714 hc_thread_mutex_lock (mux_counter
);
3716 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3718 hc_thread_mutex_unlock (mux_counter
);
3726 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3728 hc_timer_set (&device_param
->timer_speed
);
3732 //hc_thread_mutex_lock (mux_display);
3734 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3736 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3738 //hc_thread_mutex_unlock (mux_display);
3742 if (speed_pos
== SPEED_CACHE
)
3751 if (data
.benchmark
== 1) break;
3755 device_param
->speed_pos
= speed_pos
;
3760 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3762 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3766 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3768 wl_data
->buf
[wl_data
->cnt
] = 0;
3770 if (wl_data
->cnt
== 0) return;
3772 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3776 if (wl_data
->cnt
== wl_data
->avail
)
3778 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3780 wl_data
->avail
+= wl_data
->incr
;
3783 const int c
= fgetc (fd
);
3785 if (c
== EOF
) break;
3787 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3791 if (c
== '\n') break;
3794 // ensure stream ends with a newline
3796 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3800 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3806 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3810 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3812 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3822 if (*ptr
!= '\n') continue;
3826 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3837 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3841 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3843 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3845 if (*ptr
!= '\n') continue;
3849 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3860 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3864 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3866 if (*ptr
!= '\n') continue;
3870 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3881 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3883 while (wl_data
->pos
< wl_data
->cnt
)
3888 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3890 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3892 wl_data
->pos
+= off
;
3894 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3896 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3898 int rule_len_out
= -1;
3900 if (len
< BLOCK_SIZE
)
3902 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3905 if (rule_len_out
< 0)
3910 if (rule_len_out
> PW_MAX
)
3931 fprintf (stderr
, "BUG feof()!!\n");
3936 load_segment (wl_data
, fd
);
3938 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3942 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3946 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3956 fstat (fileno (fd
), &d
.stat
);
3960 _fstat64 (fileno (fd
), &d
.stat
);
3964 d
.stat
.st_nlink
= 0;
3968 d
.stat
.st_atime
= 0;
3971 d
.stat
.st_blksize
= 0;
3972 d
.stat
.st_blocks
= 0;
3975 if (d
.stat
.st_size
== 0) return 0;
3977 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3979 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3983 u64 cnt
= d_cache
->cnt
;
3987 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3989 keyspace
*= data
.kernel_rules_cnt
;
3991 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3993 keyspace
*= data
.combs_cnt
;
3996 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
);
3997 if (data
.quiet
== 0) log_info ("");
3999 hc_signal (sigHandler_default
);
4014 load_segment (wl_data
, fd
);
4016 comp
+= wl_data
->cnt
;
4020 while (i
< wl_data
->cnt
)
4025 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4027 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4029 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4031 int rule_len_out
= -1;
4033 if (len
< BLOCK_SIZE
)
4035 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4038 if (rule_len_out
< 0)
4050 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4052 cnt
+= data
.kernel_rules_cnt
;
4054 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4056 cnt
+= data
.combs_cnt
;
4069 if ((now
- prev
) == 0) continue;
4071 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4073 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
);
4078 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
);
4079 if (data
.quiet
== 0) log_info ("");
4081 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4083 hc_signal (sigHandler_default
);
4088 static void *thread_monitor (void *p
)
4090 uint runtime_check
= 0;
4091 uint remove_check
= 0;
4092 uint status_check
= 0;
4093 uint restore_check
= 0;
4095 uint restore_left
= data
.restore_timer
;
4096 uint remove_left
= data
.remove_timer
;
4097 uint status_left
= data
.status_timer
;
4100 uint hwmon_check
= 0;
4102 int slowdown_warnings
= 0;
4104 // these variables are mainly used for fan control
4106 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4108 // temperature controller "loopback" values
4110 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4111 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4113 int temp_threshold
= 1; // degrees celcius
4115 int fan_speed_min
= 15; // in percentage
4116 int fan_speed_max
= 100;
4118 time_t last_temp_check_time
;
4119 #endif // HAVE_HWMON
4121 uint sleep_time
= 1;
4128 if (data
.restore_timer
)
4133 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4138 if (data
.status
== 1)
4144 if (data
.gpu_temp_disable
== 0)
4146 time (&last_temp_check_time
);
4152 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4155 if (hwmon_check
== 0)
4160 while (data
.shutdown_inner
== 0)
4162 hc_sleep (sleep_time
);
4164 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4168 if (hwmon_check
== 1)
4170 hc_thread_mutex_lock (mux_adl
);
4172 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4174 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4176 if (device_param
->skipped
) continue;
4178 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4182 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
= { 0 };
4183 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
= { 0 };
4185 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4186 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4188 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4190 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4192 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4194 if (perfPolicies_status
.throttle
& 2)
4196 if (slowdown_warnings
< 3)
4198 if (data
.quiet
== 0) clear_prompt ();
4200 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4202 if (slowdown_warnings
== 2)
4207 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4208 if (data
.quiet
== 0) fflush (stdout
);
4210 slowdown_warnings
++;
4215 slowdown_warnings
= 0;
4221 hc_thread_mutex_unlock (mux_adl
);
4224 if (hwmon_check
== 1)
4226 hc_thread_mutex_lock (mux_adl
);
4228 time_t temp_check_time
;
4230 time (&temp_check_time
);
4232 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4234 if (Ta
== 0) Ta
= 1;
4236 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4238 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4240 if (device_param
->skipped
) continue;
4242 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4244 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4246 if (temperature
> (int) data
.gpu_temp_abort
)
4248 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4250 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4255 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4257 if (gpu_temp_retain
)
4259 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4261 int temp_cur
= temperature
;
4263 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4265 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4267 // calculate Ta value (time difference in seconds between the last check and this check)
4269 last_temp_check_time
= temp_check_time
;
4275 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4277 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
);
4279 if (abs (fan_diff_required
) >= temp_threshold
)
4281 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4283 int fan_speed_level
= fan_speed_cur
;
4285 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4287 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4289 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4290 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4292 if (fan_speed_new
!= fan_speed_cur
)
4294 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4295 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4297 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4299 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4301 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4303 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4306 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4310 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4314 fan_speed_chgd
[device_id
] = 1;
4317 temp_diff_old
[device_id
] = temp_diff_new
;
4324 hc_thread_mutex_unlock (mux_adl
);
4326 #endif // HAVE_HWMON
4328 if (restore_check
== 1)
4332 if (restore_left
== 0)
4334 if (data
.restore_disable
== 0) cycle_restore ();
4336 restore_left
= data
.restore_timer
;
4340 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4344 time (&runtime_cur
);
4346 int runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
4348 if (runtime_left
<= 0)
4350 if (data
.benchmark
== 0)
4352 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4355 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4359 if (remove_check
== 1)
4363 if (remove_left
== 0)
4365 if (data
.digests_saved
!= data
.digests_done
)
4367 data
.digests_saved
= data
.digests_done
;
4372 remove_left
= data
.remove_timer
;
4376 if (status_check
== 1)
4380 if (status_left
== 0)
4382 hc_thread_mutex_lock (mux_display
);
4384 if (data
.quiet
== 0) clear_prompt ();
4386 if (data
.quiet
== 0) log_info ("");
4390 if (data
.quiet
== 0) log_info ("");
4392 hc_thread_mutex_unlock (mux_display
);
4394 status_left
= data
.status_timer
;
4400 myfree (fan_speed_chgd
);
4402 myfree (temp_diff_old
);
4403 myfree (temp_diff_sum
);
4411 static void *thread_outfile_remove (void *p
)
4413 // some hash-dependent constants
4414 char *outfile_dir
= data
.outfile_check_directory
;
4415 uint dgst_size
= data
.dgst_size
;
4416 uint isSalted
= data
.isSalted
;
4417 uint esalt_size
= data
.esalt_size
;
4418 uint hash_mode
= data
.hash_mode
;
4420 uint outfile_check_timer
= data
.outfile_check_timer
;
4422 char separator
= data
.separator
;
4424 // some hash-dependent functions
4425 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4426 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4429 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4431 hash_buf
.digest
= mymalloc (dgst_size
);
4433 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4435 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4437 uint digest_buf
[64] = { 0 };
4439 outfile_data_t
*out_info
= NULL
;
4441 char **out_files
= NULL
;
4443 time_t folder_mtime
= 0;
4447 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4449 while (data
.shutdown_inner
== 0)
4453 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4457 if (check_left
== 0)
4459 struct stat outfile_check_stat
;
4461 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4463 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4467 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4469 char **out_files_new
= scan_directory (outfile_dir
);
4471 int out_cnt_new
= count_dictionaries (out_files_new
);
4473 outfile_data_t
*out_info_new
= NULL
;
4475 if (out_cnt_new
> 0)
4477 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4479 for (int i
= 0; i
< out_cnt_new
; i
++)
4481 out_info_new
[i
].file_name
= out_files_new
[i
];
4483 // check if there are files that we have seen/checked before (and not changed)
4485 for (int j
= 0; j
< out_cnt
; j
++)
4487 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4489 struct stat outfile_stat
;
4491 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4493 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4495 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4496 out_info_new
[i
].seek
= out_info
[j
].seek
;
4504 local_free (out_info
);
4505 local_free (out_files
);
4507 out_files
= out_files_new
;
4508 out_cnt
= out_cnt_new
;
4509 out_info
= out_info_new
;
4511 folder_mtime
= outfile_check_stat
.st_mtime
;
4514 for (int j
= 0; j
< out_cnt
; j
++)
4516 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4520 //hc_thread_mutex_lock (mux_display);
4523 struct stat outfile_stat
;
4525 fstat (fileno (fp
), &outfile_stat
);
4529 struct stat64 outfile_stat
;
4531 _fstat64 (fileno (fp
), &outfile_stat
);
4534 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4536 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4537 out_info
[j
].seek
= 0;
4540 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4542 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4546 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4548 if (ptr
== NULL
) break;
4550 int line_len
= strlen (line_buf
);
4552 if (line_len
<= 0) continue;
4554 int iter
= MAX_CUT_TRIES
;
4556 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4558 if (line_buf
[i
] != separator
) continue;
4560 int parser_status
= PARSER_OK
;
4562 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4564 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4569 if (parser_status
== PARSER_OK
)
4571 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4573 if (data
.salts_shown
[salt_pos
] == 1) continue;
4575 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4577 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4579 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4581 if (data
.digests_shown
[idx
] == 1) continue;
4585 if (hash_mode
== 6800)
4587 if (i
== salt_buf
->salt_len
)
4589 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4592 else if (hash_mode
== 2500)
4594 // BSSID : MAC1 : MAC2 (:plain)
4595 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4597 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4599 if (!cracked
) continue;
4601 // now compare MAC1 and MAC2 too, since we have this additional info
4602 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4603 char *mac2_pos
= mac1_pos
+ 12 + 1;
4605 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4606 wpa_t
*wpa
= &wpas
[salt_pos
];
4608 // compare hex string(s) vs binary MAC address(es)
4610 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4612 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4621 if (!cracked
) continue;
4623 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4625 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4636 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4638 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4640 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4647 data
.digests_shown
[idx
] = 1;
4649 data
.digests_done
++;
4651 salt_buf
->digests_done
++;
4653 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4655 data
.salts_shown
[salt_pos
] = 1;
4659 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4664 if (data
.devices_status
== STATUS_CRACKED
) break;
4670 if (data
.devices_status
== STATUS_CRACKED
) break;
4675 if (data
.devices_status
== STATUS_CRACKED
) break;
4680 out_info
[j
].seek
= ftell (fp
);
4682 //hc_thread_mutex_unlock (mux_display);
4690 check_left
= outfile_check_timer
;
4694 if (esalt_size
) local_free (hash_buf
.esalt
);
4696 if (isSalted
) local_free (hash_buf
.salt
);
4698 local_free (hash_buf
.digest
);
4700 local_free (out_info
);
4702 local_free (out_files
);
4709 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4711 //if (device_param->pws_cnt < device_param->kernel_power)
4713 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4715 u8
*ptr
= (u8
*) pw
->i
;
4717 memcpy (ptr
, pw_buf
, pw_len
);
4719 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4721 pw
->pw_len
= pw_len
;
4723 device_param
->pws_cnt
++;
4727 // fprintf (stderr, "BUG pw_add()!!\n");
4733 static void set_kernel_power_final (const u64 kernel_power_final
)
4735 if (data
.quiet
== 0)
4741 log_info ("INFO: approaching final keyspace, workload adjusted");
4744 fprintf (stdout
, "%s", PROMPT
);
4749 data
.kernel_power_final
= kernel_power_final
;
4752 static u32
get_power (hc_device_param_t
*device_param
)
4754 const u64 kernel_power_final
= data
.kernel_power_final
;
4756 if (kernel_power_final
)
4758 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
4760 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
4762 // work should be at least the hardware power available without any accelerator
4764 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
4769 return device_param
->kernel_power
;
4772 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
4774 hc_thread_mutex_lock (mux_dispatcher
);
4776 const u64 words_cur
= data
.words_cur
;
4777 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
4779 device_param
->words_off
= words_cur
;
4781 const u64 kernel_power_all
= data
.kernel_power_all
;
4783 const u64 words_left
= words_base
- words_cur
;
4785 if (words_left
< kernel_power_all
)
4787 if (data
.kernel_power_final
== 0)
4789 set_kernel_power_final (words_left
);
4793 const u32 kernel_power
= get_power (device_param
);
4795 uint work
= MIN (words_left
, kernel_power
);
4797 work
= MIN (work
, max
);
4799 data
.words_cur
+= work
;
4801 hc_thread_mutex_unlock (mux_dispatcher
);
4806 static void *thread_autotune (void *p
)
4808 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4810 if (device_param
->skipped
) return NULL
;
4812 autotune (device_param
);
4817 static void *thread_calc_stdin (void *p
)
4819 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4821 if (device_param
->skipped
) return NULL
;
4823 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4825 const uint attack_kern
= data
.attack_kern
;
4827 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4829 hc_thread_mutex_lock (mux_dispatcher
);
4831 if (feof (stdin
) != 0)
4833 hc_thread_mutex_unlock (mux_dispatcher
);
4840 while (words_cur
< device_param
->kernel_power
)
4842 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4844 if (line_buf
== NULL
) break;
4846 uint line_len
= in_superchop (line_buf
);
4848 line_len
= convert_from_hex (line_buf
, line_len
);
4850 // post-process rule engine
4852 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4854 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4856 int rule_len_out
= -1;
4858 if (line_len
< BLOCK_SIZE
)
4860 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4863 if (rule_len_out
< 0) continue;
4865 line_buf
= rule_buf_out
;
4866 line_len
= rule_len_out
;
4869 if (line_len
> PW_MAX
)
4874 // hmm that's always the case, or?
4876 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4878 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4880 hc_thread_mutex_lock (mux_counter
);
4882 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4884 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4887 hc_thread_mutex_unlock (mux_counter
);
4893 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4897 if (data
.devices_status
== STATUS_CRACKED
) break;
4898 if (data
.devices_status
== STATUS_ABORTED
) break;
4899 if (data
.devices_status
== STATUS_QUIT
) break;
4900 if (data
.devices_status
== STATUS_BYPASS
) break;
4903 hc_thread_mutex_unlock (mux_dispatcher
);
4905 if (data
.devices_status
== STATUS_CRACKED
) break;
4906 if (data
.devices_status
== STATUS_ABORTED
) break;
4907 if (data
.devices_status
== STATUS_QUIT
) break;
4908 if (data
.devices_status
== STATUS_BYPASS
) break;
4912 const uint pws_cnt
= device_param
->pws_cnt
;
4916 run_copy (device_param
, pws_cnt
);
4918 run_cracker (device_param
, pws_cnt
);
4920 device_param
->pws_cnt
= 0;
4924 if (attack_kern == ATTACK_KERN_STRAIGHT)
4926 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4928 else if (attack_kern == ATTACK_KERN_COMBI)
4930 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4936 device_param
->kernel_accel
= 0;
4937 device_param
->kernel_loops
= 0;
4944 static void *thread_calc (void *p
)
4946 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4948 if (device_param
->skipped
) return NULL
;
4950 const uint attack_mode
= data
.attack_mode
;
4951 const uint attack_kern
= data
.attack_kern
;
4953 if (attack_mode
== ATTACK_MODE_BF
)
4955 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4957 const uint work
= get_work (device_param
, -1);
4959 if (work
== 0) break;
4961 const u64 words_off
= device_param
->words_off
;
4962 const u64 words_fin
= words_off
+ work
;
4964 const uint pws_cnt
= work
;
4966 device_param
->pws_cnt
= pws_cnt
;
4970 run_copy (device_param
, pws_cnt
);
4972 run_cracker (device_param
, pws_cnt
);
4974 device_param
->pws_cnt
= 0;
4978 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4982 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4984 if (data
.devices_status
== STATUS_CRACKED
) break;
4985 if (data
.devices_status
== STATUS_ABORTED
) break;
4986 if (data
.devices_status
== STATUS_QUIT
) break;
4987 if (data
.devices_status
== STATUS_BYPASS
) break;
4989 if (data
.benchmark
== 1) break;
4991 device_param
->words_done
= words_fin
;
4996 const uint segment_size
= data
.segment_size
;
4998 char *dictfile
= data
.dictfile
;
5000 if (attack_mode
== ATTACK_MODE_COMBI
)
5002 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5004 dictfile
= data
.dictfile2
;
5008 FILE *fd
= fopen (dictfile
, "rb");
5012 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5017 if (attack_mode
== ATTACK_MODE_COMBI
)
5019 const uint combs_mode
= data
.combs_mode
;
5021 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5023 const char *dictfilec
= data
.dictfile2
;
5025 FILE *combs_fp
= fopen (dictfilec
, "rb");
5027 if (combs_fp
== NULL
)
5029 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5036 device_param
->combs_fp
= combs_fp
;
5038 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5040 const char *dictfilec
= data
.dictfile
;
5042 FILE *combs_fp
= fopen (dictfilec
, "rb");
5044 if (combs_fp
== NULL
)
5046 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5053 device_param
->combs_fp
= combs_fp
;
5057 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5059 wl_data
->buf
= (char *) mymalloc (segment_size
);
5060 wl_data
->avail
= segment_size
;
5061 wl_data
->incr
= segment_size
;
5067 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5076 const uint work
= get_work (device_param
, max
);
5078 if (work
== 0) break;
5082 words_off
= device_param
->words_off
;
5083 words_fin
= words_off
+ work
;
5088 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5090 for ( ; words_cur
< words_fin
; words_cur
++)
5092 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5094 line_len
= convert_from_hex (line_buf
, line_len
);
5096 // post-process rule engine
5098 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5100 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5102 int rule_len_out
= -1;
5104 if (line_len
< BLOCK_SIZE
)
5106 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5109 if (rule_len_out
< 0) continue;
5111 line_buf
= rule_buf_out
;
5112 line_len
= rule_len_out
;
5115 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5117 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5121 hc_thread_mutex_lock (mux_counter
);
5123 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5125 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5128 hc_thread_mutex_unlock (mux_counter
);
5133 else if (attack_kern
== ATTACK_KERN_COMBI
)
5135 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5136 // since we still need to combine the plains
5138 if (line_len
> data
.pw_max
)
5142 hc_thread_mutex_lock (mux_counter
);
5144 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5146 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5149 hc_thread_mutex_unlock (mux_counter
);
5155 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5157 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5159 if (data
.devices_status
== STATUS_CRACKED
) break;
5160 if (data
.devices_status
== STATUS_ABORTED
) break;
5161 if (data
.devices_status
== STATUS_QUIT
) break;
5162 if (data
.devices_status
== STATUS_BYPASS
) break;
5165 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5167 if (data
.devices_status
== STATUS_CRACKED
) break;
5168 if (data
.devices_status
== STATUS_ABORTED
) break;
5169 if (data
.devices_status
== STATUS_QUIT
) break;
5170 if (data
.devices_status
== STATUS_BYPASS
) break;
5173 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5175 if (data
.devices_status
== STATUS_CRACKED
) break;
5176 if (data
.devices_status
== STATUS_ABORTED
) break;
5177 if (data
.devices_status
== STATUS_QUIT
) break;
5178 if (data
.devices_status
== STATUS_BYPASS
) break;
5184 const uint pws_cnt
= device_param
->pws_cnt
;
5188 run_copy (device_param
, pws_cnt
);
5190 run_cracker (device_param
, pws_cnt
);
5192 device_param
->pws_cnt
= 0;
5196 if (attack_kern == ATTACK_KERN_STRAIGHT)
5198 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5200 else if (attack_kern == ATTACK_KERN_COMBI)
5202 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5207 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5209 if (data
.devices_status
== STATUS_CRACKED
) break;
5210 if (data
.devices_status
== STATUS_ABORTED
) break;
5211 if (data
.devices_status
== STATUS_QUIT
) break;
5212 if (data
.devices_status
== STATUS_BYPASS
) break;
5214 if (words_fin
== 0) break;
5216 device_param
->words_done
= words_fin
;
5219 if (attack_mode
== ATTACK_MODE_COMBI
)
5221 fclose (device_param
->combs_fp
);
5224 free (wl_data
->buf
);
5230 device_param
->kernel_accel
= 0;
5231 device_param
->kernel_loops
= 0;
5236 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5240 log_error ("ERROR: %s : Invalid argument", __func__
);
5245 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5247 device_param
->kernel_params_buf32
[27] = salt_pos
;
5248 device_param
->kernel_params_buf32
[30] = 1;
5249 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5250 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5251 device_param
->kernel_params_buf32
[33] = 0;
5252 device_param
->kernel_params_buf32
[34] = 1;
5254 char *dictfile_old
= data
.dictfile
;
5256 const char *weak_hash_check
= "weak-hash-check";
5258 data
.dictfile
= (char *) weak_hash_check
;
5260 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5262 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5268 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5270 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5274 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5276 uint loop_step
= 16;
5278 const uint iter
= salt_buf
->salt_iter
;
5280 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5282 uint loop_left
= iter
- loop_pos
;
5284 loop_left
= MIN (loop_left
, loop_step
);
5286 device_param
->kernel_params_buf32
[28] = loop_pos
;
5287 device_param
->kernel_params_buf32
[29] = loop_left
;
5289 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5292 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5299 check_cracked (device_param
, salt_pos
);
5305 device_param
->kernel_params_buf32
[27] = 0;
5306 device_param
->kernel_params_buf32
[28] = 0;
5307 device_param
->kernel_params_buf32
[29] = 0;
5308 device_param
->kernel_params_buf32
[30] = 0;
5309 device_param
->kernel_params_buf32
[31] = 0;
5310 device_param
->kernel_params_buf32
[32] = 0;
5311 device_param
->kernel_params_buf32
[33] = 0;
5312 device_param
->kernel_params_buf32
[34] = 0;
5314 data
.dictfile
= dictfile_old
;
5316 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5321 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5323 if (data
.username
== 0)
5325 *hashbuf_pos
= line_buf
;
5326 *hashbuf_len
= line_len
;
5330 char *pos
= line_buf
;
5333 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5335 if (line_buf
[i
] == data
.separator
)
5350 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5357 for (int i
= 0; i
< line_len
; i
++)
5359 if (line_buf
[i
] == data
.separator
)
5368 if (pos
== NULL
) pos
= line_buf
+ i
;
5380 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5387 for (int i
= 0; i
< line_len
; i
++)
5389 if (line_buf
[i
] == ':')
5396 if (sep_cnt
== 2) sep2_len
++;
5397 if (sep_cnt
== 3) sep3_len
++;
5400 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5405 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5412 for (int i
= 0; i
< line_len
; i
++)
5414 if (line_buf
[i
] == ':')
5421 if (data
.hash_mode
== 1000)
5425 if (pos
== NULL
) pos
= line_buf
+ i
;
5430 else if (data
.hash_mode
== 3000)
5434 if (pos
== NULL
) pos
= line_buf
+ i
;
5445 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5452 for (int i
= 0; i
< line_len
; i
++)
5454 if (line_buf
[i
] == ':')
5463 if (pos
== NULL
) pos
= line_buf
+ i
;
5475 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5479 char sep5_first
= 0;
5480 char sep6_first
= 0;
5482 for (int i
= 0; i
< line_len
; i
++)
5484 if (line_buf
[i
] == ':')
5491 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5492 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5495 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5500 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5507 for (int i
= 0; i
< line_len
; i
++)
5509 if (line_buf
[i
] == ':')
5518 if (pos
== NULL
) pos
= line_buf
+ i
;
5528 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5535 for (int i
= 0; i
< line_len
; i
++)
5537 if (line_buf
[i
] == ':')
5546 if (pos
== NULL
) pos
= line_buf
+ i
;
5558 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5562 for (int i
= 0; i
< line_len
; i
++)
5564 if (line_buf
[i
] == ':') sep_cnt
++;
5567 if (sep_cnt
== 8) return 1;
5572 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5574 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5577 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5579 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5584 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5586 switch (hashfile_format
)
5588 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5589 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5590 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5591 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5595 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5597 switch (hashfile_format
)
5599 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5600 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5601 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5602 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5606 char *strhlfmt (const uint hashfile_format
)
5608 switch (hashfile_format
)
5610 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5611 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5612 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5613 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5614 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5615 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5616 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5617 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5618 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5619 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5622 return ((char *) "Unknown");
5625 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5627 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5629 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5630 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5632 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5636 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5640 int line_len
= fgetl (fp
, line_buf
);
5642 if (line_len
== 0) continue;
5644 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5645 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5646 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5648 if (num_check
== max_check
) break;
5655 uint hashlist_format
= HLFMT_HASHCAT
;
5657 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5659 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5661 hashlist_format
= i
;
5666 return hashlist_format
;
5670 * some further helper function
5673 // wrapper around mymalloc for ADL
5675 #if defined(HAVE_HWMON)
5676 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
5678 return mymalloc (iSize
);
5682 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
)
5686 const uint dgst_pos0
= data
.dgst_pos0
;
5687 const uint dgst_pos1
= data
.dgst_pos1
;
5688 const uint dgst_pos2
= data
.dgst_pos2
;
5689 const uint dgst_pos3
= data
.dgst_pos3
;
5691 memset (bitmap_a
, 0, bitmap_size
);
5692 memset (bitmap_b
, 0, bitmap_size
);
5693 memset (bitmap_c
, 0, bitmap_size
);
5694 memset (bitmap_d
, 0, bitmap_size
);
5696 for (uint i
= 0; i
< digests_cnt
; i
++)
5698 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5700 digests_buf_ptr
+= dgst_size
;
5702 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5703 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5704 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5705 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5707 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5708 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5709 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5710 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5712 if (bitmap_a
[idx0
] & val0
) collisions
++;
5713 if (bitmap_b
[idx1
] & val1
) collisions
++;
5714 if (bitmap_c
[idx2
] & val2
) collisions
++;
5715 if (bitmap_d
[idx3
] & val3
) collisions
++;
5717 bitmap_a
[idx0
] |= val0
;
5718 bitmap_b
[idx1
] |= val1
;
5719 bitmap_c
[idx2
] |= val2
;
5720 bitmap_d
[idx3
] |= val3
;
5722 if (collisions
>= collisions_max
) return 0x7fffffff;
5733 void SetConsoleWindowSize (const int x
)
5735 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5737 if (h
== INVALID_HANDLE_VALUE
) return;
5739 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5741 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5743 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5745 sr
->Right
= MAX (sr
->Right
, x
- 1);
5749 co
.X
= sr
->Right
+ 1;
5752 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5754 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5758 int main (int argc
, char **argv
)
5761 SetConsoleWindowSize (132);
5765 * To help users a bit
5768 char *compute
= getenv ("COMPUTE");
5772 static char display
[100];
5774 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5780 if (getenv ("DISPLAY") == NULL
)
5781 putenv ((char *) "DISPLAY=:0");
5784 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5785 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5787 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5788 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5790 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5791 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5793 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5794 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5796 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5797 putenv ((char *) "POCL_KERNEL_CACHE=0");
5805 memset (&data
, 0, sizeof (hc_global_data_t
));
5811 data
.proc_start
= proc_start
;
5814 char **myargv
= argv
;
5816 hc_thread_mutex_init (mux_dispatcher
);
5817 hc_thread_mutex_init (mux_counter
);
5818 hc_thread_mutex_init (mux_display
);
5819 hc_thread_mutex_init (mux_adl
);
5822 * commandline parameters
5826 uint version
= VERSION
;
5828 uint benchmark
= BENCHMARK
;
5829 uint stdout_flag
= STDOUT_FLAG
;
5832 uint username
= USERNAME
;
5833 uint remove
= REMOVE
;
5834 uint remove_timer
= REMOVE_TIMER
;
5837 uint keyspace
= KEYSPACE
;
5838 uint potfile_disable
= POTFILE_DISABLE
;
5839 char *potfile_path
= NULL
;
5840 uint debug_mode
= DEBUG_MODE
;
5841 char *debug_file
= NULL
;
5842 char *induction_dir
= NULL
;
5843 char *outfile_check_dir
= NULL
;
5845 uint runtime
= RUNTIME
;
5846 uint hash_mode
= HASH_MODE
;
5847 uint attack_mode
= ATTACK_MODE
;
5848 uint markov_disable
= MARKOV_DISABLE
;
5849 uint markov_classic
= MARKOV_CLASSIC
;
5850 uint markov_threshold
= MARKOV_THRESHOLD
;
5851 char *markov_hcstat
= NULL
;
5852 char *outfile
= NULL
;
5853 uint outfile_format
= OUTFILE_FORMAT
;
5854 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5855 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5856 uint restore
= RESTORE
;
5857 uint restore_timer
= RESTORE_TIMER
;
5858 uint restore_disable
= RESTORE_DISABLE
;
5859 uint status
= STATUS
;
5860 uint status_timer
= STATUS_TIMER
;
5861 uint machine_readable
= MACHINE_READABLE
;
5862 uint loopback
= LOOPBACK
;
5863 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5864 char *session
= NULL
;
5865 uint hex_charset
= HEX_CHARSET
;
5866 uint hex_salt
= HEX_SALT
;
5867 uint hex_wordlist
= HEX_WORDLIST
;
5868 uint rp_gen
= RP_GEN
;
5869 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5870 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5871 uint rp_gen_seed
= RP_GEN_SEED
;
5872 char *rule_buf_l
= (char *) RULE_BUF_L
;
5873 char *rule_buf_r
= (char *) RULE_BUF_R
;
5874 uint increment
= INCREMENT
;
5875 uint increment_min
= INCREMENT_MIN
;
5876 uint increment_max
= INCREMENT_MAX
;
5877 char *cpu_affinity
= NULL
;
5878 OCL_PTR
*ocl
= NULL
;
5879 char *opencl_devices
= NULL
;
5880 char *opencl_platforms
= NULL
;
5881 char *opencl_device_types
= NULL
;
5882 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5883 char *truecrypt_keyfiles
= NULL
;
5884 char *veracrypt_keyfiles
= NULL
;
5885 uint veracrypt_pim
= 0;
5886 uint workload_profile
= WORKLOAD_PROFILE
;
5887 uint kernel_accel
= KERNEL_ACCEL
;
5888 uint kernel_loops
= KERNEL_LOOPS
;
5889 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
5890 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5892 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5893 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5894 uint powertune_enable
= POWERTUNE_ENABLE
;
5896 uint logfile_disable
= LOGFILE_DISABLE
;
5897 uint segment_size
= SEGMENT_SIZE
;
5898 uint scrypt_tmto
= SCRYPT_TMTO
;
5899 char separator
= SEPARATOR
;
5900 uint bitmap_min
= BITMAP_MIN
;
5901 uint bitmap_max
= BITMAP_MAX
;
5902 char *custom_charset_1
= NULL
;
5903 char *custom_charset_2
= NULL
;
5904 char *custom_charset_3
= NULL
;
5905 char *custom_charset_4
= NULL
;
5907 #define IDX_HELP 'h'
5908 #define IDX_VERSION 'V'
5909 #define IDX_VERSION_LOWER 'v'
5910 #define IDX_QUIET 0xff02
5911 #define IDX_SHOW 0xff03
5912 #define IDX_LEFT 0xff04
5913 #define IDX_REMOVE 0xff05
5914 #define IDX_REMOVE_TIMER 0xff37
5915 #define IDX_SKIP 's'
5916 #define IDX_LIMIT 'l'
5917 #define IDX_KEYSPACE 0xff35
5918 #define IDX_POTFILE_DISABLE 0xff06
5919 #define IDX_POTFILE_PATH 0xffe0
5920 #define IDX_DEBUG_MODE 0xff43
5921 #define IDX_DEBUG_FILE 0xff44
5922 #define IDX_INDUCTION_DIR 0xff46
5923 #define IDX_OUTFILE_CHECK_DIR 0xff47
5924 #define IDX_USERNAME 0xff07
5925 #define IDX_FORCE 0xff08
5926 #define IDX_RUNTIME 0xff09
5927 #define IDX_BENCHMARK 'b'
5928 #define IDX_STDOUT_FLAG 0xff77
5929 #define IDX_HASH_MODE 'm'
5930 #define IDX_ATTACK_MODE 'a'
5931 #define IDX_RP_FILE 'r'
5932 #define IDX_RP_GEN 'g'
5933 #define IDX_RP_GEN_FUNC_MIN 0xff10
5934 #define IDX_RP_GEN_FUNC_MAX 0xff11
5935 #define IDX_RP_GEN_SEED 0xff34
5936 #define IDX_RULE_BUF_L 'j'
5937 #define IDX_RULE_BUF_R 'k'
5938 #define IDX_INCREMENT 'i'
5939 #define IDX_INCREMENT_MIN 0xff12
5940 #define IDX_INCREMENT_MAX 0xff13
5941 #define IDX_OUTFILE 'o'
5942 #define IDX_OUTFILE_FORMAT 0xff14
5943 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5944 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5945 #define IDX_RESTORE 0xff15
5946 #define IDX_RESTORE_DISABLE 0xff27
5947 #define IDX_STATUS 0xff17
5948 #define IDX_STATUS_TIMER 0xff18
5949 #define IDX_MACHINE_READABLE 0xff50
5950 #define IDX_LOOPBACK 0xff38
5951 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5952 #define IDX_SESSION 0xff19
5953 #define IDX_HEX_CHARSET 0xff20
5954 #define IDX_HEX_SALT 0xff21
5955 #define IDX_HEX_WORDLIST 0xff40
5956 #define IDX_MARKOV_DISABLE 0xff22
5957 #define IDX_MARKOV_CLASSIC 0xff23
5958 #define IDX_MARKOV_THRESHOLD 't'
5959 #define IDX_MARKOV_HCSTAT 0xff24
5960 #define IDX_CPU_AFFINITY 0xff25
5961 #define IDX_OPENCL_DEVICES 'd'
5962 #define IDX_OPENCL_PLATFORMS 0xff72
5963 #define IDX_OPENCL_DEVICE_TYPES 'D'
5964 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5965 #define IDX_WORKLOAD_PROFILE 'w'
5966 #define IDX_KERNEL_ACCEL 'n'
5967 #define IDX_KERNEL_LOOPS 'u'
5968 #define IDX_NVIDIA_SPIN_DAMP 0xff79
5969 #define IDX_GPU_TEMP_DISABLE 0xff29
5970 #define IDX_GPU_TEMP_ABORT 0xff30
5971 #define IDX_GPU_TEMP_RETAIN 0xff31
5972 #define IDX_POWERTUNE_ENABLE 0xff41
5973 #define IDX_LOGFILE_DISABLE 0xff51
5974 #define IDX_TRUECRYPT_KEYFILES 0xff52
5975 #define IDX_VERACRYPT_KEYFILES 0xff53
5976 #define IDX_VERACRYPT_PIM 0xff54
5977 #define IDX_SCRYPT_TMTO 0xff61
5978 #define IDX_SEGMENT_SIZE 'c'
5979 #define IDX_SEPARATOR 'p'
5980 #define IDX_BITMAP_MIN 0xff70
5981 #define IDX_BITMAP_MAX 0xff71
5982 #define IDX_CUSTOM_CHARSET_1 '1'
5983 #define IDX_CUSTOM_CHARSET_2 '2'
5984 #define IDX_CUSTOM_CHARSET_3 '3'
5985 #define IDX_CUSTOM_CHARSET_4 '4'
5987 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
5989 struct option long_options
[] =
5991 {"help", no_argument
, 0, IDX_HELP
},
5992 {"version", no_argument
, 0, IDX_VERSION
},
5993 {"quiet", no_argument
, 0, IDX_QUIET
},
5994 {"show", no_argument
, 0, IDX_SHOW
},
5995 {"left", no_argument
, 0, IDX_LEFT
},
5996 {"username", no_argument
, 0, IDX_USERNAME
},
5997 {"remove", no_argument
, 0, IDX_REMOVE
},
5998 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5999 {"skip", required_argument
, 0, IDX_SKIP
},
6000 {"limit", required_argument
, 0, IDX_LIMIT
},
6001 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6002 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6003 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6004 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6005 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6006 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6007 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6008 {"force", no_argument
, 0, IDX_FORCE
},
6009 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6010 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6011 {"restore", no_argument
, 0, IDX_RESTORE
},
6012 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6013 {"status", no_argument
, 0, IDX_STATUS
},
6014 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6015 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6016 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6017 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6018 {"session", required_argument
, 0, IDX_SESSION
},
6019 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6020 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6021 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6022 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6023 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6024 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6025 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6026 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6027 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6028 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6029 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6030 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6031 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6032 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6033 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6034 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6035 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6036 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6037 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6038 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6039 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6040 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6041 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6042 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6043 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6044 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6045 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6046 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6047 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6048 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6049 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6051 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6052 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6053 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6054 #endif // HAVE_HWMON
6055 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6056 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6057 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6058 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6059 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6060 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6061 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6062 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6063 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6064 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6065 {"increment", no_argument
, 0, IDX_INCREMENT
},
6066 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6067 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6068 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6069 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6070 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6071 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6075 uint rp_files_cnt
= 0;
6077 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6079 int option_index
= 0;
6085 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6089 case IDX_HELP
: usage
= 1; break;
6091 case IDX_VERSION_LOWER
: version
= 1; break;
6092 case IDX_RESTORE
: restore
= 1; break;
6093 case IDX_SESSION
: session
= optarg
; break;
6094 case IDX_SHOW
: show
= 1; break;
6095 case IDX_LEFT
: left
= 1; break;
6096 case '?': return (-1);
6102 log_error ("ERROR: Invalid argument specified");
6113 log_info ("%s", VERSION_TAG
);
6120 usage_big_print (PROGNAME
);
6126 * session needs to be set, always!
6129 if (session
== NULL
) session
= (char *) PROGNAME
;
6132 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6135 char *exec_path
= get_exec_path ();
6139 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6140 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6142 if (resolved_install_folder
== NULL
)
6144 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6149 if (resolved_exec_path
== NULL
)
6151 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6156 char *install_dir
= get_install_dir (resolved_exec_path
);
6157 char *profile_dir
= NULL
;
6158 char *session_dir
= NULL
;
6159 char *shared_dir
= NULL
;
6161 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6163 struct passwd
*pw
= getpwuid (getuid ());
6165 const char *homedir
= pw
->pw_dir
;
6167 profile_dir
= get_profile_dir (homedir
);
6168 session_dir
= get_session_dir (profile_dir
);
6169 shared_dir
= strdup (SHARED_FOLDER
);
6171 mkdir (profile_dir
, 0700);
6172 mkdir (session_dir
, 0700);
6176 profile_dir
= install_dir
;
6177 session_dir
= install_dir
;
6178 shared_dir
= install_dir
;
6181 myfree (resolved_install_folder
);
6182 myfree (resolved_exec_path
);
6186 char *install_dir
= get_install_dir (exec_path
);
6187 char *profile_dir
= install_dir
;
6188 char *session_dir
= install_dir
;
6189 char *shared_dir
= install_dir
;
6193 data
.install_dir
= install_dir
;
6194 data
.profile_dir
= profile_dir
;
6195 data
.session_dir
= session_dir
;
6196 data
.shared_dir
= shared_dir
;
6201 * kernel cache, we need to make sure folder exist
6204 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6206 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6208 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6210 mkdir (kernels_folder
, 0700);
6212 myfree (kernels_folder
);
6218 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6220 data
.session
= session
;
6222 char *eff_restore_file
= (char *) mymalloc (session_size
);
6223 char *new_restore_file
= (char *) mymalloc (session_size
);
6225 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6226 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6228 data
.eff_restore_file
= eff_restore_file
;
6229 data
.new_restore_file
= new_restore_file
;
6231 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6233 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6234 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6239 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6240 if ((show
== 1) || (left
== 1))
6242 restore_disable
= 1;
6247 data
.restore_disable
= restore_disable
;
6249 restore_data_t
*rd
= init_restore (argc
, argv
);
6259 read_restore (eff_restore_file
, rd
);
6261 if (rd
->version_bin
< RESTORE_MIN
)
6263 log_error ("ERROR: Incompatible restore-file version");
6272 rd
->pid
= getpid ();
6274 rd
->pid
= GetCurrentProcessId ();
6278 uint hash_mode_chgd
= 0;
6279 uint runtime_chgd
= 0;
6280 uint kernel_loops_chgd
= 0;
6281 uint kernel_accel_chgd
= 0;
6282 uint nvidia_spin_damp_chgd
= 0;
6283 uint attack_mode_chgd
= 0;
6284 uint outfile_format_chgd
= 0;
6285 uint rp_gen_seed_chgd
= 0;
6286 uint remove_timer_chgd
= 0;
6287 uint increment_min_chgd
= 0;
6288 uint increment_max_chgd
= 0;
6289 uint workload_profile_chgd
= 0;
6290 uint opencl_vector_width_chgd
= 0;
6296 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6300 //case IDX_HELP: usage = 1; break;
6301 //case IDX_VERSION: version = 1; break;
6302 //case IDX_RESTORE: restore = 1; break;
6303 case IDX_QUIET
: quiet
= 1; break;
6304 //case IDX_SHOW: show = 1; break;
6305 case IDX_SHOW
: break;
6306 //case IDX_LEFT: left = 1; break;
6307 case IDX_LEFT
: break;
6308 case IDX_USERNAME
: username
= 1; break;
6309 case IDX_REMOVE
: remove
= 1; break;
6310 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6311 remove_timer_chgd
= 1; break;
6312 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6313 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6314 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6315 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6316 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6317 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6318 case IDX_FORCE
: force
= 1; break;
6319 case IDX_SKIP
: skip
= atoll (optarg
); break;
6320 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6321 case IDX_KEYSPACE
: keyspace
= 1; break;
6322 case IDX_BENCHMARK
: benchmark
= 1; break;
6323 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6324 case IDX_RESTORE
: break;
6325 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6326 case IDX_STATUS
: status
= 1; break;
6327 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6328 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6329 case IDX_LOOPBACK
: loopback
= 1; break;
6330 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6331 //case IDX_SESSION: session = optarg; break;
6332 case IDX_SESSION
: break;
6333 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6334 hash_mode_chgd
= 1; break;
6335 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6336 runtime_chgd
= 1; break;
6337 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6338 attack_mode_chgd
= 1; break;
6339 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6340 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6341 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6342 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6343 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6344 rp_gen_seed_chgd
= 1; break;
6345 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6346 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6347 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6348 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6349 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6350 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6351 case IDX_OUTFILE
: outfile
= optarg
; break;
6352 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6353 outfile_format_chgd
= 1; break;
6354 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6355 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6356 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6357 case IDX_HEX_SALT
: hex_salt
= 1; break;
6358 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6359 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6360 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6361 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6362 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6363 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6364 opencl_vector_width_chgd
= 1; break;
6365 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6366 workload_profile_chgd
= 1; break;
6367 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6368 kernel_accel_chgd
= 1; break;
6369 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6370 kernel_loops_chgd
= 1; break;
6371 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6372 nvidia_spin_damp_chgd
= 1; break;
6373 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6375 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6376 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6377 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6378 #endif // HAVE_HWMON
6379 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6380 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6381 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6382 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6383 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6384 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6385 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6386 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6387 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6388 case IDX_INCREMENT
: increment
= 1; break;
6389 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6390 increment_min_chgd
= 1; break;
6391 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6392 increment_max_chgd
= 1; break;
6393 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6394 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6395 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6396 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6399 log_error ("ERROR: Invalid argument specified");
6406 log_error ("ERROR: Invalid argument specified");
6412 * Inform user things getting started,
6413 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6414 * - we do not need to check algorithm_pos
6421 if (machine_readable
== 0)
6423 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6428 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6431 else if (restore
== 1)
6433 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6436 else if (stdout_flag
== 1)
6440 else if (keyspace
== 1)
6446 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6455 if (attack_mode
> 7)
6457 log_error ("ERROR: Invalid attack-mode specified");
6462 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6464 log_error ("ERROR: Invalid runtime specified");
6469 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6471 log_error ("ERROR: Invalid hash-type specified");
6476 // renamed hash modes
6490 log_error ("Old -m specified, use -m %d instead", n
);
6498 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6500 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6506 if (outfile_format
> 16)
6508 log_error ("ERROR: Invalid outfile-format specified");
6515 if (outfile_format_chgd
== 1)
6517 if (outfile_format
> 1)
6519 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6526 outfile_format
= OUTFILE_FMT_HASH
;
6532 if (outfile_format_chgd
== 1)
6534 if ((outfile_format
> 7) && (outfile_format
< 16))
6536 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6543 if (increment_min
< INCREMENT_MIN
)
6545 log_error ("ERROR: Invalid increment-min specified");
6550 if (increment_max
> INCREMENT_MAX
)
6552 log_error ("ERROR: Invalid increment-max specified");
6557 if (increment_min
> increment_max
)
6559 log_error ("ERROR: Invalid increment-min specified");
6564 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6566 log_error ("ERROR: Increment is not allowed in attack-mode 0");
6571 if ((increment
== 0) && (increment_min_chgd
== 1))
6573 log_error ("ERROR: Increment-min is only supported combined with increment switch");
6578 if ((increment
== 0) && (increment_max_chgd
== 1))
6580 log_error ("ERROR: Increment-max is only supported combined with increment switch");
6585 if (rp_files_cnt
&& rp_gen
)
6587 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6592 if (rp_files_cnt
|| rp_gen
)
6594 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6596 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6602 if (rp_gen_func_min
> rp_gen_func_max
)
6604 log_error ("ERROR: Invalid rp-gen-func-min specified");
6609 if (kernel_accel_chgd
== 1)
6613 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
6614 log_info ("Please consider using the -w option instead");
6615 log_info ("You can use --force to override this but do not post error reports if you do so");
6621 if (kernel_accel
< 1)
6623 log_error ("ERROR: Invalid kernel-accel specified");
6628 if (kernel_accel
> 1024)
6630 log_error ("ERROR: Invalid kernel-accel specified");
6636 if (kernel_loops_chgd
== 1)
6640 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
6641 log_info ("Please consider using the -w option instead");
6642 log_info ("You can use --force to override this but do not post error reports if you do so");
6648 if (kernel_loops
< 1)
6650 log_error ("ERROR: Invalid kernel-loops specified");
6655 if (kernel_loops
> 1024)
6657 log_error ("ERROR: Invalid kernel-loops specified");
6663 if ((workload_profile
< 1) || (workload_profile
> 4))
6665 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6670 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6672 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6677 if (show
== 1 || left
== 1)
6679 attack_mode
= ATTACK_MODE_NONE
;
6683 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6688 if (potfile_disable
== 1)
6690 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6696 uint attack_kern
= ATTACK_KERN_NONE
;
6698 switch (attack_mode
)
6700 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6701 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6702 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6703 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6704 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6709 if (myargv
[optind
] != 0)
6711 log_error ("ERROR: Invalid argument for benchmark mode specified");
6716 if (attack_mode_chgd
== 1)
6718 if (attack_mode
!= ATTACK_MODE_BF
)
6720 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6728 if (stdout_flag
== 1) // no hash here
6735 int num_additional_params
= 1;
6737 if (attack_kern
== ATTACK_KERN_COMBI
)
6739 num_additional_params
= 2;
6742 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6744 if (keyspace_wordlist_specified
== 0) optind
--;
6747 if (attack_kern
== ATTACK_KERN_NONE
)
6749 if ((optind
+ 1) != myargc
)
6751 usage_mini_print (myargv
[0]);
6756 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6758 if ((optind
+ 1) > myargc
)
6760 usage_mini_print (myargv
[0]);
6765 else if (attack_kern
== ATTACK_KERN_COMBI
)
6767 if ((optind
+ 3) != myargc
)
6769 usage_mini_print (myargv
[0]);
6774 else if (attack_kern
== ATTACK_KERN_BF
)
6776 if ((optind
+ 1) > myargc
)
6778 usage_mini_print (myargv
[0]);
6785 usage_mini_print (myargv
[0]);
6791 if (skip
!= 0 && limit
!= 0)
6800 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
6806 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
6811 potfile_disable
= 1;
6813 restore_disable
= 1;
6817 weak_hash_threshold
= 0;
6822 if (stdout_flag
== 1)
6826 restore_disable
= 1;
6828 potfile_disable
= 1;
6829 weak_hash_threshold
= 0;
6830 gpu_temp_disable
= 1;
6833 outfile_format
= OUTFILE_FMT_PLAIN
;
6834 kernel_accel
= 1024;
6835 kernel_loops
= 1024;
6837 outfile_check_timer
= 0;
6839 opencl_vector_width
= 1;
6842 if (remove_timer_chgd
== 1)
6846 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6851 if (remove_timer
< 1)
6853 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6861 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6863 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6865 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6872 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6880 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6882 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6887 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6889 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6897 log_error ("ERROR: Invalid debug-mode specified");
6902 if (debug_file
!= NULL
)
6906 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6912 if (induction_dir
!= NULL
)
6914 if (attack_mode
== ATTACK_MODE_BF
)
6916 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6922 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6924 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6926 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6931 weak_hash_threshold
= 0;
6934 if (nvidia_spin_damp
> 100)
6936 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
6943 * induction directory
6946 char *induction_directory
= NULL
;
6948 if (attack_mode
!= ATTACK_MODE_BF
)
6950 if (induction_dir
== NULL
)
6952 induction_directory
= (char *) mymalloc (session_size
);
6954 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6956 // create induction folder if it does not already exist
6960 if (rmdir (induction_directory
) == -1)
6962 if (errno
== ENOENT
)
6964 // good, we can ignore
6966 else if (errno
== ENOTEMPTY
)
6968 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6970 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6972 if (rename (induction_directory
, induction_directory_mv
) != 0)
6974 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6981 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6987 if (mkdir (induction_directory
, 0700) == -1)
6989 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6997 induction_directory
= induction_dir
;
7001 data
.induction_directory
= induction_directory
;
7007 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7009 char *loopback_file
= (char *) mymalloc (loopback_size
);
7015 char tuning_db_file
[256] = { 0 };
7017 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7019 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7022 * outfile-check directory
7025 char *outfile_check_directory
= NULL
;
7027 if (outfile_check_dir
== NULL
)
7029 outfile_check_directory
= (char *) mymalloc (session_size
);
7031 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7035 outfile_check_directory
= outfile_check_dir
;
7038 data
.outfile_check_directory
= outfile_check_directory
;
7042 struct stat outfile_check_stat
;
7044 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7046 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7050 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7055 else if (outfile_check_dir
== NULL
)
7057 if (mkdir (outfile_check_directory
, 0700) == -1)
7059 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7067 * special other stuff
7070 if (hash_mode
== 9710)
7073 outfile_format_chgd
= 1;
7076 if (hash_mode
== 9810)
7079 outfile_format_chgd
= 1;
7082 if (hash_mode
== 10410)
7085 outfile_format_chgd
= 1;
7092 data
.hash_mode
= hash_mode
;
7093 data
.restore
= restore
;
7094 data
.restore_timer
= restore_timer
;
7095 data
.restore_disable
= restore_disable
;
7096 data
.status
= status
;
7097 data
.status_timer
= status_timer
;
7098 data
.machine_readable
= machine_readable
;
7099 data
.loopback
= loopback
;
7100 data
.runtime
= runtime
;
7101 data
.remove
= remove
;
7102 data
.remove_timer
= remove_timer
;
7103 data
.debug_mode
= debug_mode
;
7104 data
.debug_file
= debug_file
;
7105 data
.username
= username
;
7107 data
.outfile
= outfile
;
7108 data
.outfile_format
= outfile_format
;
7109 data
.outfile_autohex
= outfile_autohex
;
7110 data
.hex_charset
= hex_charset
;
7111 data
.hex_salt
= hex_salt
;
7112 data
.hex_wordlist
= hex_wordlist
;
7113 data
.separator
= separator
;
7114 data
.rp_files
= rp_files
;
7115 data
.rp_files_cnt
= rp_files_cnt
;
7116 data
.rp_gen
= rp_gen
;
7117 data
.rp_gen_seed
= rp_gen_seed
;
7119 data
.benchmark
= benchmark
;
7123 data
.powertune_enable
= powertune_enable
;
7125 data
.logfile_disable
= logfile_disable
;
7126 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7127 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7128 data
.veracrypt_pim
= veracrypt_pim
;
7129 data
.scrypt_tmto
= scrypt_tmto
;
7130 data
.workload_profile
= workload_profile
;
7138 set_cpu_affinity (cpu_affinity
);
7141 if (rp_gen_seed_chgd
== 0)
7147 srand (rp_gen_seed
);
7154 if (logfile_disable
== 0)
7156 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7158 char *logfile
= (char *) mymalloc (logfile_size
);
7160 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7162 data
.logfile
= logfile
;
7164 char *topid
= logfile_generate_topid ();
7169 // logfile_append() checks for logfile_disable internally to make it easier from here
7171 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7172 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7173 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7174 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7175 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7176 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7177 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7178 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7179 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7180 #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));
7182 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7183 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7184 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7185 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7186 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7187 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7188 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7189 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7191 logfile_top_msg ("START");
7193 logfile_top_uint (attack_mode
);
7194 logfile_top_uint (attack_kern
);
7195 logfile_top_uint (benchmark
);
7196 logfile_top_uint (stdout_flag
);
7197 logfile_top_uint (bitmap_min
);
7198 logfile_top_uint (bitmap_max
);
7199 logfile_top_uint (debug_mode
);
7200 logfile_top_uint (force
);
7201 logfile_top_uint (kernel_accel
);
7202 logfile_top_uint (kernel_loops
);
7203 logfile_top_uint (nvidia_spin_damp
);
7204 logfile_top_uint (gpu_temp_disable
);
7206 logfile_top_uint (gpu_temp_abort
);
7207 logfile_top_uint (gpu_temp_retain
);
7209 logfile_top_uint (hash_mode
);
7210 logfile_top_uint (hex_charset
);
7211 logfile_top_uint (hex_salt
);
7212 logfile_top_uint (hex_wordlist
);
7213 logfile_top_uint (increment
);
7214 logfile_top_uint (increment_max
);
7215 logfile_top_uint (increment_min
);
7216 logfile_top_uint (keyspace
);
7217 logfile_top_uint (left
);
7218 logfile_top_uint (logfile_disable
);
7219 logfile_top_uint (loopback
);
7220 logfile_top_uint (markov_classic
);
7221 logfile_top_uint (markov_disable
);
7222 logfile_top_uint (markov_threshold
);
7223 logfile_top_uint (outfile_autohex
);
7224 logfile_top_uint (outfile_check_timer
);
7225 logfile_top_uint (outfile_format
);
7226 logfile_top_uint (potfile_disable
);
7227 logfile_top_string (potfile_path
);
7228 #if defined(HAVE_HWMON)
7229 logfile_top_uint (powertune_enable
);
7231 logfile_top_uint (scrypt_tmto
);
7232 logfile_top_uint (quiet
);
7233 logfile_top_uint (remove
);
7234 logfile_top_uint (remove_timer
);
7235 logfile_top_uint (restore
);
7236 logfile_top_uint (restore_disable
);
7237 logfile_top_uint (restore_timer
);
7238 logfile_top_uint (rp_gen
);
7239 logfile_top_uint (rp_gen_func_max
);
7240 logfile_top_uint (rp_gen_func_min
);
7241 logfile_top_uint (rp_gen_seed
);
7242 logfile_top_uint (runtime
);
7243 logfile_top_uint (segment_size
);
7244 logfile_top_uint (show
);
7245 logfile_top_uint (status
);
7246 logfile_top_uint (machine_readable
);
7247 logfile_top_uint (status_timer
);
7248 logfile_top_uint (usage
);
7249 logfile_top_uint (username
);
7250 logfile_top_uint (version
);
7251 logfile_top_uint (weak_hash_threshold
);
7252 logfile_top_uint (workload_profile
);
7253 logfile_top_uint64 (limit
);
7254 logfile_top_uint64 (skip
);
7255 logfile_top_char (separator
);
7256 logfile_top_string (cpu_affinity
);
7257 logfile_top_string (custom_charset_1
);
7258 logfile_top_string (custom_charset_2
);
7259 logfile_top_string (custom_charset_3
);
7260 logfile_top_string (custom_charset_4
);
7261 logfile_top_string (debug_file
);
7262 logfile_top_string (opencl_devices
);
7263 logfile_top_string (opencl_platforms
);
7264 logfile_top_string (opencl_device_types
);
7265 logfile_top_uint (opencl_vector_width
);
7266 logfile_top_string (induction_dir
);
7267 logfile_top_string (markov_hcstat
);
7268 logfile_top_string (outfile
);
7269 logfile_top_string (outfile_check_dir
);
7270 logfile_top_string (rule_buf_l
);
7271 logfile_top_string (rule_buf_r
);
7272 logfile_top_string (session
);
7273 logfile_top_string (truecrypt_keyfiles
);
7274 logfile_top_string (veracrypt_keyfiles
);
7275 logfile_top_uint (veracrypt_pim
);
7278 * Init OpenCL library loader
7283 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7291 * OpenCL platform selection
7294 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7297 * OpenCL device selection
7300 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7303 * OpenCL device type selection
7306 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7315 * disable useless stuff for benchmark
7320 restore_disable
= 1;
7321 potfile_disable
= 1;
7322 weak_hash_threshold
= 0;
7323 nvidia_spin_damp
= 0;
7324 gpu_temp_disable
= 1;
7325 outfile_check_timer
= 0;
7328 if (powertune_enable
== 1)
7330 gpu_temp_disable
= 0;
7334 data
.status_timer
= status_timer
;
7335 data
.restore_timer
= restore_timer
;
7336 data
.restore_disable
= restore_disable
;
7337 data
.outfile_check_timer
= outfile_check_timer
;
7340 * force attack mode to be bruteforce
7343 attack_mode
= ATTACK_MODE_BF
;
7344 attack_kern
= ATTACK_KERN_BF
;
7346 if (workload_profile_chgd
== 0)
7348 workload_profile
= 3;
7350 data
.workload_profile
= workload_profile
;
7355 * status, monitor and outfile remove threads
7358 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7360 data
.wordlist_mode
= wordlist_mode
;
7362 if (wordlist_mode
== WL_MODE_STDIN
)
7366 data
.status
= status
;
7369 uint outer_threads_cnt
= 0;
7371 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7373 data
.shutdown_outer
= 0;
7375 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7377 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7379 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7381 outer_threads_cnt
++;
7391 uint attack_exec
= 0;
7395 uint esalt_size
= 0;
7397 uint dgst_pos0
= -1;
7398 uint dgst_pos1
= -1;
7399 uint dgst_pos2
= -1;
7400 uint dgst_pos3
= -1;
7402 int (*parse_func
) (char *, uint
, hash_t
*);
7403 int (*sort_by_digest
) (const void *, const void *);
7405 uint algorithm_pos
= 0;
7406 uint algorithm_max
= 1;
7408 uint
*algorithms
= default_benchmark_algorithms
;
7410 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7412 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7415 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7416 * the following algos are skipped entirely
7419 if (algorithm_pos
> 0)
7423 rd
= init_restore (argc
, argv
);
7429 * update hash_mode in case of multihash benchmark
7434 if (hash_mode_chgd
== 0)
7436 hash_mode
= algorithms
[algorithm_pos
];
7438 data
.hash_mode
= hash_mode
;
7448 case 0: hash_type
= HASH_TYPE_MD5
;
7449 salt_type
= SALT_TYPE_NONE
;
7450 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7451 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7452 | OPTS_TYPE_PT_ADD80
7453 | OPTS_TYPE_PT_ADDBITS14
;
7454 kern_type
= KERN_TYPE_MD5
;
7455 dgst_size
= DGST_SIZE_4_4
;
7456 parse_func
= md5_parse_hash
;
7457 sort_by_digest
= sort_by_digest_4_4
;
7458 opti_type
= OPTI_TYPE_ZERO_BYTE
7459 | OPTI_TYPE_PRECOMPUTE_INIT
7460 | OPTI_TYPE_PRECOMPUTE_MERKLE
7461 | OPTI_TYPE_MEET_IN_MIDDLE
7462 | OPTI_TYPE_EARLY_SKIP
7463 | OPTI_TYPE_NOT_ITERATED
7464 | OPTI_TYPE_NOT_SALTED
7465 | OPTI_TYPE_RAW_HASH
;
7472 case 10: hash_type
= HASH_TYPE_MD5
;
7473 salt_type
= SALT_TYPE_INTERN
;
7474 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7476 | OPTS_TYPE_ST_ADD80
7477 | OPTS_TYPE_ST_ADDBITS14
;
7478 kern_type
= KERN_TYPE_MD5_PWSLT
;
7479 dgst_size
= DGST_SIZE_4_4
;
7480 parse_func
= md5s_parse_hash
;
7481 sort_by_digest
= sort_by_digest_4_4
;
7482 opti_type
= OPTI_TYPE_ZERO_BYTE
7483 | OPTI_TYPE_PRECOMPUTE_INIT
7484 | OPTI_TYPE_PRECOMPUTE_MERKLE
7485 | OPTI_TYPE_MEET_IN_MIDDLE
7486 | OPTI_TYPE_EARLY_SKIP
7487 | OPTI_TYPE_NOT_ITERATED
7488 | OPTI_TYPE_APPENDED_SALT
7489 | OPTI_TYPE_RAW_HASH
;
7496 case 11: hash_type
= HASH_TYPE_MD5
;
7497 salt_type
= SALT_TYPE_INTERN
;
7498 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7500 | OPTS_TYPE_ST_ADD80
7501 | OPTS_TYPE_ST_ADDBITS14
;
7502 kern_type
= KERN_TYPE_MD5_PWSLT
;
7503 dgst_size
= DGST_SIZE_4_4
;
7504 parse_func
= joomla_parse_hash
;
7505 sort_by_digest
= sort_by_digest_4_4
;
7506 opti_type
= OPTI_TYPE_ZERO_BYTE
7507 | OPTI_TYPE_PRECOMPUTE_INIT
7508 | OPTI_TYPE_PRECOMPUTE_MERKLE
7509 | OPTI_TYPE_MEET_IN_MIDDLE
7510 | OPTI_TYPE_EARLY_SKIP
7511 | OPTI_TYPE_NOT_ITERATED
7512 | OPTI_TYPE_APPENDED_SALT
7513 | OPTI_TYPE_RAW_HASH
;
7520 case 12: hash_type
= HASH_TYPE_MD5
;
7521 salt_type
= SALT_TYPE_INTERN
;
7522 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7523 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7524 | OPTS_TYPE_ST_ADD80
7525 | OPTS_TYPE_ST_ADDBITS14
;
7526 kern_type
= KERN_TYPE_MD5_PWSLT
;
7527 dgst_size
= DGST_SIZE_4_4
;
7528 parse_func
= postgresql_parse_hash
;
7529 sort_by_digest
= sort_by_digest_4_4
;
7530 opti_type
= OPTI_TYPE_ZERO_BYTE
7531 | OPTI_TYPE_PRECOMPUTE_INIT
7532 | OPTI_TYPE_PRECOMPUTE_MERKLE
7533 | OPTI_TYPE_MEET_IN_MIDDLE
7534 | OPTI_TYPE_EARLY_SKIP
7535 | OPTI_TYPE_NOT_ITERATED
7536 | OPTI_TYPE_APPENDED_SALT
7537 | OPTI_TYPE_RAW_HASH
;
7544 case 20: hash_type
= HASH_TYPE_MD5
;
7545 salt_type
= SALT_TYPE_INTERN
;
7546 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7547 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7548 | OPTS_TYPE_PT_ADD80
7549 | OPTS_TYPE_PT_ADDBITS14
;
7550 kern_type
= KERN_TYPE_MD5_SLTPW
;
7551 dgst_size
= DGST_SIZE_4_4
;
7552 parse_func
= md5s_parse_hash
;
7553 sort_by_digest
= sort_by_digest_4_4
;
7554 opti_type
= OPTI_TYPE_ZERO_BYTE
7555 | OPTI_TYPE_PRECOMPUTE_INIT
7556 | OPTI_TYPE_PRECOMPUTE_MERKLE
7557 | OPTI_TYPE_EARLY_SKIP
7558 | OPTI_TYPE_NOT_ITERATED
7559 | OPTI_TYPE_PREPENDED_SALT
7560 | OPTI_TYPE_RAW_HASH
;
7567 case 21: hash_type
= HASH_TYPE_MD5
;
7568 salt_type
= SALT_TYPE_INTERN
;
7569 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7570 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7571 | OPTS_TYPE_PT_ADD80
7572 | OPTS_TYPE_PT_ADDBITS14
;
7573 kern_type
= KERN_TYPE_MD5_SLTPW
;
7574 dgst_size
= DGST_SIZE_4_4
;
7575 parse_func
= osc_parse_hash
;
7576 sort_by_digest
= sort_by_digest_4_4
;
7577 opti_type
= OPTI_TYPE_ZERO_BYTE
7578 | OPTI_TYPE_PRECOMPUTE_INIT
7579 | OPTI_TYPE_PRECOMPUTE_MERKLE
7580 | OPTI_TYPE_EARLY_SKIP
7581 | OPTI_TYPE_NOT_ITERATED
7582 | OPTI_TYPE_PREPENDED_SALT
7583 | OPTI_TYPE_RAW_HASH
;
7590 case 22: hash_type
= HASH_TYPE_MD5
;
7591 salt_type
= SALT_TYPE_EMBEDDED
;
7592 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7593 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7594 | OPTS_TYPE_PT_ADD80
7595 | OPTS_TYPE_PT_ADDBITS14
;
7596 kern_type
= KERN_TYPE_MD5_SLTPW
;
7597 dgst_size
= DGST_SIZE_4_4
;
7598 parse_func
= netscreen_parse_hash
;
7599 sort_by_digest
= sort_by_digest_4_4
;
7600 opti_type
= OPTI_TYPE_ZERO_BYTE
7601 | OPTI_TYPE_PRECOMPUTE_INIT
7602 | OPTI_TYPE_PRECOMPUTE_MERKLE
7603 | OPTI_TYPE_EARLY_SKIP
7604 | OPTI_TYPE_NOT_ITERATED
7605 | OPTI_TYPE_PREPENDED_SALT
7606 | OPTI_TYPE_RAW_HASH
;
7613 case 23: hash_type
= HASH_TYPE_MD5
;
7614 salt_type
= SALT_TYPE_EMBEDDED
;
7615 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7616 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7617 | OPTS_TYPE_PT_ADD80
7618 | OPTS_TYPE_PT_ADDBITS14
;
7619 kern_type
= KERN_TYPE_MD5_SLTPW
;
7620 dgst_size
= DGST_SIZE_4_4
;
7621 parse_func
= skype_parse_hash
;
7622 sort_by_digest
= sort_by_digest_4_4
;
7623 opti_type
= OPTI_TYPE_ZERO_BYTE
7624 | OPTI_TYPE_PRECOMPUTE_INIT
7625 | OPTI_TYPE_PRECOMPUTE_MERKLE
7626 | OPTI_TYPE_EARLY_SKIP
7627 | OPTI_TYPE_NOT_ITERATED
7628 | OPTI_TYPE_PREPENDED_SALT
7629 | OPTI_TYPE_RAW_HASH
;
7636 case 30: hash_type
= HASH_TYPE_MD5
;
7637 salt_type
= SALT_TYPE_INTERN
;
7638 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7639 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7640 | OPTS_TYPE_PT_UNICODE
7641 | OPTS_TYPE_ST_ADD80
7642 | OPTS_TYPE_ST_ADDBITS14
;
7643 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7644 dgst_size
= DGST_SIZE_4_4
;
7645 parse_func
= md5s_parse_hash
;
7646 sort_by_digest
= sort_by_digest_4_4
;
7647 opti_type
= OPTI_TYPE_ZERO_BYTE
7648 | OPTI_TYPE_PRECOMPUTE_INIT
7649 | OPTI_TYPE_PRECOMPUTE_MERKLE
7650 | OPTI_TYPE_MEET_IN_MIDDLE
7651 | OPTI_TYPE_EARLY_SKIP
7652 | OPTI_TYPE_NOT_ITERATED
7653 | OPTI_TYPE_APPENDED_SALT
7654 | OPTI_TYPE_RAW_HASH
;
7661 case 40: hash_type
= HASH_TYPE_MD5
;
7662 salt_type
= SALT_TYPE_INTERN
;
7663 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7664 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7665 | OPTS_TYPE_PT_ADD80
7666 | OPTS_TYPE_PT_ADDBITS14
7667 | OPTS_TYPE_PT_UNICODE
;
7668 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7669 dgst_size
= DGST_SIZE_4_4
;
7670 parse_func
= md5s_parse_hash
;
7671 sort_by_digest
= sort_by_digest_4_4
;
7672 opti_type
= OPTI_TYPE_ZERO_BYTE
7673 | OPTI_TYPE_PRECOMPUTE_INIT
7674 | OPTI_TYPE_PRECOMPUTE_MERKLE
7675 | OPTI_TYPE_EARLY_SKIP
7676 | OPTI_TYPE_NOT_ITERATED
7677 | OPTI_TYPE_PREPENDED_SALT
7678 | OPTI_TYPE_RAW_HASH
;
7685 case 50: hash_type
= HASH_TYPE_MD5
;
7686 salt_type
= SALT_TYPE_INTERN
;
7687 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7688 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7689 | OPTS_TYPE_ST_ADD80
7690 | OPTS_TYPE_ST_ADDBITS14
;
7691 kern_type
= KERN_TYPE_HMACMD5_PW
;
7692 dgst_size
= DGST_SIZE_4_4
;
7693 parse_func
= hmacmd5_parse_hash
;
7694 sort_by_digest
= sort_by_digest_4_4
;
7695 opti_type
= OPTI_TYPE_ZERO_BYTE
7696 | OPTI_TYPE_NOT_ITERATED
;
7703 case 60: hash_type
= HASH_TYPE_MD5
;
7704 salt_type
= SALT_TYPE_INTERN
;
7705 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7706 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7707 | OPTS_TYPE_PT_ADD80
7708 | OPTS_TYPE_PT_ADDBITS14
;
7709 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7710 dgst_size
= DGST_SIZE_4_4
;
7711 parse_func
= hmacmd5_parse_hash
;
7712 sort_by_digest
= sort_by_digest_4_4
;
7713 opti_type
= OPTI_TYPE_ZERO_BYTE
7714 | OPTI_TYPE_NOT_ITERATED
;
7721 case 100: hash_type
= HASH_TYPE_SHA1
;
7722 salt_type
= SALT_TYPE_NONE
;
7723 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7724 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7725 | OPTS_TYPE_PT_ADD80
7726 | OPTS_TYPE_PT_ADDBITS15
;
7727 kern_type
= KERN_TYPE_SHA1
;
7728 dgst_size
= DGST_SIZE_4_5
;
7729 parse_func
= sha1_parse_hash
;
7730 sort_by_digest
= sort_by_digest_4_5
;
7731 opti_type
= OPTI_TYPE_ZERO_BYTE
7732 | OPTI_TYPE_PRECOMPUTE_INIT
7733 | OPTI_TYPE_PRECOMPUTE_MERKLE
7734 | OPTI_TYPE_EARLY_SKIP
7735 | OPTI_TYPE_NOT_ITERATED
7736 | OPTI_TYPE_NOT_SALTED
7737 | OPTI_TYPE_RAW_HASH
;
7744 case 101: hash_type
= HASH_TYPE_SHA1
;
7745 salt_type
= SALT_TYPE_NONE
;
7746 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7747 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7748 | OPTS_TYPE_PT_ADD80
7749 | OPTS_TYPE_PT_ADDBITS15
;
7750 kern_type
= KERN_TYPE_SHA1
;
7751 dgst_size
= DGST_SIZE_4_5
;
7752 parse_func
= sha1b64_parse_hash
;
7753 sort_by_digest
= sort_by_digest_4_5
;
7754 opti_type
= OPTI_TYPE_ZERO_BYTE
7755 | OPTI_TYPE_PRECOMPUTE_INIT
7756 | OPTI_TYPE_PRECOMPUTE_MERKLE
7757 | OPTI_TYPE_EARLY_SKIP
7758 | OPTI_TYPE_NOT_ITERATED
7759 | OPTI_TYPE_NOT_SALTED
7760 | OPTI_TYPE_RAW_HASH
;
7767 case 110: hash_type
= HASH_TYPE_SHA1
;
7768 salt_type
= SALT_TYPE_INTERN
;
7769 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7770 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7771 | OPTS_TYPE_ST_ADD80
7772 | OPTS_TYPE_ST_ADDBITS15
;
7773 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7774 dgst_size
= DGST_SIZE_4_5
;
7775 parse_func
= sha1s_parse_hash
;
7776 sort_by_digest
= sort_by_digest_4_5
;
7777 opti_type
= OPTI_TYPE_ZERO_BYTE
7778 | OPTI_TYPE_PRECOMPUTE_INIT
7779 | OPTI_TYPE_PRECOMPUTE_MERKLE
7780 | OPTI_TYPE_EARLY_SKIP
7781 | OPTI_TYPE_NOT_ITERATED
7782 | OPTI_TYPE_APPENDED_SALT
7783 | OPTI_TYPE_RAW_HASH
;
7790 case 111: hash_type
= HASH_TYPE_SHA1
;
7791 salt_type
= SALT_TYPE_EMBEDDED
;
7792 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7793 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7794 | OPTS_TYPE_ST_ADD80
7795 | OPTS_TYPE_ST_ADDBITS15
;
7796 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7797 dgst_size
= DGST_SIZE_4_5
;
7798 parse_func
= sha1b64s_parse_hash
;
7799 sort_by_digest
= sort_by_digest_4_5
;
7800 opti_type
= OPTI_TYPE_ZERO_BYTE
7801 | OPTI_TYPE_PRECOMPUTE_INIT
7802 | OPTI_TYPE_PRECOMPUTE_MERKLE
7803 | OPTI_TYPE_EARLY_SKIP
7804 | OPTI_TYPE_NOT_ITERATED
7805 | OPTI_TYPE_APPENDED_SALT
7806 | OPTI_TYPE_RAW_HASH
;
7813 case 112: hash_type
= HASH_TYPE_SHA1
;
7814 salt_type
= SALT_TYPE_INTERN
;
7815 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7816 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7817 | OPTS_TYPE_ST_ADD80
7818 | OPTS_TYPE_ST_ADDBITS15
7820 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7821 dgst_size
= DGST_SIZE_4_5
;
7822 parse_func
= oracles_parse_hash
;
7823 sort_by_digest
= sort_by_digest_4_5
;
7824 opti_type
= OPTI_TYPE_ZERO_BYTE
7825 | OPTI_TYPE_PRECOMPUTE_INIT
7826 | OPTI_TYPE_PRECOMPUTE_MERKLE
7827 | OPTI_TYPE_EARLY_SKIP
7828 | OPTI_TYPE_NOT_ITERATED
7829 | OPTI_TYPE_APPENDED_SALT
7830 | OPTI_TYPE_RAW_HASH
;
7837 case 120: hash_type
= HASH_TYPE_SHA1
;
7838 salt_type
= SALT_TYPE_INTERN
;
7839 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7840 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7841 | OPTS_TYPE_PT_ADD80
7842 | OPTS_TYPE_PT_ADDBITS15
;
7843 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7844 dgst_size
= DGST_SIZE_4_5
;
7845 parse_func
= sha1s_parse_hash
;
7846 sort_by_digest
= sort_by_digest_4_5
;
7847 opti_type
= OPTI_TYPE_ZERO_BYTE
7848 | OPTI_TYPE_PRECOMPUTE_INIT
7849 | OPTI_TYPE_PRECOMPUTE_MERKLE
7850 | OPTI_TYPE_EARLY_SKIP
7851 | OPTI_TYPE_NOT_ITERATED
7852 | OPTI_TYPE_PREPENDED_SALT
7853 | OPTI_TYPE_RAW_HASH
;
7860 case 121: hash_type
= HASH_TYPE_SHA1
;
7861 salt_type
= SALT_TYPE_INTERN
;
7862 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7863 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7864 | OPTS_TYPE_PT_ADD80
7865 | OPTS_TYPE_PT_ADDBITS15
7866 | OPTS_TYPE_ST_LOWER
;
7867 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7868 dgst_size
= DGST_SIZE_4_5
;
7869 parse_func
= smf_parse_hash
;
7870 sort_by_digest
= sort_by_digest_4_5
;
7871 opti_type
= OPTI_TYPE_ZERO_BYTE
7872 | OPTI_TYPE_PRECOMPUTE_INIT
7873 | OPTI_TYPE_PRECOMPUTE_MERKLE
7874 | OPTI_TYPE_EARLY_SKIP
7875 | OPTI_TYPE_NOT_ITERATED
7876 | OPTI_TYPE_PREPENDED_SALT
7877 | OPTI_TYPE_RAW_HASH
;
7884 case 122: hash_type
= HASH_TYPE_SHA1
;
7885 salt_type
= SALT_TYPE_EMBEDDED
;
7886 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7887 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7888 | OPTS_TYPE_PT_ADD80
7889 | OPTS_TYPE_PT_ADDBITS15
7891 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7892 dgst_size
= DGST_SIZE_4_5
;
7893 parse_func
= osx1_parse_hash
;
7894 sort_by_digest
= sort_by_digest_4_5
;
7895 opti_type
= OPTI_TYPE_ZERO_BYTE
7896 | OPTI_TYPE_PRECOMPUTE_INIT
7897 | OPTI_TYPE_PRECOMPUTE_MERKLE
7898 | OPTI_TYPE_EARLY_SKIP
7899 | OPTI_TYPE_NOT_ITERATED
7900 | OPTI_TYPE_PREPENDED_SALT
7901 | OPTI_TYPE_RAW_HASH
;
7908 case 124: hash_type
= HASH_TYPE_SHA1
;
7909 salt_type
= SALT_TYPE_EMBEDDED
;
7910 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7911 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7912 | OPTS_TYPE_PT_ADD80
7913 | OPTS_TYPE_PT_ADDBITS15
;
7914 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7915 dgst_size
= DGST_SIZE_4_5
;
7916 parse_func
= djangosha1_parse_hash
;
7917 sort_by_digest
= sort_by_digest_4_5
;
7918 opti_type
= OPTI_TYPE_ZERO_BYTE
7919 | OPTI_TYPE_PRECOMPUTE_INIT
7920 | OPTI_TYPE_PRECOMPUTE_MERKLE
7921 | OPTI_TYPE_EARLY_SKIP
7922 | OPTI_TYPE_NOT_ITERATED
7923 | OPTI_TYPE_PREPENDED_SALT
7924 | OPTI_TYPE_RAW_HASH
;
7931 case 125: hash_type
= HASH_TYPE_SHA1
;
7932 salt_type
= SALT_TYPE_EMBEDDED
;
7933 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7934 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7935 | OPTS_TYPE_PT_ADD80
7936 | OPTS_TYPE_PT_ADDBITS15
7938 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7939 dgst_size
= DGST_SIZE_4_5
;
7940 parse_func
= arubaos_parse_hash
;
7941 sort_by_digest
= sort_by_digest_4_5
;
7942 opti_type
= OPTI_TYPE_ZERO_BYTE
7943 | OPTI_TYPE_PRECOMPUTE_INIT
7944 | OPTI_TYPE_PRECOMPUTE_MERKLE
7945 | OPTI_TYPE_EARLY_SKIP
7946 | OPTI_TYPE_NOT_ITERATED
7947 | OPTI_TYPE_PREPENDED_SALT
7948 | OPTI_TYPE_RAW_HASH
;
7955 case 130: hash_type
= HASH_TYPE_SHA1
;
7956 salt_type
= SALT_TYPE_INTERN
;
7957 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7958 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7959 | OPTS_TYPE_PT_UNICODE
7960 | OPTS_TYPE_ST_ADD80
7961 | OPTS_TYPE_ST_ADDBITS15
;
7962 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7963 dgst_size
= DGST_SIZE_4_5
;
7964 parse_func
= sha1s_parse_hash
;
7965 sort_by_digest
= sort_by_digest_4_5
;
7966 opti_type
= OPTI_TYPE_ZERO_BYTE
7967 | OPTI_TYPE_PRECOMPUTE_INIT
7968 | OPTI_TYPE_PRECOMPUTE_MERKLE
7969 | OPTI_TYPE_EARLY_SKIP
7970 | OPTI_TYPE_NOT_ITERATED
7971 | OPTI_TYPE_APPENDED_SALT
7972 | OPTI_TYPE_RAW_HASH
;
7979 case 131: hash_type
= HASH_TYPE_SHA1
;
7980 salt_type
= SALT_TYPE_EMBEDDED
;
7981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7982 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7983 | OPTS_TYPE_PT_UNICODE
7984 | OPTS_TYPE_PT_UPPER
7985 | OPTS_TYPE_ST_ADD80
7986 | OPTS_TYPE_ST_ADDBITS15
7988 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7989 dgst_size
= DGST_SIZE_4_5
;
7990 parse_func
= mssql2000_parse_hash
;
7991 sort_by_digest
= sort_by_digest_4_5
;
7992 opti_type
= OPTI_TYPE_ZERO_BYTE
7993 | OPTI_TYPE_PRECOMPUTE_INIT
7994 | OPTI_TYPE_PRECOMPUTE_MERKLE
7995 | OPTI_TYPE_EARLY_SKIP
7996 | OPTI_TYPE_NOT_ITERATED
7997 | OPTI_TYPE_APPENDED_SALT
7998 | OPTI_TYPE_RAW_HASH
;
8005 case 132: hash_type
= HASH_TYPE_SHA1
;
8006 salt_type
= SALT_TYPE_EMBEDDED
;
8007 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8008 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8009 | OPTS_TYPE_PT_UNICODE
8010 | OPTS_TYPE_ST_ADD80
8011 | OPTS_TYPE_ST_ADDBITS15
8013 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8014 dgst_size
= DGST_SIZE_4_5
;
8015 parse_func
= mssql2005_parse_hash
;
8016 sort_by_digest
= sort_by_digest_4_5
;
8017 opti_type
= OPTI_TYPE_ZERO_BYTE
8018 | OPTI_TYPE_PRECOMPUTE_INIT
8019 | OPTI_TYPE_PRECOMPUTE_MERKLE
8020 | OPTI_TYPE_EARLY_SKIP
8021 | OPTI_TYPE_NOT_ITERATED
8022 | OPTI_TYPE_APPENDED_SALT
8023 | OPTI_TYPE_RAW_HASH
;
8030 case 133: hash_type
= HASH_TYPE_SHA1
;
8031 salt_type
= SALT_TYPE_EMBEDDED
;
8032 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8033 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8034 | OPTS_TYPE_PT_UNICODE
8035 | OPTS_TYPE_ST_ADD80
8036 | OPTS_TYPE_ST_ADDBITS15
;
8037 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8038 dgst_size
= DGST_SIZE_4_5
;
8039 parse_func
= peoplesoft_parse_hash
;
8040 sort_by_digest
= sort_by_digest_4_5
;
8041 opti_type
= OPTI_TYPE_ZERO_BYTE
8042 | OPTI_TYPE_PRECOMPUTE_INIT
8043 | OPTI_TYPE_PRECOMPUTE_MERKLE
8044 | OPTI_TYPE_EARLY_SKIP
8045 | OPTI_TYPE_NOT_ITERATED
8046 | OPTI_TYPE_APPENDED_SALT
8047 | OPTI_TYPE_RAW_HASH
;
8054 case 140: hash_type
= HASH_TYPE_SHA1
;
8055 salt_type
= SALT_TYPE_INTERN
;
8056 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8057 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8058 | OPTS_TYPE_PT_ADD80
8059 | OPTS_TYPE_PT_ADDBITS15
8060 | OPTS_TYPE_PT_UNICODE
;
8061 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8062 dgst_size
= DGST_SIZE_4_5
;
8063 parse_func
= sha1s_parse_hash
;
8064 sort_by_digest
= sort_by_digest_4_5
;
8065 opti_type
= OPTI_TYPE_ZERO_BYTE
8066 | OPTI_TYPE_PRECOMPUTE_INIT
8067 | OPTI_TYPE_PRECOMPUTE_MERKLE
8068 | OPTI_TYPE_EARLY_SKIP
8069 | OPTI_TYPE_NOT_ITERATED
8070 | OPTI_TYPE_PREPENDED_SALT
8071 | OPTI_TYPE_RAW_HASH
;
8078 case 141: hash_type
= HASH_TYPE_SHA1
;
8079 salt_type
= SALT_TYPE_EMBEDDED
;
8080 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8081 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8082 | OPTS_TYPE_PT_ADD80
8083 | OPTS_TYPE_PT_ADDBITS15
8084 | OPTS_TYPE_PT_UNICODE
8085 | OPTS_TYPE_ST_BASE64
;
8086 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8087 dgst_size
= DGST_SIZE_4_5
;
8088 parse_func
= episerver_parse_hash
;
8089 sort_by_digest
= sort_by_digest_4_5
;
8090 opti_type
= OPTI_TYPE_ZERO_BYTE
8091 | OPTI_TYPE_PRECOMPUTE_INIT
8092 | OPTI_TYPE_PRECOMPUTE_MERKLE
8093 | OPTI_TYPE_EARLY_SKIP
8094 | OPTI_TYPE_NOT_ITERATED
8095 | OPTI_TYPE_PREPENDED_SALT
8096 | OPTI_TYPE_RAW_HASH
;
8103 case 150: hash_type
= HASH_TYPE_SHA1
;
8104 salt_type
= SALT_TYPE_INTERN
;
8105 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8106 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8107 | OPTS_TYPE_ST_ADD80
8108 | OPTS_TYPE_ST_ADDBITS15
;
8109 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8110 dgst_size
= DGST_SIZE_4_5
;
8111 parse_func
= hmacsha1_parse_hash
;
8112 sort_by_digest
= sort_by_digest_4_5
;
8113 opti_type
= OPTI_TYPE_ZERO_BYTE
8114 | OPTI_TYPE_NOT_ITERATED
;
8121 case 160: hash_type
= HASH_TYPE_SHA1
;
8122 salt_type
= SALT_TYPE_INTERN
;
8123 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8124 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8125 | OPTS_TYPE_PT_ADD80
8126 | OPTS_TYPE_PT_ADDBITS15
;
8127 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8128 dgst_size
= DGST_SIZE_4_5
;
8129 parse_func
= hmacsha1_parse_hash
;
8130 sort_by_digest
= sort_by_digest_4_5
;
8131 opti_type
= OPTI_TYPE_ZERO_BYTE
8132 | OPTI_TYPE_NOT_ITERATED
;
8139 case 200: hash_type
= HASH_TYPE_MYSQL
;
8140 salt_type
= SALT_TYPE_NONE
;
8141 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8143 kern_type
= KERN_TYPE_MYSQL
;
8144 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8145 parse_func
= mysql323_parse_hash
;
8146 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8147 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8154 case 300: hash_type
= HASH_TYPE_SHA1
;
8155 salt_type
= SALT_TYPE_NONE
;
8156 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8157 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8158 | OPTS_TYPE_PT_ADD80
8159 | OPTS_TYPE_PT_ADDBITS15
;
8160 kern_type
= KERN_TYPE_MYSQL41
;
8161 dgst_size
= DGST_SIZE_4_5
;
8162 parse_func
= sha1_parse_hash
;
8163 sort_by_digest
= sort_by_digest_4_5
;
8164 opti_type
= OPTI_TYPE_ZERO_BYTE
8165 | OPTI_TYPE_PRECOMPUTE_INIT
8166 | OPTI_TYPE_PRECOMPUTE_MERKLE
8167 | OPTI_TYPE_EARLY_SKIP
8168 | OPTI_TYPE_NOT_ITERATED
8169 | OPTI_TYPE_NOT_SALTED
;
8176 case 400: hash_type
= HASH_TYPE_MD5
;
8177 salt_type
= SALT_TYPE_EMBEDDED
;
8178 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8179 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8180 kern_type
= KERN_TYPE_PHPASS
;
8181 dgst_size
= DGST_SIZE_4_4
;
8182 parse_func
= phpass_parse_hash
;
8183 sort_by_digest
= sort_by_digest_4_4
;
8184 opti_type
= OPTI_TYPE_ZERO_BYTE
8185 | OPTI_TYPE_SLOW_HASH_SIMD
;
8192 case 500: hash_type
= HASH_TYPE_MD5
;
8193 salt_type
= SALT_TYPE_EMBEDDED
;
8194 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8195 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8196 kern_type
= KERN_TYPE_MD5CRYPT
;
8197 dgst_size
= DGST_SIZE_4_4
;
8198 parse_func
= md5crypt_parse_hash
;
8199 sort_by_digest
= sort_by_digest_4_4
;
8200 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8207 case 501: hash_type
= HASH_TYPE_MD5
;
8208 salt_type
= SALT_TYPE_EMBEDDED
;
8209 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8210 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8211 | OPTS_TYPE_HASH_COPY
;
8212 kern_type
= KERN_TYPE_MD5CRYPT
;
8213 dgst_size
= DGST_SIZE_4_4
;
8214 parse_func
= juniper_parse_hash
;
8215 sort_by_digest
= sort_by_digest_4_4
;
8216 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8223 case 900: hash_type
= HASH_TYPE_MD4
;
8224 salt_type
= SALT_TYPE_NONE
;
8225 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8226 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8227 | OPTS_TYPE_PT_ADD80
8228 | OPTS_TYPE_PT_ADDBITS14
;
8229 kern_type
= KERN_TYPE_MD4
;
8230 dgst_size
= DGST_SIZE_4_4
;
8231 parse_func
= md4_parse_hash
;
8232 sort_by_digest
= sort_by_digest_4_4
;
8233 opti_type
= OPTI_TYPE_ZERO_BYTE
8234 | OPTI_TYPE_PRECOMPUTE_INIT
8235 | OPTI_TYPE_PRECOMPUTE_MERKLE
8236 | OPTI_TYPE_MEET_IN_MIDDLE
8237 | OPTI_TYPE_EARLY_SKIP
8238 | OPTI_TYPE_NOT_ITERATED
8239 | OPTI_TYPE_NOT_SALTED
8240 | OPTI_TYPE_RAW_HASH
;
8247 case 1000: hash_type
= HASH_TYPE_MD4
;
8248 salt_type
= SALT_TYPE_NONE
;
8249 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8250 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8251 | OPTS_TYPE_PT_ADD80
8252 | OPTS_TYPE_PT_ADDBITS14
8253 | OPTS_TYPE_PT_UNICODE
;
8254 kern_type
= KERN_TYPE_MD4_PWU
;
8255 dgst_size
= DGST_SIZE_4_4
;
8256 parse_func
= md4_parse_hash
;
8257 sort_by_digest
= sort_by_digest_4_4
;
8258 opti_type
= OPTI_TYPE_ZERO_BYTE
8259 | OPTI_TYPE_PRECOMPUTE_INIT
8260 | OPTI_TYPE_PRECOMPUTE_MERKLE
8261 | OPTI_TYPE_MEET_IN_MIDDLE
8262 | OPTI_TYPE_EARLY_SKIP
8263 | OPTI_TYPE_NOT_ITERATED
8264 | OPTI_TYPE_NOT_SALTED
8265 | OPTI_TYPE_RAW_HASH
;
8272 case 1100: hash_type
= HASH_TYPE_MD4
;
8273 salt_type
= SALT_TYPE_INTERN
;
8274 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8275 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8276 | OPTS_TYPE_PT_ADD80
8277 | OPTS_TYPE_PT_ADDBITS14
8278 | OPTS_TYPE_PT_UNICODE
8279 | OPTS_TYPE_ST_ADD80
8280 | OPTS_TYPE_ST_UNICODE
8281 | OPTS_TYPE_ST_LOWER
;
8282 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8283 dgst_size
= DGST_SIZE_4_4
;
8284 parse_func
= dcc_parse_hash
;
8285 sort_by_digest
= sort_by_digest_4_4
;
8286 opti_type
= OPTI_TYPE_ZERO_BYTE
8287 | OPTI_TYPE_PRECOMPUTE_INIT
8288 | OPTI_TYPE_PRECOMPUTE_MERKLE
8289 | OPTI_TYPE_EARLY_SKIP
8290 | OPTI_TYPE_NOT_ITERATED
;
8297 case 1400: hash_type
= HASH_TYPE_SHA256
;
8298 salt_type
= SALT_TYPE_NONE
;
8299 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8300 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8301 | OPTS_TYPE_PT_ADD80
8302 | OPTS_TYPE_PT_ADDBITS15
;
8303 kern_type
= KERN_TYPE_SHA256
;
8304 dgst_size
= DGST_SIZE_4_8
;
8305 parse_func
= sha256_parse_hash
;
8306 sort_by_digest
= sort_by_digest_4_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_NOT_SALTED
8313 | OPTI_TYPE_RAW_HASH
;
8320 case 1410: hash_type
= HASH_TYPE_SHA256
;
8321 salt_type
= SALT_TYPE_INTERN
;
8322 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8323 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8324 | OPTS_TYPE_ST_ADD80
8325 | OPTS_TYPE_ST_ADDBITS15
;
8326 kern_type
= KERN_TYPE_SHA256_PWSLT
;
8327 dgst_size
= DGST_SIZE_4_8
;
8328 parse_func
= sha256s_parse_hash
;
8329 sort_by_digest
= sort_by_digest_4_8
;
8330 opti_type
= OPTI_TYPE_ZERO_BYTE
8331 | OPTI_TYPE_PRECOMPUTE_INIT
8332 | OPTI_TYPE_PRECOMPUTE_MERKLE
8333 | OPTI_TYPE_EARLY_SKIP
8334 | OPTI_TYPE_NOT_ITERATED
8335 | OPTI_TYPE_APPENDED_SALT
8336 | OPTI_TYPE_RAW_HASH
;
8343 case 1420: hash_type
= HASH_TYPE_SHA256
;
8344 salt_type
= SALT_TYPE_INTERN
;
8345 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8346 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8347 | OPTS_TYPE_PT_ADD80
8348 | OPTS_TYPE_PT_ADDBITS15
;
8349 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8350 dgst_size
= DGST_SIZE_4_8
;
8351 parse_func
= sha256s_parse_hash
;
8352 sort_by_digest
= sort_by_digest_4_8
;
8353 opti_type
= OPTI_TYPE_ZERO_BYTE
8354 | OPTI_TYPE_PRECOMPUTE_INIT
8355 | OPTI_TYPE_PRECOMPUTE_MERKLE
8356 | OPTI_TYPE_EARLY_SKIP
8357 | OPTI_TYPE_NOT_ITERATED
8358 | OPTI_TYPE_PREPENDED_SALT
8359 | OPTI_TYPE_RAW_HASH
;
8366 case 1421: hash_type
= HASH_TYPE_SHA256
;
8367 salt_type
= SALT_TYPE_EMBEDDED
;
8368 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8369 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8370 | OPTS_TYPE_PT_ADD80
8371 | OPTS_TYPE_PT_ADDBITS15
;
8372 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8373 dgst_size
= DGST_SIZE_4_8
;
8374 parse_func
= hmailserver_parse_hash
;
8375 sort_by_digest
= sort_by_digest_4_8
;
8376 opti_type
= OPTI_TYPE_ZERO_BYTE
8377 | OPTI_TYPE_PRECOMPUTE_INIT
8378 | OPTI_TYPE_PRECOMPUTE_MERKLE
8379 | OPTI_TYPE_EARLY_SKIP
8380 | OPTI_TYPE_NOT_ITERATED
8381 | OPTI_TYPE_PREPENDED_SALT
8382 | OPTI_TYPE_RAW_HASH
;
8389 case 1430: hash_type
= HASH_TYPE_SHA256
;
8390 salt_type
= SALT_TYPE_INTERN
;
8391 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8392 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8393 | OPTS_TYPE_PT_UNICODE
8394 | OPTS_TYPE_ST_ADD80
8395 | OPTS_TYPE_ST_ADDBITS15
;
8396 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8397 dgst_size
= DGST_SIZE_4_8
;
8398 parse_func
= sha256s_parse_hash
;
8399 sort_by_digest
= sort_by_digest_4_8
;
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_APPENDED_SALT
8406 | OPTI_TYPE_RAW_HASH
;
8413 case 1440: hash_type
= HASH_TYPE_SHA256
;
8414 salt_type
= SALT_TYPE_INTERN
;
8415 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8416 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8417 | OPTS_TYPE_PT_ADD80
8418 | OPTS_TYPE_PT_ADDBITS15
8419 | OPTS_TYPE_PT_UNICODE
;
8420 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8421 dgst_size
= DGST_SIZE_4_8
;
8422 parse_func
= sha256s_parse_hash
;
8423 sort_by_digest
= sort_by_digest_4_8
;
8424 opti_type
= OPTI_TYPE_ZERO_BYTE
8425 | OPTI_TYPE_PRECOMPUTE_INIT
8426 | OPTI_TYPE_PRECOMPUTE_MERKLE
8427 | OPTI_TYPE_EARLY_SKIP
8428 | OPTI_TYPE_NOT_ITERATED
8429 | OPTI_TYPE_PREPENDED_SALT
8430 | OPTI_TYPE_RAW_HASH
;
8437 case 1441: hash_type
= HASH_TYPE_SHA256
;
8438 salt_type
= SALT_TYPE_EMBEDDED
;
8439 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8440 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8441 | OPTS_TYPE_PT_ADD80
8442 | OPTS_TYPE_PT_ADDBITS15
8443 | OPTS_TYPE_PT_UNICODE
8444 | OPTS_TYPE_ST_BASE64
;
8445 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8446 dgst_size
= DGST_SIZE_4_8
;
8447 parse_func
= episerver4_parse_hash
;
8448 sort_by_digest
= sort_by_digest_4_8
;
8449 opti_type
= OPTI_TYPE_ZERO_BYTE
8450 | OPTI_TYPE_PRECOMPUTE_INIT
8451 | OPTI_TYPE_PRECOMPUTE_MERKLE
8452 | OPTI_TYPE_EARLY_SKIP
8453 | OPTI_TYPE_NOT_ITERATED
8454 | OPTI_TYPE_PREPENDED_SALT
8455 | OPTI_TYPE_RAW_HASH
;
8462 case 1450: hash_type
= HASH_TYPE_SHA256
;
8463 salt_type
= SALT_TYPE_INTERN
;
8464 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8465 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8466 | OPTS_TYPE_ST_ADD80
;
8467 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8468 dgst_size
= DGST_SIZE_4_8
;
8469 parse_func
= hmacsha256_parse_hash
;
8470 sort_by_digest
= sort_by_digest_4_8
;
8471 opti_type
= OPTI_TYPE_ZERO_BYTE
8472 | OPTI_TYPE_NOT_ITERATED
;
8479 case 1460: hash_type
= HASH_TYPE_SHA256
;
8480 salt_type
= SALT_TYPE_INTERN
;
8481 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8482 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8483 | OPTS_TYPE_PT_ADD80
8484 | OPTS_TYPE_PT_ADDBITS15
;
8485 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8486 dgst_size
= DGST_SIZE_4_8
;
8487 parse_func
= hmacsha256_parse_hash
;
8488 sort_by_digest
= sort_by_digest_4_8
;
8489 opti_type
= OPTI_TYPE_ZERO_BYTE
8490 | OPTI_TYPE_NOT_ITERATED
;
8497 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8498 salt_type
= SALT_TYPE_EMBEDDED
;
8499 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8501 | OPTS_TYPE_PT_BITSLICE
;
8502 kern_type
= KERN_TYPE_DESCRYPT
;
8503 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8504 parse_func
= descrypt_parse_hash
;
8505 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8506 opti_type
= OPTI_TYPE_ZERO_BYTE
8507 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8514 case 1600: hash_type
= HASH_TYPE_MD5
;
8515 salt_type
= SALT_TYPE_EMBEDDED
;
8516 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8518 kern_type
= KERN_TYPE_APR1CRYPT
;
8519 dgst_size
= DGST_SIZE_4_4
;
8520 parse_func
= md5apr1_parse_hash
;
8521 sort_by_digest
= sort_by_digest_4_4
;
8522 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8529 case 1700: hash_type
= HASH_TYPE_SHA512
;
8530 salt_type
= SALT_TYPE_NONE
;
8531 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8532 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8533 | OPTS_TYPE_PT_ADD80
8534 | OPTS_TYPE_PT_ADDBITS15
;
8535 kern_type
= KERN_TYPE_SHA512
;
8536 dgst_size
= DGST_SIZE_8_8
;
8537 parse_func
= sha512_parse_hash
;
8538 sort_by_digest
= sort_by_digest_8_8
;
8539 opti_type
= OPTI_TYPE_ZERO_BYTE
8540 | OPTI_TYPE_PRECOMPUTE_INIT
8541 | OPTI_TYPE_PRECOMPUTE_MERKLE
8542 | OPTI_TYPE_EARLY_SKIP
8543 | OPTI_TYPE_NOT_ITERATED
8544 | OPTI_TYPE_NOT_SALTED
8545 | OPTI_TYPE_USES_BITS_64
8546 | OPTI_TYPE_RAW_HASH
;
8553 case 1710: hash_type
= HASH_TYPE_SHA512
;
8554 salt_type
= SALT_TYPE_INTERN
;
8555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8557 | OPTS_TYPE_ST_ADD80
8558 | OPTS_TYPE_ST_ADDBITS15
;
8559 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8560 dgst_size
= DGST_SIZE_8_8
;
8561 parse_func
= sha512s_parse_hash
;
8562 sort_by_digest
= sort_by_digest_8_8
;
8563 opti_type
= OPTI_TYPE_ZERO_BYTE
8564 | OPTI_TYPE_PRECOMPUTE_INIT
8565 | OPTI_TYPE_PRECOMPUTE_MERKLE
8566 | OPTI_TYPE_EARLY_SKIP
8567 | OPTI_TYPE_NOT_ITERATED
8568 | OPTI_TYPE_APPENDED_SALT
8569 | OPTI_TYPE_USES_BITS_64
8570 | OPTI_TYPE_RAW_HASH
;
8577 case 1711: hash_type
= HASH_TYPE_SHA512
;
8578 salt_type
= SALT_TYPE_EMBEDDED
;
8579 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8580 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8581 | OPTS_TYPE_ST_ADD80
8582 | OPTS_TYPE_ST_ADDBITS15
;
8583 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8584 dgst_size
= DGST_SIZE_8_8
;
8585 parse_func
= sha512b64s_parse_hash
;
8586 sort_by_digest
= sort_by_digest_8_8
;
8587 opti_type
= OPTI_TYPE_ZERO_BYTE
8588 | OPTI_TYPE_PRECOMPUTE_INIT
8589 | OPTI_TYPE_PRECOMPUTE_MERKLE
8590 | OPTI_TYPE_EARLY_SKIP
8591 | OPTI_TYPE_NOT_ITERATED
8592 | OPTI_TYPE_APPENDED_SALT
8593 | OPTI_TYPE_USES_BITS_64
8594 | OPTI_TYPE_RAW_HASH
;
8601 case 1720: hash_type
= HASH_TYPE_SHA512
;
8602 salt_type
= SALT_TYPE_INTERN
;
8603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8604 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8605 | OPTS_TYPE_PT_ADD80
8606 | OPTS_TYPE_PT_ADDBITS15
;
8607 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8608 dgst_size
= DGST_SIZE_8_8
;
8609 parse_func
= sha512s_parse_hash
;
8610 sort_by_digest
= sort_by_digest_8_8
;
8611 opti_type
= OPTI_TYPE_ZERO_BYTE
8612 | OPTI_TYPE_PRECOMPUTE_INIT
8613 | OPTI_TYPE_PRECOMPUTE_MERKLE
8614 | OPTI_TYPE_EARLY_SKIP
8615 | OPTI_TYPE_NOT_ITERATED
8616 | OPTI_TYPE_PREPENDED_SALT
8617 | OPTI_TYPE_USES_BITS_64
8618 | OPTI_TYPE_RAW_HASH
;
8625 case 1722: hash_type
= HASH_TYPE_SHA512
;
8626 salt_type
= SALT_TYPE_EMBEDDED
;
8627 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8628 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8629 | OPTS_TYPE_PT_ADD80
8630 | OPTS_TYPE_PT_ADDBITS15
8632 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8633 dgst_size
= DGST_SIZE_8_8
;
8634 parse_func
= osx512_parse_hash
;
8635 sort_by_digest
= sort_by_digest_8_8
;
8636 opti_type
= OPTI_TYPE_ZERO_BYTE
8637 | OPTI_TYPE_PRECOMPUTE_INIT
8638 | OPTI_TYPE_PRECOMPUTE_MERKLE
8639 | OPTI_TYPE_EARLY_SKIP
8640 | OPTI_TYPE_NOT_ITERATED
8641 | OPTI_TYPE_PREPENDED_SALT
8642 | OPTI_TYPE_USES_BITS_64
8643 | OPTI_TYPE_RAW_HASH
;
8650 case 1730: hash_type
= HASH_TYPE_SHA512
;
8651 salt_type
= SALT_TYPE_INTERN
;
8652 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8653 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8654 | OPTS_TYPE_PT_UNICODE
8655 | OPTS_TYPE_ST_ADD80
8656 | OPTS_TYPE_ST_ADDBITS15
;
8657 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8658 dgst_size
= DGST_SIZE_8_8
;
8659 parse_func
= sha512s_parse_hash
;
8660 sort_by_digest
= sort_by_digest_8_8
;
8661 opti_type
= OPTI_TYPE_ZERO_BYTE
8662 | OPTI_TYPE_PRECOMPUTE_INIT
8663 | OPTI_TYPE_PRECOMPUTE_MERKLE
8664 | OPTI_TYPE_EARLY_SKIP
8665 | OPTI_TYPE_NOT_ITERATED
8666 | OPTI_TYPE_APPENDED_SALT
8667 | OPTI_TYPE_USES_BITS_64
8668 | OPTI_TYPE_RAW_HASH
;
8675 case 1731: hash_type
= HASH_TYPE_SHA512
;
8676 salt_type
= SALT_TYPE_EMBEDDED
;
8677 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8678 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8679 | OPTS_TYPE_PT_UNICODE
8680 | OPTS_TYPE_ST_ADD80
8681 | OPTS_TYPE_ST_ADDBITS15
8683 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8684 dgst_size
= DGST_SIZE_8_8
;
8685 parse_func
= mssql2012_parse_hash
;
8686 sort_by_digest
= sort_by_digest_8_8
;
8687 opti_type
= OPTI_TYPE_ZERO_BYTE
8688 | OPTI_TYPE_PRECOMPUTE_INIT
8689 | OPTI_TYPE_PRECOMPUTE_MERKLE
8690 | OPTI_TYPE_EARLY_SKIP
8691 | OPTI_TYPE_NOT_ITERATED
8692 | OPTI_TYPE_APPENDED_SALT
8693 | OPTI_TYPE_USES_BITS_64
8694 | OPTI_TYPE_RAW_HASH
;
8701 case 1740: hash_type
= HASH_TYPE_SHA512
;
8702 salt_type
= SALT_TYPE_INTERN
;
8703 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8704 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8705 | OPTS_TYPE_PT_ADD80
8706 | OPTS_TYPE_PT_ADDBITS15
8707 | OPTS_TYPE_PT_UNICODE
;
8708 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8709 dgst_size
= DGST_SIZE_8_8
;
8710 parse_func
= sha512s_parse_hash
;
8711 sort_by_digest
= sort_by_digest_8_8
;
8712 opti_type
= OPTI_TYPE_ZERO_BYTE
8713 | OPTI_TYPE_PRECOMPUTE_INIT
8714 | OPTI_TYPE_PRECOMPUTE_MERKLE
8715 | OPTI_TYPE_EARLY_SKIP
8716 | OPTI_TYPE_NOT_ITERATED
8717 | OPTI_TYPE_PREPENDED_SALT
8718 | OPTI_TYPE_USES_BITS_64
8719 | OPTI_TYPE_RAW_HASH
;
8726 case 1750: hash_type
= HASH_TYPE_SHA512
;
8727 salt_type
= SALT_TYPE_INTERN
;
8728 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8729 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8730 | OPTS_TYPE_ST_ADD80
;
8731 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8732 dgst_size
= DGST_SIZE_8_8
;
8733 parse_func
= hmacsha512_parse_hash
;
8734 sort_by_digest
= sort_by_digest_8_8
;
8735 opti_type
= OPTI_TYPE_ZERO_BYTE
8736 | OPTI_TYPE_USES_BITS_64
8737 | OPTI_TYPE_NOT_ITERATED
;
8744 case 1760: hash_type
= HASH_TYPE_SHA512
;
8745 salt_type
= SALT_TYPE_INTERN
;
8746 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8747 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8748 | OPTS_TYPE_PT_ADD80
8749 | OPTS_TYPE_PT_ADDBITS15
;
8750 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8751 dgst_size
= DGST_SIZE_8_8
;
8752 parse_func
= hmacsha512_parse_hash
;
8753 sort_by_digest
= sort_by_digest_8_8
;
8754 opti_type
= OPTI_TYPE_ZERO_BYTE
8755 | OPTI_TYPE_USES_BITS_64
8756 | OPTI_TYPE_NOT_ITERATED
;
8763 case 1800: hash_type
= HASH_TYPE_SHA512
;
8764 salt_type
= SALT_TYPE_EMBEDDED
;
8765 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8766 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8767 kern_type
= KERN_TYPE_SHA512CRYPT
;
8768 dgst_size
= DGST_SIZE_8_8
;
8769 parse_func
= sha512crypt_parse_hash
;
8770 sort_by_digest
= sort_by_digest_8_8
;
8771 opti_type
= OPTI_TYPE_ZERO_BYTE
8772 | OPTI_TYPE_USES_BITS_64
;
8779 case 2000: hash_type
= HASH_TYPE_STDOUT
;
8780 salt_type
= SALT_TYPE_NONE
;
8781 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8782 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8783 kern_type
= KERN_TYPE_STDOUT
;
8784 dgst_size
= DGST_SIZE_4_4
;
8786 sort_by_digest
= NULL
;
8794 case 2100: hash_type
= HASH_TYPE_DCC2
;
8795 salt_type
= SALT_TYPE_EMBEDDED
;
8796 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8797 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8798 | OPTS_TYPE_ST_LOWER
8799 | OPTS_TYPE_ST_UNICODE
;
8800 kern_type
= KERN_TYPE_DCC2
;
8801 dgst_size
= DGST_SIZE_4_4
;
8802 parse_func
= dcc2_parse_hash
;
8803 sort_by_digest
= sort_by_digest_4_4
;
8804 opti_type
= OPTI_TYPE_ZERO_BYTE
8805 | OPTI_TYPE_SLOW_HASH_SIMD
;
8812 case 2400: hash_type
= HASH_TYPE_MD5
;
8813 salt_type
= SALT_TYPE_NONE
;
8814 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8815 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8816 kern_type
= KERN_TYPE_MD5PIX
;
8817 dgst_size
= DGST_SIZE_4_4
;
8818 parse_func
= md5pix_parse_hash
;
8819 sort_by_digest
= sort_by_digest_4_4
;
8820 opti_type
= OPTI_TYPE_ZERO_BYTE
8821 | OPTI_TYPE_PRECOMPUTE_INIT
8822 | OPTI_TYPE_PRECOMPUTE_MERKLE
8823 | OPTI_TYPE_EARLY_SKIP
8824 | OPTI_TYPE_NOT_ITERATED
8825 | OPTI_TYPE_NOT_SALTED
;
8832 case 2410: hash_type
= HASH_TYPE_MD5
;
8833 salt_type
= SALT_TYPE_INTERN
;
8834 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8835 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8836 kern_type
= KERN_TYPE_MD5ASA
;
8837 dgst_size
= DGST_SIZE_4_4
;
8838 parse_func
= md5asa_parse_hash
;
8839 sort_by_digest
= sort_by_digest_4_4
;
8840 opti_type
= OPTI_TYPE_ZERO_BYTE
8841 | OPTI_TYPE_PRECOMPUTE_INIT
8842 | OPTI_TYPE_PRECOMPUTE_MERKLE
8843 | OPTI_TYPE_EARLY_SKIP
8844 | OPTI_TYPE_NOT_ITERATED
;
8851 case 2500: hash_type
= HASH_TYPE_WPA
;
8852 salt_type
= SALT_TYPE_EMBEDDED
;
8853 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8854 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8855 kern_type
= KERN_TYPE_WPA
;
8856 dgst_size
= DGST_SIZE_4_4
;
8857 parse_func
= wpa_parse_hash
;
8858 sort_by_digest
= sort_by_digest_4_4
;
8859 opti_type
= OPTI_TYPE_ZERO_BYTE
8860 | OPTI_TYPE_SLOW_HASH_SIMD
;
8867 case 2600: hash_type
= HASH_TYPE_MD5
;
8868 salt_type
= SALT_TYPE_VIRTUAL
;
8869 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8871 | OPTS_TYPE_PT_ADD80
8872 | OPTS_TYPE_PT_ADDBITS14
8873 | OPTS_TYPE_ST_ADD80
;
8874 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8875 dgst_size
= DGST_SIZE_4_4
;
8876 parse_func
= md5md5_parse_hash
;
8877 sort_by_digest
= sort_by_digest_4_4
;
8878 opti_type
= OPTI_TYPE_ZERO_BYTE
8879 | OPTI_TYPE_PRECOMPUTE_INIT
8880 | OPTI_TYPE_PRECOMPUTE_MERKLE
8881 | OPTI_TYPE_EARLY_SKIP
;
8888 case 2611: hash_type
= HASH_TYPE_MD5
;
8889 salt_type
= SALT_TYPE_INTERN
;
8890 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8891 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8892 | OPTS_TYPE_PT_ADD80
8893 | OPTS_TYPE_PT_ADDBITS14
8894 | OPTS_TYPE_ST_ADD80
;
8895 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8896 dgst_size
= DGST_SIZE_4_4
;
8897 parse_func
= vb3_parse_hash
;
8898 sort_by_digest
= sort_by_digest_4_4
;
8899 opti_type
= OPTI_TYPE_ZERO_BYTE
8900 | OPTI_TYPE_PRECOMPUTE_INIT
8901 | OPTI_TYPE_PRECOMPUTE_MERKLE
8902 | OPTI_TYPE_EARLY_SKIP
;
8909 case 2612: hash_type
= HASH_TYPE_MD5
;
8910 salt_type
= SALT_TYPE_EMBEDDED
;
8911 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8912 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8913 | OPTS_TYPE_PT_ADD80
8914 | OPTS_TYPE_PT_ADDBITS14
8915 | OPTS_TYPE_ST_ADD80
8917 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8918 dgst_size
= DGST_SIZE_4_4
;
8919 parse_func
= phps_parse_hash
;
8920 sort_by_digest
= sort_by_digest_4_4
;
8921 opti_type
= OPTI_TYPE_ZERO_BYTE
8922 | OPTI_TYPE_PRECOMPUTE_INIT
8923 | OPTI_TYPE_PRECOMPUTE_MERKLE
8924 | OPTI_TYPE_EARLY_SKIP
;
8931 case 2711: hash_type
= HASH_TYPE_MD5
;
8932 salt_type
= SALT_TYPE_INTERN
;
8933 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8934 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8935 | OPTS_TYPE_PT_ADD80
8936 | OPTS_TYPE_PT_ADDBITS14
8937 | OPTS_TYPE_ST_ADD80
;
8938 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8939 dgst_size
= DGST_SIZE_4_4
;
8940 parse_func
= vb30_parse_hash
;
8941 sort_by_digest
= sort_by_digest_4_4
;
8942 opti_type
= OPTI_TYPE_ZERO_BYTE
8943 | OPTI_TYPE_PRECOMPUTE_INIT
8944 | OPTI_TYPE_EARLY_SKIP
;
8951 case 2811: hash_type
= HASH_TYPE_MD5
;
8952 salt_type
= SALT_TYPE_INTERN
;
8953 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8954 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8955 | OPTS_TYPE_PT_ADD80
8956 | OPTS_TYPE_PT_ADDBITS14
;
8957 kern_type
= KERN_TYPE_MD55_SLTPW
;
8958 dgst_size
= DGST_SIZE_4_4
;
8959 parse_func
= ipb2_parse_hash
;
8960 sort_by_digest
= sort_by_digest_4_4
;
8961 opti_type
= OPTI_TYPE_ZERO_BYTE
8962 | OPTI_TYPE_PRECOMPUTE_INIT
8963 | OPTI_TYPE_EARLY_SKIP
;
8970 case 3000: hash_type
= HASH_TYPE_LM
;
8971 salt_type
= SALT_TYPE_NONE
;
8972 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8973 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8974 | OPTS_TYPE_PT_UPPER
8975 | OPTS_TYPE_PT_BITSLICE
;
8976 kern_type
= KERN_TYPE_LM
;
8977 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8978 parse_func
= lm_parse_hash
;
8979 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8980 opti_type
= OPTI_TYPE_ZERO_BYTE
8981 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8988 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8989 salt_type
= SALT_TYPE_INTERN
;
8990 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8991 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8992 | OPTS_TYPE_PT_UPPER
8993 | OPTS_TYPE_ST_UPPER
;
8994 kern_type
= KERN_TYPE_ORACLEH
;
8995 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8996 parse_func
= oracleh_parse_hash
;
8997 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8998 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9005 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9006 salt_type
= SALT_TYPE_EMBEDDED
;
9007 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9008 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9009 | OPTS_TYPE_ST_GENERATE_LE
;
9010 kern_type
= KERN_TYPE_BCRYPT
;
9011 dgst_size
= DGST_SIZE_4_6
;
9012 parse_func
= bcrypt_parse_hash
;
9013 sort_by_digest
= sort_by_digest_4_6
;
9014 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9021 case 3710: hash_type
= HASH_TYPE_MD5
;
9022 salt_type
= SALT_TYPE_INTERN
;
9023 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9025 | OPTS_TYPE_PT_ADD80
9026 | OPTS_TYPE_PT_ADDBITS14
;
9027 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9028 dgst_size
= DGST_SIZE_4_4
;
9029 parse_func
= md5s_parse_hash
;
9030 sort_by_digest
= sort_by_digest_4_4
;
9031 opti_type
= OPTI_TYPE_ZERO_BYTE
9032 | OPTI_TYPE_PRECOMPUTE_INIT
9033 | OPTI_TYPE_PRECOMPUTE_MERKLE
9034 | OPTI_TYPE_EARLY_SKIP
;
9041 case 3711: hash_type
= HASH_TYPE_MD5
;
9042 salt_type
= SALT_TYPE_EMBEDDED
;
9043 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9045 | OPTS_TYPE_PT_ADD80
9046 | OPTS_TYPE_PT_ADDBITS14
;
9047 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9048 dgst_size
= DGST_SIZE_4_4
;
9049 parse_func
= mediawiki_b_parse_hash
;
9050 sort_by_digest
= sort_by_digest_4_4
;
9051 opti_type
= OPTI_TYPE_ZERO_BYTE
9052 | OPTI_TYPE_PRECOMPUTE_INIT
9053 | OPTI_TYPE_PRECOMPUTE_MERKLE
9054 | OPTI_TYPE_EARLY_SKIP
;
9061 case 3800: hash_type
= HASH_TYPE_MD5
;
9062 salt_type
= SALT_TYPE_INTERN
;
9063 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9064 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9065 | OPTS_TYPE_ST_ADDBITS14
;
9066 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9067 dgst_size
= DGST_SIZE_4_4
;
9068 parse_func
= md5s_parse_hash
;
9069 sort_by_digest
= sort_by_digest_4_4
;
9070 opti_type
= OPTI_TYPE_ZERO_BYTE
9071 | OPTI_TYPE_PRECOMPUTE_INIT
9072 | OPTI_TYPE_PRECOMPUTE_MERKLE
9073 | OPTI_TYPE_EARLY_SKIP
9074 | OPTI_TYPE_NOT_ITERATED
9075 | OPTI_TYPE_RAW_HASH
;
9082 case 4300: hash_type
= HASH_TYPE_MD5
;
9083 salt_type
= SALT_TYPE_VIRTUAL
;
9084 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9085 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9086 | OPTS_TYPE_PT_ADD80
9087 | OPTS_TYPE_PT_ADDBITS14
9088 | OPTS_TYPE_ST_ADD80
;
9089 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9090 dgst_size
= DGST_SIZE_4_4
;
9091 parse_func
= md5md5_parse_hash
;
9092 sort_by_digest
= sort_by_digest_4_4
;
9093 opti_type
= OPTI_TYPE_ZERO_BYTE
9094 | OPTI_TYPE_PRECOMPUTE_INIT
9095 | OPTI_TYPE_PRECOMPUTE_MERKLE
9096 | OPTI_TYPE_EARLY_SKIP
;
9104 case 4400: hash_type
= HASH_TYPE_MD5
;
9105 salt_type
= SALT_TYPE_NONE
;
9106 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9107 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9108 | OPTS_TYPE_PT_ADD80
9109 | OPTS_TYPE_PT_ADDBITS15
;
9110 kern_type
= KERN_TYPE_MD5_SHA1
;
9111 dgst_size
= DGST_SIZE_4_4
;
9112 parse_func
= md5_parse_hash
;
9113 sort_by_digest
= sort_by_digest_4_4
;
9114 opti_type
= OPTI_TYPE_ZERO_BYTE
9115 | OPTI_TYPE_PRECOMPUTE_INIT
9116 | OPTI_TYPE_PRECOMPUTE_MERKLE
9117 | OPTI_TYPE_EARLY_SKIP
9118 | OPTI_TYPE_NOT_ITERATED
9119 | OPTI_TYPE_NOT_SALTED
9120 | OPTI_TYPE_RAW_HASH
;
9127 case 4500: hash_type
= HASH_TYPE_SHA1
;
9128 salt_type
= SALT_TYPE_NONE
;
9129 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9130 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9131 | OPTS_TYPE_PT_ADD80
9132 | OPTS_TYPE_PT_ADDBITS15
;
9133 kern_type
= KERN_TYPE_SHA11
;
9134 dgst_size
= DGST_SIZE_4_5
;
9135 parse_func
= sha1_parse_hash
;
9136 sort_by_digest
= sort_by_digest_4_5
;
9137 opti_type
= OPTI_TYPE_ZERO_BYTE
9138 | OPTI_TYPE_PRECOMPUTE_INIT
9139 | OPTI_TYPE_PRECOMPUTE_MERKLE
9140 | OPTI_TYPE_EARLY_SKIP
9141 | OPTI_TYPE_NOT_SALTED
;
9148 case 4700: hash_type
= HASH_TYPE_SHA1
;
9149 salt_type
= SALT_TYPE_NONE
;
9150 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9151 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9152 | OPTS_TYPE_PT_ADD80
9153 | OPTS_TYPE_PT_ADDBITS14
;
9154 kern_type
= KERN_TYPE_SHA1_MD5
;
9155 dgst_size
= DGST_SIZE_4_5
;
9156 parse_func
= sha1_parse_hash
;
9157 sort_by_digest
= sort_by_digest_4_5
;
9158 opti_type
= OPTI_TYPE_ZERO_BYTE
9159 | OPTI_TYPE_PRECOMPUTE_INIT
9160 | OPTI_TYPE_PRECOMPUTE_MERKLE
9161 | OPTI_TYPE_EARLY_SKIP
9162 | OPTI_TYPE_NOT_ITERATED
9163 | OPTI_TYPE_NOT_SALTED
9164 | OPTI_TYPE_RAW_HASH
;
9171 case 4800: hash_type
= HASH_TYPE_MD5
;
9172 salt_type
= SALT_TYPE_EMBEDDED
;
9173 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9174 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9175 | OPTS_TYPE_PT_ADDBITS14
;
9176 kern_type
= KERN_TYPE_MD5_CHAP
;
9177 dgst_size
= DGST_SIZE_4_4
;
9178 parse_func
= chap_parse_hash
;
9179 sort_by_digest
= sort_by_digest_4_4
;
9180 opti_type
= OPTI_TYPE_ZERO_BYTE
9181 | OPTI_TYPE_PRECOMPUTE_INIT
9182 | OPTI_TYPE_PRECOMPUTE_MERKLE
9183 | OPTI_TYPE_MEET_IN_MIDDLE
9184 | OPTI_TYPE_EARLY_SKIP
9185 | OPTI_TYPE_NOT_ITERATED
9186 | OPTI_TYPE_RAW_HASH
;
9193 case 4900: hash_type
= HASH_TYPE_SHA1
;
9194 salt_type
= SALT_TYPE_INTERN
;
9195 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9197 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9198 dgst_size
= DGST_SIZE_4_5
;
9199 parse_func
= sha1s_parse_hash
;
9200 sort_by_digest
= sort_by_digest_4_5
;
9201 opti_type
= OPTI_TYPE_ZERO_BYTE
9202 | OPTI_TYPE_PRECOMPUTE_INIT
9203 | OPTI_TYPE_PRECOMPUTE_MERKLE
9204 | OPTI_TYPE_EARLY_SKIP
;
9211 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9212 salt_type
= SALT_TYPE_EMBEDDED
;
9213 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9214 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9215 | OPTS_TYPE_PT_ADD01
;
9216 kern_type
= KERN_TYPE_KECCAK
;
9217 dgst_size
= DGST_SIZE_8_25
;
9218 parse_func
= keccak_parse_hash
;
9219 sort_by_digest
= sort_by_digest_8_25
;
9220 opti_type
= OPTI_TYPE_ZERO_BYTE
9221 | OPTI_TYPE_USES_BITS_64
9222 | OPTI_TYPE_RAW_HASH
;
9229 case 5100: hash_type
= HASH_TYPE_MD5H
;
9230 salt_type
= SALT_TYPE_NONE
;
9231 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9232 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9233 | OPTS_TYPE_PT_ADD80
9234 | OPTS_TYPE_PT_ADDBITS14
;
9235 kern_type
= KERN_TYPE_MD5H
;
9236 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9237 parse_func
= md5half_parse_hash
;
9238 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9239 opti_type
= OPTI_TYPE_ZERO_BYTE
9240 | OPTI_TYPE_RAW_HASH
;
9247 case 5200: hash_type
= HASH_TYPE_SHA256
;
9248 salt_type
= SALT_TYPE_EMBEDDED
;
9249 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9250 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9251 kern_type
= KERN_TYPE_PSAFE3
;
9252 dgst_size
= DGST_SIZE_4_8
;
9253 parse_func
= psafe3_parse_hash
;
9254 sort_by_digest
= sort_by_digest_4_8
;
9255 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9262 case 5300: hash_type
= HASH_TYPE_MD5
;
9263 salt_type
= SALT_TYPE_EMBEDDED
;
9264 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9265 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9266 | OPTS_TYPE_ST_ADD80
;
9267 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9268 dgst_size
= DGST_SIZE_4_4
;
9269 parse_func
= ikepsk_md5_parse_hash
;
9270 sort_by_digest
= sort_by_digest_4_4
;
9271 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9278 case 5400: hash_type
= HASH_TYPE_SHA1
;
9279 salt_type
= SALT_TYPE_EMBEDDED
;
9280 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9281 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9282 | OPTS_TYPE_ST_ADD80
;
9283 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9284 dgst_size
= DGST_SIZE_4_5
;
9285 parse_func
= ikepsk_sha1_parse_hash
;
9286 sort_by_digest
= sort_by_digest_4_5
;
9287 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9294 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9295 salt_type
= SALT_TYPE_EMBEDDED
;
9296 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9297 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9298 | OPTS_TYPE_PT_ADD80
9299 | OPTS_TYPE_PT_ADDBITS14
9300 | OPTS_TYPE_PT_UNICODE
9302 kern_type
= KERN_TYPE_NETNTLMv1
;
9303 dgst_size
= DGST_SIZE_4_4
;
9304 parse_func
= netntlmv1_parse_hash
;
9305 sort_by_digest
= sort_by_digest_4_4
;
9306 opti_type
= OPTI_TYPE_ZERO_BYTE
9307 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9314 case 5600: hash_type
= HASH_TYPE_MD5
;
9315 salt_type
= SALT_TYPE_EMBEDDED
;
9316 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9317 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9318 | OPTS_TYPE_PT_ADD80
9319 | OPTS_TYPE_PT_ADDBITS14
9320 | OPTS_TYPE_PT_UNICODE
;
9321 kern_type
= KERN_TYPE_NETNTLMv2
;
9322 dgst_size
= DGST_SIZE_4_4
;
9323 parse_func
= netntlmv2_parse_hash
;
9324 sort_by_digest
= sort_by_digest_4_4
;
9325 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9332 case 5700: hash_type
= HASH_TYPE_SHA256
;
9333 salt_type
= SALT_TYPE_NONE
;
9334 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9335 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9336 | OPTS_TYPE_PT_ADD80
9337 | OPTS_TYPE_PT_ADDBITS15
;
9338 kern_type
= KERN_TYPE_SHA256
;
9339 dgst_size
= DGST_SIZE_4_8
;
9340 parse_func
= cisco4_parse_hash
;
9341 sort_by_digest
= sort_by_digest_4_8
;
9342 opti_type
= OPTI_TYPE_ZERO_BYTE
9343 | OPTI_TYPE_PRECOMPUTE_INIT
9344 | OPTI_TYPE_PRECOMPUTE_MERKLE
9345 | OPTI_TYPE_EARLY_SKIP
9346 | OPTI_TYPE_NOT_ITERATED
9347 | OPTI_TYPE_NOT_SALTED
9348 | OPTI_TYPE_RAW_HASH
;
9355 case 5800: hash_type
= HASH_TYPE_SHA1
;
9356 salt_type
= SALT_TYPE_INTERN
;
9357 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9358 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9359 | OPTS_TYPE_ST_ADD80
;
9360 kern_type
= KERN_TYPE_ANDROIDPIN
;
9361 dgst_size
= DGST_SIZE_4_5
;
9362 parse_func
= androidpin_parse_hash
;
9363 sort_by_digest
= sort_by_digest_4_5
;
9364 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9371 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9372 salt_type
= SALT_TYPE_NONE
;
9373 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9374 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9375 | OPTS_TYPE_PT_ADD80
;
9376 kern_type
= KERN_TYPE_RIPEMD160
;
9377 dgst_size
= DGST_SIZE_4_5
;
9378 parse_func
= ripemd160_parse_hash
;
9379 sort_by_digest
= sort_by_digest_4_5
;
9380 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9387 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9388 salt_type
= SALT_TYPE_NONE
;
9389 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9390 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9391 | OPTS_TYPE_PT_ADD80
;
9392 kern_type
= KERN_TYPE_WHIRLPOOL
;
9393 dgst_size
= DGST_SIZE_4_16
;
9394 parse_func
= whirlpool_parse_hash
;
9395 sort_by_digest
= sort_by_digest_4_16
;
9396 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9403 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9404 salt_type
= SALT_TYPE_EMBEDDED
;
9405 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9406 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9407 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9408 dgst_size
= DGST_SIZE_4_5
;
9409 parse_func
= truecrypt_parse_hash_2k
;
9410 sort_by_digest
= sort_by_digest_4_5
;
9411 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9418 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9419 salt_type
= SALT_TYPE_EMBEDDED
;
9420 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9421 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9422 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9423 dgst_size
= DGST_SIZE_4_5
;
9424 parse_func
= truecrypt_parse_hash_2k
;
9425 sort_by_digest
= sort_by_digest_4_5
;
9426 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9433 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9434 salt_type
= SALT_TYPE_EMBEDDED
;
9435 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9436 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9437 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9438 dgst_size
= DGST_SIZE_4_5
;
9439 parse_func
= truecrypt_parse_hash_2k
;
9440 sort_by_digest
= sort_by_digest_4_5
;
9441 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9448 case 6221: hash_type
= HASH_TYPE_SHA512
;
9449 salt_type
= SALT_TYPE_EMBEDDED
;
9450 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9451 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9452 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9453 dgst_size
= DGST_SIZE_8_8
;
9454 parse_func
= truecrypt_parse_hash_1k
;
9455 sort_by_digest
= sort_by_digest_8_8
;
9456 opti_type
= OPTI_TYPE_ZERO_BYTE
9457 | OPTI_TYPE_USES_BITS_64
;
9464 case 6222: hash_type
= HASH_TYPE_SHA512
;
9465 salt_type
= SALT_TYPE_EMBEDDED
;
9466 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9467 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9468 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9469 dgst_size
= DGST_SIZE_8_8
;
9470 parse_func
= truecrypt_parse_hash_1k
;
9471 sort_by_digest
= sort_by_digest_8_8
;
9472 opti_type
= OPTI_TYPE_ZERO_BYTE
9473 | OPTI_TYPE_USES_BITS_64
;
9480 case 6223: hash_type
= HASH_TYPE_SHA512
;
9481 salt_type
= SALT_TYPE_EMBEDDED
;
9482 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9483 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9484 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9485 dgst_size
= DGST_SIZE_8_8
;
9486 parse_func
= truecrypt_parse_hash_1k
;
9487 sort_by_digest
= sort_by_digest_8_8
;
9488 opti_type
= OPTI_TYPE_ZERO_BYTE
9489 | OPTI_TYPE_USES_BITS_64
;
9496 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9497 salt_type
= SALT_TYPE_EMBEDDED
;
9498 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9500 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9501 dgst_size
= DGST_SIZE_4_8
;
9502 parse_func
= truecrypt_parse_hash_1k
;
9503 sort_by_digest
= sort_by_digest_4_8
;
9504 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9511 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9512 salt_type
= SALT_TYPE_EMBEDDED
;
9513 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9515 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9516 dgst_size
= DGST_SIZE_4_8
;
9517 parse_func
= truecrypt_parse_hash_1k
;
9518 sort_by_digest
= sort_by_digest_4_8
;
9519 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9526 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9527 salt_type
= SALT_TYPE_EMBEDDED
;
9528 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9530 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9531 dgst_size
= DGST_SIZE_4_8
;
9532 parse_func
= truecrypt_parse_hash_1k
;
9533 sort_by_digest
= sort_by_digest_4_8
;
9534 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9541 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9542 salt_type
= SALT_TYPE_EMBEDDED
;
9543 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9544 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9545 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9546 dgst_size
= DGST_SIZE_4_5
;
9547 parse_func
= truecrypt_parse_hash_1k
;
9548 sort_by_digest
= sort_by_digest_4_5
;
9549 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9556 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9557 salt_type
= SALT_TYPE_EMBEDDED
;
9558 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9559 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9560 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9561 dgst_size
= DGST_SIZE_4_5
;
9562 parse_func
= truecrypt_parse_hash_1k
;
9563 sort_by_digest
= sort_by_digest_4_5
;
9564 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9571 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9572 salt_type
= SALT_TYPE_EMBEDDED
;
9573 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9575 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9576 dgst_size
= DGST_SIZE_4_5
;
9577 parse_func
= truecrypt_parse_hash_1k
;
9578 sort_by_digest
= sort_by_digest_4_5
;
9579 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9586 case 6300: hash_type
= HASH_TYPE_MD5
;
9587 salt_type
= SALT_TYPE_EMBEDDED
;
9588 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9589 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9590 kern_type
= KERN_TYPE_MD5AIX
;
9591 dgst_size
= DGST_SIZE_4_4
;
9592 parse_func
= md5aix_parse_hash
;
9593 sort_by_digest
= sort_by_digest_4_4
;
9594 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9601 case 6400: hash_type
= HASH_TYPE_SHA256
;
9602 salt_type
= SALT_TYPE_EMBEDDED
;
9603 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9605 kern_type
= KERN_TYPE_SHA256AIX
;
9606 dgst_size
= DGST_SIZE_4_8
;
9607 parse_func
= sha256aix_parse_hash
;
9608 sort_by_digest
= sort_by_digest_4_8
;
9609 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9616 case 6500: hash_type
= HASH_TYPE_SHA512
;
9617 salt_type
= SALT_TYPE_EMBEDDED
;
9618 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9619 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9620 kern_type
= KERN_TYPE_SHA512AIX
;
9621 dgst_size
= DGST_SIZE_8_8
;
9622 parse_func
= sha512aix_parse_hash
;
9623 sort_by_digest
= sort_by_digest_8_8
;
9624 opti_type
= OPTI_TYPE_ZERO_BYTE
9625 | OPTI_TYPE_USES_BITS_64
;
9632 case 6600: hash_type
= HASH_TYPE_AES
;
9633 salt_type
= SALT_TYPE_EMBEDDED
;
9634 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9635 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9636 kern_type
= KERN_TYPE_AGILEKEY
;
9637 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9638 parse_func
= agilekey_parse_hash
;
9639 sort_by_digest
= sort_by_digest_4_5
;
9640 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9647 case 6700: hash_type
= HASH_TYPE_SHA1
;
9648 salt_type
= SALT_TYPE_EMBEDDED
;
9649 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9651 kern_type
= KERN_TYPE_SHA1AIX
;
9652 dgst_size
= DGST_SIZE_4_5
;
9653 parse_func
= sha1aix_parse_hash
;
9654 sort_by_digest
= sort_by_digest_4_5
;
9655 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9662 case 6800: hash_type
= HASH_TYPE_AES
;
9663 salt_type
= SALT_TYPE_EMBEDDED
;
9664 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9666 kern_type
= KERN_TYPE_LASTPASS
;
9667 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9668 parse_func
= lastpass_parse_hash
;
9669 sort_by_digest
= sort_by_digest_4_8
;
9670 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9677 case 6900: hash_type
= HASH_TYPE_GOST
;
9678 salt_type
= SALT_TYPE_NONE
;
9679 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9681 kern_type
= KERN_TYPE_GOST
;
9682 dgst_size
= DGST_SIZE_4_8
;
9683 parse_func
= gost_parse_hash
;
9684 sort_by_digest
= sort_by_digest_4_8
;
9685 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9692 case 7100: hash_type
= HASH_TYPE_SHA512
;
9693 salt_type
= SALT_TYPE_EMBEDDED
;
9694 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9695 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9696 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9697 dgst_size
= DGST_SIZE_8_16
;
9698 parse_func
= sha512osx_parse_hash
;
9699 sort_by_digest
= sort_by_digest_8_16
;
9700 opti_type
= OPTI_TYPE_ZERO_BYTE
9701 | OPTI_TYPE_USES_BITS_64
9702 | OPTI_TYPE_SLOW_HASH_SIMD
;
9709 case 7200: hash_type
= HASH_TYPE_SHA512
;
9710 salt_type
= SALT_TYPE_EMBEDDED
;
9711 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9713 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9714 dgst_size
= DGST_SIZE_8_16
;
9715 parse_func
= sha512grub_parse_hash
;
9716 sort_by_digest
= sort_by_digest_8_16
;
9717 opti_type
= OPTI_TYPE_ZERO_BYTE
9718 | OPTI_TYPE_USES_BITS_64
9719 | OPTI_TYPE_SLOW_HASH_SIMD
;
9726 case 7300: hash_type
= HASH_TYPE_SHA1
;
9727 salt_type
= SALT_TYPE_EMBEDDED
;
9728 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9729 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9730 | OPTS_TYPE_ST_ADD80
9731 | OPTS_TYPE_ST_ADDBITS15
;
9732 kern_type
= KERN_TYPE_RAKP
;
9733 dgst_size
= DGST_SIZE_4_5
;
9734 parse_func
= rakp_parse_hash
;
9735 sort_by_digest
= sort_by_digest_4_5
;
9736 opti_type
= OPTI_TYPE_ZERO_BYTE
9737 | OPTI_TYPE_NOT_ITERATED
;
9744 case 7400: hash_type
= HASH_TYPE_SHA256
;
9745 salt_type
= SALT_TYPE_EMBEDDED
;
9746 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9747 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9748 kern_type
= KERN_TYPE_SHA256CRYPT
;
9749 dgst_size
= DGST_SIZE_4_8
;
9750 parse_func
= sha256crypt_parse_hash
;
9751 sort_by_digest
= sort_by_digest_4_8
;
9752 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9759 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9760 salt_type
= SALT_TYPE_EMBEDDED
;
9761 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9762 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9763 kern_type
= KERN_TYPE_KRB5PA
;
9764 dgst_size
= DGST_SIZE_4_4
;
9765 parse_func
= krb5pa_parse_hash
;
9766 sort_by_digest
= sort_by_digest_4_4
;
9767 opti_type
= OPTI_TYPE_ZERO_BYTE
9768 | OPTI_TYPE_NOT_ITERATED
;
9775 case 7600: hash_type
= HASH_TYPE_SHA1
;
9776 salt_type
= SALT_TYPE_INTERN
;
9777 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9778 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9779 | OPTS_TYPE_PT_ADD80
9780 | OPTS_TYPE_PT_ADDBITS15
;
9781 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9782 dgst_size
= DGST_SIZE_4_5
;
9783 parse_func
= redmine_parse_hash
;
9784 sort_by_digest
= sort_by_digest_4_5
;
9785 opti_type
= OPTI_TYPE_ZERO_BYTE
9786 | OPTI_TYPE_PRECOMPUTE_INIT
9787 | OPTI_TYPE_EARLY_SKIP
9788 | OPTI_TYPE_NOT_ITERATED
9789 | OPTI_TYPE_PREPENDED_SALT
;
9796 case 7700: hash_type
= HASH_TYPE_SAPB
;
9797 salt_type
= SALT_TYPE_EMBEDDED
;
9798 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9799 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9800 | OPTS_TYPE_PT_UPPER
9801 | OPTS_TYPE_ST_UPPER
;
9802 kern_type
= KERN_TYPE_SAPB
;
9803 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9804 parse_func
= sapb_parse_hash
;
9805 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9806 opti_type
= OPTI_TYPE_ZERO_BYTE
9807 | OPTI_TYPE_PRECOMPUTE_INIT
9808 | OPTI_TYPE_NOT_ITERATED
;
9815 case 7800: hash_type
= HASH_TYPE_SAPG
;
9816 salt_type
= SALT_TYPE_EMBEDDED
;
9817 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9818 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9819 | OPTS_TYPE_ST_ADD80
9820 | OPTS_TYPE_ST_UPPER
;
9821 kern_type
= KERN_TYPE_SAPG
;
9822 dgst_size
= DGST_SIZE_4_5
;
9823 parse_func
= sapg_parse_hash
;
9824 sort_by_digest
= sort_by_digest_4_5
;
9825 opti_type
= OPTI_TYPE_ZERO_BYTE
9826 | OPTI_TYPE_PRECOMPUTE_INIT
9827 | OPTI_TYPE_NOT_ITERATED
;
9834 case 7900: hash_type
= HASH_TYPE_SHA512
;
9835 salt_type
= SALT_TYPE_EMBEDDED
;
9836 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9837 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9838 kern_type
= KERN_TYPE_DRUPAL7
;
9839 dgst_size
= DGST_SIZE_8_8
;
9840 parse_func
= drupal7_parse_hash
;
9841 sort_by_digest
= sort_by_digest_8_8
;
9842 opti_type
= OPTI_TYPE_ZERO_BYTE
9843 | OPTI_TYPE_USES_BITS_64
;
9850 case 8000: hash_type
= HASH_TYPE_SHA256
;
9851 salt_type
= SALT_TYPE_EMBEDDED
;
9852 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9853 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9854 | OPTS_TYPE_PT_UNICODE
9855 | OPTS_TYPE_ST_ADD80
9857 kern_type
= KERN_TYPE_SYBASEASE
;
9858 dgst_size
= DGST_SIZE_4_8
;
9859 parse_func
= sybasease_parse_hash
;
9860 sort_by_digest
= sort_by_digest_4_8
;
9861 opti_type
= OPTI_TYPE_ZERO_BYTE
9862 | OPTI_TYPE_PRECOMPUTE_INIT
9863 | OPTI_TYPE_EARLY_SKIP
9864 | OPTI_TYPE_NOT_ITERATED
9865 | OPTI_TYPE_RAW_HASH
;
9872 case 8100: hash_type
= HASH_TYPE_SHA1
;
9873 salt_type
= SALT_TYPE_EMBEDDED
;
9874 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9875 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9876 kern_type
= KERN_TYPE_NETSCALER
;
9877 dgst_size
= DGST_SIZE_4_5
;
9878 parse_func
= netscaler_parse_hash
;
9879 sort_by_digest
= sort_by_digest_4_5
;
9880 opti_type
= OPTI_TYPE_ZERO_BYTE
9881 | OPTI_TYPE_PRECOMPUTE_INIT
9882 | OPTI_TYPE_PRECOMPUTE_MERKLE
9883 | OPTI_TYPE_EARLY_SKIP
9884 | OPTI_TYPE_NOT_ITERATED
9885 | OPTI_TYPE_PREPENDED_SALT
9886 | OPTI_TYPE_RAW_HASH
;
9893 case 8200: hash_type
= HASH_TYPE_SHA256
;
9894 salt_type
= SALT_TYPE_EMBEDDED
;
9895 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9896 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9897 kern_type
= KERN_TYPE_CLOUDKEY
;
9898 dgst_size
= DGST_SIZE_4_8
;
9899 parse_func
= cloudkey_parse_hash
;
9900 sort_by_digest
= sort_by_digest_4_8
;
9901 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9908 case 8300: hash_type
= HASH_TYPE_SHA1
;
9909 salt_type
= SALT_TYPE_EMBEDDED
;
9910 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9911 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9913 | OPTS_TYPE_ST_ADD80
;
9914 kern_type
= KERN_TYPE_NSEC3
;
9915 dgst_size
= DGST_SIZE_4_5
;
9916 parse_func
= nsec3_parse_hash
;
9917 sort_by_digest
= sort_by_digest_4_5
;
9918 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9925 case 8400: hash_type
= HASH_TYPE_SHA1
;
9926 salt_type
= SALT_TYPE_INTERN
;
9927 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9928 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9929 | OPTS_TYPE_PT_ADD80
9930 | OPTS_TYPE_PT_ADDBITS15
;
9931 kern_type
= KERN_TYPE_WBB3
;
9932 dgst_size
= DGST_SIZE_4_5
;
9933 parse_func
= wbb3_parse_hash
;
9934 sort_by_digest
= sort_by_digest_4_5
;
9935 opti_type
= OPTI_TYPE_ZERO_BYTE
9936 | OPTI_TYPE_PRECOMPUTE_INIT
9937 | OPTI_TYPE_NOT_ITERATED
;
9944 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9945 salt_type
= SALT_TYPE_EMBEDDED
;
9946 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9947 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9948 | OPTS_TYPE_ST_UPPER
;
9949 kern_type
= KERN_TYPE_RACF
;
9950 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9951 parse_func
= racf_parse_hash
;
9952 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9953 opti_type
= OPTI_TYPE_ZERO_BYTE
9954 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9961 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9962 salt_type
= SALT_TYPE_NONE
;
9963 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9964 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9965 kern_type
= KERN_TYPE_LOTUS5
;
9966 dgst_size
= DGST_SIZE_4_4
;
9967 parse_func
= lotus5_parse_hash
;
9968 sort_by_digest
= sort_by_digest_4_4
;
9969 opti_type
= OPTI_TYPE_EARLY_SKIP
9970 | OPTI_TYPE_NOT_ITERATED
9971 | OPTI_TYPE_NOT_SALTED
9972 | OPTI_TYPE_RAW_HASH
;
9979 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9980 salt_type
= SALT_TYPE_EMBEDDED
;
9981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9982 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9983 kern_type
= KERN_TYPE_LOTUS6
;
9984 dgst_size
= DGST_SIZE_4_4
;
9985 parse_func
= lotus6_parse_hash
;
9986 sort_by_digest
= sort_by_digest_4_4
;
9987 opti_type
= OPTI_TYPE_EARLY_SKIP
9988 | OPTI_TYPE_NOT_ITERATED
9989 | OPTI_TYPE_RAW_HASH
;
9996 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9997 salt_type
= SALT_TYPE_EMBEDDED
;
9998 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9999 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10000 kern_type
= KERN_TYPE_ANDROIDFDE
;
10001 dgst_size
= DGST_SIZE_4_4
;
10002 parse_func
= androidfde_parse_hash
;
10003 sort_by_digest
= sort_by_digest_4_4
;
10004 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10011 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10012 salt_type
= SALT_TYPE_EMBEDDED
;
10013 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10014 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10015 kern_type
= KERN_TYPE_SCRYPT
;
10016 dgst_size
= DGST_SIZE_4_8
;
10017 parse_func
= scrypt_parse_hash
;
10018 sort_by_digest
= sort_by_digest_4_8
;
10019 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10026 case 9000: hash_type
= HASH_TYPE_SHA1
;
10027 salt_type
= SALT_TYPE_EMBEDDED
;
10028 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10029 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10030 | OPTS_TYPE_ST_GENERATE_LE
;
10031 kern_type
= KERN_TYPE_PSAFE2
;
10032 dgst_size
= DGST_SIZE_4_5
;
10033 parse_func
= psafe2_parse_hash
;
10034 sort_by_digest
= sort_by_digest_4_5
;
10035 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10042 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10043 salt_type
= SALT_TYPE_EMBEDDED
;
10044 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10045 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10046 kern_type
= KERN_TYPE_LOTUS8
;
10047 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10048 parse_func
= lotus8_parse_hash
;
10049 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10050 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10057 case 9200: hash_type
= HASH_TYPE_SHA256
;
10058 salt_type
= SALT_TYPE_EMBEDDED
;
10059 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10060 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10061 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10062 dgst_size
= DGST_SIZE_4_32
;
10063 parse_func
= cisco8_parse_hash
;
10064 sort_by_digest
= sort_by_digest_4_32
;
10065 opti_type
= OPTI_TYPE_ZERO_BYTE
10066 | OPTI_TYPE_SLOW_HASH_SIMD
;
10073 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
10074 salt_type
= SALT_TYPE_EMBEDDED
;
10075 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10076 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10077 kern_type
= KERN_TYPE_SCRYPT
;
10078 dgst_size
= DGST_SIZE_4_8
;
10079 parse_func
= cisco9_parse_hash
;
10080 sort_by_digest
= sort_by_digest_4_8
;
10081 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10088 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10089 salt_type
= SALT_TYPE_EMBEDDED
;
10090 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10092 kern_type
= KERN_TYPE_OFFICE2007
;
10093 dgst_size
= DGST_SIZE_4_4
;
10094 parse_func
= office2007_parse_hash
;
10095 sort_by_digest
= sort_by_digest_4_4
;
10096 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10103 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10104 salt_type
= SALT_TYPE_EMBEDDED
;
10105 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10106 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10107 kern_type
= KERN_TYPE_OFFICE2010
;
10108 dgst_size
= DGST_SIZE_4_4
;
10109 parse_func
= office2010_parse_hash
;
10110 sort_by_digest
= sort_by_digest_4_4
;
10111 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10118 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10119 salt_type
= SALT_TYPE_EMBEDDED
;
10120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10122 kern_type
= KERN_TYPE_OFFICE2013
;
10123 dgst_size
= DGST_SIZE_4_4
;
10124 parse_func
= office2013_parse_hash
;
10125 sort_by_digest
= sort_by_digest_4_4
;
10126 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10133 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10134 salt_type
= SALT_TYPE_EMBEDDED
;
10135 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10137 | OPTS_TYPE_PT_ADD80
10138 | OPTS_TYPE_PT_UNICODE
;
10139 kern_type
= KERN_TYPE_OLDOFFICE01
;
10140 dgst_size
= DGST_SIZE_4_4
;
10141 parse_func
= oldoffice01_parse_hash
;
10142 sort_by_digest
= sort_by_digest_4_4
;
10143 opti_type
= OPTI_TYPE_ZERO_BYTE
10144 | OPTI_TYPE_PRECOMPUTE_INIT
10145 | OPTI_TYPE_NOT_ITERATED
;
10152 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10153 salt_type
= SALT_TYPE_EMBEDDED
;
10154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10156 | OPTS_TYPE_PT_ADD80
;
10157 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10158 dgst_size
= DGST_SIZE_4_4
;
10159 parse_func
= oldoffice01cm1_parse_hash
;
10160 sort_by_digest
= sort_by_digest_4_4
;
10161 opti_type
= OPTI_TYPE_ZERO_BYTE
10162 | OPTI_TYPE_PRECOMPUTE_INIT
10163 | OPTI_TYPE_NOT_ITERATED
;
10170 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10171 salt_type
= SALT_TYPE_EMBEDDED
;
10172 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10173 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10174 | OPTS_TYPE_PT_ADD80
10175 | OPTS_TYPE_PT_UNICODE
10176 | OPTS_TYPE_PT_NEVERCRACK
;
10177 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10178 dgst_size
= DGST_SIZE_4_4
;
10179 parse_func
= oldoffice01cm2_parse_hash
;
10180 sort_by_digest
= sort_by_digest_4_4
;
10181 opti_type
= OPTI_TYPE_ZERO_BYTE
10182 | OPTI_TYPE_PRECOMPUTE_INIT
10183 | OPTI_TYPE_NOT_ITERATED
;
10190 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10191 salt_type
= SALT_TYPE_EMBEDDED
;
10192 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10193 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10194 | OPTS_TYPE_PT_ADD80
10195 | OPTS_TYPE_PT_UNICODE
;
10196 kern_type
= KERN_TYPE_OLDOFFICE34
;
10197 dgst_size
= DGST_SIZE_4_4
;
10198 parse_func
= oldoffice34_parse_hash
;
10199 sort_by_digest
= sort_by_digest_4_4
;
10200 opti_type
= OPTI_TYPE_ZERO_BYTE
10201 | OPTI_TYPE_PRECOMPUTE_INIT
10202 | OPTI_TYPE_NOT_ITERATED
;
10209 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10210 salt_type
= SALT_TYPE_EMBEDDED
;
10211 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10212 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10213 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10214 dgst_size
= DGST_SIZE_4_4
;
10215 parse_func
= oldoffice34cm1_parse_hash
;
10216 sort_by_digest
= sort_by_digest_4_4
;
10217 opti_type
= OPTI_TYPE_ZERO_BYTE
10218 | OPTI_TYPE_PRECOMPUTE_INIT
10219 | OPTI_TYPE_NOT_ITERATED
;
10226 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10227 salt_type
= SALT_TYPE_EMBEDDED
;
10228 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10229 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10230 | OPTS_TYPE_PT_ADD80
10231 | OPTS_TYPE_PT_UNICODE
10232 | OPTS_TYPE_PT_NEVERCRACK
;
10233 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10234 dgst_size
= DGST_SIZE_4_4
;
10235 parse_func
= oldoffice34cm2_parse_hash
;
10236 sort_by_digest
= sort_by_digest_4_4
;
10237 opti_type
= OPTI_TYPE_ZERO_BYTE
10238 | OPTI_TYPE_PRECOMPUTE_INIT
10239 | OPTI_TYPE_NOT_ITERATED
;
10246 case 9900: hash_type
= HASH_TYPE_MD5
;
10247 salt_type
= SALT_TYPE_NONE
;
10248 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10249 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10250 kern_type
= KERN_TYPE_RADMIN2
;
10251 dgst_size
= DGST_SIZE_4_4
;
10252 parse_func
= radmin2_parse_hash
;
10253 sort_by_digest
= sort_by_digest_4_4
;
10254 opti_type
= OPTI_TYPE_ZERO_BYTE
10255 | OPTI_TYPE_PRECOMPUTE_INIT
10256 | OPTI_TYPE_EARLY_SKIP
10257 | OPTI_TYPE_NOT_ITERATED
10258 | OPTI_TYPE_NOT_SALTED
;
10265 case 10000: hash_type
= HASH_TYPE_SHA256
;
10266 salt_type
= SALT_TYPE_EMBEDDED
;
10267 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10268 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10269 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10270 dgst_size
= DGST_SIZE_4_32
;
10271 parse_func
= djangopbkdf2_parse_hash
;
10272 sort_by_digest
= sort_by_digest_4_32
;
10273 opti_type
= OPTI_TYPE_ZERO_BYTE
10274 | OPTI_TYPE_SLOW_HASH_SIMD
;
10281 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10282 salt_type
= SALT_TYPE_EMBEDDED
;
10283 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10284 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10285 kern_type
= KERN_TYPE_SIPHASH
;
10286 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10287 parse_func
= siphash_parse_hash
;
10288 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10289 opti_type
= OPTI_TYPE_ZERO_BYTE
10290 | OPTI_TYPE_NOT_ITERATED
10291 | OPTI_TYPE_RAW_HASH
;
10298 case 10200: hash_type
= HASH_TYPE_MD5
;
10299 salt_type
= SALT_TYPE_EMBEDDED
;
10300 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10301 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10302 | OPTS_TYPE_ST_ADD80
10303 | OPTS_TYPE_ST_ADDBITS14
;
10304 kern_type
= KERN_TYPE_HMACMD5_PW
;
10305 dgst_size
= DGST_SIZE_4_4
;
10306 parse_func
= crammd5_parse_hash
;
10307 sort_by_digest
= sort_by_digest_4_4
;
10308 opti_type
= OPTI_TYPE_ZERO_BYTE
10309 | OPTI_TYPE_NOT_ITERATED
;
10316 case 10300: hash_type
= HASH_TYPE_SHA1
;
10317 salt_type
= SALT_TYPE_EMBEDDED
;
10318 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10319 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10320 kern_type
= KERN_TYPE_SAPH_SHA1
;
10321 dgst_size
= DGST_SIZE_4_5
;
10322 parse_func
= saph_sha1_parse_hash
;
10323 sort_by_digest
= sort_by_digest_4_5
;
10324 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10331 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10332 salt_type
= SALT_TYPE_EMBEDDED
;
10333 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10334 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10335 kern_type
= KERN_TYPE_PDF11
;
10336 dgst_size
= DGST_SIZE_4_4
;
10337 parse_func
= pdf11_parse_hash
;
10338 sort_by_digest
= sort_by_digest_4_4
;
10339 opti_type
= OPTI_TYPE_ZERO_BYTE
10340 | OPTI_TYPE_NOT_ITERATED
;
10347 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10348 salt_type
= SALT_TYPE_EMBEDDED
;
10349 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10350 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10351 kern_type
= KERN_TYPE_PDF11CM1
;
10352 dgst_size
= DGST_SIZE_4_4
;
10353 parse_func
= pdf11cm1_parse_hash
;
10354 sort_by_digest
= sort_by_digest_4_4
;
10355 opti_type
= OPTI_TYPE_ZERO_BYTE
10356 | OPTI_TYPE_NOT_ITERATED
;
10363 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10364 salt_type
= SALT_TYPE_EMBEDDED
;
10365 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10366 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10367 kern_type
= KERN_TYPE_PDF11CM2
;
10368 dgst_size
= DGST_SIZE_4_4
;
10369 parse_func
= pdf11cm2_parse_hash
;
10370 sort_by_digest
= sort_by_digest_4_4
;
10371 opti_type
= OPTI_TYPE_ZERO_BYTE
10372 | OPTI_TYPE_NOT_ITERATED
;
10379 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10380 salt_type
= SALT_TYPE_EMBEDDED
;
10381 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10382 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10383 kern_type
= KERN_TYPE_PDF14
;
10384 dgst_size
= DGST_SIZE_4_4
;
10385 parse_func
= pdf14_parse_hash
;
10386 sort_by_digest
= sort_by_digest_4_4
;
10387 opti_type
= OPTI_TYPE_ZERO_BYTE
10388 | OPTI_TYPE_NOT_ITERATED
;
10395 case 10600: hash_type
= HASH_TYPE_SHA256
;
10396 salt_type
= SALT_TYPE_EMBEDDED
;
10397 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10398 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10399 | OPTS_TYPE_ST_ADD80
10400 | OPTS_TYPE_ST_ADDBITS15
10401 | OPTS_TYPE_HASH_COPY
;
10402 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10403 dgst_size
= DGST_SIZE_4_8
;
10404 parse_func
= pdf17l3_parse_hash
;
10405 sort_by_digest
= sort_by_digest_4_8
;
10406 opti_type
= OPTI_TYPE_ZERO_BYTE
10407 | OPTI_TYPE_PRECOMPUTE_INIT
10408 | OPTI_TYPE_PRECOMPUTE_MERKLE
10409 | OPTI_TYPE_EARLY_SKIP
10410 | OPTI_TYPE_NOT_ITERATED
10411 | OPTI_TYPE_APPENDED_SALT
10412 | OPTI_TYPE_RAW_HASH
;
10419 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10420 salt_type
= SALT_TYPE_EMBEDDED
;
10421 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10422 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10423 | OPTS_TYPE_HASH_COPY
;
10424 kern_type
= KERN_TYPE_PDF17L8
;
10425 dgst_size
= DGST_SIZE_4_8
;
10426 parse_func
= pdf17l8_parse_hash
;
10427 sort_by_digest
= sort_by_digest_4_8
;
10428 opti_type
= OPTI_TYPE_ZERO_BYTE
10429 | OPTI_TYPE_NOT_ITERATED
;
10436 case 10800: hash_type
= HASH_TYPE_SHA384
;
10437 salt_type
= SALT_TYPE_NONE
;
10438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10439 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10440 | OPTS_TYPE_PT_ADD80
10441 | OPTS_TYPE_PT_ADDBITS15
;
10442 kern_type
= KERN_TYPE_SHA384
;
10443 dgst_size
= DGST_SIZE_8_8
;
10444 parse_func
= sha384_parse_hash
;
10445 sort_by_digest
= sort_by_digest_8_8
;
10446 opti_type
= OPTI_TYPE_ZERO_BYTE
10447 | OPTI_TYPE_PRECOMPUTE_INIT
10448 | OPTI_TYPE_PRECOMPUTE_MERKLE
10449 | OPTI_TYPE_EARLY_SKIP
10450 | OPTI_TYPE_NOT_ITERATED
10451 | OPTI_TYPE_NOT_SALTED
10452 | OPTI_TYPE_USES_BITS_64
10453 | OPTI_TYPE_RAW_HASH
;
10460 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10461 salt_type
= SALT_TYPE_EMBEDDED
;
10462 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10463 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10464 | OPTS_TYPE_ST_BASE64
10465 | OPTS_TYPE_HASH_COPY
;
10466 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10467 dgst_size
= DGST_SIZE_4_32
;
10468 parse_func
= pbkdf2_sha256_parse_hash
;
10469 sort_by_digest
= sort_by_digest_4_32
;
10470 opti_type
= OPTI_TYPE_ZERO_BYTE
10471 | OPTI_TYPE_SLOW_HASH_SIMD
;
10478 case 11000: hash_type
= HASH_TYPE_MD5
;
10479 salt_type
= SALT_TYPE_INTERN
;
10480 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10481 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10482 | OPTS_TYPE_PT_ADD80
;
10483 kern_type
= KERN_TYPE_PRESTASHOP
;
10484 dgst_size
= DGST_SIZE_4_4
;
10485 parse_func
= prestashop_parse_hash
;
10486 sort_by_digest
= sort_by_digest_4_4
;
10487 opti_type
= OPTI_TYPE_ZERO_BYTE
10488 | OPTI_TYPE_PRECOMPUTE_INIT
10489 | OPTI_TYPE_NOT_ITERATED
10490 | OPTI_TYPE_PREPENDED_SALT
;
10497 case 11100: hash_type
= HASH_TYPE_MD5
;
10498 salt_type
= SALT_TYPE_EMBEDDED
;
10499 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10501 | OPTS_TYPE_ST_ADD80
;
10502 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10503 dgst_size
= DGST_SIZE_4_4
;
10504 parse_func
= postgresql_auth_parse_hash
;
10505 sort_by_digest
= sort_by_digest_4_4
;
10506 opti_type
= OPTI_TYPE_ZERO_BYTE
10507 | OPTI_TYPE_PRECOMPUTE_INIT
10508 | OPTI_TYPE_PRECOMPUTE_MERKLE
10509 | OPTI_TYPE_EARLY_SKIP
;
10516 case 11200: hash_type
= HASH_TYPE_SHA1
;
10517 salt_type
= SALT_TYPE_EMBEDDED
;
10518 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10519 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10520 | OPTS_TYPE_PT_ADD80
10521 | OPTS_TYPE_ST_HEX
;
10522 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10523 dgst_size
= DGST_SIZE_4_5
;
10524 parse_func
= mysql_auth_parse_hash
;
10525 sort_by_digest
= sort_by_digest_4_5
;
10526 opti_type
= OPTI_TYPE_ZERO_BYTE
10527 | OPTI_TYPE_EARLY_SKIP
;
10534 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10535 salt_type
= SALT_TYPE_EMBEDDED
;
10536 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10537 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10539 | OPTS_TYPE_ST_ADD80
;
10540 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10541 dgst_size
= DGST_SIZE_4_4
;
10542 parse_func
= bitcoin_wallet_parse_hash
;
10543 sort_by_digest
= sort_by_digest_4_4
;
10544 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10551 case 11400: hash_type
= HASH_TYPE_MD5
;
10552 salt_type
= SALT_TYPE_EMBEDDED
;
10553 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10554 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10555 | OPTS_TYPE_PT_ADD80
10556 | OPTS_TYPE_HASH_COPY
;
10557 kern_type
= KERN_TYPE_SIP_AUTH
;
10558 dgst_size
= DGST_SIZE_4_4
;
10559 parse_func
= sip_auth_parse_hash
;
10560 sort_by_digest
= sort_by_digest_4_4
;
10561 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10568 case 11500: hash_type
= HASH_TYPE_CRC32
;
10569 salt_type
= SALT_TYPE_INTERN
;
10570 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10571 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10572 | OPTS_TYPE_ST_GENERATE_LE
10573 | OPTS_TYPE_ST_HEX
;
10574 kern_type
= KERN_TYPE_CRC32
;
10575 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10576 parse_func
= crc32_parse_hash
;
10577 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10578 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10585 case 11600: hash_type
= HASH_TYPE_AES
;
10586 salt_type
= SALT_TYPE_EMBEDDED
;
10587 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10588 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10589 | OPTS_TYPE_PT_NEVERCRACK
;
10590 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10591 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10592 parse_func
= seven_zip_parse_hash
;
10593 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10594 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10601 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10602 salt_type
= SALT_TYPE_NONE
;
10603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10605 | OPTS_TYPE_PT_ADD01
;
10606 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10607 dgst_size
= DGST_SIZE_4_8
;
10608 parse_func
= gost2012sbog_256_parse_hash
;
10609 sort_by_digest
= sort_by_digest_4_8
;
10610 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10617 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10618 salt_type
= SALT_TYPE_NONE
;
10619 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10620 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10621 | OPTS_TYPE_PT_ADD01
;
10622 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10623 dgst_size
= DGST_SIZE_4_16
;
10624 parse_func
= gost2012sbog_512_parse_hash
;
10625 sort_by_digest
= sort_by_digest_4_16
;
10626 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10633 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10634 salt_type
= SALT_TYPE_EMBEDDED
;
10635 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10637 | OPTS_TYPE_ST_BASE64
10638 | OPTS_TYPE_HASH_COPY
;
10639 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10640 dgst_size
= DGST_SIZE_4_32
;
10641 parse_func
= pbkdf2_md5_parse_hash
;
10642 sort_by_digest
= sort_by_digest_4_32
;
10643 opti_type
= OPTI_TYPE_ZERO_BYTE
10644 | OPTI_TYPE_SLOW_HASH_SIMD
;
10651 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10652 salt_type
= SALT_TYPE_EMBEDDED
;
10653 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10654 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10655 | OPTS_TYPE_ST_BASE64
10656 | OPTS_TYPE_HASH_COPY
;
10657 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10658 dgst_size
= DGST_SIZE_4_32
;
10659 parse_func
= pbkdf2_sha1_parse_hash
;
10660 sort_by_digest
= sort_by_digest_4_32
;
10661 opti_type
= OPTI_TYPE_ZERO_BYTE
10662 | OPTI_TYPE_SLOW_HASH_SIMD
;
10669 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10670 salt_type
= SALT_TYPE_EMBEDDED
;
10671 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10672 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10673 | OPTS_TYPE_ST_BASE64
10674 | OPTS_TYPE_HASH_COPY
;
10675 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10676 dgst_size
= DGST_SIZE_8_16
;
10677 parse_func
= pbkdf2_sha512_parse_hash
;
10678 sort_by_digest
= sort_by_digest_8_16
;
10679 opti_type
= OPTI_TYPE_ZERO_BYTE
10680 | OPTI_TYPE_USES_BITS_64
10681 | OPTI_TYPE_SLOW_HASH_SIMD
;
10688 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10689 salt_type
= SALT_TYPE_EMBEDDED
;
10690 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10691 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10692 kern_type
= KERN_TYPE_ECRYPTFS
;
10693 dgst_size
= DGST_SIZE_8_8
;
10694 parse_func
= ecryptfs_parse_hash
;
10695 sort_by_digest
= sort_by_digest_8_8
;
10696 opti_type
= OPTI_TYPE_ZERO_BYTE
10697 | OPTI_TYPE_USES_BITS_64
;
10704 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10705 salt_type
= SALT_TYPE_EMBEDDED
;
10706 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10707 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10708 kern_type
= KERN_TYPE_ORACLET
;
10709 dgst_size
= DGST_SIZE_8_16
;
10710 parse_func
= oraclet_parse_hash
;
10711 sort_by_digest
= sort_by_digest_8_16
;
10712 opti_type
= OPTI_TYPE_ZERO_BYTE
10713 | OPTI_TYPE_USES_BITS_64
;
10720 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10721 salt_type
= SALT_TYPE_EMBEDDED
;
10722 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10723 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10724 kern_type
= KERN_TYPE_BSDICRYPT
;
10725 dgst_size
= DGST_SIZE_4_4
;
10726 parse_func
= bsdicrypt_parse_hash
;
10727 sort_by_digest
= sort_by_digest_4_4
;
10728 opti_type
= OPTI_TYPE_ZERO_BYTE
10729 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10736 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10737 salt_type
= SALT_TYPE_EMBEDDED
;
10738 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10739 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10740 kern_type
= KERN_TYPE_RAR3
;
10741 dgst_size
= DGST_SIZE_4_4
;
10742 parse_func
= rar3hp_parse_hash
;
10743 sort_by_digest
= sort_by_digest_4_4
;
10744 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10751 case 12600: hash_type
= HASH_TYPE_SHA256
;
10752 salt_type
= SALT_TYPE_INTERN
;
10753 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10754 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10755 | OPTS_TYPE_PT_ADD80
;
10756 kern_type
= KERN_TYPE_CF10
;
10757 dgst_size
= DGST_SIZE_4_8
;
10758 parse_func
= cf10_parse_hash
;
10759 sort_by_digest
= sort_by_digest_4_8
;
10760 opti_type
= OPTI_TYPE_ZERO_BYTE
10761 | OPTI_TYPE_PRECOMPUTE_INIT
10762 | OPTI_TYPE_EARLY_SKIP
10763 | OPTI_TYPE_NOT_ITERATED
;
10770 case 12700: hash_type
= HASH_TYPE_AES
;
10771 salt_type
= SALT_TYPE_EMBEDDED
;
10772 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10774 | OPTS_TYPE_HASH_COPY
;
10775 kern_type
= KERN_TYPE_MYWALLET
;
10776 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10777 parse_func
= mywallet_parse_hash
;
10778 sort_by_digest
= sort_by_digest_4_5
;
10779 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10786 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10787 salt_type
= SALT_TYPE_EMBEDDED
;
10788 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10789 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10790 kern_type
= KERN_TYPE_MS_DRSR
;
10791 dgst_size
= DGST_SIZE_4_8
;
10792 parse_func
= ms_drsr_parse_hash
;
10793 sort_by_digest
= sort_by_digest_4_8
;
10794 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10801 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10802 salt_type
= SALT_TYPE_EMBEDDED
;
10803 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10804 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10805 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10806 dgst_size
= DGST_SIZE_4_8
;
10807 parse_func
= androidfde_samsung_parse_hash
;
10808 sort_by_digest
= sort_by_digest_4_8
;
10809 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10816 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10817 salt_type
= SALT_TYPE_EMBEDDED
;
10818 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10819 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10820 kern_type
= KERN_TYPE_RAR5
;
10821 dgst_size
= DGST_SIZE_4_4
;
10822 parse_func
= rar5_parse_hash
;
10823 sort_by_digest
= sort_by_digest_4_4
;
10824 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10831 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10832 salt_type
= SALT_TYPE_EMBEDDED
;
10833 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10834 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10835 kern_type
= KERN_TYPE_KRB5TGS
;
10836 dgst_size
= DGST_SIZE_4_4
;
10837 parse_func
= krb5tgs_parse_hash
;
10838 sort_by_digest
= sort_by_digest_4_4
;
10839 opti_type
= OPTI_TYPE_ZERO_BYTE
10840 | OPTI_TYPE_NOT_ITERATED
;
10847 case 13200: hash_type
= HASH_TYPE_AES
;
10848 salt_type
= SALT_TYPE_EMBEDDED
;
10849 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10850 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10851 kern_type
= KERN_TYPE_AXCRYPT
;
10852 dgst_size
= DGST_SIZE_4_4
;
10853 parse_func
= axcrypt_parse_hash
;
10854 sort_by_digest
= sort_by_digest_4_4
;
10855 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10862 case 13300: hash_type
= HASH_TYPE_SHA1
;
10863 salt_type
= SALT_TYPE_NONE
;
10864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10865 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10866 | OPTS_TYPE_PT_ADD80
10867 | OPTS_TYPE_PT_ADDBITS15
;
10868 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10869 dgst_size
= DGST_SIZE_4_5
;
10870 parse_func
= sha1axcrypt_parse_hash
;
10871 sort_by_digest
= sort_by_digest_4_5
;
10872 opti_type
= OPTI_TYPE_ZERO_BYTE
10873 | OPTI_TYPE_PRECOMPUTE_INIT
10874 | OPTI_TYPE_EARLY_SKIP
10875 | OPTI_TYPE_NOT_ITERATED
10876 | OPTI_TYPE_NOT_SALTED
;
10883 case 13400: hash_type
= HASH_TYPE_AES
;
10884 salt_type
= SALT_TYPE_EMBEDDED
;
10885 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10886 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10887 kern_type
= KERN_TYPE_KEEPASS
;
10888 dgst_size
= DGST_SIZE_4_4
;
10889 parse_func
= keepass_parse_hash
;
10890 sort_by_digest
= sort_by_digest_4_4
;
10891 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10898 case 13500: hash_type
= HASH_TYPE_SHA1
;
10899 salt_type
= SALT_TYPE_EMBEDDED
;
10900 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10901 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10902 | OPTS_TYPE_PT_UNICODE
10903 | OPTS_TYPE_PT_ADD80
;
10904 kern_type
= KERN_TYPE_PSTOKEN
;
10905 dgst_size
= DGST_SIZE_4_5
;
10906 parse_func
= pstoken_parse_hash
;
10907 sort_by_digest
= sort_by_digest_4_5
;
10908 opti_type
= OPTI_TYPE_ZERO_BYTE
10909 | OPTI_TYPE_PRECOMPUTE_INIT
10910 | OPTI_TYPE_EARLY_SKIP
10911 | OPTI_TYPE_NOT_ITERATED
10912 | OPTI_TYPE_PREPENDED_SALT
10913 | OPTI_TYPE_RAW_HASH
;
10920 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10921 salt_type
= SALT_TYPE_EMBEDDED
;
10922 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10923 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10924 kern_type
= KERN_TYPE_ZIP2
;
10925 dgst_size
= DGST_SIZE_4_4
;
10926 parse_func
= zip2_parse_hash
;
10927 sort_by_digest
= sort_by_digest_4_4
;
10928 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10935 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10936 salt_type
= SALT_TYPE_EMBEDDED
;
10937 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10938 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10939 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10940 dgst_size
= DGST_SIZE_4_5
;
10941 parse_func
= veracrypt_parse_hash_655331
;
10942 sort_by_digest
= sort_by_digest_4_5
;
10943 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10950 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10951 salt_type
= SALT_TYPE_EMBEDDED
;
10952 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10953 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10954 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10955 dgst_size
= DGST_SIZE_4_5
;
10956 parse_func
= veracrypt_parse_hash_655331
;
10957 sort_by_digest
= sort_by_digest_4_5
;
10958 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10965 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10966 salt_type
= SALT_TYPE_EMBEDDED
;
10967 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10968 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10969 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10970 dgst_size
= DGST_SIZE_4_5
;
10971 parse_func
= veracrypt_parse_hash_655331
;
10972 sort_by_digest
= sort_by_digest_4_5
;
10973 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10980 case 13721: hash_type
= HASH_TYPE_SHA512
;
10981 salt_type
= SALT_TYPE_EMBEDDED
;
10982 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10983 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10984 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10985 dgst_size
= DGST_SIZE_8_8
;
10986 parse_func
= veracrypt_parse_hash_500000
;
10987 sort_by_digest
= sort_by_digest_8_8
;
10988 opti_type
= OPTI_TYPE_ZERO_BYTE
10989 | OPTI_TYPE_USES_BITS_64
;
10996 case 13722: hash_type
= HASH_TYPE_SHA512
;
10997 salt_type
= SALT_TYPE_EMBEDDED
;
10998 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10999 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11000 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11001 dgst_size
= DGST_SIZE_8_8
;
11002 parse_func
= veracrypt_parse_hash_500000
;
11003 sort_by_digest
= sort_by_digest_8_8
;
11004 opti_type
= OPTI_TYPE_ZERO_BYTE
11005 | OPTI_TYPE_USES_BITS_64
;
11012 case 13723: hash_type
= HASH_TYPE_SHA512
;
11013 salt_type
= SALT_TYPE_EMBEDDED
;
11014 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11015 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11016 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11017 dgst_size
= DGST_SIZE_8_8
;
11018 parse_func
= veracrypt_parse_hash_500000
;
11019 sort_by_digest
= sort_by_digest_8_8
;
11020 opti_type
= OPTI_TYPE_ZERO_BYTE
11021 | OPTI_TYPE_USES_BITS_64
;
11028 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
11029 salt_type
= SALT_TYPE_EMBEDDED
;
11030 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11031 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11032 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
11033 dgst_size
= DGST_SIZE_4_8
;
11034 parse_func
= veracrypt_parse_hash_500000
;
11035 sort_by_digest
= sort_by_digest_4_8
;
11036 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11043 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
11044 salt_type
= SALT_TYPE_EMBEDDED
;
11045 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11047 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
11048 dgst_size
= DGST_SIZE_4_8
;
11049 parse_func
= veracrypt_parse_hash_500000
;
11050 sort_by_digest
= sort_by_digest_4_8
;
11051 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11058 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
11059 salt_type
= SALT_TYPE_EMBEDDED
;
11060 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11062 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
11063 dgst_size
= DGST_SIZE_4_8
;
11064 parse_func
= veracrypt_parse_hash_500000
;
11065 sort_by_digest
= sort_by_digest_4_8
;
11066 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11073 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11074 salt_type
= SALT_TYPE_EMBEDDED
;
11075 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11076 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11077 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11078 dgst_size
= DGST_SIZE_4_5
;
11079 parse_func
= veracrypt_parse_hash_327661
;
11080 sort_by_digest
= sort_by_digest_4_5
;
11081 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11088 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11089 salt_type
= SALT_TYPE_EMBEDDED
;
11090 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11092 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11093 dgst_size
= DGST_SIZE_4_5
;
11094 parse_func
= veracrypt_parse_hash_327661
;
11095 sort_by_digest
= sort_by_digest_4_5
;
11096 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11103 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11104 salt_type
= SALT_TYPE_EMBEDDED
;
11105 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11106 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11107 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11108 dgst_size
= DGST_SIZE_4_5
;
11109 parse_func
= veracrypt_parse_hash_327661
;
11110 sort_by_digest
= sort_by_digest_4_5
;
11111 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11118 case 13751: hash_type
= HASH_TYPE_SHA256
;
11119 salt_type
= SALT_TYPE_EMBEDDED
;
11120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11122 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11123 dgst_size
= DGST_SIZE_4_8
;
11124 parse_func
= veracrypt_parse_hash_500000
;
11125 sort_by_digest
= sort_by_digest_4_8
;
11126 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11133 case 13752: hash_type
= HASH_TYPE_SHA256
;
11134 salt_type
= SALT_TYPE_EMBEDDED
;
11135 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11137 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11138 dgst_size
= DGST_SIZE_4_8
;
11139 parse_func
= veracrypt_parse_hash_500000
;
11140 sort_by_digest
= sort_by_digest_4_8
;
11141 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11148 case 13753: hash_type
= HASH_TYPE_SHA256
;
11149 salt_type
= SALT_TYPE_EMBEDDED
;
11150 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11151 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11152 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11153 dgst_size
= DGST_SIZE_4_8
;
11154 parse_func
= veracrypt_parse_hash_500000
;
11155 sort_by_digest
= sort_by_digest_4_8
;
11156 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11163 case 13761: hash_type
= HASH_TYPE_SHA256
;
11164 salt_type
= SALT_TYPE_EMBEDDED
;
11165 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11166 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11167 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11168 dgst_size
= DGST_SIZE_4_8
;
11169 parse_func
= veracrypt_parse_hash_200000
;
11170 sort_by_digest
= sort_by_digest_4_8
;
11171 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11178 case 13762: hash_type
= HASH_TYPE_SHA256
;
11179 salt_type
= SALT_TYPE_EMBEDDED
;
11180 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11182 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11183 dgst_size
= DGST_SIZE_4_8
;
11184 parse_func
= veracrypt_parse_hash_200000
;
11185 sort_by_digest
= sort_by_digest_4_8
;
11186 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11193 case 13763: hash_type
= HASH_TYPE_SHA256
;
11194 salt_type
= SALT_TYPE_EMBEDDED
;
11195 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11197 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11198 dgst_size
= DGST_SIZE_4_8
;
11199 parse_func
= veracrypt_parse_hash_200000
;
11200 sort_by_digest
= sort_by_digest_4_8
;
11201 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11208 case 13800: hash_type
= HASH_TYPE_SHA256
;
11209 salt_type
= SALT_TYPE_EMBEDDED
;
11210 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11211 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11212 | OPTS_TYPE_PT_UNICODE
;
11213 kern_type
= KERN_TYPE_WIN8PHONE
;
11214 dgst_size
= DGST_SIZE_4_8
;
11215 parse_func
= win8phone_parse_hash
;
11216 sort_by_digest
= sort_by_digest_4_8
;
11217 opti_type
= OPTI_TYPE_ZERO_BYTE
11218 | OPTI_TYPE_PRECOMPUTE_INIT
11219 | OPTI_TYPE_EARLY_SKIP
11220 | OPTI_TYPE_NOT_ITERATED
11221 | OPTI_TYPE_RAW_HASH
;
11228 default: usage_mini_print (PROGNAME
); return (-1);
11235 data
.parse_func
= parse_func
;
11243 if (salt_type
== SALT_TYPE_INTERN
)
11245 opts_type
|= OPTS_TYPE_ST_HEX
;
11249 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11255 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11256 | (salt_type
== SALT_TYPE_EXTERN
)
11257 | (salt_type
== SALT_TYPE_EMBEDDED
)
11258 | (salt_type
== SALT_TYPE_VIRTUAL
));
11260 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11262 data
.hash_type
= hash_type
;
11263 data
.attack_mode
= attack_mode
;
11264 data
.attack_kern
= attack_kern
;
11265 data
.attack_exec
= attack_exec
;
11266 data
.kern_type
= kern_type
;
11267 data
.opts_type
= opts_type
;
11268 data
.dgst_size
= dgst_size
;
11269 data
.salt_type
= salt_type
;
11270 data
.isSalted
= isSalted
;
11271 data
.sort_by_digest
= sort_by_digest
;
11272 data
.dgst_pos0
= dgst_pos0
;
11273 data
.dgst_pos1
= dgst_pos1
;
11274 data
.dgst_pos2
= dgst_pos2
;
11275 data
.dgst_pos3
= dgst_pos3
;
11281 case 2500: esalt_size
= sizeof (wpa_t
); break;
11282 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11283 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11284 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11285 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11286 case 6211: esalt_size
= sizeof (tc_t
); break;
11287 case 6212: esalt_size
= sizeof (tc_t
); break;
11288 case 6213: esalt_size
= sizeof (tc_t
); break;
11289 case 6221: esalt_size
= sizeof (tc_t
); break;
11290 case 6222: esalt_size
= sizeof (tc_t
); break;
11291 case 6223: esalt_size
= sizeof (tc_t
); break;
11292 case 6231: esalt_size
= sizeof (tc_t
); break;
11293 case 6232: esalt_size
= sizeof (tc_t
); break;
11294 case 6233: esalt_size
= sizeof (tc_t
); break;
11295 case 6241: esalt_size
= sizeof (tc_t
); break;
11296 case 6242: esalt_size
= sizeof (tc_t
); break;
11297 case 6243: esalt_size
= sizeof (tc_t
); break;
11298 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11299 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11300 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11301 case 7300: esalt_size
= sizeof (rakp_t
); break;
11302 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11303 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11304 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11305 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11306 case 9400: esalt_size
= sizeof (office2007_t
); break;
11307 case 9500: esalt_size
= sizeof (office2010_t
); break;
11308 case 9600: esalt_size
= sizeof (office2013_t
); break;
11309 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11310 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11311 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11312 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11313 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11314 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11315 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11316 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11317 case 10400: esalt_size
= sizeof (pdf_t
); break;
11318 case 10410: esalt_size
= sizeof (pdf_t
); break;
11319 case 10420: esalt_size
= sizeof (pdf_t
); break;
11320 case 10500: esalt_size
= sizeof (pdf_t
); break;
11321 case 10600: esalt_size
= sizeof (pdf_t
); break;
11322 case 10700: esalt_size
= sizeof (pdf_t
); break;
11323 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11324 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11325 case 11400: esalt_size
= sizeof (sip_t
); break;
11326 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11327 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11328 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11329 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11330 case 13000: esalt_size
= sizeof (rar5_t
); break;
11331 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11332 case 13400: esalt_size
= sizeof (keepass_t
); break;
11333 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11334 case 13600: esalt_size
= sizeof (zip2_t
); break;
11335 case 13711: esalt_size
= sizeof (tc_t
); break;
11336 case 13712: esalt_size
= sizeof (tc_t
); break;
11337 case 13713: esalt_size
= sizeof (tc_t
); break;
11338 case 13721: esalt_size
= sizeof (tc_t
); break;
11339 case 13722: esalt_size
= sizeof (tc_t
); break;
11340 case 13723: esalt_size
= sizeof (tc_t
); break;
11341 case 13731: esalt_size
= sizeof (tc_t
); break;
11342 case 13732: esalt_size
= sizeof (tc_t
); break;
11343 case 13733: esalt_size
= sizeof (tc_t
); break;
11344 case 13741: esalt_size
= sizeof (tc_t
); break;
11345 case 13742: esalt_size
= sizeof (tc_t
); break;
11346 case 13743: esalt_size
= sizeof (tc_t
); break;
11347 case 13751: esalt_size
= sizeof (tc_t
); break;
11348 case 13752: esalt_size
= sizeof (tc_t
); break;
11349 case 13753: esalt_size
= sizeof (tc_t
); break;
11350 case 13761: esalt_size
= sizeof (tc_t
); break;
11351 case 13762: esalt_size
= sizeof (tc_t
); break;
11352 case 13763: esalt_size
= sizeof (tc_t
); break;
11353 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11356 data
.esalt_size
= esalt_size
;
11359 * choose dictionary parser
11362 if (hash_type
== HASH_TYPE_LM
)
11364 get_next_word_func
= get_next_word_lm
;
11366 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11368 get_next_word_func
= get_next_word_uc
;
11372 get_next_word_func
= get_next_word_std
;
11379 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11382 size_t dictstat_nmemb
= 0;
11386 uint dictstat_nmemb
= 0;
11389 char dictstat
[256] = { 0 };
11391 FILE *dictstat_fp
= NULL
;
11395 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11397 dictstat_fp
= fopen (dictstat
, "rb");
11402 struct stat tmpstat
;
11404 fstat (fileno (dictstat_fp
), &tmpstat
);
11408 struct stat64 tmpstat
;
11410 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11413 if (tmpstat
.st_mtime
< COMPTIME
)
11415 /* with v0.15 the format changed so we have to ensure user is using a good version
11416 since there is no version-header in the dictstat file */
11418 fclose (dictstat_fp
);
11424 while (!feof (dictstat_fp
))
11428 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11430 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11432 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11434 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11440 fclose (dictstat_fp
);
11449 char potfile
[256] = { 0 };
11451 if (potfile_path
== NULL
)
11453 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11457 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11460 data
.pot_fp
= NULL
;
11462 FILE *out_fp
= NULL
;
11463 FILE *pot_fp
= NULL
;
11465 if (show
== 1 || left
== 1)
11467 pot_fp
= fopen (potfile
, "rb");
11469 if (pot_fp
== NULL
)
11471 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11476 if (outfile
!= NULL
)
11478 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11480 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11494 if (potfile_disable
== 0)
11496 pot_fp
= fopen (potfile
, "ab");
11498 if (pot_fp
== NULL
)
11500 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11505 data
.pot_fp
= pot_fp
;
11512 uint pot_avail
= 0;
11514 if (show
== 1 || left
== 1)
11516 SUPPRESS_OUTPUT
= 1;
11518 pot_avail
= count_lines (pot_fp
);
11522 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11524 uint pot_hashes_avail
= 0;
11528 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11530 while (!feof (pot_fp
))
11534 int line_len
= fgetl (pot_fp
, line_buf
);
11536 if (line_len
== 0) continue;
11538 char *plain_buf
= line_buf
+ line_len
;
11540 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11542 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11544 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11545 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11547 if (pot_cnt
== pot_hashes_avail
)
11551 for (pos
= 0; pos
< INCR_POT
; pos
++)
11553 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11555 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11557 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11559 tmp_hash
->digest
= mymalloc (dgst_size
);
11563 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11568 tmp_hash
->esalt
= mymalloc (esalt_size
);
11571 pot_hashes_avail
++;
11579 int iter
= MAX_CUT_TRIES
;
11583 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11585 if (line_buf
[i
] == ':')
11593 if (data
.hash_mode
!= 2500)
11595 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11599 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11601 if (line_len
> max_salt_size
)
11603 parser_status
= PARSER_GLOBAL_LENGTH
;
11607 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11609 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11611 hashes_buf
->salt
->salt_len
= line_len
;
11613 parser_status
= PARSER_OK
;
11617 // if NOT parsed without error, we add the ":" to the plain
11619 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11625 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11627 if (parser_status
< PARSER_GLOBAL_ZERO
)
11629 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11634 if (plain_len
>= 255) continue;
11636 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11638 pot_ptr
->plain_len
= plain_len
;
11647 SUPPRESS_OUTPUT
= 0;
11649 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11656 uint pw_min
= PW_MIN
;
11657 uint pw_max
= PW_MAX
;
11661 case 125: if (pw_max
> 32) pw_max
= 32;
11663 case 400: if (pw_max
> 40) pw_max
= 40;
11665 case 500: if (pw_max
> 16) pw_max
= 16;
11667 case 1500: if (pw_max
> 8) pw_max
= 8;
11669 case 1600: if (pw_max
> 16) pw_max
= 16;
11671 case 1800: if (pw_max
> 16) pw_max
= 16;
11673 case 2100: if (pw_max
> 16) pw_max
= 16;
11675 case 2500: if (pw_min
< 8) pw_min
= 8;
11677 case 3000: if (pw_max
> 7) pw_max
= 7;
11679 case 5200: if (pw_max
> 24) pw_max
= 24;
11681 case 5800: if (pw_max
> 16) pw_max
= 16;
11683 case 6300: if (pw_max
> 16) pw_max
= 16;
11685 case 7400: if (pw_max
> 16) pw_max
= 16;
11687 case 7700: if (pw_max
> 8) pw_max
= 8;
11689 case 7900: if (pw_max
> 48) pw_max
= 48;
11691 case 8500: if (pw_max
> 8) pw_max
= 8;
11693 case 8600: if (pw_max
> 16) pw_max
= 16;
11695 case 9710: pw_min
= 5;
11698 case 9810: pw_min
= 5;
11701 case 10410: pw_min
= 5;
11704 case 10300: if (pw_max
< 3) pw_min
= 3;
11705 if (pw_max
> 40) pw_max
= 40;
11707 case 10500: if (pw_max
< 3) pw_min
= 3;
11708 if (pw_max
> 40) pw_max
= 40;
11710 case 10700: if (pw_max
> 16) pw_max
= 16;
11712 case 11300: if (pw_max
> 40) pw_max
= 40;
11714 case 11600: if (pw_max
> 32) pw_max
= 32;
11716 case 12500: if (pw_max
> 20) pw_max
= 20;
11718 case 12800: if (pw_max
> 24) pw_max
= 24;
11722 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11724 switch (attack_kern
)
11726 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11728 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11734 * charsets : keep them together for more easy maintainnce
11737 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11738 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11740 mp_setup_sys (mp_sys
);
11742 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11743 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11744 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11745 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11748 * load hashes, part I: find input mode, count hashes
11751 uint hashlist_mode
= 0;
11752 uint hashlist_format
= HLFMT_HASHCAT
;
11754 uint hashes_avail
= 0;
11756 if ((benchmark
== 0) && (stdout_flag
== 0))
11760 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11762 if ((hash_mode
== 2500) ||
11763 (hash_mode
== 5200) ||
11764 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11765 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11766 (hash_mode
== 9000))
11768 hashlist_mode
= HL_MODE_ARG
;
11770 char *hashfile
= myargv
[optind
];
11772 data
.hashfile
= hashfile
;
11774 logfile_top_var_string ("target", hashfile
);
11777 if (hashlist_mode
== HL_MODE_ARG
)
11779 if (hash_mode
== 2500)
11783 if (stat (data
.hashfile
, &st
) == -1)
11785 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11790 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11797 else if (hashlist_mode
== HL_MODE_FILE
)
11799 char *hashfile
= myargv
[optind
];
11801 data
.hashfile
= hashfile
;
11803 logfile_top_var_string ("target", hashfile
);
11807 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11809 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11814 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11816 hashes_avail
= count_lines (fp
);
11820 if (hashes_avail
== 0)
11822 log_error ("ERROR: hashfile is empty or corrupt");
11829 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11831 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11833 log_error ("ERROR: remove not supported in native hashfile-format mode");
11845 hashlist_mode
= HL_MODE_ARG
;
11850 if (hash_mode
== 3000) hashes_avail
*= 2;
11852 data
.hashlist_mode
= hashlist_mode
;
11853 data
.hashlist_format
= hashlist_format
;
11855 logfile_top_uint (hashlist_mode
);
11856 logfile_top_uint (hashlist_format
);
11859 * load hashes, part II: allocate required memory, set pointers
11862 hash_t
*hashes_buf
= NULL
;
11863 void *digests_buf
= NULL
;
11864 salt_t
*salts_buf
= NULL
;
11865 void *esalts_buf
= NULL
;
11867 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11869 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11871 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11875 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11877 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11879 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11881 if (username
&& (remove
|| show
|| left
))
11883 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11888 hash_info
->orighash
= (char *) mymalloc (256);
11895 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11899 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11904 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11907 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11909 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11913 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11917 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11922 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11927 * load hashes, part III: parse hashes or generate them if benchmark
11930 uint hashes_cnt
= 0;
11932 if (benchmark
== 0)
11936 // useless to read hash file for keyspace, cheat a little bit w/ optind
11938 else if (stdout_flag
== 1)
11940 // useless to read hash file for stdout, cheat a little bit w/ optind
11942 else if (hashes_avail
== 0)
11945 else if (hashlist_mode
== HL_MODE_ARG
)
11947 char *input_buf
= myargv
[optind
];
11949 uint input_len
= strlen (input_buf
);
11951 logfile_top_var_string ("target", input_buf
);
11953 char *hash_buf
= NULL
;
11956 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11958 bool hash_fmt_error
= 0;
11960 if (hash_len
< 1) hash_fmt_error
= 1;
11961 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11963 if (hash_fmt_error
)
11965 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11969 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11971 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11973 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11978 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11981 int parser_status
= PARSER_OK
;
11983 if (hash_mode
== 2500)
11987 log_error ("ERROR: hccap file not specified");
11992 hashlist_mode
= HL_MODE_FILE
;
11994 data
.hashlist_mode
= hashlist_mode
;
11996 FILE *fp
= fopen (hash_buf
, "rb");
12000 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12005 if (hashes_avail
< 1)
12007 log_error ("ERROR: hccap file is empty or corrupt");
12014 uint hccap_size
= sizeof (hccap_t
);
12016 char *in
= (char *) mymalloc (hccap_size
);
12020 int n
= fread (in
, hccap_size
, 1, fp
);
12024 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12029 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12031 if (parser_status
!= PARSER_OK
)
12033 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12038 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12040 if ((show
== 1) || (left
== 1))
12042 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12044 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12046 int cur_pos
= tmp_salt
->salt_len
;
12047 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12049 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12051 // do the appending task
12053 snprintf (salt_ptr
+ cur_pos
,
12055 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12067 wpa
->orig_mac2
[5]);
12069 // memset () the remaining part of the salt
12071 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12072 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12074 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12076 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12079 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
);
12080 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
);
12089 else if (hash_mode
== 3000)
12091 if (hash_len
== 32)
12093 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12095 hash_t
*lm_hash_left
= NULL
;
12097 if (parser_status
== PARSER_OK
)
12099 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12105 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12108 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12110 hash_t
*lm_hash_right
= NULL
;
12112 if (parser_status
== PARSER_OK
)
12114 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12120 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12125 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12127 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
);
12128 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
);
12133 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12135 if (parser_status
== PARSER_OK
)
12137 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12138 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12141 if (parser_status
== PARSER_OK
)
12147 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12153 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12155 if (parser_status
== PARSER_OK
)
12157 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12158 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12161 if (parser_status
== PARSER_OK
)
12167 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12172 else if (hashlist_mode
== HL_MODE_FILE
)
12174 char *hashfile
= data
.hashfile
;
12178 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12180 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12187 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12193 int line_len
= fgetl (fp
, line_buf
);
12195 if (line_len
== 0) continue;
12197 char *hash_buf
= NULL
;
12200 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12202 bool hash_fmt_error
= 0;
12204 if (hash_len
< 1) hash_fmt_error
= 1;
12205 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12207 if (hash_fmt_error
)
12209 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12216 char *user_buf
= NULL
;
12219 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12221 if (remove
|| show
)
12223 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12225 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12227 user_t
*user_ptr
= *user
;
12229 if (user_buf
!= NULL
)
12231 user_ptr
->user_name
= mystrdup (user_buf
);
12235 user_ptr
->user_name
= mystrdup ("");
12238 user_ptr
->user_len
= user_len
;
12242 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12244 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12246 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12251 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12254 if (hash_mode
== 3000)
12256 if (hash_len
== 32)
12258 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12260 if (parser_status
< PARSER_GLOBAL_ZERO
)
12262 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12267 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12271 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12273 if (parser_status
< PARSER_GLOBAL_ZERO
)
12275 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12280 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12282 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);
12288 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
);
12289 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
);
12293 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12295 if (parser_status
< PARSER_GLOBAL_ZERO
)
12297 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12302 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);
12304 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12305 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12312 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12314 if (parser_status
< PARSER_GLOBAL_ZERO
)
12316 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12321 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);
12323 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12324 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12334 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12336 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12343 hashes_buf
[0].salt
->salt_len
= 8;
12345 // special salt handling
12349 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12350 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12352 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12354 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12356 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12358 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12360 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12362 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12364 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12366 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12368 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12370 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12371 hashes_buf
[0].salt
->scrypt_N
= 1024;
12372 hashes_buf
[0].salt
->scrypt_r
= 1;
12373 hashes_buf
[0].salt
->scrypt_p
= 1;
12375 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12377 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12378 hashes_buf
[0].salt
->scrypt_N
= 16384;
12379 hashes_buf
[0].salt
->scrypt_r
= 1;
12380 hashes_buf
[0].salt
->scrypt_p
= 1;
12382 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12384 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12386 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12388 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12390 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12392 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12394 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12396 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12398 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12400 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12402 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12404 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12406 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12408 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12410 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12414 // special esalt handling
12418 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12420 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12421 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12423 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12424 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12426 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12427 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12428 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12429 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12431 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12432 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12433 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12434 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12436 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12438 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12439 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12440 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12442 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12443 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12444 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12446 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12447 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12448 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12450 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12451 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12452 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12454 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12455 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12456 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12458 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12459 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12460 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12462 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12463 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12464 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12466 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12468 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12470 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12471 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12472 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12481 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12483 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12485 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12487 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12489 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12491 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12493 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12495 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12497 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12499 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12501 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12503 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12505 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12507 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12509 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12511 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12513 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12515 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12517 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12519 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12521 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12523 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12525 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12527 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12529 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12531 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12533 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12535 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12537 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12539 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12541 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12543 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12545 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12547 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12549 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12551 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12555 // set default iterations
12559 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12561 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12563 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12565 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12567 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12569 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12571 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12573 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12575 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12577 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12579 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12581 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12583 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12585 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12587 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12589 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12591 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12593 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12595 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12597 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12599 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12601 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12603 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12605 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12607 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12609 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12611 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12613 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12615 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12617 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12619 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12621 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12623 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12625 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12627 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12629 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12631 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12633 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12635 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12637 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12639 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12641 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12643 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12645 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12647 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12649 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12651 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12653 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12655 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12657 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12659 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12661 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12663 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12665 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12667 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12669 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12671 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12673 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12675 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12677 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12679 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12681 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12683 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12685 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12687 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12689 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12691 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12693 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12695 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12697 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12699 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12701 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12703 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12705 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12707 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12709 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12711 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12713 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12715 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12717 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12719 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12721 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12728 if (show
== 1 || left
== 1)
12730 for (uint i
= 0; i
< pot_cnt
; i
++)
12732 pot_t
*pot_ptr
= &pot
[i
];
12734 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12736 local_free (hashes_buf
->digest
);
12740 local_free (hashes_buf
->salt
);
12746 if (data
.quiet
== 0) log_info_nn ("");
12751 if ((keyspace
== 0) && (stdout_flag
== 0))
12753 if (hashes_cnt
== 0)
12755 log_error ("ERROR: No hashes loaded");
12762 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12765 if (data
.outfile
!= NULL
)
12767 if (data
.hashfile
!= NULL
)
12770 struct stat tmpstat_outfile
;
12771 struct stat tmpstat_hashfile
;
12775 struct stat64 tmpstat_outfile
;
12776 struct stat64 tmpstat_hashfile
;
12779 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12781 if (tmp_outfile_fp
)
12784 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12788 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12791 fclose (tmp_outfile_fp
);
12794 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12796 if (tmp_hashfile_fp
)
12799 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12803 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12806 fclose (tmp_hashfile_fp
);
12809 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12811 tmpstat_outfile
.st_mode
= 0;
12812 tmpstat_outfile
.st_nlink
= 0;
12813 tmpstat_outfile
.st_uid
= 0;
12814 tmpstat_outfile
.st_gid
= 0;
12815 tmpstat_outfile
.st_rdev
= 0;
12816 tmpstat_outfile
.st_atime
= 0;
12818 tmpstat_hashfile
.st_mode
= 0;
12819 tmpstat_hashfile
.st_nlink
= 0;
12820 tmpstat_hashfile
.st_uid
= 0;
12821 tmpstat_hashfile
.st_gid
= 0;
12822 tmpstat_hashfile
.st_rdev
= 0;
12823 tmpstat_hashfile
.st_atime
= 0;
12826 tmpstat_outfile
.st_blksize
= 0;
12827 tmpstat_outfile
.st_blocks
= 0;
12829 tmpstat_hashfile
.st_blksize
= 0;
12830 tmpstat_hashfile
.st_blocks
= 0;
12834 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12836 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12843 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12845 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12855 * Remove duplicates
12858 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12862 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12866 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12869 uint hashes_cnt_orig
= hashes_cnt
;
12873 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12877 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12879 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12884 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12887 if (hashes_pos
> hashes_cnt
)
12889 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12899 uint potfile_remove_cracks
= 0;
12901 if (potfile_disable
== 0)
12905 hash_buf
.digest
= mymalloc (dgst_size
);
12906 hash_buf
.salt
= NULL
;
12907 hash_buf
.esalt
= NULL
;
12908 hash_buf
.hash_info
= NULL
;
12909 hash_buf
.cracked
= 0;
12913 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12918 hash_buf
.esalt
= mymalloc (esalt_size
);
12921 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12923 // no solution for these special hash types (for instane because they use hashfile in output etc)
12924 if ((hash_mode
!= 5200) &&
12925 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12926 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12927 (hash_mode
!= 9000))
12929 FILE *fp
= fopen (potfile
, "rb");
12933 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12935 // to be safe work with a copy (because of line_len loop, i etc)
12936 // moved up here because it's easier to handle continue case
12939 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12943 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12945 if (ptr
== NULL
) break;
12947 int line_len
= strlen (line_buf
);
12949 if (line_len
== 0) continue;
12951 int iter
= MAX_CUT_TRIES
;
12953 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12955 if (line_buf
[i
] != ':') continue;
12959 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12962 hash_t
*found
= NULL
;
12964 if (hash_mode
== 6800)
12966 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12968 // manipulate salt_buf
12969 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12971 hash_buf
.salt
->salt_len
= i
;
12973 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12976 else if (hash_mode
== 2500)
12978 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12980 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12981 // manipulate salt_buf
12983 memcpy (line_buf_cpy
, line_buf
, i
);
12985 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12987 if (mac2_pos
== NULL
) continue;
12992 if (strlen (mac2_pos
) != 12) continue;
12994 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12996 if (mac1_pos
== NULL
) continue;
13001 if (strlen (mac1_pos
) != 12) continue;
13003 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13005 // here we need the ESSID
13006 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13008 hash_buf
.salt
->salt_len
= essid_length
;
13010 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13014 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13016 // compare hex string(s) vs binary MAC address(es)
13018 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13020 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13029 if (!found
) continue;
13031 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13033 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13045 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13047 if (parser_status
== PARSER_OK
)
13051 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13055 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13060 if (found
== NULL
) continue;
13062 if (!found
->cracked
) potfile_remove_cracks
++;
13064 found
->cracked
= 1;
13072 myfree (line_buf_cpy
);
13082 local_free (hash_buf
.esalt
);
13087 local_free (hash_buf
.salt
);
13090 local_free (hash_buf
.digest
);
13094 * Now generate all the buffers required for later
13097 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13099 salt_t
*salts_buf_new
= NULL
;
13100 void *esalts_buf_new
= NULL
;
13104 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13108 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13113 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13116 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13118 uint digests_cnt
= hashes_cnt
;
13119 uint digests_done
= 0;
13121 size_t size_digests
= digests_cnt
* dgst_size
;
13122 size_t size_shown
= digests_cnt
* sizeof (uint
);
13124 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13125 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13127 uint salts_cnt
= 0;
13128 uint salts_done
= 0;
13130 hashinfo_t
**hash_info
= NULL
;
13132 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13134 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13136 if (username
&& (remove
|| show
))
13140 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13142 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13144 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13149 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13154 // copied from inner loop
13156 salt_buf
= &salts_buf_new
[salts_cnt
];
13158 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13162 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13165 salt_buf
->digests_cnt
= 0;
13166 salt_buf
->digests_done
= 0;
13167 salt_buf
->digests_offset
= 0;
13172 if (hashes_buf
[0].cracked
== 1)
13174 digests_shown
[0] = 1;
13178 salt_buf
->digests_done
++;
13181 salt_buf
->digests_cnt
++;
13183 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13185 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13187 hash_info
[0] = hashes_buf
[0].hash_info
;
13190 // copy from inner loop
13192 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13196 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13198 salt_buf
= &salts_buf_new
[salts_cnt
];
13200 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13204 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13207 salt_buf
->digests_cnt
= 0;
13208 salt_buf
->digests_done
= 0;
13209 salt_buf
->digests_offset
= hashes_pos
;
13215 if (hashes_buf
[hashes_pos
].cracked
== 1)
13217 digests_shown
[hashes_pos
] = 1;
13221 salt_buf
->digests_done
++;
13224 salt_buf
->digests_cnt
++;
13226 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13228 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13230 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13234 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13236 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13238 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13240 salts_shown
[salt_pos
] = 1;
13245 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13248 local_free (digests_buf
);
13249 local_free (salts_buf
);
13250 local_free (esalts_buf
);
13252 digests_buf
= digests_buf_new
;
13253 salts_buf
= salts_buf_new
;
13254 esalts_buf
= esalts_buf_new
;
13256 local_free (hashes_buf
);
13259 * special modification not set from parser
13264 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13265 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13266 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13267 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13268 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13269 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13270 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13271 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13272 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13273 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13274 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13275 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13276 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13277 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13278 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13279 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13280 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13281 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13282 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13283 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13284 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13285 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13286 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13287 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13288 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13289 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13290 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13291 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13292 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13293 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13296 if (truecrypt_keyfiles
)
13298 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13300 char *keyfiles
= strdup (truecrypt_keyfiles
);
13302 char *keyfile
= strtok (keyfiles
, ",");
13306 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13308 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13313 if (veracrypt_keyfiles
)
13315 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13317 char *keyfiles
= strdup (veracrypt_keyfiles
);
13319 char *keyfile
= strtok (keyfiles
, ",");
13323 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13325 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13330 data
.digests_cnt
= digests_cnt
;
13331 data
.digests_done
= digests_done
;
13332 data
.digests_buf
= digests_buf
;
13333 data
.digests_shown
= digests_shown
;
13334 data
.digests_shown_tmp
= digests_shown_tmp
;
13336 data
.salts_cnt
= salts_cnt
;
13337 data
.salts_done
= salts_done
;
13338 data
.salts_buf
= salts_buf
;
13339 data
.salts_shown
= salts_shown
;
13341 data
.esalts_buf
= esalts_buf
;
13342 data
.hash_info
= hash_info
;
13345 * Automatic Optimizers
13348 if (salts_cnt
== 1)
13349 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13351 if (digests_cnt
== 1)
13352 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13354 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13355 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13357 if (attack_mode
== ATTACK_MODE_BF
)
13358 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13360 data
.opti_type
= opti_type
;
13362 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13364 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13366 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13368 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13370 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13371 opts_type
|= OPTS_TYPE_PT_ADD80
;
13374 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13376 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13377 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13380 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13382 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13383 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13390 * Some algorithm, like descrypt, can benefit from JIT compilation
13393 int force_jit_compilation
= -1;
13395 if (hash_mode
== 8900)
13397 force_jit_compilation
= 8900;
13399 else if (hash_mode
== 9300)
13401 force_jit_compilation
= 8900;
13403 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13405 force_jit_compilation
= 1500;
13409 * generate bitmap tables
13412 const uint bitmap_shift1
= 5;
13413 const uint bitmap_shift2
= 13;
13415 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13417 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13418 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13419 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13420 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13421 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13422 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13423 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13424 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13431 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13433 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13435 bitmap_nums
= 1 << bitmap_bits
;
13437 bitmap_mask
= bitmap_nums
- 1;
13439 bitmap_size
= bitmap_nums
* sizeof (uint
);
13441 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13443 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;
13444 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;
13449 bitmap_nums
= 1 << bitmap_bits
;
13451 bitmap_mask
= bitmap_nums
- 1;
13453 bitmap_size
= bitmap_nums
* sizeof (uint
);
13455 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);
13456 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);
13459 * prepare quick rule
13462 data
.rule_buf_l
= rule_buf_l
;
13463 data
.rule_buf_r
= rule_buf_r
;
13465 int rule_len_l
= (int) strlen (rule_buf_l
);
13466 int rule_len_r
= (int) strlen (rule_buf_r
);
13468 data
.rule_len_l
= rule_len_l
;
13469 data
.rule_len_r
= rule_len_r
;
13475 uint
*all_kernel_rules_cnt
= NULL
;
13477 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13481 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13483 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13486 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13490 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13492 uint kernel_rules_avail
= 0;
13494 uint kernel_rules_cnt
= 0;
13496 kernel_rule_t
*kernel_rules_buf
= NULL
;
13498 char *rp_file
= rp_files
[i
];
13500 char in
[BLOCK_SIZE
] = { 0 };
13501 char out
[BLOCK_SIZE
] = { 0 };
13505 uint rule_line
= 0;
13507 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13509 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13516 memset (rule_buf
, 0, HCBUFSIZ
);
13518 rule_len
= fgetl (fp
, rule_buf
);
13522 if (rule_len
== 0) continue;
13524 if (rule_buf
[0] == '#') continue;
13526 if (kernel_rules_avail
== kernel_rules_cnt
)
13528 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13530 kernel_rules_avail
+= INCR_RULES
;
13533 memset (in
, 0, BLOCK_SIZE
);
13534 memset (out
, 0, BLOCK_SIZE
);
13536 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13540 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13545 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13547 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13549 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13555 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13557 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13563 kernel_rules_cnt
++;
13568 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13570 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13574 * merge rules or automatic rule generator
13577 uint kernel_rules_cnt
= 0;
13579 kernel_rule_t
*kernel_rules_buf
= NULL
;
13581 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13585 kernel_rules_cnt
= 1;
13587 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13589 repeats
[0] = kernel_rules_cnt
;
13591 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13593 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13595 repeats
[i
+ 1] = kernel_rules_cnt
;
13598 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13600 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13602 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13606 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13608 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13610 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13613 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13615 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13617 if (out_pos
== RULES_MAX
- 1)
13619 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13624 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13629 local_free (repeats
);
13633 uint kernel_rules_avail
= 0;
13635 while (kernel_rules_cnt
< rp_gen
)
13637 if (kernel_rules_avail
== kernel_rules_cnt
)
13639 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13641 kernel_rules_avail
+= INCR_RULES
;
13644 memset (rule_buf
, 0, HCBUFSIZ
);
13646 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13648 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13650 kernel_rules_cnt
++;
13658 * generate NOP rules
13661 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
13663 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13665 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13667 kernel_rules_cnt
++;
13670 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13671 data
.kernel_rules_buf
= kernel_rules_buf
;
13673 if (kernel_rules_cnt
== 0)
13675 log_error ("ERROR: No valid rules left");
13681 * OpenCL platforms: detect
13684 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13685 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13687 cl_uint platforms_cnt
= 0;
13688 cl_uint platform_devices_cnt
= 0;
13692 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13694 if (platforms_cnt
== 0)
13697 log_info ("ATTENTION! No OpenCL compatible platform found");
13699 log_info ("You're probably missing the OpenCL runtime installation");
13700 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13701 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13702 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13708 if (opencl_platforms_filter
!= (uint
) -1)
13710 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13712 if (opencl_platforms_filter
> platform_cnt_mask
)
13714 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13721 if (opencl_device_types
== NULL
)
13724 * OpenCL device types:
13725 * 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.
13728 cl_device_type device_types_all
= 0;
13730 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13732 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13734 cl_platform_id platform
= platforms
[platform_id
];
13736 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13738 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13740 cl_device_id device
= platform_devices
[platform_devices_id
];
13742 cl_device_type device_type
;
13744 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13746 device_types_all
|= device_type
;
13750 // In such a case, automatically enable CPU device type support, since it's disabled by default.
13752 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13754 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13757 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
13758 // If we have a CPU device, force it to be used
13760 if (stdout_flag
== 1)
13762 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
13764 device_types_filter
= CL_DEVICE_TYPE_CPU
;
13770 * OpenCL devices: simply push all devices from all platforms into the same device array
13774 int need_nvapi
= 0;
13776 int need_xnvctrl
= 0;
13778 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13780 data
.devices_param
= devices_param
;
13782 uint devices_cnt
= 0;
13784 uint devices_active
= 0;
13786 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13788 cl_platform_id platform
= platforms
[platform_id
];
13790 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13792 char platform_vendor
[INFOSZ
] = { 0 };
13794 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13796 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13797 // this causes trouble with vendor id based macros
13798 // we'll assign generic to those without special optimization available
13800 cl_uint platform_vendor_id
= 0;
13802 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13804 platform_vendor_id
= VENDOR_ID_AMD
;
13806 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13808 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13810 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13812 platform_vendor_id
= VENDOR_ID_APPLE
;
13814 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13816 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13818 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13820 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13822 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13824 platform_vendor_id
= VENDOR_ID_MESA
;
13826 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13828 platform_vendor_id
= VENDOR_ID_NV
;
13830 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13832 platform_vendor_id
= VENDOR_ID_POCL
;
13836 platform_vendor_id
= VENDOR_ID_GENERIC
;
13839 const uint platform_skipped
= ((opencl_platforms_filter
& (1 << platform_id
)) == 0);
13841 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13843 if (machine_readable
== 0)
13845 if (platform_skipped
== 0)
13847 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
13849 char line
[256] = { 0 };
13851 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
13857 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
13863 if (platform_skipped
== 1) continue;
13865 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13867 size_t param_value_size
= 0;
13869 const uint device_id
= devices_cnt
;
13871 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13873 device_param
->platform_vendor_id
= platform_vendor_id
;
13875 device_param
->device
= platform_devices
[platform_devices_id
];
13877 device_param
->device_id
= device_id
;
13879 device_param
->platform_devices_id
= platform_devices_id
;
13883 cl_device_type device_type
;
13885 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13887 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13889 device_param
->device_type
= device_type
;
13893 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13895 char *device_name
= (char *) mymalloc (param_value_size
);
13897 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13899 device_param
->device_name
= device_name
;
13903 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13905 char *device_vendor
= (char *) mymalloc (param_value_size
);
13907 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13909 device_param
->device_vendor
= device_vendor
;
13911 cl_uint device_vendor_id
= 0;
13913 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13915 device_vendor_id
= VENDOR_ID_AMD
;
13917 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13919 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13921 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13923 device_vendor_id
= VENDOR_ID_APPLE
;
13925 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13927 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13929 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13931 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13933 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13935 device_vendor_id
= VENDOR_ID_MESA
;
13937 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13939 device_vendor_id
= VENDOR_ID_NV
;
13941 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13943 device_vendor_id
= VENDOR_ID_POCL
;
13947 device_vendor_id
= VENDOR_ID_GENERIC
;
13950 device_param
->device_vendor_id
= device_vendor_id
;
13954 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13958 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13960 char *device_version
= (char *) mymalloc (param_value_size
);
13962 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13964 device_param
->device_version
= device_version
;
13966 // device_opencl_version
13968 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13970 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13972 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13974 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13976 myfree (device_opencl_version
);
13980 cl_uint vector_width
;
13982 if (opencl_vector_width_chgd
== 0)
13984 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13986 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13988 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13992 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13997 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14002 vector_width
= opencl_vector_width
;
14005 if (vector_width
> 16) vector_width
= 16;
14007 device_param
->vector_width
= vector_width
;
14009 // max_compute_units
14011 cl_uint device_processors
;
14013 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14015 device_param
->device_processors
= device_processors
;
14017 // device_maxmem_alloc
14018 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14020 cl_ulong device_maxmem_alloc
;
14022 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14024 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14026 // device_global_mem
14028 cl_ulong device_global_mem
;
14030 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14032 device_param
->device_global_mem
= device_global_mem
;
14034 // max_work_group_size
14036 size_t device_maxworkgroup_size
;
14038 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14040 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14042 // max_clock_frequency
14044 cl_uint device_maxclock_frequency
;
14046 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14048 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14050 // device_endian_little
14052 cl_bool device_endian_little
;
14054 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14056 if (device_endian_little
== CL_FALSE
)
14058 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14060 device_param
->skipped
= 1;
14063 // device_available
14065 cl_bool device_available
;
14067 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14069 if (device_available
== CL_FALSE
)
14071 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14073 device_param
->skipped
= 1;
14076 // device_compiler_available
14078 cl_bool device_compiler_available
;
14080 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14082 if (device_compiler_available
== CL_FALSE
)
14084 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14086 device_param
->skipped
= 1;
14089 // device_execution_capabilities
14091 cl_device_exec_capabilities device_execution_capabilities
;
14093 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14095 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14097 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14099 device_param
->skipped
= 1;
14102 // device_extensions
14104 size_t device_extensions_size
;
14106 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14108 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14110 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14112 if (strstr (device_extensions
, "base_atomics") == 0)
14114 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14116 device_param
->skipped
= 1;
14119 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14121 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14123 device_param
->skipped
= 1;
14126 myfree (device_extensions
);
14128 // device_local_mem_size
14130 cl_ulong device_local_mem_size
;
14132 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14134 if (device_local_mem_size
< 32768)
14136 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14138 device_param
->skipped
= 1;
14141 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14142 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14143 // This results in both utilizing it for 50%
14144 // However, Intel has much better SIMD control over their own hardware
14145 // It makes sense to give them full control over their own hardware
14147 if (device_type
& CL_DEVICE_TYPE_CPU
)
14149 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14151 if (data
.force
== 0)
14153 if (algorithm_pos
== 0)
14155 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14156 log_info (" You can use --force to override this but do not post error reports if you do so");
14159 device_param
->skipped
= 1;
14166 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
14167 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14171 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14173 char *driver_version
= (char *) mymalloc (param_value_size
);
14175 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14177 device_param
->driver_version
= driver_version
;
14179 // device_name_chksum
14181 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14184 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
);
14186 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
);
14189 uint device_name_digest
[4] = { 0 };
14191 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14193 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14195 device_param
->device_name_chksum
= device_name_chksum
;
14199 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14201 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14206 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14220 if (device_type
& CL_DEVICE_TYPE_GPU
)
14222 if (device_vendor_id
== VENDOR_ID_NV
)
14224 cl_uint kernel_exec_timeout
= 0;
14226 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14228 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14230 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14232 cl_uint sm_minor
= 0;
14233 cl_uint sm_major
= 0;
14235 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14236 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14238 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14239 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14241 device_param
->sm_minor
= sm_minor
;
14242 device_param
->sm_major
= sm_major
;
14244 // CPU burning loop damper
14245 // Value is given as number between 0-100
14248 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14250 if (nvidia_spin_damp_chgd
== 0)
14252 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14255 * the workaround is not a friend of rule based attacks
14256 * the words from the wordlist combined with fast and slow rules cause
14257 * fluctuations which cause inaccurate wait time estimations
14258 * using a reduced damping percentage almost compensates this
14261 device_param
->nvidia_spin_damp
= 64;
14265 device_param
->nvidia_spin_damp
/= 100;
14271 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14273 if (machine_readable
== 0)
14275 if (device_param
->skipped
== 0)
14277 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
14280 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
14281 (unsigned int) (device_global_mem
/ 1024 / 1024),
14282 (unsigned int) device_processors
);
14286 log_info ("- Device #%u: %s, skipped",
14293 // common driver check
14295 if (device_param
->skipped
== 0)
14297 if (device_type
& CL_DEVICE_TYPE_GPU
)
14299 if (platform_vendor_id
== VENDOR_ID_AMD
)
14301 int catalyst_check
= (force
== 1) ? 0 : 1;
14303 int catalyst_warn
= 0;
14305 int catalyst_broken
= 0;
14307 if (catalyst_check
== 1)
14311 // v14.9 and higher
14312 if (atoi (device_param
->driver_version
) >= 1573)
14317 catalyst_check
= 0;
14320 if (catalyst_broken
== 1)
14323 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
14324 log_info ("It passes over cracked hashes and will not report them as cracked");
14325 log_info ("You are STRONGLY encouraged not to use it");
14326 log_info ("You can use --force to override this but do not post error reports if you do so");
14332 if (catalyst_warn
== 1)
14335 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
14336 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
14337 log_info ("See hashcat's homepage for official supported catalyst drivers");
14339 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
14341 log_info ("You can use --force to override this but do not post error reports if you do so");
14347 else if (platform_vendor_id
== VENDOR_ID_NV
)
14349 if (device_param
->kernel_exec_timeout
!= 0)
14351 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);
14352 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
14357 /* turns out pocl still creates segfaults (because of llvm)
14358 if (device_type & CL_DEVICE_TYPE_CPU)
14360 if (platform_vendor_id == VENDOR_ID_AMD)
14365 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
14366 log_info ("You are STRONGLY encouraged not to use it");
14367 log_info ("You can use --force to override this but do not post error reports if you do so");
14368 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
14378 * kernel accel and loops tuning db adjustment
14381 device_param
->kernel_accel_min
= 1;
14382 device_param
->kernel_accel_max
= 1024;
14384 device_param
->kernel_loops_min
= 1;
14385 device_param
->kernel_loops_max
= 1024;
14387 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14389 if (tuningdb_entry
)
14391 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
14392 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
14396 device_param
->kernel_accel_min
= _kernel_accel
;
14397 device_param
->kernel_accel_max
= _kernel_accel
;
14402 if (workload_profile
== 1)
14404 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
14406 else if (workload_profile
== 2)
14408 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
14411 device_param
->kernel_loops_min
= _kernel_loops
;
14412 device_param
->kernel_loops_max
= _kernel_loops
;
14416 // commandline parameters overwrite tuningdb entries
14420 device_param
->kernel_accel_min
= kernel_accel
;
14421 device_param
->kernel_accel_max
= kernel_accel
;
14426 device_param
->kernel_loops_min
= kernel_loops
;
14427 device_param
->kernel_loops_max
= kernel_loops
;
14442 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14444 if (machine_readable
== 0)
14451 if (keyspace
== 0 && devices_active
== 0)
14453 log_error ("ERROR: No devices found/left");
14458 // 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)
14460 if (devices_filter
!= (uint
) -1)
14462 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
14464 if (devices_filter
> devices_cnt_mask
)
14466 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
14472 data
.devices_cnt
= devices_cnt
;
14474 data
.devices_active
= devices_active
;
14481 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
] = { { 0 } };
14482 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
] = { { 0 } };
14483 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
] = { { 0 } };
14484 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
] = { { 0 } };
14486 if (gpu_temp_disable
== 0)
14488 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14489 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
14490 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14491 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
14493 data
.hm_adl
= NULL
;
14494 data
.hm_nvapi
= NULL
;
14495 data
.hm_nvml
= NULL
;
14496 data
.hm_xnvctrl
= NULL
;
14498 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
14500 data
.hm_nvml
= nvml
;
14505 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
14507 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
14509 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
14513 for (int i
= 0; i
< tmp_in
; i
++)
14515 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
14518 for (int i
= 0; i
< tmp_out
; i
++)
14520 unsigned int speed
;
14522 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
14524 // doesn't seem to create any advantages
14525 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
14526 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
14531 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
14533 data
.hm_nvapi
= nvapi
;
14538 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
14540 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
14542 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
14546 for (int i
= 0; i
< tmp_in
; i
++)
14548 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
14553 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
14555 data
.hm_xnvctrl
= xnvctrl
;
14558 if (data
.hm_xnvctrl
)
14560 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
14562 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14564 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14566 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14568 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
14572 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
14577 if ((need_adl
== 1) && (adl_init (adl
) == 0))
14584 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14586 // total number of adapters
14588 int hm_adapters_num
;
14590 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return (-1);
14594 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
14596 if (lpAdapterInfo
== NULL
) return (-1);
14598 // get a list (of ids of) valid/usable adapters
14600 int num_adl_adapters
= 0;
14602 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14604 if (num_adl_adapters
> 0)
14606 hc_thread_mutex_lock (mux_adl
);
14608 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
14610 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14612 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14613 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14615 hc_thread_mutex_unlock (mux_adl
);
14618 myfree (valid_adl_device_list
);
14619 myfree (lpAdapterInfo
);
14623 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
14625 gpu_temp_disable
= 1;
14630 * OpenCL devices: allocate buffer for device specific information
14633 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14635 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14637 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
14640 * User-defined GPU temp handling
14643 if (gpu_temp_disable
== 1)
14645 gpu_temp_abort
= 0;
14646 gpu_temp_retain
= 0;
14649 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14651 if (gpu_temp_abort
< gpu_temp_retain
)
14653 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14659 data
.gpu_temp_disable
= gpu_temp_disable
;
14660 data
.gpu_temp_abort
= gpu_temp_abort
;
14661 data
.gpu_temp_retain
= gpu_temp_retain
;
14665 * enable custom signal handler(s)
14668 if (benchmark
== 0)
14670 hc_signal (sigHandler_default
);
14674 hc_signal (sigHandler_benchmark
);
14681 if (data
.quiet
== 0)
14683 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14685 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
);
14687 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14689 log_info ("Rules: %u", kernel_rules_cnt
);
14694 log_info ("Applicable Optimizers:");
14696 for (uint i
= 0; i
< 32; i
++)
14698 const uint opti_bit
= 1u << i
;
14700 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14705 * Watchdog and Temperature balance
14709 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
14711 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14714 if (gpu_temp_abort
== 0)
14716 log_info ("Watchdog: Temperature abort trigger disabled");
14720 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14723 if (gpu_temp_retain
== 0)
14725 log_info ("Watchdog: Temperature retain trigger disabled");
14729 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14732 if (data
.quiet
== 0) log_info ("");
14742 if (gpu_temp_disable
== 0)
14744 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14746 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14748 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14750 if (device_param
->skipped
) continue;
14752 const uint platform_devices_id
= device_param
->platform_devices_id
;
14754 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14756 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
14757 data
.hm_device
[device_id
].nvapi
= 0;
14758 data
.hm_device
[device_id
].nvml
= 0;
14759 data
.hm_device
[device_id
].xnvctrl
= 0;
14760 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
14761 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
14762 data
.hm_device
[device_id
].fan_set_supported
= 0;
14765 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14767 data
.hm_device
[device_id
].adl
= 0;
14768 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
14769 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
14770 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
14771 data
.hm_device
[device_id
].od_version
= 0;
14772 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
14773 data
.hm_device
[device_id
].fan_set_supported
= 0;
14779 * powertune on user request
14782 if (powertune_enable
== 1)
14784 hc_thread_mutex_lock (mux_adl
);
14786 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14788 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14790 if (device_param
->skipped
) continue;
14792 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
14796 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14797 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14798 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14799 * Driver / ADL bug?
14802 if (data
.hm_device
[device_id
].od_version
== 6)
14806 // check powertune capabilities first, if not available then skip device
14808 int powertune_supported
= 0;
14810 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
14812 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14817 // first backup current value, we will restore it later
14819 if (powertune_supported
!= 0)
14821 // powercontrol settings
14823 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14825 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
14827 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
14830 if (ADL_rc
!= ADL_OK
)
14832 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14837 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14839 log_error ("ERROR: Failed to set new ADL PowerControl values");
14846 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
14848 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
14850 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
14852 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
14857 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
14859 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
14861 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
14863 log_error ("ERROR: Failed to get ADL device capabilities");
14868 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
14869 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
14871 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
14872 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
14874 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
14875 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
14877 // warning if profile has too low max values
14879 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
14881 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
14884 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
14886 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
14889 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
14891 performance_state
->iNumberOfPerformanceLevels
= 2;
14893 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
14894 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
14895 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
14896 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
14898 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
14900 log_info ("ERROR: Failed to set ADL performance state");
14905 local_free (performance_state
);
14908 // set powertune value only
14910 if (powertune_supported
!= 0)
14913 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14915 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
14917 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14922 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
14924 log_error ("ERROR: Failed to set new ADL PowerControl values");
14932 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
14934 // first backup current value, we will restore it later
14936 unsigned int limit
;
14938 int powertune_supported
= 0;
14940 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
14942 powertune_supported
= 1;
14945 // if backup worked, activate the maximum allowed
14947 if (powertune_supported
!= 0)
14949 unsigned int minLimit
;
14950 unsigned int maxLimit
;
14952 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
14956 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
14958 // now we can be sure we need to reset later
14960 nvml_power_limit
[device_id
] = limit
;
14968 hc_thread_mutex_unlock (mux_adl
);
14971 #endif // HAVE_HWMON
14974 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14977 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14979 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14985 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14987 if (device_param
->skipped
) continue;
14990 * device properties
14993 const char *device_name_chksum
= device_param
->device_name_chksum
;
14994 const u32 device_processors
= device_param
->device_processors
;
14997 * create context for each device
15000 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
15003 * create command-queue
15006 // not supported with NV
15007 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15009 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
15012 * kernel threads: some algorithms need a fixed kernel-threads count
15013 * because of shared memory usage or bitslice
15014 * there needs to be some upper limit, otherwise there's too much overhead
15017 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15019 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15021 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15024 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15025 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15026 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15027 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15028 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15029 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15030 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15031 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15032 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15033 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15034 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15035 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15036 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15037 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15038 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15040 device_param
->kernel_threads
= kernel_threads
;
15042 device_param
->hardware_power
= device_processors
* kernel_threads
;
15045 * create input buffers on device : calculate size of fixed memory buffers
15048 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15049 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15051 device_param
->size_root_css
= size_root_css
;
15052 device_param
->size_markov_css
= size_markov_css
;
15054 size_t size_results
= sizeof (uint
);
15056 device_param
->size_results
= size_results
;
15058 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15059 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15061 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15062 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15063 size_t size_esalts
= salts_cnt
* esalt_size
;
15065 device_param
->size_plains
= size_plains
;
15066 device_param
->size_digests
= size_digests
;
15067 device_param
->size_shown
= size_shown
;
15068 device_param
->size_salts
= size_salts
;
15070 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15071 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15072 size_t size_tm
= 32 * sizeof (bs_word_t
);
15076 size_t size_scrypt
= 4;
15078 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15080 // we need to check that all hashes have the same scrypt settings
15082 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15083 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15084 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15086 for (uint i
= 1; i
< salts_cnt
; i
++)
15088 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15089 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15090 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15092 log_error ("ERROR: Mixed scrypt settings not supported");
15098 uint tmto_start
= 0;
15099 uint tmto_stop
= 10;
15103 tmto_start
= scrypt_tmto
;
15107 // in case the user did not specify the tmto manually
15108 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15110 if (hash_mode
== 8900)
15112 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15116 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15121 else if (hash_mode
== 9300)
15123 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15127 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15134 data
.scrypt_tmp_size
= (128 * scrypt_r
);
15136 device_param
->kernel_accel_min
= 1;
15137 device_param
->kernel_accel_max
= 8;
15141 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15143 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15145 size_scrypt
/= 1 << tmto
;
15147 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15149 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15151 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15156 if (size_scrypt
> device_param
->device_global_mem
)
15158 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15163 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15165 data
.scrypt_tmto_final
= tmto
;
15171 if (tmto
== tmto_stop
)
15173 log_error ("ERROR: Can't allocate enough device memory");
15178 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.scrypt_tmto_final
, size_scrypt
);
15181 size_t size_scrypt4
= size_scrypt
/ 4;
15184 * some algorithms need a fixed kernel-loops count
15187 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15189 const u32 kernel_loops_fixed
= 1024;
15191 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15192 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15195 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15197 const u32 kernel_loops_fixed
= 1024;
15199 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15200 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15203 if (hash_mode
== 8900)
15205 const u32 kernel_loops_fixed
= 1;
15207 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15208 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15211 if (hash_mode
== 9300)
15213 const u32 kernel_loops_fixed
= 1;
15215 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15216 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15219 if (hash_mode
== 12500)
15221 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15223 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15224 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15228 * some algorithms have a maximum kernel-loops count
15231 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15233 u32 innerloop_cnt
= 0;
15235 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15237 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15238 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15239 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15243 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
15246 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
15247 (innerloop_cnt
<= device_param
->kernel_loops_max
))
15249 device_param
->kernel_loops_max
= innerloop_cnt
;
15253 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
15254 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
15256 // find out if we would request too much memory on memory blocks which are based on kernel_accel
15258 size_t size_pws
= 4;
15259 size_t size_tmps
= 4;
15260 size_t size_hooks
= 4;
15262 while (kernel_accel_max
>= kernel_accel_min
)
15264 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
15268 size_pws
= kernel_power_max
* sizeof (pw_t
);
15274 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
15275 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15276 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15277 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15278 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
15279 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
15280 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
15281 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
15282 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
15283 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
15284 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15285 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15286 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15287 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15288 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15289 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15290 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15291 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15292 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15293 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15294 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15295 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15296 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15297 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
15298 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
15299 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
15300 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
15301 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
15302 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15303 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15304 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
15305 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
15306 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15307 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
15308 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
15309 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
15310 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
15311 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15312 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
15313 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
15314 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
15315 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
15316 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15317 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
15318 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
15319 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
15320 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
15321 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15322 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
15323 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
15324 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
15325 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
15326 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
15327 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
15328 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
15329 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
15330 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
15331 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
15332 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15333 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15334 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
15335 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
15336 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
15337 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
15338 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15339 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15340 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15341 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15342 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15343 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15344 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15345 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15346 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15347 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15348 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15349 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15350 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15351 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15352 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15353 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15354 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15355 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15360 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
15367 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
15368 // if not, decrease amplifier and try again
15370 int memory_limit_hit
= 0;
15372 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
15373 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
15374 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
15376 const u64 size_total
15393 + size_pws
// not a bug
15407 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
15409 if (memory_limit_hit
== 1)
15411 kernel_accel_max
--;
15419 if (kernel_accel_max
< kernel_accel_min
)
15421 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
15426 device_param
->kernel_accel_min
= kernel_accel_min
;
15427 device_param
->kernel_accel_max
= kernel_accel_max
;
15430 if (kernel_accel_max < kernel_accel)
15432 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
15434 device_param->kernel_accel = kernel_accel_max;
15438 device_param
->size_bfs
= size_bfs
;
15439 device_param
->size_combs
= size_combs
;
15440 device_param
->size_rules
= size_rules
;
15441 device_param
->size_rules_c
= size_rules_c
;
15442 device_param
->size_pws
= size_pws
;
15443 device_param
->size_tmps
= size_tmps
;
15444 device_param
->size_hooks
= size_hooks
;
15447 * default building options
15450 char cpath
[1024] = { 0 };
15452 char build_opts
[1024] = { 0 };
15456 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
15458 char *cpath_real
= mymalloc (MAX_PATH
);
15460 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
15462 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
15467 naive_replace (cpath_real
, '\\', '/');
15469 // not escaping here, windows has quotes
15471 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
15475 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
15477 char *cpath_real
= mymalloc (PATH_MAX
);
15479 if (realpath (cpath
, cpath_real
) == NULL
)
15481 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
15486 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
15488 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
15493 // this test needs to be done manually because of osx opencl runtime
15494 // if there's a problem with permission, its not reporting back and erroring out silently
15496 #define files_cnt 15
15498 const char *files_names
[files_cnt
] =
15500 "inc_cipher_aes256.cl",
15501 "inc_cipher_serpent256.cl",
15502 "inc_cipher_twofish256.cl",
15504 "inc_comp_multi_bs.cl",
15505 "inc_comp_multi.cl",
15506 "inc_comp_single_bs.cl",
15507 "inc_comp_single.cl",
15508 "inc_hash_constants.h",
15509 "inc_hash_functions.cl",
15517 for (int i
= 0; i
< files_cnt
; i
++)
15519 char path
[1024] = { 0 };
15521 snprintf (path
, sizeof (path
) - 1, "%s/%s", cpath_real
, files_names
[i
]);
15523 FILE *fd
= fopen (path
, "r");
15527 log_error ("ERROR: %s: fopen(): %s", path
, strerror (errno
));
15534 size_t n
= fread (buf
, 1, 1, fd
);
15538 log_error ("ERROR: %s: fread(): %s", path
, strerror (errno
));
15546 myfree (cpath_real
);
15548 // we don't have sm_* on vendors not NV but it doesn't matter
15550 char build_opts_new
[1024] = { 0 };
15552 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_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
, data
.dgst_pos0
, data
.dgst_pos1
, data
.dgst_pos2
, data
.dgst_pos3
, data
.dgst_size
/ 4, kern_type
);
15554 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
15557 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
15566 * kernel source filename
15569 char source_file
[256] = { 0 };
15571 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
15575 if (stat (source_file
, &sst
) == -1)
15577 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15583 * kernel cached filename
15586 char cached_file
[256] = { 0 };
15588 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
15594 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
15600 * kernel compile or load
15603 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15605 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15607 if (force_jit_compilation
== -1)
15611 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
15613 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15615 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15617 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15620 size_t build_log_size
= 0;
15622 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15624 if (build_log_size
> 1)
15626 char *build_log
= (char *) malloc (build_log_size
+ 1);
15628 memset (build_log
, 0, build_log_size
+ 1);
15630 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15640 device_param
->skipped
= true;
15642 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
15647 size_t binary_size
;
15649 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15651 u8
*binary
= (u8
*) mymalloc (binary_size
);
15653 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15655 writeProgramBin (cached_file
, binary
, binary_size
);
15657 local_free (binary
);
15662 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15665 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15667 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15669 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15675 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
15678 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15680 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15682 char build_opts_update
[1024] = { 0 };
15684 if (force_jit_compilation
== 1500)
15686 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
15688 else if (force_jit_compilation
== 8900)
15690 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%u", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.scrypt_tmto_final
, data
.scrypt_tmp_size
/ 16);
15694 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
15697 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
15700 size_t build_log_size
= 0;
15702 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
15704 if (build_log_size
> 1)
15706 char *build_log
= (char *) malloc (build_log_size
+ 1);
15708 memset (build_log
, 0, build_log_size
+ 1);
15710 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
15720 device_param
->skipped
= true;
15722 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
15726 local_free (kernel_lengths
);
15727 local_free (kernel_sources
[0]);
15728 local_free (kernel_sources
);
15732 * word generator kernel
15735 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
15738 * kernel mp source filename
15741 char source_file
[256] = { 0 };
15743 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
15747 if (stat (source_file
, &sst
) == -1)
15749 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15755 * kernel mp cached filename
15758 char cached_file
[256] = { 0 };
15760 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
15766 if (stat (cached_file
, &cst
) == -1)
15772 * kernel compile or load
15775 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15777 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15781 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
15782 if (quiet
== 0) log_info ("");
15784 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15786 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15788 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15792 device_param
->skipped
= true;
15794 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
15799 size_t binary_size
;
15801 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15803 u8
*binary
= (u8
*) mymalloc (binary_size
);
15805 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15807 writeProgramBin (cached_file
, binary
, binary_size
);
15809 local_free (binary
);
15814 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15817 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15819 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15821 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15824 local_free (kernel_lengths
);
15825 local_free (kernel_sources
[0]);
15826 local_free (kernel_sources
);
15833 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15840 * kernel amp source filename
15843 char source_file
[256] = { 0 };
15845 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15849 if (stat (source_file
, &sst
) == -1)
15851 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15857 * kernel amp cached filename
15860 char cached_file
[256] = { 0 };
15862 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15868 if (stat (cached_file
, &cst
) == -1)
15874 * kernel compile or load
15877 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15879 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15883 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
15884 if (quiet
== 0) log_info ("");
15886 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15888 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15890 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15894 device_param
->skipped
= true;
15896 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15901 size_t binary_size
;
15903 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15905 u8
*binary
= (u8
*) mymalloc (binary_size
);
15907 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15909 writeProgramBin (cached_file
, binary
, binary_size
);
15911 local_free (binary
);
15916 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15919 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15921 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15923 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15926 local_free (kernel_lengths
);
15927 local_free (kernel_sources
[0]);
15928 local_free (kernel_sources
);
15931 // some algorithm collide too fast, make that impossible
15933 if (benchmark
== 1)
15935 ((uint
*) digests_buf
)[0] = -1;
15936 ((uint
*) digests_buf
)[1] = -1;
15937 ((uint
*) digests_buf
)[2] = -1;
15938 ((uint
*) digests_buf
)[3] = -1;
15945 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15946 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15947 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15948 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15949 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15950 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15951 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15952 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15953 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15954 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15955 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15956 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15957 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15958 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15959 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15960 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15961 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15962 device_param
->d_scryptV0_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
);
15963 device_param
->d_scryptV1_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
);
15964 device_param
->d_scryptV2_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
);
15965 device_param
->d_scryptV3_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
);
15967 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
);
15968 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
);
15969 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
);
15970 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
);
15971 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
);
15972 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
);
15973 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
);
15974 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
);
15975 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15976 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15977 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15983 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15985 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15986 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15988 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15990 else if (attack_kern
== ATTACK_KERN_COMBI
)
15992 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15993 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15994 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15995 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15997 else if (attack_kern
== ATTACK_KERN_BF
)
15999 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
16000 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
16001 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
16002 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
16003 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
16008 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
16010 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
16017 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16019 device_param
->pws_buf
= pws_buf
;
16021 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16023 device_param
->combs_buf
= combs_buf
;
16025 void *hooks_buf
= mymalloc (size_hooks
);
16027 device_param
->hooks_buf
= hooks_buf
;
16033 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16034 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16035 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16036 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16037 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16038 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16039 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16040 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16041 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16042 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16043 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16045 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16046 ? &device_param
->d_pws_buf
16047 : &device_param
->d_pws_amp_buf
;
16048 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16049 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
16050 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
16051 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
16052 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
16053 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
16054 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
16055 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
16056 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
16057 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
16058 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
16059 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
16060 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
16061 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
16062 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
16063 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
16064 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
16065 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
16066 device_param
->kernel_params
[19] = &device_param
->d_result
;
16067 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
16068 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
16069 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
16070 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
16071 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
16072 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
16073 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
16074 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
16075 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
16076 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
16077 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
16078 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
16079 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
16080 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
16081 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
16083 device_param
->kernel_params_mp_buf64
[3] = 0;
16084 device_param
->kernel_params_mp_buf32
[4] = 0;
16085 device_param
->kernel_params_mp_buf32
[5] = 0;
16086 device_param
->kernel_params_mp_buf32
[6] = 0;
16087 device_param
->kernel_params_mp_buf32
[7] = 0;
16088 device_param
->kernel_params_mp_buf32
[8] = 0;
16090 device_param
->kernel_params_mp
[0] = NULL
;
16091 device_param
->kernel_params_mp
[1] = NULL
;
16092 device_param
->kernel_params_mp
[2] = NULL
;
16093 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
16094 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
16095 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
16096 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
16097 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
16098 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
16100 device_param
->kernel_params_mp_l_buf64
[3] = 0;
16101 device_param
->kernel_params_mp_l_buf32
[4] = 0;
16102 device_param
->kernel_params_mp_l_buf32
[5] = 0;
16103 device_param
->kernel_params_mp_l_buf32
[6] = 0;
16104 device_param
->kernel_params_mp_l_buf32
[7] = 0;
16105 device_param
->kernel_params_mp_l_buf32
[8] = 0;
16106 device_param
->kernel_params_mp_l_buf32
[9] = 0;
16108 device_param
->kernel_params_mp_l
[0] = NULL
;
16109 device_param
->kernel_params_mp_l
[1] = NULL
;
16110 device_param
->kernel_params_mp_l
[2] = NULL
;
16111 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
16112 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
16113 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
16114 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
16115 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
16116 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
16117 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
16119 device_param
->kernel_params_mp_r_buf64
[3] = 0;
16120 device_param
->kernel_params_mp_r_buf32
[4] = 0;
16121 device_param
->kernel_params_mp_r_buf32
[5] = 0;
16122 device_param
->kernel_params_mp_r_buf32
[6] = 0;
16123 device_param
->kernel_params_mp_r_buf32
[7] = 0;
16124 device_param
->kernel_params_mp_r_buf32
[8] = 0;
16126 device_param
->kernel_params_mp_r
[0] = NULL
;
16127 device_param
->kernel_params_mp_r
[1] = NULL
;
16128 device_param
->kernel_params_mp_r
[2] = NULL
;
16129 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
16130 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
16131 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
16132 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
16133 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
16134 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
16136 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
16137 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
16139 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
16140 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
16141 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
16142 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
16143 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
16144 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
16145 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
16147 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
16148 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
16150 device_param
->kernel_params_memset_buf32
[1] = 0; // value
16151 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
16153 device_param
->kernel_params_memset
[0] = NULL
;
16154 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
16155 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
16161 size_t kernel_wgs_tmp
;
16163 char kernel_name
[64] = { 0 };
16165 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16167 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
16169 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
16171 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16173 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
16175 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16177 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
16179 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16183 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
16185 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16187 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
16189 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16191 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
16193 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16196 if (data
.attack_mode
== ATTACK_MODE_BF
)
16198 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
16200 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
16202 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16204 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
);
16210 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
16212 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16214 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
16216 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16218 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
16220 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16222 if (opts_type
& OPTS_TYPE_HOOK12
)
16224 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
16226 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16228 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
);
16231 if (opts_type
& OPTS_TYPE_HOOK23
)
16233 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
16235 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
16237 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
);
16241 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
);
16242 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
);
16243 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
);
16245 for (uint i
= 0; i
<= 23; i
++)
16247 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
16248 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
16249 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
16251 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
16252 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
16255 for (uint i
= 24; i
<= 34; i
++)
16257 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
16258 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
16259 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
16261 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
16262 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
16267 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
16269 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
);
16271 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
16272 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
16273 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
16277 if (attack_mode
== ATTACK_MODE_BF
)
16279 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
16280 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
16282 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
);
16283 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
);
16285 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
16287 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
16288 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
16291 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16293 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
16295 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
);
16297 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16299 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
16301 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
);
16304 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16310 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
16312 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
);
16315 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16321 for (uint i
= 0; i
< 5; i
++)
16323 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
16326 for (uint i
= 5; i
< 7; i
++)
16328 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
16332 // maybe this has been updated by clGetKernelWorkGroupInfo()
16333 // value can only be decreased, so we don't need to reallocate buffers
16335 device_param
->kernel_threads
= kernel_threads
;
16337 // zero some data buffers
16339 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
16340 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
16341 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
16342 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
16343 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
16344 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
16350 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16352 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
16354 else if (attack_kern
== ATTACK_KERN_COMBI
)
16356 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
16357 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
16358 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
16359 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
16361 else if (attack_kern
== ATTACK_KERN_BF
)
16363 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
16364 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
16365 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
16366 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
16367 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
16370 #if defined(HAVE_HWMON)
16373 * Store initial fanspeed if gpu_temp_retain is enabled
16376 if (gpu_temp_disable
== 0)
16378 if (gpu_temp_retain
!= 0)
16380 hc_thread_mutex_lock (mux_adl
);
16382 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
16384 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
16385 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
16387 // we also set it to tell the OS we take control over the fan and it's automatic controller
16388 // if it was set to automatic. we do not control user-defined fanspeeds.
16390 if (fanpolicy
== 1)
16392 data
.hm_device
[device_id
].fan_set_supported
= 1;
16396 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
16398 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
16400 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
16403 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
16407 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
16413 data
.hm_device
[device_id
].fan_set_supported
= 1;
16417 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
16419 data
.hm_device
[device_id
].fan_set_supported
= 0;
16424 data
.hm_device
[device_id
].fan_set_supported
= 0;
16428 hc_thread_mutex_unlock (mux_adl
);
16432 #endif // HAVE_HWMON
16435 if (data
.quiet
== 0) log_info_nn ("");
16438 * In benchmark-mode, inform user which algorithm is checked
16441 if (benchmark
== 1)
16443 if (machine_readable
== 0)
16447 data
.quiet
= quiet
;
16449 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
16451 log_info ("Hashtype: %s", hash_type
);
16457 * keep track of the progress
16460 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
16461 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
16462 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
16469 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
16471 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
16476 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
16478 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
16483 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
16485 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
16495 segment_size
*= (1024 * 1024);
16497 data
.segment_size
= segment_size
;
16499 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
16501 wl_data
->buf
= (char *) mymalloc (segment_size
);
16502 wl_data
->avail
= segment_size
;
16503 wl_data
->incr
= segment_size
;
16507 cs_t
*css_buf
= NULL
;
16511 char **masks
= NULL
;
16512 char **dictfiles
= NULL
;
16514 uint mask_from_file
= 0;
16516 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
16518 if (wordlist_mode
== WL_MODE_FILE
)
16520 int wls_left
= myargc
- (optind
+ 1);
16522 for (int i
= 0; i
< wls_left
; i
++)
16524 char *l0_filename
= myargv
[optind
+ 1 + i
];
16526 struct stat l0_stat
;
16528 if (stat (l0_filename
, &l0_stat
) == -1)
16530 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
16535 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
16539 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16543 dictfiles
[dictcnt
- 1] = l0_filename
;
16547 // do not allow --keyspace w/ a directory
16551 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
16556 char **dictionary_files
= NULL
;
16558 dictionary_files
= scan_directory (l0_filename
);
16560 if (dictionary_files
!= NULL
)
16562 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16564 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16566 char *l1_filename
= dictionary_files
[d
];
16568 struct stat l1_stat
;
16570 if (stat (l1_filename
, &l1_stat
) == -1)
16572 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16577 if (S_ISREG (l1_stat
.st_mode
))
16579 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16583 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16588 local_free (dictionary_files
);
16594 log_error ("ERROR: No usable dictionary file found.");
16599 else if (wordlist_mode
== WL_MODE_STDIN
)
16604 else if (attack_mode
== ATTACK_MODE_COMBI
)
16608 char *dictfile1
= myargv
[optind
+ 1 + 0];
16609 char *dictfile2
= myargv
[optind
+ 1 + 1];
16611 // find the bigger dictionary and use as base
16616 struct stat tmp_stat
;
16618 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
16620 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16625 if (stat (dictfile1
, &tmp_stat
) == -1)
16627 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
16634 if (S_ISDIR (tmp_stat
.st_mode
))
16636 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
16643 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16645 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16652 if (stat (dictfile2
, &tmp_stat
) == -1)
16654 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16662 if (S_ISDIR (tmp_stat
.st_mode
))
16664 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16672 data
.combs_cnt
= 1;
16676 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16678 data
.quiet
= quiet
;
16680 if (words1_cnt
== 0)
16682 log_error ("ERROR: %s: empty file", dictfile1
);
16690 data
.combs_cnt
= 1;
16694 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16696 data
.quiet
= quiet
;
16698 if (words2_cnt
== 0)
16700 log_error ("ERROR: %s: empty file", dictfile2
);
16711 data
.dictfile
= dictfile1
;
16712 data
.dictfile2
= dictfile2
;
16714 if (words1_cnt
>= words2_cnt
)
16716 data
.combs_cnt
= words2_cnt
;
16717 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16719 dictfiles
= &data
.dictfile
;
16725 data
.combs_cnt
= words1_cnt
;
16726 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16728 dictfiles
= &data
.dictfile2
;
16732 // we also have to switch wordlist related rules!
16734 char *tmpc
= data
.rule_buf_l
;
16736 data
.rule_buf_l
= data
.rule_buf_r
;
16737 data
.rule_buf_r
= tmpc
;
16739 int tmpi
= data
.rule_len_l
;
16741 data
.rule_len_l
= data
.rule_len_r
;
16742 data
.rule_len_r
= tmpi
;
16745 else if (attack_mode
== ATTACK_MODE_BF
)
16751 if (benchmark
== 0)
16753 mask
= myargv
[optind
+ 1];
16755 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16757 if ((optind
+ 2) <= myargc
)
16759 struct stat file_stat
;
16761 if (stat (mask
, &file_stat
) == -1)
16765 masks
[maskcnt
- 1] = mystrdup (mask
);
16769 int wls_left
= myargc
- (optind
+ 1);
16771 uint masks_avail
= INCR_MASKS
;
16773 for (int i
= 0; i
< wls_left
; i
++)
16777 mask
= myargv
[optind
+ 1 + i
];
16779 if (stat (mask
, &file_stat
) == -1)
16781 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16787 uint is_file
= S_ISREG (file_stat
.st_mode
);
16793 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16795 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16800 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16802 while (!feof (mask_fp
))
16804 memset (line_buf
, 0, HCBUFSIZ
);
16806 int line_len
= fgetl (mask_fp
, line_buf
);
16808 if (line_len
== 0) continue;
16810 if (line_buf
[0] == '#') continue;
16812 if (masks_avail
== maskcnt
)
16814 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16816 masks_avail
+= INCR_MASKS
;
16819 masks
[maskcnt
] = mystrdup (line_buf
);
16830 log_error ("ERROR: %s: unsupported file-type", mask
);
16836 mask_from_file
= 1;
16841 custom_charset_1
= (char *) "?l?d?u";
16842 custom_charset_2
= (char *) "?l?d";
16843 custom_charset_3
= (char *) "?l?d*!$@_";
16845 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16846 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16847 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16849 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16851 wordlist_mode
= WL_MODE_MASK
;
16853 data
.wordlist_mode
= wordlist_mode
;
16863 * generate full masks and charsets
16866 masks
= (char **) mymalloc (sizeof (char *));
16870 case 1731: pw_min
= 5;
16872 mask
= mystrdup ("?b?b?b?b?b");
16874 case 12500: pw_min
= 5;
16876 mask
= mystrdup ("?b?b?b?b?b");
16878 default: pw_min
= 7;
16880 mask
= mystrdup ("?b?b?b?b?b?b?b");
16886 masks
[maskcnt
- 1] = mystrdup (mask
);
16888 wordlist_mode
= WL_MODE_MASK
;
16890 data
.wordlist_mode
= wordlist_mode
;
16895 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16899 if (increment_min
> pw_min
) pw_min
= increment_min
;
16901 if (increment_max
< pw_max
) pw_max
= increment_max
;
16904 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16906 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16910 char *mask
= myargv
[myargc
- 1];
16914 masks
= (char **) mymalloc (1 * sizeof (char *));
16918 struct stat file_stat
;
16920 if (stat (mask
, &file_stat
) == -1)
16924 masks
[maskcnt
- 1] = mystrdup (mask
);
16928 uint is_file
= S_ISREG (file_stat
.st_mode
);
16934 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16936 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16941 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16943 uint masks_avail
= 1;
16945 while (!feof (mask_fp
))
16947 memset (line_buf
, 0, HCBUFSIZ
);
16949 int line_len
= fgetl (mask_fp
, line_buf
);
16951 if (line_len
== 0) continue;
16953 if (line_buf
[0] == '#') continue;
16955 if (masks_avail
== maskcnt
)
16957 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16959 masks_avail
+= INCR_MASKS
;
16962 masks
[maskcnt
] = mystrdup (line_buf
);
16971 mask_from_file
= 1;
16977 masks
[maskcnt
- 1] = mystrdup (mask
);
16983 int wls_left
= myargc
- (optind
+ 2);
16985 for (int i
= 0; i
< wls_left
; i
++)
16987 char *filename
= myargv
[optind
+ 1 + i
];
16989 struct stat file_stat
;
16991 if (stat (filename
, &file_stat
) == -1)
16993 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16998 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
17002 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17006 dictfiles
[dictcnt
- 1] = filename
;
17010 // do not allow --keyspace w/ a directory
17014 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17019 char **dictionary_files
= NULL
;
17021 dictionary_files
= scan_directory (filename
);
17023 if (dictionary_files
!= NULL
)
17025 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17027 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17029 char *l1_filename
= dictionary_files
[d
];
17031 struct stat l1_stat
;
17033 if (stat (l1_filename
, &l1_stat
) == -1)
17035 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17040 if (S_ISREG (l1_stat
.st_mode
))
17042 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17046 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17051 local_free (dictionary_files
);
17057 log_error ("ERROR: No usable dictionary file found.");
17066 uint mask_min
= increment_min
; // we can't reject smaller masks here
17067 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
17069 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
17071 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
17073 if (cur_mask
== NULL
) break;
17075 masks
[maskcnt
] = cur_mask
;
17079 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
17083 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17085 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17089 char *mask
= myargv
[optind
+ 1 + 0];
17093 masks
= (char **) mymalloc (1 * sizeof (char *));
17097 struct stat file_stat
;
17099 if (stat (mask
, &file_stat
) == -1)
17103 masks
[maskcnt
- 1] = mystrdup (mask
);
17107 uint is_file
= S_ISREG (file_stat
.st_mode
);
17113 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17115 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17120 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17122 uint masks_avail
= 1;
17124 while (!feof (mask_fp
))
17126 memset (line_buf
, 0, HCBUFSIZ
);
17128 int line_len
= fgetl (mask_fp
, line_buf
);
17130 if (line_len
== 0) continue;
17132 if (line_buf
[0] == '#') continue;
17134 if (masks_avail
== maskcnt
)
17136 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17138 masks_avail
+= INCR_MASKS
;
17141 masks
[maskcnt
] = mystrdup (line_buf
);
17150 mask_from_file
= 1;
17156 masks
[maskcnt
- 1] = mystrdup (mask
);
17162 int wls_left
= myargc
- (optind
+ 2);
17164 for (int i
= 0; i
< wls_left
; i
++)
17166 char *filename
= myargv
[optind
+ 2 + i
];
17168 struct stat file_stat
;
17170 if (stat (filename
, &file_stat
) == -1)
17172 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
17177 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
17181 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17185 dictfiles
[dictcnt
- 1] = filename
;
17189 // do not allow --keyspace w/ a directory
17193 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17198 char **dictionary_files
= NULL
;
17200 dictionary_files
= scan_directory (filename
);
17202 if (dictionary_files
!= NULL
)
17204 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17206 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17208 char *l1_filename
= dictionary_files
[d
];
17210 struct stat l1_stat
;
17212 if (stat (l1_filename
, &l1_stat
) == -1)
17214 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17219 if (S_ISREG (l1_stat
.st_mode
))
17221 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17225 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17230 local_free (dictionary_files
);
17236 log_error ("ERROR: No usable dictionary file found.");
17245 uint mask_min
= increment_min
; // we can't reject smaller masks here
17246 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
17248 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
17250 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
17252 if (cur_mask
== NULL
) break;
17254 masks
[maskcnt
] = cur_mask
;
17258 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
17263 data
.pw_min
= pw_min
;
17264 data
.pw_max
= pw_max
;
17270 if (weak_hash_threshold
>= salts_cnt
)
17272 hc_device_param_t
*device_param
= NULL
;
17274 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17276 device_param
= &data
.devices_param
[device_id
];
17278 if (device_param
->skipped
) continue;
17283 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
17285 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
17287 weak_hash_check (device_param
, salt_pos
);
17290 // Display hack, guarantee that there is at least one \r before real start
17292 //if (data.quiet == 0) log_info ("");
17296 * status and monitor threads
17299 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17301 data
.devices_status
= STATUS_STARTING
;
17304 uint inner_threads_cnt
= 0;
17306 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
17308 data
.shutdown_inner
= 0;
17314 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
17316 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
17318 inner_threads_cnt
++;
17320 if (outfile_check_timer
!= 0)
17322 if (data
.outfile_check_directory
!= NULL
)
17324 if ((hash_mode
!= 5200) &&
17325 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
17326 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
17327 (hash_mode
!= 9000))
17329 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
17331 inner_threads_cnt
++;
17335 outfile_check_timer
= 0;
17340 outfile_check_timer
= 0;
17346 * Inform the user if we got some hashes remove because of the pot file remove feature
17349 if (data
.quiet
== 0)
17351 if (potfile_remove_cracks
> 0)
17353 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
17354 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
17358 data
.outfile_check_timer
= outfile_check_timer
;
17364 char **induction_dictionaries
= NULL
;
17366 int induction_dictionaries_cnt
= 0;
17368 hcstat_table_t
*root_table_buf
= NULL
;
17369 hcstat_table_t
*markov_table_buf
= NULL
;
17371 uint initial_restore_done
= 0;
17373 data
.maskcnt
= maskcnt
;
17375 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
17377 if (data
.devices_status
== STATUS_CRACKED
) continue;
17378 if (data
.devices_status
== STATUS_ABORTED
) continue;
17379 if (data
.devices_status
== STATUS_QUIT
) continue;
17381 if (maskpos
> rd
->maskpos
)
17386 rd
->maskpos
= maskpos
;
17387 data
.maskpos
= maskpos
;
17389 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
17391 char *mask
= masks
[maskpos
];
17393 if (mask_from_file
== 1)
17395 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
17400 uint mask_offset
= 0;
17402 uint separator_cnt
;
17404 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
17406 str_ptr
= strstr (mask
+ mask_offset
, ",");
17408 if (str_ptr
== NULL
) break;
17410 str_pos
= str_ptr
- mask
;
17412 // escaped separator, i.e. "\,"
17416 if (mask
[str_pos
- 1] == '\\')
17420 mask_offset
= str_pos
+ 1;
17426 // reset the offset
17430 mask
[str_pos
] = '\0';
17432 switch (separator_cnt
)
17435 mp_reset_usr (mp_usr
, 0);
17437 custom_charset_1
= mask
;
17438 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
17442 mp_reset_usr (mp_usr
, 1);
17444 custom_charset_2
= mask
;
17445 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
17449 mp_reset_usr (mp_usr
, 2);
17451 custom_charset_3
= mask
;
17452 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
17456 mp_reset_usr (mp_usr
, 3);
17458 custom_charset_4
= mask
;
17459 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
17463 mask
= mask
+ str_pos
+ 1;
17467 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17471 local_free (css_buf
);
17472 local_free (data
.root_css_buf
);
17473 local_free (data
.markov_css_buf
);
17475 local_free (masks
[maskpos
- 1]);
17478 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17481 data
.css_cnt
= css_cnt
;
17482 data
.css_buf
= css_buf
;
17484 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17486 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17488 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17489 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17491 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17493 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17495 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17496 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17498 data
.root_css_buf
= root_css_buf
;
17499 data
.markov_css_buf
= markov_css_buf
;
17501 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17503 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17505 local_free (root_table_buf
);
17506 local_free (markov_table_buf
);
17510 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17512 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17514 if (device_param
->skipped
) continue;
17516 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
17517 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
17518 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
17520 device_param
->kernel_params_mp_buf64
[3] = 0;
17521 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
17522 device_param
->kernel_params_mp_buf32
[5] = 0;
17523 device_param
->kernel_params_mp_buf32
[6] = 0;
17524 device_param
->kernel_params_mp_buf32
[7] = 0;
17526 if (attack_mode
== ATTACK_MODE_HYBRID1
)
17528 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
17529 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
17530 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
17531 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
17533 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17535 device_param
->kernel_params_mp_buf32
[5] = 0;
17536 device_param
->kernel_params_mp_buf32
[6] = 0;
17537 device_param
->kernel_params_mp_buf32
[7] = 0;
17540 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
]);
17541 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
]);
17542 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
]);
17544 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
);
17545 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
);
17548 else if (attack_mode
== ATTACK_MODE_BF
)
17550 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
17554 for (uint i
= 0; i
< dictcnt
; i
++)
17556 local_free (dictfiles
[i
]);
17559 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
17561 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
17563 if (l1_filename
== NULL
) break;
17567 dictfiles
[dictcnt
- 1] = l1_filename
;
17574 dictfiles
[dictcnt
- 1] = mask
;
17579 log_error ("ERROR: Mask is too small");
17586 free (induction_dictionaries
);
17588 // induction_dictionaries_cnt = 0; // implied
17590 if (attack_mode
!= ATTACK_MODE_BF
)
17594 induction_dictionaries
= scan_directory (induction_directory
);
17596 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17600 if (induction_dictionaries_cnt
)
17602 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17606 * prevent the user from using --keyspace together w/ maskfile and or dictfile
17610 if ((maskcnt
> 1) || (dictcnt
> 1))
17612 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
17618 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
17620 if (data
.devices_status
== STATUS_CRACKED
) continue;
17621 if (data
.devices_status
== STATUS_ABORTED
) continue;
17622 if (data
.devices_status
== STATUS_QUIT
) continue;
17624 rd
->dictpos
= dictpos
;
17626 char *subid
= logfile_generate_subid ();
17628 data
.subid
= subid
;
17630 logfile_sub_msg ("START");
17632 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17634 data
.devices_status
= STATUS_INIT
;
17637 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
17638 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
17639 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
17641 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
17645 data
.cpt_start
= time (NULL
);
17647 data
.cpt_total
= 0;
17649 if (data
.restore
== 0)
17651 rd
->words_cur
= skip
;
17658 data
.ms_paused
= 0;
17660 data
.kernel_power_final
= 0;
17662 data
.words_cur
= rd
->words_cur
;
17664 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17666 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17668 if (device_param
->skipped
) continue;
17670 device_param
->speed_pos
= 0;
17672 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17673 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17675 device_param
->exec_pos
= 0;
17677 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17679 device_param
->outerloop_pos
= 0;
17680 device_param
->outerloop_left
= 0;
17681 device_param
->innerloop_pos
= 0;
17682 device_param
->innerloop_left
= 0;
17684 // some more resets:
17686 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17688 device_param
->pws_cnt
= 0;
17690 device_param
->words_off
= 0;
17691 device_param
->words_done
= 0;
17694 // figure out some workload
17696 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17698 if (data
.wordlist_mode
== WL_MODE_FILE
)
17700 char *dictfile
= NULL
;
17702 if (induction_dictionaries_cnt
)
17704 dictfile
= induction_dictionaries
[0];
17708 dictfile
= dictfiles
[dictpos
];
17711 data
.dictfile
= dictfile
;
17713 logfile_sub_string (dictfile
);
17715 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17717 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17720 FILE *fd2
= fopen (dictfile
, "rb");
17724 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17729 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17733 if (data
.words_cnt
== 0)
17735 logfile_sub_msg ("STOP");
17741 else if (attack_mode
== ATTACK_MODE_COMBI
)
17743 char *dictfile
= data
.dictfile
;
17744 char *dictfile2
= data
.dictfile2
;
17746 logfile_sub_string (dictfile
);
17747 logfile_sub_string (dictfile2
);
17749 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17751 FILE *fd2
= fopen (dictfile
, "rb");
17755 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17760 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17764 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17766 FILE *fd2
= fopen (dictfile2
, "rb");
17770 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17775 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17780 if (data
.words_cnt
== 0)
17782 logfile_sub_msg ("STOP");
17787 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17789 char *dictfile
= NULL
;
17791 if (induction_dictionaries_cnt
)
17793 dictfile
= induction_dictionaries
[0];
17797 dictfile
= dictfiles
[dictpos
];
17800 data
.dictfile
= dictfile
;
17802 char *mask
= data
.mask
;
17804 logfile_sub_string (dictfile
);
17805 logfile_sub_string (mask
);
17807 FILE *fd2
= fopen (dictfile
, "rb");
17811 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17816 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17820 if (data
.words_cnt
== 0)
17822 logfile_sub_msg ("STOP");
17827 else if (attack_mode
== ATTACK_MODE_BF
)
17829 local_free (css_buf
);
17830 local_free (data
.root_css_buf
);
17831 local_free (data
.markov_css_buf
);
17833 char *mask
= dictfiles
[dictpos
];
17835 logfile_sub_string (mask
);
17839 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17841 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17843 uint css_cnt_unicode
= css_cnt
* 2;
17845 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17847 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17849 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17851 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17852 css_buf_unicode
[j
+ 1].cs_len
= 1;
17857 css_buf
= css_buf_unicode
;
17858 css_cnt
= css_cnt_unicode
;
17861 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17863 uint mask_min
= pw_min
;
17864 uint mask_max
= pw_max
;
17866 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17872 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17874 if (css_cnt
< mask_min
)
17876 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
17879 if (css_cnt
> mask_max
)
17881 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
17884 // skip to next mask
17886 logfile_sub_msg ("STOP");
17891 uint save_css_cnt
= css_cnt
;
17893 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17895 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17897 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17898 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17900 uint css_cnt_salt
= css_cnt
+ salt_len
;
17902 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17904 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17906 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17908 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17909 css_buf_salt
[j
].cs_len
= 1;
17914 css_buf
= css_buf_salt
;
17915 css_cnt
= css_cnt_salt
;
17920 data
.css_cnt
= css_cnt
;
17921 data
.css_buf
= css_buf
;
17923 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17925 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17927 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17929 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17930 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17932 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17934 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17936 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17937 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17939 data
.root_css_buf
= root_css_buf
;
17940 data
.markov_css_buf
= markov_css_buf
;
17942 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17944 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17946 local_free (root_table_buf
);
17947 local_free (markov_table_buf
);
17951 uint css_cnt_l
= css_cnt
;
17954 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17956 if (save_css_cnt
< 6)
17960 else if (save_css_cnt
== 6)
17966 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17968 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17979 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17994 /* unfinished code?
17995 int sum = css_buf[css_cnt_r - 1].cs_len;
17997 for (uint i = 1; i < 4 && i < css_cnt; i++)
17999 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
18003 sum *= css_buf[css_cnt_r - 1].cs_len;
18008 css_cnt_l
-= css_cnt_r
;
18010 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
18012 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18014 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18016 if (device_param
->skipped
) continue;
18018 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
18019 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
18020 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
18022 device_param
->kernel_params_mp_l_buf64
[3] = 0;
18023 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
18024 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
18025 device_param
->kernel_params_mp_l_buf32
[6] = 0;
18026 device_param
->kernel_params_mp_l_buf32
[7] = 0;
18027 device_param
->kernel_params_mp_l_buf32
[8] = 0;
18029 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
18030 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
18031 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
18032 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
18034 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
18035 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
18036 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
18038 device_param
->kernel_params_mp_r_buf64
[3] = 0;
18039 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
18040 device_param
->kernel_params_mp_r_buf32
[5] = 0;
18041 device_param
->kernel_params_mp_r_buf32
[6] = 0;
18042 device_param
->kernel_params_mp_r_buf32
[7] = 0;
18044 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
]);
18045 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
]);
18046 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
]);
18048 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
]);
18049 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
]);
18050 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
]);
18052 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
);
18053 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
);
18057 u64 words_base
= data
.words_cnt
;
18059 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
18061 if (data
.kernel_rules_cnt
)
18063 words_base
/= data
.kernel_rules_cnt
;
18066 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
18068 if (data
.combs_cnt
)
18070 words_base
/= data
.combs_cnt
;
18073 else if (data
.attack_kern
== ATTACK_KERN_BF
)
18077 words_base
/= data
.bfs_cnt
;
18081 data
.words_base
= words_base
;
18085 log_info ("%llu", (unsigned long long int) words_base
);
18090 if (data
.words_cur
> data
.words_base
)
18092 log_error ("ERROR: Restore value greater keyspace");
18097 if (data
.words_cur
)
18099 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
18101 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
18103 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
18106 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
18108 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
18110 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
18113 else if (data
.attack_kern
== ATTACK_KERN_BF
)
18115 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
18117 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
18123 * Update loopback file
18132 uint random_num
= get_random_num (0, 9999);
18134 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
18136 data
.loopback_file
= loopback_file
;
18140 * Update dictionary statistic
18145 dictstat_fp
= fopen (dictstat
, "wb");
18149 lock_file (dictstat_fp
);
18151 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
18153 fclose (dictstat_fp
);
18158 * create autotune threads
18161 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
18163 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18165 data
.devices_status
= STATUS_AUTOTUNE
;
18168 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18170 hc_device_param_t
*device_param
= &devices_param
[device_id
];
18172 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
18175 hc_thread_wait (data
.devices_cnt
, c_threads
);
18178 * Inform user about possible slow speeds
18181 uint hardware_power_all
= 0;
18183 uint kernel_power_all
= 0;
18185 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18187 hc_device_param_t
*device_param
= &devices_param
[device_id
];
18189 hardware_power_all
+= device_param
->hardware_power
;
18191 kernel_power_all
+= device_param
->kernel_power
;
18194 data
.hardware_power_all
= hardware_power_all
; // hardware_power_all is the same as kernel_power_all but without the influence of kernel_accel on the devices
18196 data
.kernel_power_all
= kernel_power_all
;
18198 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
18200 if (data
.words_base
< kernel_power_all
)
18206 log_info ("ATTENTION!");
18207 log_info (" The wordlist or mask you are using is too small.");
18208 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
18209 log_info (" The cracking speed will drop.");
18210 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
18217 * create cracker threads
18220 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18222 data
.devices_status
= STATUS_RUNNING
;
18225 if (initial_restore_done
== 0)
18227 if (data
.restore_disable
== 0) cycle_restore ();
18229 initial_restore_done
= 1;
18232 hc_timer_set (&data
.timer_running
);
18234 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
18236 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
18238 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
18239 if (quiet
== 0) fflush (stdout
);
18242 else if (wordlist_mode
== WL_MODE_STDIN
)
18244 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
18245 if (data
.quiet
== 0) log_info ("");
18248 time_t runtime_start
;
18250 time (&runtime_start
);
18252 data
.runtime_start
= runtime_start
;
18254 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18256 hc_device_param_t
*device_param
= &devices_param
[device_id
];
18258 if (wordlist_mode
== WL_MODE_STDIN
)
18260 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
18264 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
18268 hc_thread_wait (data
.devices_cnt
, c_threads
);
18270 local_free (c_threads
);
18272 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18274 data
.devices_status
= STATUS_EXHAUSTED
;
18277 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
18281 if (induction_dictionaries_cnt
)
18283 unlink (induction_dictionaries
[0]);
18286 free (induction_dictionaries
);
18288 if (attack_mode
!= ATTACK_MODE_BF
)
18290 induction_dictionaries
= scan_directory (induction_directory
);
18292 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18295 if (benchmark
== 1)
18297 status_benchmark ();
18299 if (machine_readable
== 0)
18325 if (induction_dictionaries_cnt
)
18327 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18330 time_t runtime_stop
;
18332 time (&runtime_stop
);
18334 data
.runtime_stop
= runtime_stop
;
18336 logfile_sub_uint (runtime_start
);
18337 logfile_sub_uint (runtime_stop
);
18339 logfile_sub_msg ("STOP");
18341 global_free (subid
);
18343 // from this point we handle bypass as running
18345 if (data
.devices_status
== STATUS_BYPASS
)
18347 data
.devices_status
= STATUS_RUNNING
;
18350 // and overwrite benchmark aborts as well
18352 if (data
.benchmark
== 1)
18354 if (data
.devices_status
== STATUS_ABORTED
)
18356 data
.devices_status
= STATUS_RUNNING
;
18362 if (data
.devices_status
== STATUS_CRACKED
) break;
18363 if (data
.devices_status
== STATUS_ABORTED
) break;
18364 if (data
.devices_status
== STATUS_QUIT
) break;
18367 if (data
.devices_status
== STATUS_CRACKED
) break;
18368 if (data
.devices_status
== STATUS_ABORTED
) break;
18369 if (data
.devices_status
== STATUS_QUIT
) break;
18372 // 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
18373 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18375 if (data
.wordlist_mode
== WL_MODE_FILE
)
18377 if (data
.dictfile
== NULL
)
18379 if (dictfiles
!= NULL
)
18381 data
.dictfile
= dictfiles
[0];
18383 hc_timer_set (&data
.timer_running
);
18388 // NOTE: combi is okay because it is already set beforehand
18389 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
18391 if (data
.dictfile
== NULL
)
18393 if (dictfiles
!= NULL
)
18395 hc_timer_set (&data
.timer_running
);
18397 data
.dictfile
= dictfiles
[0];
18401 else if (attack_mode
== ATTACK_MODE_BF
)
18403 if (data
.mask
== NULL
)
18405 hc_timer_set (&data
.timer_running
);
18407 data
.mask
= masks
[0];
18411 // if cracked / aborted remove last induction dictionary
18413 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
18415 struct stat induct_stat
;
18417 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
18419 unlink (induction_dictionaries
[file_pos
]);
18423 // wait for inner threads
18425 data
.shutdown_inner
= 1;
18427 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
18429 hc_thread_wait (1, &inner_threads
[thread_idx
]);
18432 local_free (inner_threads
);
18434 // we dont need restore file anymore
18435 if (data
.restore_disable
== 0)
18437 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
18439 unlink (eff_restore_file
);
18440 unlink (new_restore_file
);
18448 // finally save left hashes
18450 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
18459 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18461 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18463 if (device_param
->skipped
) continue;
18465 local_free (device_param
->combs_buf
);
18466 local_free (device_param
->hooks_buf
);
18467 local_free (device_param
->device_name
);
18468 local_free (device_param
->device_name_chksum
);
18469 local_free (device_param
->device_version
);
18470 local_free (device_param
->driver_version
);
18472 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
18473 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
18474 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
18475 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
18476 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
18477 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
18478 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
18479 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
18480 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
18481 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
18482 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
18483 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
18484 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
18485 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
18486 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
18487 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
18488 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
18489 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
18490 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
18491 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
18492 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
18493 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
18494 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
18495 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
18496 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
18497 if (device_param
->d_scryptV0_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
18498 if (device_param
->d_scryptV1_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
18499 if (device_param
->d_scryptV2_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
18500 if (device_param
->d_scryptV3_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
18501 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
18502 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
18503 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
18505 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
18506 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
18507 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
18508 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
18509 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
18510 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
18511 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
18512 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
18513 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
18514 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
18515 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
18517 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
18518 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
18519 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
18521 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
18522 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
18525 // reset default fan speed
18528 if (gpu_temp_disable
== 0)
18530 if (gpu_temp_retain
!= 0)
18532 hc_thread_mutex_lock (mux_adl
);
18534 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18536 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18538 if (device_param
->skipped
) continue;
18540 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
18544 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
18546 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
18548 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
18551 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
18555 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
18559 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
18563 hc_thread_mutex_unlock (mux_adl
);
18567 // reset power tuning
18569 if (powertune_enable
== 1)
18571 hc_thread_mutex_lock (mux_adl
);
18573 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18575 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18577 if (device_param
->skipped
) continue;
18579 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
18581 if (data
.hm_device
[device_id
].od_version
== 6)
18583 // check powertune capabilities first, if not available then skip device
18585 int powertune_supported
= 0;
18587 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
18589 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
18594 if (powertune_supported
!= 0)
18596 // powercontrol settings
18598 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
18600 log_info ("ERROR: Failed to restore the ADL PowerControl values");
18607 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
18609 performance_state
->iNumberOfPerformanceLevels
= 2;
18611 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
18612 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
18613 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
18614 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
18616 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
18618 log_info ("ERROR: Failed to restore ADL performance state");
18623 local_free (performance_state
);
18628 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
18630 unsigned int limit
= nvml_power_limit
[device_id
];
18634 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
18639 hc_thread_mutex_unlock (mux_adl
);
18642 if (gpu_temp_disable
== 0)
18646 hm_NVML_nvmlShutdown (data
.hm_nvml
);
18648 nvml_close (data
.hm_nvml
);
18650 data
.hm_nvml
= NULL
;
18655 hm_NvAPI_Unload (data
.hm_nvapi
);
18657 nvapi_close (data
.hm_nvapi
);
18659 data
.hm_nvapi
= NULL
;
18662 if (data
.hm_xnvctrl
)
18664 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
18666 xnvctrl_close (data
.hm_xnvctrl
);
18668 data
.hm_xnvctrl
= NULL
;
18673 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
18675 adl_close (data
.hm_adl
);
18677 data
.hm_adl
= NULL
;
18680 #endif // HAVE_HWMON
18684 local_free (masks
);
18686 local_free (dictstat_base
);
18688 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18690 pot_t
*pot_ptr
= &pot
[pot_pos
];
18692 hash_t
*hash
= &pot_ptr
->hash
;
18694 local_free (hash
->digest
);
18698 local_free (hash
->salt
);
18704 local_free (all_kernel_rules_cnt
);
18705 local_free (all_kernel_rules_buf
);
18707 local_free (wl_data
->buf
);
18708 local_free (wl_data
);
18710 local_free (bitmap_s1_a
);
18711 local_free (bitmap_s1_b
);
18712 local_free (bitmap_s1_c
);
18713 local_free (bitmap_s1_d
);
18714 local_free (bitmap_s2_a
);
18715 local_free (bitmap_s2_b
);
18716 local_free (bitmap_s2_c
);
18717 local_free (bitmap_s2_d
);
18720 local_free (od_clock_mem_status
);
18721 local_free (od_power_control_status
);
18722 local_free (nvml_power_limit
);
18725 global_free (devices_param
);
18727 global_free (kernel_rules_buf
);
18729 global_free (root_css_buf
);
18730 global_free (markov_css_buf
);
18732 global_free (digests_buf
);
18733 global_free (digests_shown
);
18734 global_free (digests_shown_tmp
);
18736 global_free (salts_buf
);
18737 global_free (salts_shown
);
18739 global_free (esalts_buf
);
18741 global_free (words_progress_done
);
18742 global_free (words_progress_rejected
);
18743 global_free (words_progress_restored
);
18745 if (pot_fp
) fclose (pot_fp
);
18747 if (data
.devices_status
== STATUS_QUIT
) break;
18750 // wait for outer threads
18752 data
.shutdown_outer
= 1;
18754 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
18756 hc_thread_wait (1, &outer_threads
[thread_idx
]);
18759 local_free (outer_threads
);
18761 // destroy others mutex
18763 hc_thread_mutex_delete (mux_dispatcher
);
18764 hc_thread_mutex_delete (mux_counter
);
18765 hc_thread_mutex_delete (mux_display
);
18766 hc_thread_mutex_delete (mux_adl
);
18770 local_free (eff_restore_file
);
18771 local_free (new_restore_file
);
18777 tuning_db_destroy (tuning_db
);
18781 local_free (loopback_file
);
18783 if (loopback
== 1) unlink (loopback_file
);
18785 // induction directory
18787 if (induction_dir
== NULL
)
18789 if (attack_mode
!= ATTACK_MODE_BF
)
18791 if (rmdir (induction_directory
) == -1)
18793 if (errno
== ENOENT
)
18795 // good, we can ignore
18797 else if (errno
== ENOTEMPTY
)
18799 // good, we can ignore
18803 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18809 local_free (induction_directory
);
18813 // outfile-check directory
18815 if (outfile_check_dir
== NULL
)
18817 if (rmdir (outfile_check_directory
) == -1)
18819 if (errno
== ENOENT
)
18821 // good, we can ignore
18823 else if (errno
== ENOTEMPTY
)
18825 // good, we can ignore
18829 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18835 local_free (outfile_check_directory
);
18842 logfile_top_uint (proc_start
);
18843 logfile_top_uint (proc_stop
);
18845 logfile_top_msg ("STOP");
18847 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18848 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18850 if (data
.ocl
) ocl_close (data
.ocl
);
18852 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18853 if (data
.devices_status
== STATUS_QUIT
) return 2;
18854 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18855 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18856 if (data
.devices_status
== STATUS_CRACKED
) return 0;