2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 0
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
318 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
324 static unsigned int full01
= 0x01010101;
325 static unsigned int full80
= 0x80808080;
327 int SUPPRESS_OUTPUT
= 0;
329 hc_thread_mutex_t mux_adl
;
330 hc_thread_mutex_t mux_counter
;
331 hc_thread_mutex_t mux_dispatcher
;
332 hc_thread_mutex_t mux_display
;
334 hc_global_data_t data
;
336 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
338 const char *USAGE_MINI
[] =
340 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
342 "Try --help for more help.",
346 const char *USAGE_BIG
[] =
348 "%s, advanced password recovery",
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
354 " Options Short / Long | Type | Description | Example",
355 "===============================|======|======================================================|=======================",
356 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
357 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
358 " -V, --version | | Print version |",
359 " -h, --help | | Print help |",
360 " --quiet | | Suppress output |",
361 " --hex-charset | | Assume charset is given in hex |",
362 " --hex-salt | | Assume salt is given in hex |",
363 " --hex-wordlist | | Assume words in wordlist is given in hex |",
364 " --force | | Ignore warnings |",
365 " --status | | Enable automatic update of the status-screen |",
366 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
367 " --machine-readable | | Display the status view in a machine readable format |",
368 " --loopback | | Add new plains to induct directory |",
369 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
370 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
371 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
372 " --markov-classic | | Enables classic markov-chains, no per-position |",
373 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
374 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
375 " --session | Str | Define specific session name | --session=mysession",
376 " --restore | | Restore session from --session |",
377 " --restore-disable | | Do not write restore file |",
378 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
379 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
380 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
381 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
382 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
383 " --show | | Show cracked passwords only |",
384 " --left | | Show un-cracked passwords only |",
385 " --username | | Enable ignoring of usernames in hashfile |",
386 " --remove | | Enable remove of hash once it is cracked |",
387 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
388 " --potfile-disable | | Do not write potfile |",
389 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
390 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
391 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
392 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
393 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
394 " --logfile-disable | | Disable the logfile |",
395 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
396 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
397 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
398 " -b, --benchmark | | Run benchmark |",
399 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
400 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
401 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
402 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
403 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
404 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
405 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
406 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
407 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
408 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
409 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
410 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
412 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
413 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
414 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
416 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
417 " -s, --skip | Num | Skip X words from the start | -s 1000000",
418 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
419 " --keyspace | | Show keyspace base:mod values and quit |",
420 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
421 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
422 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
423 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
424 " --generate-rules-func-min | Num | Force min X funcs per rule |",
425 " --generate-rules-func-max | Num | Force max X funcs per rule |",
426 " --generate-rules-seed | Num | Force RNG seed set to X |",
427 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
428 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
429 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
430 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
431 " -i, --increment | | Enable mask increment mode |",
432 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
433 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
435 "- [ Hash modes ] -",
437 " # | Name | Category",
438 " ======+==================================================+======================================",
439 " 900 | MD4 | Raw Hash",
440 " 0 | MD5 | Raw Hash",
441 " 5100 | Half MD5 | Raw Hash",
442 " 100 | SHA1 | Raw Hash",
443 " 10800 | SHA-384 | Raw Hash",
444 " 1400 | SHA-256 | Raw Hash",
445 " 1700 | SHA-512 | Raw Hash",
446 " 5000 | SHA-3(Keccak) | Raw Hash",
447 " 10100 | SipHash | Raw Hash",
448 " 6000 | RipeMD160 | Raw Hash",
449 " 6100 | Whirlpool | Raw Hash",
450 " 6900 | GOST R 34.11-94 | Raw Hash",
451 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
452 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
453 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
454 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
455 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
456 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
457 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
458 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
459 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
460 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
461 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
462 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
463 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
464 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
465 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
466 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
467 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
469 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
471 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
472 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
473 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
474 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
475 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
476 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
477 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
478 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
479 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
480 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
481 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
482 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
483 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
484 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
485 " 400 | phpass | Generic KDF",
486 " 8900 | scrypt | Generic KDF",
487 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
488 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
489 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
490 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
491 " 23 | Skype | Network protocols",
492 " 2500 | WPA/WPA2 | Network protocols",
493 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
494 " 5300 | IKE-PSK MD5 | Network protocols",
495 " 5400 | IKE-PSK SHA1 | Network protocols",
496 " 5500 | NetNTLMv1 | Network protocols",
497 " 5500 | NetNTLMv1 + ESS | Network protocols",
498 " 5600 | NetNTLMv2 | Network protocols",
499 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
500 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
501 " 8300 | DNSSEC (NSEC3) | Network protocols",
502 " 10200 | Cram MD5 | Network protocols",
503 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
504 " 11200 | MySQL CRAM (SHA1) | Network protocols",
505 " 11400 | SIP digest authentication (MD5) | Network protocols",
506 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
507 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
508 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
509 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
510 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
511 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
512 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
513 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
514 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
515 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
516 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
517 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
518 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
519 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
520 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
521 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
522 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
523 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
524 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
525 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
526 " 12 | PostgreSQL | Database Server",
527 " 131 | MSSQL(2000) | Database Server",
528 " 132 | MSSQL(2005) | Database Server",
529 " 1731 | MSSQL(2012) | Database Server",
530 " 1731 | MSSQL(2014) | Database Server",
531 " 200 | MySQL323 | Database Server",
532 " 300 | MySQL4.1/MySQL5 | Database Server",
533 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
534 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
535 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
536 " 8000 | Sybase ASE | Database Server",
537 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
538 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
539 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
540 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
541 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
542 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
543 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
544 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
545 " 11500 | CRC32 | Checksums",
546 " 3000 | LM | Operating-Systems",
547 " 1000 | NTLM | Operating-Systems",
548 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
549 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
550 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
551 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
552 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
553 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
554 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
555 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
556 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
557 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
558 " 1722 | OSX v10.7 | Operating-Systems",
559 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
560 " 6300 | AIX {smd5} | Operating-Systems",
561 " 6700 | AIX {ssha1} | Operating-Systems",
562 " 6400 | AIX {ssha256} | Operating-Systems",
563 " 6500 | AIX {ssha512} | Operating-Systems",
564 " 2400 | Cisco-PIX | Operating-Systems",
565 " 2410 | Cisco-ASA | Operating-Systems",
566 " 500 | Cisco-IOS $1$ | Operating-Systems",
567 " 5700 | Cisco-IOS $4$ | Operating-Systems",
568 " 9200 | Cisco-IOS $8$ | Operating-Systems",
569 " 9300 | Cisco-IOS $9$ | Operating-Systems",
570 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
571 " 501 | Juniper IVE | Operating-Systems",
572 " 5800 | Android PIN | Operating-Systems",
573 " 8100 | Citrix Netscaler | Operating-Systems",
574 " 8500 | RACF | Operating-Systems",
575 " 7200 | GRUB 2 | Operating-Systems",
576 " 9900 | Radmin2 | Operating-Systems",
577 " 125 | ArubaOS | Operating-Systems",
578 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
579 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
580 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
581 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
582 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
583 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
584 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
585 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
586 " 11600 | 7-Zip | Archives",
587 " 12500 | RAR3-hp | Archives",
588 " 13000 | RAR5 | Archives",
589 " 13200 | AxCrypt | Archives",
590 " 13300 | AxCrypt in memory SHA1 | Archives",
591 " 13600 | WinZip | Archives",
592 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
593 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
594 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
595 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
596 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
597 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
598 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
600 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
601 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
606 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
607 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
608 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
609 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
610 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
611 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
612 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
613 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
614 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
615 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
616 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
617 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
618 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
626 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
627 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
628 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
629 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
630 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
631 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
632 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
633 " 9400 | MS Office 2007 | Documents",
634 " 9500 | MS Office 2010 | Documents",
635 " 9600 | MS Office 2013 | Documents",
636 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
637 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
638 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
639 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
640 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
641 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
642 " 9000 | Password Safe v2 | Password Managers",
643 " 5200 | Password Safe v3 | Password Managers",
644 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
645 " 6600 | 1Password, agilekeychain | Password Managers",
646 " 8200 | 1Password, cloudkeychain | Password Managers",
647 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
648 " 12700 | Blockchain, My Wallet | Password Managers",
649 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
651 "- [ Outfile Formats ] -",
657 " 3 | hash[:salt]:plain",
659 " 5 | hash[:salt]:hex_plain",
660 " 6 | plain:hex_plain",
661 " 7 | hash[:salt]:plain:hex_plain",
663 " 9 | hash[:salt]:crack_pos",
664 " 10 | plain:crack_pos",
665 " 11 | hash[:salt]:plain:crack_pos",
666 " 12 | hex_plain:crack_pos",
667 " 13 | hash[:salt]:hex_plain:crack_pos",
668 " 14 | plain:hex_plain:crack_pos",
669 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
671 "- [ Rule Debugging Modes ] -",
676 " 2 | Original-Word",
677 " 3 | Original-Word:Finding-Rule",
678 " 4 | Original-Word:Finding-Rule:Processed-Word",
680 "- [ Attack Modes ] -",
687 " 6 | Hybrid Wordlist + Mask",
688 " 7 | Hybrid Mask + Wordlist",
690 "- [ Built-in Charsets ] -",
694 " l | abcdefghijklmnopqrstuvwxyz",
695 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
697 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
701 "- [ OpenCL Device Types ] -",
704 " ===+=============",
707 " 3 | FPGA, DSP, Co-Processor",
709 "- [ Workload Profiles ] -",
711 " # | Performance | Runtime | Power Consumption | Desktop Impact",
712 " ===+=============+=========+===================+=================",
713 " 1 | Low | 2 ms | Low | Minimal",
714 " 2 | Default | 12 ms | Economic | Noticeable",
715 " 3 | High | 96 ms | High | Unresponsive",
716 " 4 | Nightmare | 480 ms | Insane | Headless",
718 "If you have no idea what just happened then visit the following pages:",
720 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
721 "* https://hashcat.net/wiki/#frequently_asked_questions",
727 * hashcat specific functions
730 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
732 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
734 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
736 double exec_ms_sum
= 0;
740 for (int i
= 0; i
< last_num_entries
; i
++)
742 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
746 exec_ms_sum
+= exec_ms
;
752 if (exec_ms_cnt
== 0) return 0;
754 return exec_ms_sum
/ exec_ms_cnt
;
757 void status_display_machine_readable ()
761 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
767 fprintf (out
, "SPEED\t");
769 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
771 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
773 if (device_param
->skipped
) continue;
778 for (int i
= 0; i
< SPEED_CACHE
; i
++)
780 speed_cnt
+= device_param
->speed_cnt
[i
];
781 speed_ms
+= device_param
->speed_ms
[i
];
784 speed_cnt
/= SPEED_CACHE
;
785 speed_ms
/= SPEED_CACHE
;
787 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
794 fprintf (out
, "EXEC_RUNTIME\t");
796 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
798 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
800 if (device_param
->skipped
) continue;
802 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
804 fprintf (out
, "%f\t", exec_ms_avg
);
811 u64 words_cur
= get_lowest_words_done ();
813 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
819 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
822 u64 all_rejected
= 0;
823 u64 all_restored
= 0;
825 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
827 all_done
+= data
.words_progress_done
[salt_pos
];
828 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
829 all_restored
+= data
.words_progress_restored
[salt_pos
];
832 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
833 u64 progress_end
= progress_total
;
835 u64 progress_skip
= 0;
839 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
841 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
842 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
843 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
848 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
850 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
851 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
852 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
855 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
856 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
858 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
864 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
865 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
872 if (data
.gpu_temp_disable
== 0)
874 fprintf (out
, "TEMP\t");
876 hc_thread_mutex_lock (mux_adl
);
878 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
880 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
882 if (device_param
->skipped
) continue;
884 int temp
= hm_get_temperature_with_device_id (device_id
);
886 fprintf (out
, "%d\t", temp
);
889 hc_thread_mutex_unlock (mux_adl
);
909 void status_display ()
911 if (data
.devices_status
== STATUS_INIT
) return;
912 if (data
.devices_status
== STATUS_STARTING
) return;
913 if (data
.devices_status
== STATUS_BYPASS
) return;
915 if (data
.machine_readable
== 1)
917 status_display_machine_readable ();
922 char tmp_buf
[1000] = { 0 };
926 log_info ("Session.Name...: %s", data
.session
);
928 char *status_type
= strstatus (data
.devices_status
);
930 uint hash_mode
= data
.hash_mode
;
932 char *hash_type
= strhashtype (hash_mode
); // not a bug
934 log_info ("Status.........: %s", status_type
);
940 if (data
.rp_files_cnt
)
944 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
946 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
949 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
951 log_info ("Rules.Type.....: %s", tmp_buf
);
958 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
960 if (data
.rp_gen_seed
)
962 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
970 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
972 if (data
.wordlist_mode
== WL_MODE_FILE
)
974 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
976 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
978 log_info ("Input.Mode.....: Pipe");
981 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
983 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
984 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
986 else if (data
.attack_mode
== ATTACK_MODE_BF
)
988 char *mask
= data
.mask
;
992 uint mask_len
= data
.css_cnt
;
994 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
998 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1000 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1002 mask_len
-= data
.salts_buf
[0].salt_len
;
1006 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1008 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1011 if (data
.maskcnt
> 1)
1013 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1015 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1018 log_info ("Input.Mode.....: %s", tmp_buf
);
1023 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1025 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1026 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1028 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1030 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1031 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1034 if (data
.digests_cnt
== 1)
1036 if (data
.hash_mode
== 2500)
1038 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1040 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1041 (char *) data
.salts_buf
[0].salt_buf
,
1055 else if (data
.hash_mode
== 5200)
1057 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1059 else if (data
.hash_mode
== 9000)
1061 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1063 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1065 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1067 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1069 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1073 char out_buf
[HCBUFSIZ
] = { 0 };
1075 ascii_digest (out_buf
, 0, 0);
1078 if (strlen (out_buf
) > 40)
1086 log_info ("Hash.Target....: %s", out_buf
);
1091 if (data
.hash_mode
== 3000)
1093 char out_buf1
[32] = { 0 };
1094 char out_buf2
[32] = { 0 };
1096 ascii_digest (out_buf1
, 0, 0);
1097 ascii_digest (out_buf2
, 0, 1);
1099 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1103 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1107 log_info ("Hash.Type......: %s", hash_type
);
1113 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1114 double speed_ms
[DEVICES_MAX
] = { 0 };
1116 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1118 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1120 if (device_param
->skipped
) continue;
1122 speed_cnt
[device_id
] = 0;
1123 speed_ms
[device_id
] = 0;
1125 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1127 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1128 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1131 speed_cnt
[device_id
] /= SPEED_CACHE
;
1132 speed_ms
[device_id
] /= SPEED_CACHE
;
1135 double hashes_all_ms
= 0;
1137 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1139 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1141 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1143 if (device_param
->skipped
) continue;
1145 hashes_dev_ms
[device_id
] = 0;
1147 if (speed_ms
[device_id
])
1149 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1151 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1159 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1161 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1163 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1165 if (device_param
->skipped
) continue;
1167 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1169 exec_all_ms
[device_id
] = exec_ms_avg
;
1176 double ms_running
= 0;
1178 hc_timer_get (data
.timer_running
, ms_running
);
1180 double ms_paused
= data
.ms_paused
;
1182 if (data
.devices_status
== STATUS_PAUSED
)
1184 double ms_paused_tmp
= 0;
1186 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1188 ms_paused
+= ms_paused_tmp
;
1193 __time64_t sec_run
= ms_running
/ 1000;
1197 time_t sec_run
= ms_running
/ 1000;
1203 char display_run
[32] = { 0 };
1207 struct tm
*tmp
= NULL
;
1211 tmp
= _gmtime64 (&sec_run
);
1215 tmp
= gmtime (&sec_run
);
1221 memset (&tm_run
, 0, sizeof (tm_run
));
1223 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1225 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1227 char *start
= ctime (&data
.proc_start
);
1229 size_t start_len
= strlen (start
);
1231 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1232 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1234 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1239 log_info ("Time.Started...: 0 secs");
1246 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1249 u64 all_rejected
= 0;
1250 u64 all_restored
= 0;
1252 u64 progress_noneed
= 0;
1254 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1256 all_done
+= data
.words_progress_done
[salt_pos
];
1257 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1258 all_restored
+= data
.words_progress_restored
[salt_pos
];
1260 // Important for ETA only
1262 if (data
.salts_shown
[salt_pos
] == 1)
1264 const u64 all
= data
.words_progress_done
[salt_pos
]
1265 + data
.words_progress_rejected
[salt_pos
]
1266 + data
.words_progress_restored
[salt_pos
];
1268 const u64 left
= data
.words_cnt
- all
;
1270 progress_noneed
+= left
;
1274 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1275 u64 progress_end
= progress_total
;
1277 u64 progress_skip
= 0;
1281 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1283 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1284 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1285 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1290 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1292 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1293 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1294 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1297 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1298 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1300 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1302 if (data
.devices_status
!= STATUS_CRACKED
)
1305 __time64_t sec_etc
= 0;
1312 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1314 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1316 sec_etc
= ms_left
/ 1000;
1321 //log_info ("Time.Estimated.: 0 secs");
1323 else if ((u64
) sec_etc
> ETC_MAX
)
1325 log_info ("Time.Estimated.: > 10 Years");
1329 char display_etc
[32] = { 0 };
1333 struct tm
*tmp
= NULL
;
1337 tmp
= _gmtime64 (&sec_etc
);
1341 tmp
= gmtime (&sec_etc
);
1347 memset (&tm_etc
, 0, sizeof (tm_etc
));
1349 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1351 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1359 char *etc
= ctime (&now
);
1361 size_t etc_len
= strlen (etc
);
1363 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1364 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1366 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1372 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1374 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1376 if (device_param
->skipped
) continue;
1378 char display_dev_cur
[16] = { 0 };
1380 strncpy (display_dev_cur
, "0.00", 4);
1382 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1384 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1387 char display_all_cur
[16] = { 0 };
1389 strncpy (display_all_cur
, "0.00", 4);
1391 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1393 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1395 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1396 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1398 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1402 if (data
.digests_cnt
> 100)
1404 time_t now
= time (NULL
);
1406 int cpt_cur_min
= 0;
1407 int cpt_cur_hour
= 0;
1408 int cpt_cur_day
= 0;
1410 for (int i
= 0; i
< CPT_BUF
; i
++)
1412 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1413 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1415 if ((timestamp
+ 60) > now
)
1417 cpt_cur_min
+= cracked
;
1420 if ((timestamp
+ 3600) > now
)
1422 cpt_cur_hour
+= cracked
;
1425 if ((timestamp
+ 86400) > now
)
1427 cpt_cur_day
+= cracked
;
1431 double ms_real
= ms_running
- ms_paused
;
1433 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1434 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1435 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1437 if ((data
.cpt_start
+ 86400) < now
)
1439 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1447 else if ((data
.cpt_start
+ 3600) < now
)
1449 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1456 else if ((data
.cpt_start
+ 60) < now
)
1458 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1466 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1475 u64 restore_point
= get_lowest_words_done ();
1477 u64 restore_total
= data
.words_base
;
1479 float percent_restore
= 0;
1481 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1483 if (progress_end_relative_skip
)
1485 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1487 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1488 float percent_rejected
= 0.0;
1492 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1495 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1496 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1498 if (data
.restore_disable
== 0)
1500 if (percent_finished
!= 1)
1502 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1509 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1511 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1512 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 if (data
.restore_disable
== 0)
1516 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1521 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1522 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1524 // --restore not allowed if stdin is used -- really? why?
1526 //if (data.restore_disable == 0)
1528 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1534 if (data
.gpu_temp_disable
== 0)
1536 hc_thread_mutex_lock (mux_adl
);
1538 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1540 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1542 if (device_param
->skipped
) continue;
1544 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1545 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1546 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1547 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1548 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1549 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1551 //const int num_throttle = hm_get_throttle_with_device_id (device_id);
1553 char output_buf
[256] = { 0 };
1557 if (num_temperature
>= 0)
1559 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1561 output_len
= strlen (output_buf
);
1564 if (num_fanspeed
>= 0)
1566 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1568 output_len
= strlen (output_buf
);
1571 if (num_utilization
>= 0)
1573 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1575 output_len
= strlen (output_buf
);
1578 if (num_corespeed
>= 0)
1580 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1582 output_len
= strlen (output_buf
);
1585 if (num_memoryspeed
>= 0)
1587 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1589 output_len
= strlen (output_buf
);
1592 if (num_buslanes
>= 0)
1594 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1596 output_len
= strlen (output_buf
);
1600 if (num_throttle >= 0)
1602 snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Throttle:%u", num_throttle);
1604 output_len = strlen (output_buf);
1608 if (output_len
== 0)
1610 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1612 output_len
= strlen (output_buf
);
1615 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1618 hc_thread_mutex_unlock (mux_adl
);
1620 #endif // HAVE_HWMON
1623 static void status_benchmark_automate ()
1625 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1626 double speed_ms
[DEVICES_MAX
] = { 0 };
1628 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1630 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1632 if (device_param
->skipped
) continue;
1634 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1635 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1638 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1640 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1642 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1644 if (device_param
->skipped
) continue;
1646 hashes_dev_ms
[device_id
] = 0;
1648 if (speed_ms
[device_id
])
1650 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1654 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1656 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1658 if (device_param
->skipped
) continue;
1660 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1664 static void status_benchmark ()
1666 if (data
.devices_status
== STATUS_INIT
) return;
1667 if (data
.devices_status
== STATUS_STARTING
) return;
1668 if (data
.devices_status
== STATUS_BYPASS
) return;
1670 if (data
.machine_readable
== 1)
1672 status_benchmark_automate ();
1677 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1678 double speed_ms
[DEVICES_MAX
] = { 0 };
1680 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1682 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1684 if (device_param
->skipped
) continue;
1686 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1687 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1690 double hashes_all_ms
= 0;
1692 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1694 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1696 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1698 if (device_param
->skipped
) continue;
1700 hashes_dev_ms
[device_id
] = 0;
1702 if (speed_ms
[device_id
])
1704 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1706 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1714 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1716 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1718 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1720 if (device_param
->skipped
) continue;
1722 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1724 exec_all_ms
[device_id
] = exec_ms_avg
;
1727 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1729 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1731 if (device_param
->skipped
) continue;
1733 char display_dev_cur
[16] = { 0 };
1735 strncpy (display_dev_cur
, "0.00", 4);
1737 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1739 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1742 char display_all_cur
[16] = { 0 };
1744 strncpy (display_all_cur
, "0.00", 4);
1746 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1748 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1752 * hashcat -only- functions
1755 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1757 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1759 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1760 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1761 else if (attack_kern
== ATTACK_KERN_COMBI
)
1762 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1763 else if (attack_kern
== ATTACK_KERN_BF
)
1764 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1767 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1770 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
)
1772 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1774 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1775 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1776 else if (attack_kern
== ATTACK_KERN_COMBI
)
1777 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1778 else if (attack_kern
== ATTACK_KERN_BF
)
1779 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1783 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1787 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1789 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1791 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1795 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1799 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
)
1801 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1803 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1807 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1811 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1813 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1816 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1818 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1821 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1823 if (line_len
& 1) return (line_len
); // not in hex
1825 if (data
.hex_wordlist
== 1)
1830 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1832 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1835 memset (line_buf
+ i
, 0, line_len
- i
);
1839 else if (line_len
>= 6) // $HEX[] = 6
1841 if (line_buf
[0] != '$') return (line_len
);
1842 if (line_buf
[1] != 'H') return (line_len
);
1843 if (line_buf
[2] != 'E') return (line_len
);
1844 if (line_buf
[3] != 'X') return (line_len
);
1845 if (line_buf
[4] != '[') return (line_len
);
1846 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1851 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1853 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1856 memset (line_buf
+ i
, 0, line_len
- i
);
1864 static void clear_prompt ()
1866 fputc ('\r', stdout
);
1868 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1870 fputc (' ', stdout
);
1873 fputc ('\r', stdout
);
1878 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1880 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
);
1883 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1885 char *outfile
= data
.outfile
;
1886 uint quiet
= data
.quiet
;
1887 FILE *pot_fp
= data
.pot_fp
;
1888 uint loopback
= data
.loopback
;
1889 uint debug_mode
= data
.debug_mode
;
1890 char *debug_file
= data
.debug_file
;
1892 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1893 int debug_rule_len
= 0; // -1 error
1894 uint debug_plain_len
= 0;
1896 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1900 char out_buf
[HCBUFSIZ
] = { 0 };
1902 const u32 salt_pos
= plain
->salt_pos
;
1903 const u32 digest_pos
= plain
->digest_pos
; // relative
1904 const u32 gidvid
= plain
->gidvid
;
1905 const u32 il_pos
= plain
->il_pos
;
1907 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1911 u64 crackpos
= device_param
->words_off
;
1913 uint plain_buf
[16] = { 0 };
1915 u8
*plain_ptr
= (u8
*) plain_buf
;
1917 unsigned int plain_len
= 0;
1919 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1923 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1925 for (int i
= 0; i
< 16; i
++)
1927 plain_buf
[i
] = pw
.i
[i
];
1930 plain_len
= pw
.pw_len
;
1932 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1939 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1941 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1943 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1947 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1949 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1951 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1953 debug_plain_len
= plain_len
;
1957 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1960 crackpos
*= data
.kernel_rules_cnt
;
1961 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1963 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1965 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1969 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1971 for (int i
= 0; i
< 16; i
++)
1973 plain_buf
[i
] = pw
.i
[i
];
1976 plain_len
= pw
.pw_len
;
1978 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1979 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1981 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1983 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1987 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1989 memcpy (plain_ptr
, comb_buf
, comb_len
);
1992 plain_len
+= comb_len
;
1995 crackpos
*= data
.combs_cnt
;
1996 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1998 if (data
.pw_max
!= PW_DICTMAX1
)
2000 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2003 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2005 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2006 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2008 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2009 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2011 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2012 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2014 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2015 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2017 plain_len
= data
.css_cnt
;
2020 crackpos
*= data
.bfs_cnt
;
2021 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2023 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2027 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2029 for (int i
= 0; i
< 16; i
++)
2031 plain_buf
[i
] = pw
.i
[i
];
2034 plain_len
= pw
.pw_len
;
2036 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2039 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2041 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2043 plain_len
+= start
+ stop
;
2046 crackpos
*= data
.combs_cnt
;
2047 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2049 if (data
.pw_max
!= PW_DICTMAX1
)
2051 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2054 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2058 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2060 for (int i
= 0; i
< 16; i
++)
2062 plain_buf
[i
] = pw
.i
[i
];
2065 plain_len
= pw
.pw_len
;
2067 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2070 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2072 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2074 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2076 plain_len
+= start
+ stop
;
2079 crackpos
*= data
.combs_cnt
;
2080 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2082 if (data
.pw_max
!= PW_DICTMAX1
)
2084 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2088 if (data
.attack_mode
== ATTACK_MODE_BF
)
2090 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2092 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2094 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2096 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2100 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2102 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2104 plain_ptr
[j
] = plain_ptr
[i
];
2107 plain_len
= plain_len
/ 2;
2112 // if enabled, update also the potfile
2118 fprintf (pot_fp
, "%s:", out_buf
);
2120 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2122 fputc ('\n', pot_fp
);
2126 unlock_file (pot_fp
);
2131 FILE *out_fp
= NULL
;
2133 if (outfile
!= NULL
)
2135 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2137 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2148 if (quiet
== 0) clear_prompt ();
2151 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2153 if (outfile
!= NULL
)
2155 if (out_fp
!= stdout
)
2162 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2164 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2166 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2167 if (quiet
== 0) fflush (stdout
);
2176 char *loopback_file
= data
.loopback_file
;
2180 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2184 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2186 fputc ('\n', fb_fp
);
2192 // (rule) debug mode
2194 // the next check implies that:
2195 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2198 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2200 if (debug_rule_len
< 0) debug_rule_len
= 0;
2202 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2204 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2206 if ((quiet
== 0) && (debug_file
== NULL
))
2208 fprintf (stdout
, "%s", PROMPT
);
2215 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2217 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2221 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2225 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2229 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2231 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
);
2233 uint cpt_cracked
= 0;
2235 for (uint i
= 0; i
< num_cracked
; i
++)
2237 const uint hash_pos
= cracked
[i
].hash_pos
;
2239 if (data
.digests_shown
[hash_pos
] == 1) continue;
2241 hc_thread_mutex_lock (mux_display
);
2243 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2245 data
.digests_shown
[hash_pos
] = 1;
2247 data
.digests_done
++;
2251 salt_buf
->digests_done
++;
2253 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2255 data
.salts_shown
[salt_pos
] = 1;
2261 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2263 hc_thread_mutex_unlock (mux_display
);
2265 check_hash (device_param
, &cracked
[i
]);
2270 if (cpt_cracked
> 0)
2272 hc_thread_mutex_lock (mux_display
);
2274 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2275 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2279 data
.cpt_total
+= cpt_cracked
;
2281 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2283 hc_thread_mutex_unlock (mux_display
);
2286 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2288 // we need to reset cracked state on the device
2289 // otherwise host thinks again and again the hash was cracked
2290 // and returns invalid password each time
2292 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2294 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
);
2299 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2303 static void save_hash ()
2305 char *hashfile
= data
.hashfile
;
2307 char new_hashfile
[256] = { 0 };
2308 char old_hashfile
[256] = { 0 };
2310 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2311 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2313 unlink (new_hashfile
);
2315 char separator
= data
.separator
;
2317 FILE *fp
= fopen (new_hashfile
, "wb");
2321 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2326 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2328 if (data
.salts_shown
[salt_pos
] == 1) continue;
2330 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2332 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2334 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2336 if (data
.digests_shown
[idx
] == 1) continue;
2338 if (data
.hash_mode
!= 2500)
2340 char out_buf
[HCBUFSIZ
] = { 0 };
2342 if (data
.username
== 1)
2344 user_t
*user
= data
.hash_info
[idx
]->user
;
2348 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2350 fputc (separator
, fp
);
2353 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2355 fputs (out_buf
, fp
);
2363 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2365 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2374 unlink (old_hashfile
);
2376 if (rename (hashfile
, old_hashfile
) != 0)
2378 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2385 if (rename (new_hashfile
, hashfile
) != 0)
2387 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2392 unlink (old_hashfile
);
2395 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2397 // function called only in case kernel_power_all > words_left
2399 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2401 kernel_power_div
+= kernel_power_div
/ 100;
2403 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2405 while (kernel_power_new
< total_left
)
2407 kernel_power_div
+= kernel_power_div
/ 100;
2409 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2412 if (data
.quiet
== 0)
2418 log_info ("INFO: approaching final keyspace, workload adjusted");
2421 fprintf (stdout
, "%s", PROMPT
);
2426 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2428 return kernel_power_div
;
2431 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2433 uint num_elements
= num
;
2435 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2436 device_param
->kernel_params_buf32
[31] = num
;
2438 uint kernel_threads
= device_param
->kernel_threads
;
2440 while (num_elements
% kernel_threads
) num_elements
++;
2442 cl_kernel kernel
= NULL
;
2446 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2447 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2448 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2449 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2450 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2453 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2454 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2455 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2456 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2457 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2458 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2459 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2460 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2461 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2462 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2463 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2467 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2469 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2470 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2472 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2476 if (kern_run
== KERN_RUN_2
)
2478 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2480 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2484 while (num_elements
% kernel_threads
) num_elements
++;
2486 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2487 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2489 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2492 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2494 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2498 cl_ulong time_start
;
2501 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2502 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2504 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2506 uint exec_pos
= device_param
->exec_pos
;
2508 device_param
->exec_ms
[exec_pos
] = exec_time
;
2512 if (exec_pos
== EXEC_CACHE
)
2517 device_param
->exec_pos
= exec_pos
;
2520 hc_clReleaseEvent (data
.ocl
, event
);
2522 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2525 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2527 uint num_elements
= num
;
2531 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2532 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2533 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2536 // causes problems with special threads like in bcrypt
2537 // const uint kernel_threads = device_param->kernel_threads;
2539 uint kernel_threads
= device_param
->kernel_threads
;
2541 while (num_elements
% kernel_threads
) num_elements
++;
2543 cl_kernel kernel
= NULL
;
2547 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2548 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2549 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2554 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2555 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2556 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2557 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2558 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2559 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2561 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2562 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2563 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2564 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2565 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2566 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2568 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2569 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2570 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2571 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2572 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2573 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2574 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2578 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2579 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2581 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2583 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2585 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2588 static void run_kernel_tm (hc_device_param_t
*device_param
)
2590 const uint num_elements
= 1024; // fixed
2592 uint kernel_threads
= 32;
2594 cl_kernel kernel
= device_param
->kernel_tm
;
2596 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2597 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2599 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2601 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2603 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2606 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2608 uint num_elements
= num
;
2610 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2611 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2613 // causes problems with special threads like in bcrypt
2614 // const uint kernel_threads = device_param->kernel_threads;
2616 uint kernel_threads
= device_param
->kernel_threads
;
2618 while (num_elements
% kernel_threads
) num_elements
++;
2620 cl_kernel kernel
= device_param
->kernel_amp
;
2622 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2623 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2625 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2626 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2628 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2630 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2632 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2635 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2637 const u32 num16d
= num
/ 16;
2638 const u32 num16m
= num
% 16;
2642 device_param
->kernel_params_memset_buf32
[1] = value
;
2643 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2645 uint kernel_threads
= device_param
->kernel_threads
;
2647 uint num_elements
= num16d
;
2649 while (num_elements
% kernel_threads
) num_elements
++;
2651 cl_kernel kernel
= device_param
->kernel_memset
;
2653 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2654 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2655 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2657 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2658 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2660 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2662 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2664 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2676 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2680 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2682 run_kernel_memset (device_param
, buf
, 0, size
);
2687 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2689 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2691 const cl_uchar zero = 0;
2693 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2698 // NOTE: clEnqueueFillBuffer () always fails with -59
2699 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2700 // How's that possible, OpenCL 1.2 support is advertised??
2701 // We need to workaround...
2703 #define FILLSZ 0x100000
2705 char *tmp = (char *) mymalloc (FILLSZ);
2707 for (size_t i = 0; i < size; i += FILLSZ)
2709 const size_t left = size - i;
2711 const size_t fillsz = MIN (FILLSZ, left);
2713 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2721 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
)
2723 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2725 if (attack_mode
== ATTACK_MODE_BF
)
2727 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2729 const uint size_tm
= 32 * sizeof (bs_word_t
);
2731 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2733 run_kernel_tm (device_param
);
2735 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
);
2739 if (highest_pw_len
< 16)
2741 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2743 else if (highest_pw_len
< 32)
2745 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2749 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2754 run_kernel_amp (device_param
, pws_cnt
);
2756 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2758 if (opts_type
& OPTS_TYPE_HOOK12
)
2760 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2763 uint iter
= salt_buf
->salt_iter
;
2765 uint loop_step
= device_param
->kernel_loops
;
2767 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2769 uint loop_left
= iter
- loop_pos
;
2771 loop_left
= MIN (loop_left
, loop_step
);
2773 device_param
->kernel_params_buf32
[25] = loop_pos
;
2774 device_param
->kernel_params_buf32
[26] = loop_left
;
2776 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2778 if (data
.devices_status
== STATUS_CRACKED
) break;
2779 if (data
.devices_status
== STATUS_ABORTED
) break;
2780 if (data
.devices_status
== STATUS_QUIT
) break;
2786 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2788 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2792 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2794 const u32 speed_pos
= device_param
->speed_pos
;
2796 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2798 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2800 if (data
.benchmark
== 1)
2802 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2806 if (opts_type
& OPTS_TYPE_HOOK23
)
2808 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2810 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
);
2812 // do something with data
2814 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
);
2817 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2821 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2827 else if (rule_len
== 1)
2829 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2835 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2837 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2839 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
);
2841 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2843 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2845 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2847 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2849 for (u32 i
= 0; i
< pws_cnt
; i
++)
2851 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2853 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2858 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2860 for (u32 i
= 0; i
< pws_cnt
; i
++)
2862 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2864 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2871 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2873 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2875 for (u32 i
= 0; i
< pws_cnt
; i
++)
2877 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2879 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2884 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2886 for (u32 i
= 0; i
< pws_cnt
; i
++)
2888 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2890 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2897 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
);
2899 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2901 const u64 off
= device_param
->words_off
;
2903 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2905 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2909 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2911 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2913 device_param
->kernel_params_buf32
[25] = 0;
2914 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2915 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2917 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2919 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2923 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2926 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2928 return exec_ms_prev
;
2931 static void autotune (hc_device_param_t
*device_param
)
2933 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2935 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2936 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2938 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2939 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2941 u32 kernel_accel
= kernel_accel_min
;
2942 u32 kernel_loops
= kernel_loops_min
;
2944 // in this case the user specified a fixed -u and -n on the commandline
2945 // no way to tune anything
2946 // but we need to run a few caching rounds
2948 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2950 try_run (device_param
, kernel_accel
, kernel_loops
);
2951 try_run (device_param
, kernel_accel
, kernel_loops
);
2952 try_run (device_param
, kernel_accel
, kernel_loops
);
2953 try_run (device_param
, kernel_accel
, kernel_loops
);
2955 device_param
->kernel_accel
= kernel_accel
;
2956 device_param
->kernel_loops
= kernel_loops
;
2958 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2960 device_param
->kernel_power
= kernel_power
;
2965 // from here it's clear we are allowed to autotune
2966 // so let's init some fake words
2968 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2970 if (data
.attack_kern
== ATTACK_KERN_BF
)
2972 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2976 for (u32 i
= 0; i
< kernel_power_max
; i
++)
2978 device_param
->pws_buf
[i
].i
[0] = i
;
2979 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
2980 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
2983 if (data
.kernel_rules_cnt
> 1)
2985 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, kernel_loops_max
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
2988 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
);
2991 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2993 run_kernel_amp (device_param
, kernel_power_max
);
2996 #define VERIFIER_CNT 1
2998 // first find out highest kernel-loops that stays below target_ms
3000 if (kernel_loops_min
< kernel_loops_max
)
3002 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3004 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3006 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3008 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3010 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3013 if (exec_ms
< target_ms
) break;
3017 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3019 #define STEPS_CNT 10
3021 if (kernel_accel_min
< kernel_accel_max
)
3023 for (int i
= 0; i
< STEPS_CNT
; i
++)
3025 const u32 kernel_accel_try
= 1 << i
;
3027 if (kernel_accel_try
< kernel_accel_min
) continue;
3028 if (kernel_accel_try
> kernel_accel_max
) break;
3030 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3032 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3034 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3036 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3039 if (exec_ms
> target_ms
) break;
3041 kernel_accel
= kernel_accel_try
;
3045 // at this point we want to know the actual runtime for the following reason:
3046 // we need a reference for the balancing loop following up, and this
3047 // the balancing loop can have an effect that the creates a new opportunity, for example:
3048 // if the target is 95 ms and the current runtime is 48ms the above loop
3049 // stopped the execution because the previous exec_ms was > 95ms
3050 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3051 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3053 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3055 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3057 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3059 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3062 u32 diff
= kernel_loops
- kernel_accel
;
3064 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3066 u32 kernel_accel_orig
= kernel_accel
;
3067 u32 kernel_loops_orig
= kernel_loops
;
3069 for (u32 f
= 1; f
< 1024; f
++)
3071 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3072 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3074 if (kernel_accel_try
> kernel_accel_max
) break;
3075 if (kernel_loops_try
< kernel_loops_min
) break;
3077 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3079 if (diff_new
> diff
) break;
3083 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3085 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3087 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3089 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3092 if (exec_ms
< exec_ms_pre_final
)
3094 exec_ms_pre_final
= exec_ms
;
3096 kernel_accel
= kernel_accel_try
;
3097 kernel_loops
= kernel_loops_try
;
3102 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3104 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3106 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3108 if (exec_accel_min
>= 1.0)
3110 // this is safe to not overflow kernel_accel_max because of accel_left
3112 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3115 // reset them fake words
3118 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3120 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);
3121 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);
3124 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3126 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3128 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3133 device_param
->exec_pos
= 0;
3135 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3139 device_param
->kernel_accel
= kernel_accel
;
3140 device_param
->kernel_loops
= kernel_loops
;
3142 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3144 device_param
->kernel_power
= kernel_power
;
3148 if (data
.quiet
== 0)
3152 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3153 "Device #%u: autotuned kernel-loops to %u\n",
3154 device_param
->device_id
+ 1, kernel_accel
,
3155 device_param
->device_id
+ 1, kernel_loops
);
3157 fprintf (stdout
, "%s", PROMPT
);
3165 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3167 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3171 uint speed_pos
= device_param
->speed_pos
;
3174 if (device_param
->timer_speed
.tv_sec
== 0)
3176 hc_timer_set (&device_param
->timer_speed
);
3181 if (device_param
->timer_speed
.QuadPart
== 0)
3183 hc_timer_set (&device_param
->timer_speed
);
3187 // find higest password length, this is for optimization stuff
3189 uint highest_pw_len
= 0;
3191 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3194 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3197 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3199 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3200 + device_param
->kernel_params_mp_l_buf32
[5];
3205 uint innerloop_step
= 0;
3206 uint innerloop_cnt
= 0;
3208 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3209 else innerloop_step
= 1;
3211 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3212 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3213 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3215 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3217 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3219 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3221 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3223 if (data
.devices_status
== STATUS_CRACKED
) break;
3224 if (data
.devices_status
== STATUS_ABORTED
) break;
3225 if (data
.devices_status
== STATUS_QUIT
) break;
3226 if (data
.devices_status
== STATUS_BYPASS
) break;
3228 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3230 device_param
->kernel_params_buf32
[24] = salt_pos
;
3231 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3232 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3234 FILE *combs_fp
= device_param
->combs_fp
;
3236 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3243 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3245 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3247 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3249 if (data
.devices_status
== STATUS_CRACKED
) break;
3250 if (data
.devices_status
== STATUS_ABORTED
) break;
3251 if (data
.devices_status
== STATUS_QUIT
) break;
3252 if (data
.devices_status
== STATUS_BYPASS
) break;
3254 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3256 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3258 device_param
->innerloop_pos
= innerloop_pos
;
3259 device_param
->innerloop_left
= innerloop_left
;
3261 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3263 // i think we can get rid of this
3264 if (innerloop_left
== 0)
3266 puts ("bug, how should this happen????\n");
3271 if (data
.salts_shown
[salt_pos
] == 1)
3273 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3278 // initialize amplifiers
3280 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3284 while (i
< innerloop_left
)
3286 if (feof (combs_fp
)) break;
3288 int line_len
= fgetl (combs_fp
, line_buf
);
3290 if (line_len
>= PW_MAX1
) continue;
3292 line_len
= convert_from_hex (line_buf
, line_len
);
3294 char *line_buf_new
= line_buf
;
3296 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3298 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3300 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3302 if (rule_len_out
< 0)
3304 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3309 line_len
= rule_len_out
;
3311 line_buf_new
= rule_buf_out
;
3314 line_len
= MIN (line_len
, PW_DICTMAX
);
3316 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3318 memcpy (ptr
, line_buf_new
, line_len
);
3320 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3322 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3324 uppercase (ptr
, line_len
);
3327 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3329 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3331 ptr
[line_len
] = 0x80;
3334 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3336 ptr
[line_len
] = 0x01;
3340 device_param
->combs_buf
[i
].pw_len
= line_len
;
3345 for (uint j
= i
; j
< innerloop_left
; j
++)
3347 device_param
->combs_buf
[j
].i
[0] = 0;
3348 device_param
->combs_buf
[j
].i
[1] = 0;
3349 device_param
->combs_buf
[j
].i
[2] = 0;
3350 device_param
->combs_buf
[j
].i
[3] = 0;
3351 device_param
->combs_buf
[j
].i
[4] = 0;
3352 device_param
->combs_buf
[j
].i
[5] = 0;
3353 device_param
->combs_buf
[j
].i
[6] = 0;
3354 device_param
->combs_buf
[j
].i
[7] = 0;
3356 device_param
->combs_buf
[j
].pw_len
= 0;
3361 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3363 u64 off
= innerloop_pos
;
3365 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3367 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3369 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3371 u64 off
= innerloop_pos
;
3373 device_param
->kernel_params_mp_buf64
[3] = off
;
3375 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3377 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3379 u64 off
= innerloop_pos
;
3381 device_param
->kernel_params_mp_buf64
[3] = off
;
3383 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3388 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3390 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
);
3392 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3394 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
);
3396 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3398 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
);
3400 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3402 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
);
3404 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3406 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
);
3409 if (data
.benchmark
== 1)
3411 hc_timer_set (&device_param
->timer_speed
);
3414 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3416 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3418 if (data
.devices_status
== STATUS_CRACKED
) break;
3419 if (data
.devices_status
== STATUS_ABORTED
) break;
3420 if (data
.devices_status
== STATUS_QUIT
) break;
3426 check_cracked (device_param
, salt_pos
);
3432 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3434 hc_thread_mutex_lock (mux_counter
);
3436 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3438 hc_thread_mutex_unlock (mux_counter
);
3446 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3448 hc_timer_set (&device_param
->timer_speed
);
3452 //hc_thread_mutex_lock (mux_display);
3454 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3456 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3458 //hc_thread_mutex_unlock (mux_display);
3462 if (speed_pos
== SPEED_CACHE
)
3471 if (data
.benchmark
== 1) break;
3475 device_param
->speed_pos
= speed_pos
;
3480 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3482 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3486 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3488 wl_data
->buf
[wl_data
->cnt
] = 0;
3490 if (wl_data
->cnt
== 0) return;
3492 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3496 if (wl_data
->cnt
== wl_data
->avail
)
3498 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3500 wl_data
->avail
+= wl_data
->incr
;
3503 const int c
= fgetc (fd
);
3505 if (c
== EOF
) break;
3507 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3511 if (c
== '\n') break;
3514 // ensure stream ends with a newline
3516 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3520 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3526 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3530 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3532 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3542 if (*ptr
!= '\n') continue;
3546 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3557 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3561 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3563 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3565 if (*ptr
!= '\n') continue;
3569 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3580 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3584 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3586 if (*ptr
!= '\n') continue;
3590 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3601 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3603 while (wl_data
->pos
< wl_data
->cnt
)
3608 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3610 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3612 wl_data
->pos
+= off
;
3614 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3616 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3618 int rule_len_out
= -1;
3620 if (len
< BLOCK_SIZE
)
3622 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3625 if (rule_len_out
< 0)
3630 if (rule_len_out
> PW_MAX
)
3651 fprintf (stderr
, "BUG feof()!!\n");
3656 load_segment (wl_data
, fd
);
3658 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3662 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3666 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3676 fstat (fileno (fd
), &d
.stat
);
3680 _fstat64 (fileno (fd
), &d
.stat
);
3684 d
.stat
.st_nlink
= 0;
3688 d
.stat
.st_atime
= 0;
3691 d
.stat
.st_blksize
= 0;
3692 d
.stat
.st_blocks
= 0;
3695 if (d
.stat
.st_size
== 0) return 0;
3697 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3699 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3703 u64 cnt
= d_cache
->cnt
;
3707 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3709 keyspace
*= data
.kernel_rules_cnt
;
3711 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3713 keyspace
*= data
.combs_cnt
;
3716 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
);
3717 if (data
.quiet
== 0) log_info ("");
3719 hc_signal (sigHandler_default
);
3734 load_segment (wl_data
, fd
);
3736 comp
+= wl_data
->cnt
;
3740 while (i
< wl_data
->cnt
)
3745 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3747 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3749 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3751 int rule_len_out
= -1;
3753 if (len
< BLOCK_SIZE
)
3755 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3758 if (rule_len_out
< 0)
3770 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3772 cnt
+= data
.kernel_rules_cnt
;
3774 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3776 cnt
+= data
.combs_cnt
;
3789 if ((now
- prev
) == 0) continue;
3791 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3793 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
);
3798 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
);
3799 if (data
.quiet
== 0) log_info ("");
3801 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3803 hc_signal (sigHandler_default
);
3808 static void *thread_monitor (void *p
)
3810 uint runtime_check
= 0;
3811 uint remove_check
= 0;
3812 uint status_check
= 0;
3813 uint restore_check
= 0;
3815 uint restore_left
= data
.restore_timer
;
3816 uint remove_left
= data
.remove_timer
;
3817 uint status_left
= data
.status_timer
;
3820 uint hwmon_check
= 0;
3822 int slowdown_warnings
= 0;
3824 // these variables are mainly used for fan control
3826 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3828 // temperature controller "loopback" values
3830 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3831 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3833 int temp_threshold
= 1; // degrees celcius
3835 int fan_speed_min
= 15; // in percentage
3836 int fan_speed_max
= 100;
3838 time_t last_temp_check_time
;
3839 #endif // HAVE_HWMON
3841 uint sleep_time
= 1;
3848 if (data
.restore_timer
)
3853 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3858 if (data
.status
== 1)
3864 if (data
.gpu_temp_disable
== 0)
3866 time (&last_temp_check_time
);
3872 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3875 if (hwmon_check
== 0)
3880 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3882 hc_sleep (sleep_time
);
3884 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3890 hc_thread_mutex_lock (mux_adl
);
3892 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3894 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3896 if (device_param
->skipped
) continue;
3898 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3900 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3902 const int threshold
= data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
;
3904 if (temperature
>= threshold
)
3906 if (slowdown_warnings
< 3)
3908 if (data
.quiet
== 0) clear_prompt ();
3910 log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold
, device_id
+ 1);
3912 if (slowdown_warnings
== 2)
3917 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
3918 if (data
.quiet
== 0) fflush (stdout
);
3920 slowdown_warnings
++;
3925 slowdown_warnings
= 0;
3929 hc_thread_mutex_unlock (mux_adl
);
3932 if (hwmon_check
== 1)
3934 hc_thread_mutex_lock (mux_adl
);
3936 time_t temp_check_time
;
3938 time (&temp_check_time
);
3940 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3942 if (Ta
== 0) Ta
= 1;
3944 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3946 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3948 if (device_param
->skipped
) continue;
3950 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3952 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3954 if (temperature
> (int) data
.gpu_temp_abort
)
3956 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3958 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3963 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3965 if (gpu_temp_retain
)
3967 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
3969 int temp_cur
= temperature
;
3971 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3973 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3975 // calculate Ta value (time difference in seconds between the last check and this check)
3977 last_temp_check_time
= temp_check_time
;
3983 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3985 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
);
3987 if (abs (fan_diff_required
) >= temp_threshold
)
3989 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3991 int fan_speed_level
= fan_speed_cur
;
3993 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3995 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3997 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3998 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4000 if (fan_speed_new
!= fan_speed_cur
)
4002 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4003 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4005 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4007 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4009 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
, 1);
4011 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4014 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4018 fan_speed_chgd
[device_id
] = 1;
4021 temp_diff_old
[device_id
] = temp_diff_new
;
4028 hc_thread_mutex_unlock (mux_adl
);
4030 #endif // HAVE_HWMON
4032 if (restore_check
== 1)
4036 if (restore_left
== 0)
4038 if (data
.restore_disable
== 0) cycle_restore ();
4040 restore_left
= data
.restore_timer
;
4044 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4048 time (&runtime_cur
);
4050 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
4052 if (runtime_left
<= 0)
4054 if (data
.benchmark
== 0)
4056 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4059 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4063 if (remove_check
== 1)
4067 if (remove_left
== 0)
4069 if (data
.digests_saved
!= data
.digests_done
)
4071 data
.digests_saved
= data
.digests_done
;
4076 remove_left
= data
.remove_timer
;
4080 if (status_check
== 1)
4084 if (status_left
== 0)
4086 //hc_thread_mutex_lock (mux_display);
4088 if (data
.quiet
== 0) clear_prompt ();
4090 if (data
.quiet
== 0) log_info ("");
4094 if (data
.quiet
== 0) log_info ("");
4096 //hc_thread_mutex_unlock (mux_display);
4098 status_left
= data
.status_timer
;
4104 myfree (fan_speed_chgd
);
4106 myfree (temp_diff_old
);
4107 myfree (temp_diff_sum
);
4115 static void *thread_outfile_remove (void *p
)
4117 // some hash-dependent constants
4118 char *outfile_dir
= data
.outfile_check_directory
;
4119 uint dgst_size
= data
.dgst_size
;
4120 uint isSalted
= data
.isSalted
;
4121 uint esalt_size
= data
.esalt_size
;
4122 uint hash_mode
= data
.hash_mode
;
4124 uint outfile_check_timer
= data
.outfile_check_timer
;
4126 char separator
= data
.separator
;
4128 // some hash-dependent functions
4129 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4130 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4133 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4135 hash_buf
.digest
= mymalloc (dgst_size
);
4137 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4139 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4141 uint digest_buf
[64] = { 0 };
4143 outfile_data_t
*out_info
= NULL
;
4145 char **out_files
= NULL
;
4147 time_t folder_mtime
= 0;
4151 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4153 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4157 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4161 if (check_left
== 0)
4163 struct stat outfile_check_stat
;
4165 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4167 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4171 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4173 char **out_files_new
= scan_directory (outfile_dir
);
4175 int out_cnt_new
= count_dictionaries (out_files_new
);
4177 outfile_data_t
*out_info_new
= NULL
;
4179 if (out_cnt_new
> 0)
4181 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4183 for (int i
= 0; i
< out_cnt_new
; i
++)
4185 out_info_new
[i
].file_name
= out_files_new
[i
];
4187 // check if there are files that we have seen/checked before (and not changed)
4189 for (int j
= 0; j
< out_cnt
; j
++)
4191 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4193 struct stat outfile_stat
;
4195 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4197 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4199 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4200 out_info_new
[i
].seek
= out_info
[j
].seek
;
4208 local_free (out_info
);
4209 local_free (out_files
);
4211 out_files
= out_files_new
;
4212 out_cnt
= out_cnt_new
;
4213 out_info
= out_info_new
;
4215 folder_mtime
= outfile_check_stat
.st_mtime
;
4218 for (int j
= 0; j
< out_cnt
; j
++)
4220 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4224 //hc_thread_mutex_lock (mux_display);
4227 struct stat outfile_stat
;
4229 fstat (fileno (fp
), &outfile_stat
);
4233 struct stat64 outfile_stat
;
4235 _fstat64 (fileno (fp
), &outfile_stat
);
4238 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4240 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4241 out_info
[j
].seek
= 0;
4244 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4246 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4250 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4252 if (ptr
== NULL
) break;
4254 int line_len
= strlen (line_buf
);
4256 if (line_len
<= 0) continue;
4258 int iter
= MAX_CUT_TRIES
;
4260 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4262 if (line_buf
[i
] != separator
) continue;
4264 int parser_status
= PARSER_OK
;
4266 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4268 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4273 if (parser_status
== PARSER_OK
)
4275 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4277 if (data
.salts_shown
[salt_pos
] == 1) continue;
4279 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4281 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4283 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4285 if (data
.digests_shown
[idx
] == 1) continue;
4289 if (hash_mode
== 6800)
4291 if (i
== salt_buf
->salt_len
)
4293 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4296 else if (hash_mode
== 2500)
4298 // BSSID : MAC1 : MAC2 (:plain)
4299 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4301 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4303 if (!cracked
) continue;
4305 // now compare MAC1 and MAC2 too, since we have this additional info
4306 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4307 char *mac2_pos
= mac1_pos
+ 12 + 1;
4309 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4310 wpa_t
*wpa
= &wpas
[salt_pos
];
4312 // compare hex string(s) vs binary MAC address(es)
4314 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4316 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4325 if (!cracked
) continue;
4327 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4329 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4340 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4342 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4344 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4351 data
.digests_shown
[idx
] = 1;
4353 data
.digests_done
++;
4355 salt_buf
->digests_done
++;
4357 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4359 data
.salts_shown
[salt_pos
] = 1;
4363 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4368 if (data
.devices_status
== STATUS_CRACKED
) break;
4374 if (data
.devices_status
== STATUS_CRACKED
) break;
4379 if (data
.devices_status
== STATUS_CRACKED
) break;
4384 out_info
[j
].seek
= ftell (fp
);
4386 //hc_thread_mutex_unlock (mux_display);
4394 check_left
= outfile_check_timer
;
4398 if (esalt_size
) local_free (hash_buf
.esalt
);
4400 if (isSalted
) local_free (hash_buf
.salt
);
4402 local_free (hash_buf
.digest
);
4404 local_free (out_info
);
4406 local_free (out_files
);
4413 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4415 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4417 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4419 u8
*ptr
= (u8
*) pw
->i
;
4421 memcpy (ptr
, pw_buf
, pw_len
);
4423 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4425 pw
->pw_len
= pw_len
;
4427 device_param
->pws_cnt
++;
4431 fprintf (stderr
, "BUG pw_add()!!\n");
4437 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4439 hc_thread_mutex_lock (mux_dispatcher
);
4441 const u64 words_cur
= data
.words_cur
;
4442 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4444 device_param
->words_off
= words_cur
;
4446 const u64 words_left
= words_base
- words_cur
;
4450 if (data
.kernel_power_all
> words_left
)
4452 if (data
.kernel_power_div
== 0)
4454 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4458 if (data
.kernel_power_div
)
4460 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4462 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4464 if (kernel_power_new
< device_param
->kernel_power
)
4466 device_param
->kernel_power
= kernel_power_new
;
4472 const uint kernel_power
= device_param
->kernel_power
;
4474 uint work
= MIN (words_left
, kernel_power
);
4476 work
= MIN (work
, max
);
4478 data
.words_cur
+= work
;
4480 hc_thread_mutex_unlock (mux_dispatcher
);
4485 static void *thread_calc_stdin (void *p
)
4487 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4489 if (device_param
->skipped
) return NULL
;
4491 autotune (device_param
);
4493 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4495 const uint attack_kern
= data
.attack_kern
;
4497 const uint kernel_power
= device_param
->kernel_power
;
4499 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4501 hc_thread_mutex_lock (mux_dispatcher
);
4503 if (feof (stdin
) != 0)
4505 hc_thread_mutex_unlock (mux_dispatcher
);
4512 while (words_cur
< kernel_power
)
4514 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4516 if (line_buf
== NULL
) break;
4518 uint line_len
= in_superchop (line_buf
);
4520 line_len
= convert_from_hex (line_buf
, line_len
);
4522 // post-process rule engine
4524 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4526 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4528 int rule_len_out
= -1;
4530 if (line_len
< BLOCK_SIZE
)
4532 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4535 if (rule_len_out
< 0) continue;
4537 line_buf
= rule_buf_out
;
4538 line_len
= rule_len_out
;
4541 if (line_len
> PW_MAX
)
4546 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4548 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4550 hc_thread_mutex_lock (mux_counter
);
4552 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4554 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4557 hc_thread_mutex_unlock (mux_counter
);
4562 else if (attack_kern
== ATTACK_KERN_COMBI
)
4564 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4565 // since we still need to combine the plains
4567 if (line_len
> data
.pw_max
)
4569 hc_thread_mutex_lock (mux_counter
);
4571 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4573 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4576 hc_thread_mutex_unlock (mux_counter
);
4582 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4586 if (data
.devices_status
== STATUS_CRACKED
) break;
4587 if (data
.devices_status
== STATUS_ABORTED
) break;
4588 if (data
.devices_status
== STATUS_QUIT
) break;
4589 if (data
.devices_status
== STATUS_BYPASS
) break;
4592 hc_thread_mutex_unlock (mux_dispatcher
);
4594 if (data
.devices_status
== STATUS_CRACKED
) break;
4595 if (data
.devices_status
== STATUS_ABORTED
) break;
4596 if (data
.devices_status
== STATUS_QUIT
) break;
4597 if (data
.devices_status
== STATUS_BYPASS
) break;
4601 const uint pws_cnt
= device_param
->pws_cnt
;
4605 run_copy (device_param
, pws_cnt
);
4607 run_cracker (device_param
, pws_cnt
);
4609 device_param
->pws_cnt
= 0;
4613 if (attack_kern == ATTACK_KERN_STRAIGHT)
4615 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4617 else if (attack_kern == ATTACK_KERN_COMBI)
4619 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4625 device_param
->kernel_accel
= 0;
4626 device_param
->kernel_loops
= 0;
4633 static void *thread_calc (void *p
)
4635 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4637 if (device_param
->skipped
) return NULL
;
4639 autotune (device_param
);
4641 const uint attack_mode
= data
.attack_mode
;
4642 const uint attack_kern
= data
.attack_kern
;
4644 if (attack_mode
== ATTACK_MODE_BF
)
4646 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4648 const uint work
= get_work (device_param
, -1, true);
4650 if (work
== 0) break;
4652 const u64 words_off
= device_param
->words_off
;
4653 const u64 words_fin
= words_off
+ work
;
4655 const uint pws_cnt
= work
;
4657 device_param
->pws_cnt
= pws_cnt
;
4661 run_copy (device_param
, pws_cnt
);
4663 run_cracker (device_param
, pws_cnt
);
4665 device_param
->pws_cnt
= 0;
4669 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4673 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4675 if (data
.devices_status
== STATUS_CRACKED
) break;
4676 if (data
.devices_status
== STATUS_ABORTED
) break;
4677 if (data
.devices_status
== STATUS_QUIT
) break;
4678 if (data
.devices_status
== STATUS_BYPASS
) break;
4680 if (data
.benchmark
== 1) break;
4682 device_param
->words_done
= words_fin
;
4687 const uint segment_size
= data
.segment_size
;
4689 char *dictfile
= data
.dictfile
;
4691 if (attack_mode
== ATTACK_MODE_COMBI
)
4693 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4695 dictfile
= data
.dictfile2
;
4699 FILE *fd
= fopen (dictfile
, "rb");
4703 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4708 if (attack_mode
== ATTACK_MODE_COMBI
)
4710 const uint combs_mode
= data
.combs_mode
;
4712 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4714 const char *dictfilec
= data
.dictfile2
;
4716 FILE *combs_fp
= fopen (dictfilec
, "rb");
4718 if (combs_fp
== NULL
)
4720 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4727 device_param
->combs_fp
= combs_fp
;
4729 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4731 const char *dictfilec
= data
.dictfile
;
4733 FILE *combs_fp
= fopen (dictfilec
, "rb");
4735 if (combs_fp
== NULL
)
4737 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4744 device_param
->combs_fp
= combs_fp
;
4748 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4750 wl_data
->buf
= (char *) mymalloc (segment_size
);
4751 wl_data
->avail
= segment_size
;
4752 wl_data
->incr
= segment_size
;
4758 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4763 bool allow_div
= true;
4769 const uint work
= get_work (device_param
, max
, allow_div
);
4773 if (work
== 0) break;
4775 words_off
= device_param
->words_off
;
4776 words_fin
= words_off
+ work
;
4781 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4785 for ( ; words_cur
< words_fin
; words_cur
++)
4787 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4789 line_len
= convert_from_hex (line_buf
, line_len
);
4791 // post-process rule engine
4793 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4795 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4797 int rule_len_out
= -1;
4799 if (line_len
< BLOCK_SIZE
)
4801 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4804 if (rule_len_out
< 0) continue;
4806 line_buf
= rule_buf_out
;
4807 line_len
= rule_len_out
;
4810 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4812 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4816 hc_thread_mutex_lock (mux_counter
);
4818 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4820 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4823 hc_thread_mutex_unlock (mux_counter
);
4828 else if (attack_kern
== ATTACK_KERN_COMBI
)
4830 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4831 // since we still need to combine the plains
4833 if (line_len
> data
.pw_max
)
4837 hc_thread_mutex_lock (mux_counter
);
4839 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4841 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4844 hc_thread_mutex_unlock (mux_counter
);
4850 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4852 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4854 if (data
.devices_status
== STATUS_CRACKED
) break;
4855 if (data
.devices_status
== STATUS_ABORTED
) break;
4856 if (data
.devices_status
== STATUS_QUIT
) break;
4857 if (data
.devices_status
== STATUS_BYPASS
) break;
4860 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4862 if (data
.devices_status
== STATUS_CRACKED
) break;
4863 if (data
.devices_status
== STATUS_ABORTED
) break;
4864 if (data
.devices_status
== STATUS_QUIT
) break;
4865 if (data
.devices_status
== STATUS_BYPASS
) break;
4868 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4870 if (data
.devices_status
== STATUS_CRACKED
) break;
4871 if (data
.devices_status
== STATUS_ABORTED
) break;
4872 if (data
.devices_status
== STATUS_QUIT
) break;
4873 if (data
.devices_status
== STATUS_BYPASS
) break;
4879 const uint pws_cnt
= device_param
->pws_cnt
;
4883 run_copy (device_param
, pws_cnt
);
4885 run_cracker (device_param
, pws_cnt
);
4887 device_param
->pws_cnt
= 0;
4891 if (attack_kern == ATTACK_KERN_STRAIGHT)
4893 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4895 else if (attack_kern == ATTACK_KERN_COMBI)
4897 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4902 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4904 if (data
.devices_status
== STATUS_CRACKED
) break;
4905 if (data
.devices_status
== STATUS_ABORTED
) break;
4906 if (data
.devices_status
== STATUS_QUIT
) break;
4907 if (data
.devices_status
== STATUS_BYPASS
) break;
4909 if (words_fin
== 0) break;
4911 device_param
->words_done
= words_fin
;
4914 if (attack_mode
== ATTACK_MODE_COMBI
)
4916 fclose (device_param
->combs_fp
);
4919 free (wl_data
->buf
);
4925 device_param
->kernel_accel
= 0;
4926 device_param
->kernel_loops
= 0;
4931 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4935 log_error ("ERROR: %s : Invalid argument", __func__
);
4940 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4942 device_param
->kernel_params_buf32
[24] = salt_pos
;
4943 device_param
->kernel_params_buf32
[27] = 1;
4944 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4945 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4946 device_param
->kernel_params_buf32
[30] = 0;
4947 device_param
->kernel_params_buf32
[31] = 1;
4949 char *dictfile_old
= data
.dictfile
;
4951 const char *weak_hash_check
= "weak-hash-check";
4953 data
.dictfile
= (char *) weak_hash_check
;
4955 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4957 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4963 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4965 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4969 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4971 uint loop_step
= 16;
4973 const uint iter
= salt_buf
->salt_iter
;
4975 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4977 uint loop_left
= iter
- loop_pos
;
4979 loop_left
= MIN (loop_left
, loop_step
);
4981 device_param
->kernel_params_buf32
[25] = loop_pos
;
4982 device_param
->kernel_params_buf32
[26] = loop_left
;
4984 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4987 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4994 check_cracked (device_param
, salt_pos
);
5000 device_param
->kernel_params_buf32
[24] = 0;
5001 device_param
->kernel_params_buf32
[25] = 0;
5002 device_param
->kernel_params_buf32
[26] = 0;
5003 device_param
->kernel_params_buf32
[27] = 0;
5004 device_param
->kernel_params_buf32
[28] = 0;
5005 device_param
->kernel_params_buf32
[29] = 0;
5006 device_param
->kernel_params_buf32
[30] = 0;
5007 device_param
->kernel_params_buf32
[31] = 0;
5009 data
.dictfile
= dictfile_old
;
5011 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5016 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5018 if (data
.username
== 0)
5020 *hashbuf_pos
= line_buf
;
5021 *hashbuf_len
= line_len
;
5025 char *pos
= line_buf
;
5028 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5030 if (line_buf
[i
] == data
.separator
)
5045 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5052 for (int i
= 0; i
< line_len
; i
++)
5054 if (line_buf
[i
] == data
.separator
)
5063 if (pos
== NULL
) pos
= line_buf
+ i
;
5075 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5082 for (int i
= 0; i
< line_len
; i
++)
5084 if (line_buf
[i
] == ':')
5091 if (sep_cnt
== 2) sep2_len
++;
5092 if (sep_cnt
== 3) sep3_len
++;
5095 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5100 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5107 for (int i
= 0; i
< line_len
; i
++)
5109 if (line_buf
[i
] == ':')
5116 if (data
.hash_mode
== 1000)
5120 if (pos
== NULL
) pos
= line_buf
+ i
;
5125 else if (data
.hash_mode
== 3000)
5129 if (pos
== NULL
) pos
= line_buf
+ i
;
5140 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5147 for (int i
= 0; i
< line_len
; i
++)
5149 if (line_buf
[i
] == ':')
5158 if (pos
== NULL
) pos
= line_buf
+ i
;
5170 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5174 char sep5_first
= 0;
5175 char sep6_first
= 0;
5177 for (int i
= 0; i
< line_len
; i
++)
5179 if (line_buf
[i
] == ':')
5186 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5187 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5190 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5195 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5202 for (int i
= 0; i
< line_len
; i
++)
5204 if (line_buf
[i
] == ':')
5213 if (pos
== NULL
) pos
= line_buf
+ i
;
5223 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5230 for (int i
= 0; i
< line_len
; i
++)
5232 if (line_buf
[i
] == ':')
5241 if (pos
== NULL
) pos
= line_buf
+ i
;
5253 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5257 for (int i
= 0; i
< line_len
; i
++)
5259 if (line_buf
[i
] == ':') sep_cnt
++;
5262 if (sep_cnt
== 8) return 1;
5267 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5269 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5272 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5274 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5279 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5281 switch (hashfile_format
)
5283 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5284 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5285 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5286 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5290 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5292 switch (hashfile_format
)
5294 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5295 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5296 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5297 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5301 char *strhlfmt (const uint hashfile_format
)
5303 switch (hashfile_format
)
5305 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5306 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5307 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5308 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5309 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5310 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5311 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5312 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5313 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5314 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5317 return ((char *) "Unknown");
5320 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5322 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5324 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5325 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5327 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5331 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5335 int line_len
= fgetl (fp
, line_buf
);
5337 if (line_len
== 0) continue;
5339 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5340 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5341 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5343 if (num_check
== max_check
) break;
5350 uint hashlist_format
= HLFMT_HASHCAT
;
5352 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5354 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5356 hashlist_format
= i
;
5361 return hashlist_format
;
5365 * some further helper function
5368 // wrapper around mymalloc for ADL
5370 #if defined(HAVE_HWMON)
5371 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5373 return mymalloc (iSize
);
5377 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
)
5381 const uint dgst_pos0
= data
.dgst_pos0
;
5382 const uint dgst_pos1
= data
.dgst_pos1
;
5383 const uint dgst_pos2
= data
.dgst_pos2
;
5384 const uint dgst_pos3
= data
.dgst_pos3
;
5386 memset (bitmap_a
, 0, bitmap_size
);
5387 memset (bitmap_b
, 0, bitmap_size
);
5388 memset (bitmap_c
, 0, bitmap_size
);
5389 memset (bitmap_d
, 0, bitmap_size
);
5391 for (uint i
= 0; i
< digests_cnt
; i
++)
5393 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5395 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5397 digests_buf_ptr
+= dgst_size
;
5399 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5400 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5401 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5402 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5404 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5405 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5406 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5407 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5409 if (bitmap_a
[idx0
] & val0
) collisions
++;
5410 if (bitmap_b
[idx1
] & val1
) collisions
++;
5411 if (bitmap_c
[idx2
] & val2
) collisions
++;
5412 if (bitmap_d
[idx3
] & val3
) collisions
++;
5414 bitmap_a
[idx0
] |= val0
;
5415 bitmap_b
[idx1
] |= val1
;
5416 bitmap_c
[idx2
] |= val2
;
5417 bitmap_d
[idx3
] |= val3
;
5419 if (collisions
>= collisions_max
) return 0x7fffffff;
5430 void SetConsoleWindowSize (const int x
)
5432 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5434 if (h
== INVALID_HANDLE_VALUE
) return;
5436 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5438 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5440 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5442 sr
->Right
= MAX (sr
->Right
, x
- 1);
5446 co
.X
= sr
->Right
+ 1;
5447 co
.Y
= sr
->Bottom
+ 1;
5449 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5451 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5455 int main (int argc
, char **argv
)
5458 SetConsoleWindowSize (132);
5462 * To help users a bit
5465 char *compute
= getenv ("COMPUTE");
5469 static char display
[100];
5471 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5477 if (getenv ("DISPLAY") == NULL
)
5478 putenv ((char *) "DISPLAY=:0");
5481 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5482 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5484 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5485 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5487 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5488 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5490 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5491 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5493 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5494 putenv ((char *) "POCL_KERNEL_CACHE=0");
5502 memset (&data
, 0, sizeof (hc_global_data_t
));
5508 data
.proc_start
= proc_start
;
5511 char **myargv
= argv
;
5513 hc_thread_mutex_init (mux_dispatcher
);
5514 hc_thread_mutex_init (mux_counter
);
5515 hc_thread_mutex_init (mux_display
);
5516 hc_thread_mutex_init (mux_adl
);
5519 * commandline parameters
5523 uint version
= VERSION
;
5525 uint benchmark
= BENCHMARK
;
5528 uint username
= USERNAME
;
5529 uint remove
= REMOVE
;
5530 uint remove_timer
= REMOVE_TIMER
;
5533 uint keyspace
= KEYSPACE
;
5534 uint potfile_disable
= POTFILE_DISABLE
;
5535 char *potfile_path
= NULL
;
5536 uint debug_mode
= DEBUG_MODE
;
5537 char *debug_file
= NULL
;
5538 char *induction_dir
= NULL
;
5539 char *outfile_check_dir
= NULL
;
5541 uint runtime
= RUNTIME
;
5542 uint hash_mode
= HASH_MODE
;
5543 uint attack_mode
= ATTACK_MODE
;
5544 uint markov_disable
= MARKOV_DISABLE
;
5545 uint markov_classic
= MARKOV_CLASSIC
;
5546 uint markov_threshold
= MARKOV_THRESHOLD
;
5547 char *markov_hcstat
= NULL
;
5548 char *outfile
= NULL
;
5549 uint outfile_format
= OUTFILE_FORMAT
;
5550 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5551 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5552 uint restore
= RESTORE
;
5553 uint restore_timer
= RESTORE_TIMER
;
5554 uint restore_disable
= RESTORE_DISABLE
;
5555 uint status
= STATUS
;
5556 uint status_timer
= STATUS_TIMER
;
5557 uint machine_readable
= MACHINE_READABLE
;
5558 uint loopback
= LOOPBACK
;
5559 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5560 char *session
= NULL
;
5561 uint hex_charset
= HEX_CHARSET
;
5562 uint hex_salt
= HEX_SALT
;
5563 uint hex_wordlist
= HEX_WORDLIST
;
5564 uint rp_gen
= RP_GEN
;
5565 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5566 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5567 uint rp_gen_seed
= RP_GEN_SEED
;
5568 char *rule_buf_l
= (char *) RULE_BUF_L
;
5569 char *rule_buf_r
= (char *) RULE_BUF_R
;
5570 uint increment
= INCREMENT
;
5571 uint increment_min
= INCREMENT_MIN
;
5572 uint increment_max
= INCREMENT_MAX
;
5573 char *cpu_affinity
= NULL
;
5574 OCL_PTR
*ocl
= NULL
;
5575 char *opencl_devices
= NULL
;
5576 char *opencl_platforms
= NULL
;
5577 char *opencl_device_types
= NULL
;
5578 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5579 char *truecrypt_keyfiles
= NULL
;
5580 char *veracrypt_keyfiles
= NULL
;
5581 uint veracrypt_pim
= 0;
5582 uint workload_profile
= WORKLOAD_PROFILE
;
5583 uint kernel_accel
= KERNEL_ACCEL
;
5584 uint kernel_loops
= KERNEL_LOOPS
;
5585 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5587 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5588 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5589 uint powertune_enable
= POWERTUNE_ENABLE
;
5591 uint logfile_disable
= LOGFILE_DISABLE
;
5592 uint segment_size
= SEGMENT_SIZE
;
5593 uint scrypt_tmto
= SCRYPT_TMTO
;
5594 char separator
= SEPARATOR
;
5595 uint bitmap_min
= BITMAP_MIN
;
5596 uint bitmap_max
= BITMAP_MAX
;
5597 char *custom_charset_1
= NULL
;
5598 char *custom_charset_2
= NULL
;
5599 char *custom_charset_3
= NULL
;
5600 char *custom_charset_4
= NULL
;
5602 #define IDX_HELP 'h'
5603 #define IDX_VERSION 'V'
5604 #define IDX_VERSION_LOWER 'v'
5605 #define IDX_QUIET 0xff02
5606 #define IDX_SHOW 0xff03
5607 #define IDX_LEFT 0xff04
5608 #define IDX_REMOVE 0xff05
5609 #define IDX_REMOVE_TIMER 0xff37
5610 #define IDX_SKIP 's'
5611 #define IDX_LIMIT 'l'
5612 #define IDX_KEYSPACE 0xff35
5613 #define IDX_POTFILE_DISABLE 0xff06
5614 #define IDX_POTFILE_PATH 0xffe0
5615 #define IDX_DEBUG_MODE 0xff43
5616 #define IDX_DEBUG_FILE 0xff44
5617 #define IDX_INDUCTION_DIR 0xff46
5618 #define IDX_OUTFILE_CHECK_DIR 0xff47
5619 #define IDX_USERNAME 0xff07
5620 #define IDX_FORCE 0xff08
5621 #define IDX_RUNTIME 0xff09
5622 #define IDX_BENCHMARK 'b'
5623 #define IDX_HASH_MODE 'm'
5624 #define IDX_ATTACK_MODE 'a'
5625 #define IDX_RP_FILE 'r'
5626 #define IDX_RP_GEN 'g'
5627 #define IDX_RP_GEN_FUNC_MIN 0xff10
5628 #define IDX_RP_GEN_FUNC_MAX 0xff11
5629 #define IDX_RP_GEN_SEED 0xff34
5630 #define IDX_RULE_BUF_L 'j'
5631 #define IDX_RULE_BUF_R 'k'
5632 #define IDX_INCREMENT 'i'
5633 #define IDX_INCREMENT_MIN 0xff12
5634 #define IDX_INCREMENT_MAX 0xff13
5635 #define IDX_OUTFILE 'o'
5636 #define IDX_OUTFILE_FORMAT 0xff14
5637 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5638 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5639 #define IDX_RESTORE 0xff15
5640 #define IDX_RESTORE_DISABLE 0xff27
5641 #define IDX_STATUS 0xff17
5642 #define IDX_STATUS_TIMER 0xff18
5643 #define IDX_MACHINE_READABLE 0xff50
5644 #define IDX_LOOPBACK 0xff38
5645 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5646 #define IDX_SESSION 0xff19
5647 #define IDX_HEX_CHARSET 0xff20
5648 #define IDX_HEX_SALT 0xff21
5649 #define IDX_HEX_WORDLIST 0xff40
5650 #define IDX_MARKOV_DISABLE 0xff22
5651 #define IDX_MARKOV_CLASSIC 0xff23
5652 #define IDX_MARKOV_THRESHOLD 't'
5653 #define IDX_MARKOV_HCSTAT 0xff24
5654 #define IDX_CPU_AFFINITY 0xff25
5655 #define IDX_OPENCL_DEVICES 'd'
5656 #define IDX_OPENCL_PLATFORMS 0xff72
5657 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5658 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5659 #define IDX_WORKLOAD_PROFILE 'w'
5660 #define IDX_KERNEL_ACCEL 'n'
5661 #define IDX_KERNEL_LOOPS 'u'
5662 #define IDX_GPU_TEMP_DISABLE 0xff29
5663 #define IDX_GPU_TEMP_ABORT 0xff30
5664 #define IDX_GPU_TEMP_RETAIN 0xff31
5665 #define IDX_POWERTUNE_ENABLE 0xff41
5666 #define IDX_LOGFILE_DISABLE 0xff51
5667 #define IDX_TRUECRYPT_KEYFILES 0xff52
5668 #define IDX_VERACRYPT_KEYFILES 0xff53
5669 #define IDX_VERACRYPT_PIM 0xff54
5670 #define IDX_SCRYPT_TMTO 0xff61
5671 #define IDX_SEGMENT_SIZE 'c'
5672 #define IDX_SEPARATOR 'p'
5673 #define IDX_BITMAP_MIN 0xff70
5674 #define IDX_BITMAP_MAX 0xff71
5675 #define IDX_CUSTOM_CHARSET_1 '1'
5676 #define IDX_CUSTOM_CHARSET_2 '2'
5677 #define IDX_CUSTOM_CHARSET_3 '3'
5678 #define IDX_CUSTOM_CHARSET_4 '4'
5680 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5682 struct option long_options
[] =
5684 {"help", no_argument
, 0, IDX_HELP
},
5685 {"version", no_argument
, 0, IDX_VERSION
},
5686 {"quiet", no_argument
, 0, IDX_QUIET
},
5687 {"show", no_argument
, 0, IDX_SHOW
},
5688 {"left", no_argument
, 0, IDX_LEFT
},
5689 {"username", no_argument
, 0, IDX_USERNAME
},
5690 {"remove", no_argument
, 0, IDX_REMOVE
},
5691 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5692 {"skip", required_argument
, 0, IDX_SKIP
},
5693 {"limit", required_argument
, 0, IDX_LIMIT
},
5694 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5695 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5696 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5697 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5698 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5699 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5700 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5701 {"force", no_argument
, 0, IDX_FORCE
},
5702 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5703 {"restore", no_argument
, 0, IDX_RESTORE
},
5704 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5705 {"status", no_argument
, 0, IDX_STATUS
},
5706 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5707 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5708 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5709 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5710 {"session", required_argument
, 0, IDX_SESSION
},
5711 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5712 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5713 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5714 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5715 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5716 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5717 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5718 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5719 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5720 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5721 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5722 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5723 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5724 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5725 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5726 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5727 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5728 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5729 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5730 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5731 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5732 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5733 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5734 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5735 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5736 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5737 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5738 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5739 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5740 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5742 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5743 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5744 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5745 #endif // HAVE_HWMON
5746 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5747 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5748 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5749 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5750 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5751 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5752 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5753 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5754 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5755 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5756 {"increment", no_argument
, 0, IDX_INCREMENT
},
5757 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5758 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5759 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5760 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5761 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5762 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5766 uint rp_files_cnt
= 0;
5768 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5770 int option_index
= 0;
5776 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5780 case IDX_HELP
: usage
= 1; break;
5782 case IDX_VERSION_LOWER
: version
= 1; break;
5783 case IDX_RESTORE
: restore
= 1; break;
5784 case IDX_SESSION
: session
= optarg
; break;
5785 case IDX_SHOW
: show
= 1; break;
5786 case IDX_LEFT
: left
= 1; break;
5787 case '?': return (-1);
5793 log_error ("ERROR: Invalid argument specified");
5804 log_info ("%s", VERSION_TAG
);
5811 usage_big_print (PROGNAME
);
5817 * session needs to be set, always!
5820 if (session
== NULL
) session
= (char *) PROGNAME
;
5823 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5826 char *exec_path
= get_exec_path ();
5830 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5831 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5833 char *install_dir
= get_install_dir (resolved_exec_path
);
5834 char *profile_dir
= NULL
;
5835 char *session_dir
= NULL
;
5836 char *shared_dir
= NULL
;
5838 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5840 struct passwd
*pw
= getpwuid (getuid ());
5842 const char *homedir
= pw
->pw_dir
;
5844 profile_dir
= get_profile_dir (homedir
);
5845 session_dir
= get_session_dir (profile_dir
);
5846 shared_dir
= strdup (SHARED_FOLDER
);
5848 mkdir (profile_dir
, 0700);
5849 mkdir (session_dir
, 0700);
5853 profile_dir
= install_dir
;
5854 session_dir
= install_dir
;
5855 shared_dir
= install_dir
;
5858 myfree (resolved_install_folder
);
5859 myfree (resolved_exec_path
);
5863 char *install_dir
= get_install_dir (exec_path
);
5864 char *profile_dir
= install_dir
;
5865 char *session_dir
= install_dir
;
5866 char *shared_dir
= install_dir
;
5870 data
.install_dir
= install_dir
;
5871 data
.profile_dir
= profile_dir
;
5872 data
.session_dir
= session_dir
;
5873 data
.shared_dir
= shared_dir
;
5878 * kernel cache, we need to make sure folder exist
5881 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5883 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5885 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5887 mkdir (kernels_folder
, 0700);
5889 myfree (kernels_folder
);
5895 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5897 data
.session
= session
;
5899 char *eff_restore_file
= (char *) mymalloc (session_size
);
5900 char *new_restore_file
= (char *) mymalloc (session_size
);
5902 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5903 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5905 data
.eff_restore_file
= eff_restore_file
;
5906 data
.new_restore_file
= new_restore_file
;
5908 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5910 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5911 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5916 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5917 if ((show
== 1) || (left
== 1))
5919 restore_disable
= 1;
5924 data
.restore_disable
= restore_disable
;
5926 restore_data_t
*rd
= init_restore (argc
, argv
);
5936 read_restore (eff_restore_file
, rd
);
5938 if (rd
->version_bin
< RESTORE_MIN
)
5940 log_error ("ERROR: Incompatible restore-file version");
5949 rd
->pid
= getpid ();
5951 rd
->pid
= GetCurrentProcessId ();
5955 uint hash_mode_chgd
= 0;
5956 uint runtime_chgd
= 0;
5957 uint kernel_loops_chgd
= 0;
5958 uint kernel_accel_chgd
= 0;
5959 uint attack_mode_chgd
= 0;
5960 uint outfile_format_chgd
= 0;
5961 uint rp_gen_seed_chgd
= 0;
5962 uint remove_timer_chgd
= 0;
5963 uint increment_min_chgd
= 0;
5964 uint increment_max_chgd
= 0;
5965 uint workload_profile_chgd
= 0;
5966 uint opencl_vector_width_chgd
= 0;
5972 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5976 //case IDX_HELP: usage = 1; break;
5977 //case IDX_VERSION: version = 1; break;
5978 //case IDX_RESTORE: restore = 1; break;
5979 case IDX_QUIET
: quiet
= 1; break;
5980 //case IDX_SHOW: show = 1; break;
5981 case IDX_SHOW
: break;
5982 //case IDX_LEFT: left = 1; break;
5983 case IDX_LEFT
: break;
5984 case IDX_USERNAME
: username
= 1; break;
5985 case IDX_REMOVE
: remove
= 1; break;
5986 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5987 remove_timer_chgd
= 1; break;
5988 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5989 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5990 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5991 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5992 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5993 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5994 case IDX_FORCE
: force
= 1; break;
5995 case IDX_SKIP
: skip
= atoll (optarg
); break;
5996 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5997 case IDX_KEYSPACE
: keyspace
= 1; break;
5998 case IDX_BENCHMARK
: benchmark
= 1; break;
5999 case IDX_RESTORE
: break;
6000 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6001 case IDX_STATUS
: status
= 1; break;
6002 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6003 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6004 case IDX_LOOPBACK
: loopback
= 1; break;
6005 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6006 //case IDX_SESSION: session = optarg; break;
6007 case IDX_SESSION
: break;
6008 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6009 hash_mode_chgd
= 1; break;
6010 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6011 runtime_chgd
= 1; break;
6012 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6013 attack_mode_chgd
= 1; break;
6014 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6015 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6016 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6017 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6018 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6019 rp_gen_seed_chgd
= 1; break;
6020 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6021 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6022 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6023 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6024 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6025 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6026 case IDX_OUTFILE
: outfile
= optarg
; break;
6027 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6028 outfile_format_chgd
= 1; break;
6029 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6030 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6031 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6032 case IDX_HEX_SALT
: hex_salt
= 1; break;
6033 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6034 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6035 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6036 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6037 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6038 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6039 opencl_vector_width_chgd
= 1; break;
6040 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6041 workload_profile_chgd
= 1; break;
6042 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6043 kernel_accel_chgd
= 1; break;
6044 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6045 kernel_loops_chgd
= 1; break;
6046 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6048 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6049 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6050 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6051 #endif // HAVE_HWMON
6052 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6053 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6054 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6055 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6056 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6057 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6058 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6059 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6060 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6061 case IDX_INCREMENT
: increment
= 1; break;
6062 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6063 increment_min_chgd
= 1; break;
6064 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6065 increment_max_chgd
= 1; break;
6066 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6067 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6068 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6069 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6072 log_error ("ERROR: Invalid argument specified");
6079 log_error ("ERROR: Invalid argument specified");
6085 * Inform user things getting started,
6086 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6087 * - we do not need to check algorithm_pos
6094 if (machine_readable
== 0)
6096 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6101 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6104 else if (restore
== 1)
6106 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6111 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6120 if (attack_mode
> 7)
6122 log_error ("ERROR: Invalid attack-mode specified");
6127 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6129 log_error ("ERROR: Invalid runtime specified");
6134 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6136 log_error ("ERROR: Invalid hash-type specified");
6141 // renamed hash modes
6155 log_error ("Old -m specified, use -m %d instead", n
);
6163 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6165 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6171 if (outfile_format
> 16)
6173 log_error ("ERROR: Invalid outfile-format specified");
6180 if (outfile_format_chgd
== 1)
6182 if (outfile_format
> 1)
6184 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6191 outfile_format
= OUTFILE_FMT_HASH
;
6197 if (outfile_format_chgd
== 1)
6199 if ((outfile_format
> 7) && (outfile_format
< 16))
6201 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6208 if (increment_min
< INCREMENT_MIN
)
6210 log_error ("ERROR: Invalid increment-min specified");
6215 if (increment_max
> INCREMENT_MAX
)
6217 log_error ("ERROR: Invalid increment-max specified");
6222 if (increment_min
> increment_max
)
6224 log_error ("ERROR: Invalid increment-min specified");
6229 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6231 log_error ("ERROR: increment is not allowed in attack-mode 0");
6236 if ((increment
== 0) && (increment_min_chgd
== 1))
6238 log_error ("ERROR: increment-min is only supported together with increment switch");
6243 if ((increment
== 0) && (increment_max_chgd
== 1))
6245 log_error ("ERROR: increment-max is only supported together with increment switch");
6250 if (rp_files_cnt
&& rp_gen
)
6252 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6257 if (rp_files_cnt
|| rp_gen
)
6259 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6261 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6267 if (rp_gen_func_min
> rp_gen_func_max
)
6269 log_error ("ERROR: Invalid rp-gen-func-min specified");
6274 if (kernel_accel_chgd
== 1)
6278 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6279 log_info ("Please consider using the option -w instead");
6280 log_info ("You can use --force to override this but do not post error reports if you do so");
6286 if (kernel_accel
< 1)
6288 log_error ("ERROR: Invalid kernel-accel specified");
6293 if (kernel_accel
> 1024)
6295 log_error ("ERROR: Invalid kernel-accel specified");
6301 if (kernel_loops_chgd
== 1)
6305 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6306 log_info ("Please consider using the option -w instead");
6307 log_info ("You can use --force to override this but do not post error reports if you do so");
6313 if (kernel_loops
< 1)
6315 log_error ("ERROR: Invalid kernel-loops specified");
6320 if (kernel_loops
> 1024)
6322 log_error ("ERROR: Invalid kernel-loops specified");
6328 if ((workload_profile
< 1) || (workload_profile
> 4))
6330 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6335 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6337 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6342 if (show
== 1 || left
== 1)
6344 attack_mode
= ATTACK_MODE_NONE
;
6348 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6353 if (potfile_disable
== 1)
6355 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6361 uint attack_kern
= ATTACK_KERN_NONE
;
6363 switch (attack_mode
)
6365 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6366 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6367 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6368 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6369 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6376 int num_additional_params
= 1;
6378 if (attack_kern
== ATTACK_KERN_COMBI
)
6380 num_additional_params
= 2;
6383 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6385 if (keyspace_wordlist_specified
== 0) optind
--;
6388 if (attack_kern
== ATTACK_KERN_NONE
)
6390 if ((optind
+ 1) != myargc
)
6392 usage_mini_print (myargv
[0]);
6397 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6399 if ((optind
+ 1) > myargc
)
6401 usage_mini_print (myargv
[0]);
6406 else if (attack_kern
== ATTACK_KERN_COMBI
)
6408 if ((optind
+ 3) != myargc
)
6410 usage_mini_print (myargv
[0]);
6415 else if (attack_kern
== ATTACK_KERN_BF
)
6417 if ((optind
+ 1) > myargc
)
6419 usage_mini_print (myargv
[0]);
6426 usage_mini_print (myargv
[0]);
6433 if (myargv
[optind
] != 0)
6435 log_error ("ERROR: Invalid argument for benchmark mode specified");
6440 if (attack_mode_chgd
== 1)
6442 if (attack_mode
!= ATTACK_MODE_BF
)
6444 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6451 if (skip
!= 0 && limit
!= 0)
6460 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6466 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6471 potfile_disable
= 1;
6473 restore_disable
= 1;
6477 weak_hash_threshold
= 0;
6482 if (remove_timer_chgd
== 1)
6486 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6491 if (remove_timer
< 1)
6493 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6501 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6503 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6505 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6512 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6520 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6522 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6527 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6529 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6537 log_error ("ERROR: Invalid debug-mode specified");
6542 if (debug_file
!= NULL
)
6546 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6552 if (induction_dir
!= NULL
)
6554 if (attack_mode
== ATTACK_MODE_BF
)
6556 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6562 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6564 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6566 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6571 weak_hash_threshold
= 0;
6575 * induction directory
6578 char *induction_directory
= NULL
;
6580 if (attack_mode
!= ATTACK_MODE_BF
)
6582 if (induction_dir
== NULL
)
6584 induction_directory
= (char *) mymalloc (session_size
);
6586 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6588 // create induction folder if it does not already exist
6592 if (rmdir (induction_directory
) == -1)
6594 if (errno
== ENOENT
)
6596 // good, we can ignore
6598 else if (errno
== ENOTEMPTY
)
6600 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6602 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6604 if (rename (induction_directory
, induction_directory_mv
) != 0)
6606 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6613 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6619 if (mkdir (induction_directory
, 0700) == -1)
6621 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6629 induction_directory
= induction_dir
;
6633 data
.induction_directory
= induction_directory
;
6639 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6641 char *loopback_file
= (char *) mymalloc (loopback_size
);
6647 char tuning_db_file
[256] = { 0 };
6649 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6651 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6654 * outfile-check directory
6657 char *outfile_check_directory
= NULL
;
6659 if (outfile_check_dir
== NULL
)
6661 outfile_check_directory
= (char *) mymalloc (session_size
);
6663 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6667 outfile_check_directory
= outfile_check_dir
;
6670 data
.outfile_check_directory
= outfile_check_directory
;
6674 struct stat outfile_check_stat
;
6676 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6678 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6682 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6687 else if (outfile_check_dir
== NULL
)
6689 if (mkdir (outfile_check_directory
, 0700) == -1)
6691 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6699 * special other stuff
6702 if (hash_mode
== 9710)
6705 outfile_format_chgd
= 1;
6708 if (hash_mode
== 9810)
6711 outfile_format_chgd
= 1;
6714 if (hash_mode
== 10410)
6717 outfile_format_chgd
= 1;
6724 data
.hash_mode
= hash_mode
;
6725 data
.restore
= restore
;
6726 data
.restore_timer
= restore_timer
;
6727 data
.restore_disable
= restore_disable
;
6728 data
.status
= status
;
6729 data
.status_timer
= status_timer
;
6730 data
.machine_readable
= machine_readable
;
6731 data
.loopback
= loopback
;
6732 data
.runtime
= runtime
;
6733 data
.remove
= remove
;
6734 data
.remove_timer
= remove_timer
;
6735 data
.debug_mode
= debug_mode
;
6736 data
.debug_file
= debug_file
;
6737 data
.username
= username
;
6739 data
.outfile
= outfile
;
6740 data
.outfile_format
= outfile_format
;
6741 data
.outfile_autohex
= outfile_autohex
;
6742 data
.hex_charset
= hex_charset
;
6743 data
.hex_salt
= hex_salt
;
6744 data
.hex_wordlist
= hex_wordlist
;
6745 data
.separator
= separator
;
6746 data
.rp_files
= rp_files
;
6747 data
.rp_files_cnt
= rp_files_cnt
;
6748 data
.rp_gen
= rp_gen
;
6749 data
.rp_gen_seed
= rp_gen_seed
;
6751 data
.benchmark
= benchmark
;
6755 data
.powertune_enable
= powertune_enable
;
6757 data
.logfile_disable
= logfile_disable
;
6758 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6759 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6760 data
.veracrypt_pim
= veracrypt_pim
;
6761 data
.scrypt_tmto
= scrypt_tmto
;
6762 data
.workload_profile
= workload_profile
;
6770 set_cpu_affinity (cpu_affinity
);
6773 if (rp_gen_seed_chgd
== 0)
6779 srand (rp_gen_seed
);
6786 if (logfile_disable
== 0)
6788 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6790 char *logfile
= (char *) mymalloc (logfile_size
);
6792 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6794 data
.logfile
= logfile
;
6796 char *topid
= logfile_generate_topid ();
6801 // logfile_append() checks for logfile_disable internally to make it easier from here
6803 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6804 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6805 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6806 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6807 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6808 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6809 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6810 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6811 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6812 #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));
6814 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6815 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6816 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6817 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6818 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6819 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6820 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6821 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6823 logfile_top_msg ("START");
6825 logfile_top_uint (attack_mode
);
6826 logfile_top_uint (attack_kern
);
6827 logfile_top_uint (benchmark
);
6828 logfile_top_uint (bitmap_min
);
6829 logfile_top_uint (bitmap_max
);
6830 logfile_top_uint (debug_mode
);
6831 logfile_top_uint (force
);
6832 logfile_top_uint (kernel_accel
);
6833 logfile_top_uint (kernel_loops
);
6834 logfile_top_uint (gpu_temp_disable
);
6836 logfile_top_uint (gpu_temp_abort
);
6837 logfile_top_uint (gpu_temp_retain
);
6839 logfile_top_uint (hash_mode
);
6840 logfile_top_uint (hex_charset
);
6841 logfile_top_uint (hex_salt
);
6842 logfile_top_uint (hex_wordlist
);
6843 logfile_top_uint (increment
);
6844 logfile_top_uint (increment_max
);
6845 logfile_top_uint (increment_min
);
6846 logfile_top_uint (keyspace
);
6847 logfile_top_uint (left
);
6848 logfile_top_uint (logfile_disable
);
6849 logfile_top_uint (loopback
);
6850 logfile_top_uint (markov_classic
);
6851 logfile_top_uint (markov_disable
);
6852 logfile_top_uint (markov_threshold
);
6853 logfile_top_uint (outfile_autohex
);
6854 logfile_top_uint (outfile_check_timer
);
6855 logfile_top_uint (outfile_format
);
6856 logfile_top_uint (potfile_disable
);
6857 logfile_top_string (potfile_path
);
6858 #if defined(HAVE_HWMON)
6859 logfile_top_uint (powertune_enable
);
6861 logfile_top_uint (scrypt_tmto
);
6862 logfile_top_uint (quiet
);
6863 logfile_top_uint (remove
);
6864 logfile_top_uint (remove_timer
);
6865 logfile_top_uint (restore
);
6866 logfile_top_uint (restore_disable
);
6867 logfile_top_uint (restore_timer
);
6868 logfile_top_uint (rp_gen
);
6869 logfile_top_uint (rp_gen_func_max
);
6870 logfile_top_uint (rp_gen_func_min
);
6871 logfile_top_uint (rp_gen_seed
);
6872 logfile_top_uint (runtime
);
6873 logfile_top_uint (segment_size
);
6874 logfile_top_uint (show
);
6875 logfile_top_uint (status
);
6876 logfile_top_uint (machine_readable
);
6877 logfile_top_uint (status_timer
);
6878 logfile_top_uint (usage
);
6879 logfile_top_uint (username
);
6880 logfile_top_uint (version
);
6881 logfile_top_uint (weak_hash_threshold
);
6882 logfile_top_uint (workload_profile
);
6883 logfile_top_uint64 (limit
);
6884 logfile_top_uint64 (skip
);
6885 logfile_top_char (separator
);
6886 logfile_top_string (cpu_affinity
);
6887 logfile_top_string (custom_charset_1
);
6888 logfile_top_string (custom_charset_2
);
6889 logfile_top_string (custom_charset_3
);
6890 logfile_top_string (custom_charset_4
);
6891 logfile_top_string (debug_file
);
6892 logfile_top_string (opencl_devices
);
6893 logfile_top_string (opencl_platforms
);
6894 logfile_top_string (opencl_device_types
);
6895 logfile_top_uint (opencl_vector_width
);
6896 logfile_top_string (induction_dir
);
6897 logfile_top_string (markov_hcstat
);
6898 logfile_top_string (outfile
);
6899 logfile_top_string (outfile_check_dir
);
6900 logfile_top_string (rule_buf_l
);
6901 logfile_top_string (rule_buf_r
);
6902 logfile_top_string (session
);
6903 logfile_top_string (truecrypt_keyfiles
);
6904 logfile_top_string (veracrypt_keyfiles
);
6905 logfile_top_uint (veracrypt_pim
);
6908 * Init OpenCL library loader
6913 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6921 * OpenCL platform selection
6924 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6927 * OpenCL device selection
6930 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6933 * OpenCL device type selection
6936 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6945 * disable useless stuff for benchmark
6950 restore_disable
= 1;
6951 potfile_disable
= 1;
6952 weak_hash_threshold
= 0;
6953 gpu_temp_disable
= 1;
6956 powertune_enable
= 1;
6959 data
.status_timer
= status_timer
;
6960 data
.restore_timer
= restore_timer
;
6961 data
.restore_disable
= restore_disable
;
6964 * force attack mode to be bruteforce
6967 attack_mode
= ATTACK_MODE_BF
;
6968 attack_kern
= ATTACK_KERN_BF
;
6970 if (workload_profile_chgd
== 0)
6972 workload_profile
= 3;
6974 data
.workload_profile
= workload_profile
;
6984 uint attack_exec
= 0;
6988 uint esalt_size
= 0;
6990 uint dgst_pos0
= -1;
6991 uint dgst_pos1
= -1;
6992 uint dgst_pos2
= -1;
6993 uint dgst_pos3
= -1;
6995 int (*parse_func
) (char *, uint
, hash_t
*);
6996 int (*sort_by_digest
) (const void *, const void *);
6998 uint algorithm_pos
= 0;
6999 uint algorithm_max
= 1;
7001 uint
*algorithms
= default_benchmark_algorithms
;
7003 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7005 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7008 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7009 * the following algos are skipped entirely
7012 if (algorithm_pos
> 0)
7016 rd
= init_restore (argc
, argv
);
7022 * update hash_mode in case of multihash benchmark
7027 if (hash_mode_chgd
== 0)
7029 hash_mode
= algorithms
[algorithm_pos
];
7031 data
.hash_mode
= hash_mode
;
7041 case 0: hash_type
= HASH_TYPE_MD5
;
7042 salt_type
= SALT_TYPE_NONE
;
7043 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7045 | OPTS_TYPE_PT_ADD80
7046 | OPTS_TYPE_PT_ADDBITS14
;
7047 kern_type
= KERN_TYPE_MD5
;
7048 dgst_size
= DGST_SIZE_4_4
;
7049 parse_func
= md5_parse_hash
;
7050 sort_by_digest
= sort_by_digest_4_4
;
7051 opti_type
= OPTI_TYPE_ZERO_BYTE
7052 | OPTI_TYPE_PRECOMPUTE_INIT
7053 | OPTI_TYPE_PRECOMPUTE_MERKLE
7054 | OPTI_TYPE_MEET_IN_MIDDLE
7055 | OPTI_TYPE_EARLY_SKIP
7056 | OPTI_TYPE_NOT_ITERATED
7057 | OPTI_TYPE_NOT_SALTED
7058 | OPTI_TYPE_RAW_HASH
;
7065 case 10: hash_type
= HASH_TYPE_MD5
;
7066 salt_type
= SALT_TYPE_INTERN
;
7067 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7069 | OPTS_TYPE_ST_ADD80
7070 | OPTS_TYPE_ST_ADDBITS14
;
7071 kern_type
= KERN_TYPE_MD5_PWSLT
;
7072 dgst_size
= DGST_SIZE_4_4
;
7073 parse_func
= md5s_parse_hash
;
7074 sort_by_digest
= sort_by_digest_4_4
;
7075 opti_type
= OPTI_TYPE_ZERO_BYTE
7076 | OPTI_TYPE_PRECOMPUTE_INIT
7077 | OPTI_TYPE_PRECOMPUTE_MERKLE
7078 | OPTI_TYPE_MEET_IN_MIDDLE
7079 | OPTI_TYPE_EARLY_SKIP
7080 | OPTI_TYPE_NOT_ITERATED
7081 | OPTI_TYPE_APPENDED_SALT
7082 | OPTI_TYPE_RAW_HASH
;
7089 case 11: hash_type
= HASH_TYPE_MD5
;
7090 salt_type
= SALT_TYPE_INTERN
;
7091 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7092 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7093 | OPTS_TYPE_ST_ADD80
7094 | OPTS_TYPE_ST_ADDBITS14
;
7095 kern_type
= KERN_TYPE_MD5_PWSLT
;
7096 dgst_size
= DGST_SIZE_4_4
;
7097 parse_func
= joomla_parse_hash
;
7098 sort_by_digest
= sort_by_digest_4_4
;
7099 opti_type
= OPTI_TYPE_ZERO_BYTE
7100 | OPTI_TYPE_PRECOMPUTE_INIT
7101 | OPTI_TYPE_PRECOMPUTE_MERKLE
7102 | OPTI_TYPE_MEET_IN_MIDDLE
7103 | OPTI_TYPE_EARLY_SKIP
7104 | OPTI_TYPE_NOT_ITERATED
7105 | OPTI_TYPE_APPENDED_SALT
7106 | OPTI_TYPE_RAW_HASH
;
7113 case 12: hash_type
= HASH_TYPE_MD5
;
7114 salt_type
= SALT_TYPE_INTERN
;
7115 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7116 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7117 | OPTS_TYPE_ST_ADD80
7118 | OPTS_TYPE_ST_ADDBITS14
;
7119 kern_type
= KERN_TYPE_MD5_PWSLT
;
7120 dgst_size
= DGST_SIZE_4_4
;
7121 parse_func
= postgresql_parse_hash
;
7122 sort_by_digest
= sort_by_digest_4_4
;
7123 opti_type
= OPTI_TYPE_ZERO_BYTE
7124 | OPTI_TYPE_PRECOMPUTE_INIT
7125 | OPTI_TYPE_PRECOMPUTE_MERKLE
7126 | OPTI_TYPE_MEET_IN_MIDDLE
7127 | OPTI_TYPE_EARLY_SKIP
7128 | OPTI_TYPE_NOT_ITERATED
7129 | OPTI_TYPE_APPENDED_SALT
7130 | OPTI_TYPE_RAW_HASH
;
7137 case 20: hash_type
= HASH_TYPE_MD5
;
7138 salt_type
= SALT_TYPE_INTERN
;
7139 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7140 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7141 | OPTS_TYPE_PT_ADD80
7142 | OPTS_TYPE_PT_ADDBITS14
;
7143 kern_type
= KERN_TYPE_MD5_SLTPW
;
7144 dgst_size
= DGST_SIZE_4_4
;
7145 parse_func
= md5s_parse_hash
;
7146 sort_by_digest
= sort_by_digest_4_4
;
7147 opti_type
= OPTI_TYPE_ZERO_BYTE
7148 | OPTI_TYPE_PRECOMPUTE_INIT
7149 | OPTI_TYPE_PRECOMPUTE_MERKLE
7150 | OPTI_TYPE_EARLY_SKIP
7151 | OPTI_TYPE_NOT_ITERATED
7152 | OPTI_TYPE_PREPENDED_SALT
7153 | OPTI_TYPE_RAW_HASH
;
7160 case 21: hash_type
= HASH_TYPE_MD5
;
7161 salt_type
= SALT_TYPE_INTERN
;
7162 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7164 | OPTS_TYPE_PT_ADD80
7165 | OPTS_TYPE_PT_ADDBITS14
;
7166 kern_type
= KERN_TYPE_MD5_SLTPW
;
7167 dgst_size
= DGST_SIZE_4_4
;
7168 parse_func
= osc_parse_hash
;
7169 sort_by_digest
= sort_by_digest_4_4
;
7170 opti_type
= OPTI_TYPE_ZERO_BYTE
7171 | OPTI_TYPE_PRECOMPUTE_INIT
7172 | OPTI_TYPE_PRECOMPUTE_MERKLE
7173 | OPTI_TYPE_EARLY_SKIP
7174 | OPTI_TYPE_NOT_ITERATED
7175 | OPTI_TYPE_PREPENDED_SALT
7176 | OPTI_TYPE_RAW_HASH
;
7183 case 22: hash_type
= HASH_TYPE_MD5
;
7184 salt_type
= SALT_TYPE_EMBEDDED
;
7185 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7186 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7187 | OPTS_TYPE_PT_ADD80
7188 | OPTS_TYPE_PT_ADDBITS14
;
7189 kern_type
= KERN_TYPE_MD5_SLTPW
;
7190 dgst_size
= DGST_SIZE_4_4
;
7191 parse_func
= netscreen_parse_hash
;
7192 sort_by_digest
= sort_by_digest_4_4
;
7193 opti_type
= OPTI_TYPE_ZERO_BYTE
7194 | OPTI_TYPE_PRECOMPUTE_INIT
7195 | OPTI_TYPE_PRECOMPUTE_MERKLE
7196 | OPTI_TYPE_EARLY_SKIP
7197 | OPTI_TYPE_NOT_ITERATED
7198 | OPTI_TYPE_PREPENDED_SALT
7199 | OPTI_TYPE_RAW_HASH
;
7206 case 23: hash_type
= HASH_TYPE_MD5
;
7207 salt_type
= SALT_TYPE_EMBEDDED
;
7208 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7210 | OPTS_TYPE_PT_ADD80
7211 | OPTS_TYPE_PT_ADDBITS14
;
7212 kern_type
= KERN_TYPE_MD5_SLTPW
;
7213 dgst_size
= DGST_SIZE_4_4
;
7214 parse_func
= skype_parse_hash
;
7215 sort_by_digest
= sort_by_digest_4_4
;
7216 opti_type
= OPTI_TYPE_ZERO_BYTE
7217 | OPTI_TYPE_PRECOMPUTE_INIT
7218 | OPTI_TYPE_PRECOMPUTE_MERKLE
7219 | OPTI_TYPE_EARLY_SKIP
7220 | OPTI_TYPE_NOT_ITERATED
7221 | OPTI_TYPE_PREPENDED_SALT
7222 | OPTI_TYPE_RAW_HASH
;
7229 case 30: hash_type
= HASH_TYPE_MD5
;
7230 salt_type
= SALT_TYPE_INTERN
;
7231 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7232 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7233 | OPTS_TYPE_PT_UNICODE
7234 | OPTS_TYPE_ST_ADD80
7235 | OPTS_TYPE_ST_ADDBITS14
;
7236 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7237 dgst_size
= DGST_SIZE_4_4
;
7238 parse_func
= md5s_parse_hash
;
7239 sort_by_digest
= sort_by_digest_4_4
;
7240 opti_type
= OPTI_TYPE_ZERO_BYTE
7241 | OPTI_TYPE_PRECOMPUTE_INIT
7242 | OPTI_TYPE_PRECOMPUTE_MERKLE
7243 | OPTI_TYPE_MEET_IN_MIDDLE
7244 | OPTI_TYPE_EARLY_SKIP
7245 | OPTI_TYPE_NOT_ITERATED
7246 | OPTI_TYPE_APPENDED_SALT
7247 | OPTI_TYPE_RAW_HASH
;
7254 case 40: hash_type
= HASH_TYPE_MD5
;
7255 salt_type
= SALT_TYPE_INTERN
;
7256 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7257 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7258 | OPTS_TYPE_PT_ADD80
7259 | OPTS_TYPE_PT_ADDBITS14
7260 | OPTS_TYPE_PT_UNICODE
;
7261 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7262 dgst_size
= DGST_SIZE_4_4
;
7263 parse_func
= md5s_parse_hash
;
7264 sort_by_digest
= sort_by_digest_4_4
;
7265 opti_type
= OPTI_TYPE_ZERO_BYTE
7266 | OPTI_TYPE_PRECOMPUTE_INIT
7267 | OPTI_TYPE_PRECOMPUTE_MERKLE
7268 | OPTI_TYPE_EARLY_SKIP
7269 | OPTI_TYPE_NOT_ITERATED
7270 | OPTI_TYPE_PREPENDED_SALT
7271 | OPTI_TYPE_RAW_HASH
;
7278 case 50: hash_type
= HASH_TYPE_MD5
;
7279 salt_type
= SALT_TYPE_INTERN
;
7280 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7281 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7282 | OPTS_TYPE_ST_ADD80
7283 | OPTS_TYPE_ST_ADDBITS14
;
7284 kern_type
= KERN_TYPE_HMACMD5_PW
;
7285 dgst_size
= DGST_SIZE_4_4
;
7286 parse_func
= hmacmd5_parse_hash
;
7287 sort_by_digest
= sort_by_digest_4_4
;
7288 opti_type
= OPTI_TYPE_ZERO_BYTE
7289 | OPTI_TYPE_NOT_ITERATED
;
7296 case 60: hash_type
= HASH_TYPE_MD5
;
7297 salt_type
= SALT_TYPE_INTERN
;
7298 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7299 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7300 | OPTS_TYPE_PT_ADD80
7301 | OPTS_TYPE_PT_ADDBITS14
;
7302 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7303 dgst_size
= DGST_SIZE_4_4
;
7304 parse_func
= hmacmd5_parse_hash
;
7305 sort_by_digest
= sort_by_digest_4_4
;
7306 opti_type
= OPTI_TYPE_ZERO_BYTE
7307 | OPTI_TYPE_NOT_ITERATED
;
7314 case 100: hash_type
= HASH_TYPE_SHA1
;
7315 salt_type
= SALT_TYPE_NONE
;
7316 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7317 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7318 | OPTS_TYPE_PT_ADD80
7319 | OPTS_TYPE_PT_ADDBITS15
;
7320 kern_type
= KERN_TYPE_SHA1
;
7321 dgst_size
= DGST_SIZE_4_5
;
7322 parse_func
= sha1_parse_hash
;
7323 sort_by_digest
= sort_by_digest_4_5
;
7324 opti_type
= OPTI_TYPE_ZERO_BYTE
7325 | OPTI_TYPE_PRECOMPUTE_INIT
7326 | OPTI_TYPE_PRECOMPUTE_MERKLE
7327 | OPTI_TYPE_EARLY_SKIP
7328 | OPTI_TYPE_NOT_ITERATED
7329 | OPTI_TYPE_NOT_SALTED
7330 | OPTI_TYPE_RAW_HASH
;
7337 case 101: hash_type
= HASH_TYPE_SHA1
;
7338 salt_type
= SALT_TYPE_NONE
;
7339 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7340 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7341 | OPTS_TYPE_PT_ADD80
7342 | OPTS_TYPE_PT_ADDBITS15
;
7343 kern_type
= KERN_TYPE_SHA1
;
7344 dgst_size
= DGST_SIZE_4_5
;
7345 parse_func
= sha1b64_parse_hash
;
7346 sort_by_digest
= sort_by_digest_4_5
;
7347 opti_type
= OPTI_TYPE_ZERO_BYTE
7348 | OPTI_TYPE_PRECOMPUTE_INIT
7349 | OPTI_TYPE_PRECOMPUTE_MERKLE
7350 | OPTI_TYPE_EARLY_SKIP
7351 | OPTI_TYPE_NOT_ITERATED
7352 | OPTI_TYPE_NOT_SALTED
7353 | OPTI_TYPE_RAW_HASH
;
7360 case 110: hash_type
= HASH_TYPE_SHA1
;
7361 salt_type
= SALT_TYPE_INTERN
;
7362 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7363 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7364 | OPTS_TYPE_ST_ADD80
7365 | OPTS_TYPE_ST_ADDBITS15
;
7366 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7367 dgst_size
= DGST_SIZE_4_5
;
7368 parse_func
= sha1s_parse_hash
;
7369 sort_by_digest
= sort_by_digest_4_5
;
7370 opti_type
= OPTI_TYPE_ZERO_BYTE
7371 | OPTI_TYPE_PRECOMPUTE_INIT
7372 | OPTI_TYPE_PRECOMPUTE_MERKLE
7373 | OPTI_TYPE_EARLY_SKIP
7374 | OPTI_TYPE_NOT_ITERATED
7375 | OPTI_TYPE_APPENDED_SALT
7376 | OPTI_TYPE_RAW_HASH
;
7383 case 111: hash_type
= HASH_TYPE_SHA1
;
7384 salt_type
= SALT_TYPE_EMBEDDED
;
7385 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7386 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7387 | OPTS_TYPE_ST_ADD80
7388 | OPTS_TYPE_ST_ADDBITS15
;
7389 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7390 dgst_size
= DGST_SIZE_4_5
;
7391 parse_func
= sha1b64s_parse_hash
;
7392 sort_by_digest
= sort_by_digest_4_5
;
7393 opti_type
= OPTI_TYPE_ZERO_BYTE
7394 | OPTI_TYPE_PRECOMPUTE_INIT
7395 | OPTI_TYPE_PRECOMPUTE_MERKLE
7396 | OPTI_TYPE_EARLY_SKIP
7397 | OPTI_TYPE_NOT_ITERATED
7398 | OPTI_TYPE_APPENDED_SALT
7399 | OPTI_TYPE_RAW_HASH
;
7406 case 112: hash_type
= HASH_TYPE_SHA1
;
7407 salt_type
= SALT_TYPE_INTERN
;
7408 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7409 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7410 | OPTS_TYPE_ST_ADD80
7411 | OPTS_TYPE_ST_ADDBITS15
7413 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7414 dgst_size
= DGST_SIZE_4_5
;
7415 parse_func
= oracles_parse_hash
;
7416 sort_by_digest
= sort_by_digest_4_5
;
7417 opti_type
= OPTI_TYPE_ZERO_BYTE
7418 | OPTI_TYPE_PRECOMPUTE_INIT
7419 | OPTI_TYPE_PRECOMPUTE_MERKLE
7420 | OPTI_TYPE_EARLY_SKIP
7421 | OPTI_TYPE_NOT_ITERATED
7422 | OPTI_TYPE_APPENDED_SALT
7423 | OPTI_TYPE_RAW_HASH
;
7430 case 120: hash_type
= HASH_TYPE_SHA1
;
7431 salt_type
= SALT_TYPE_INTERN
;
7432 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7433 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7434 | OPTS_TYPE_PT_ADD80
7435 | OPTS_TYPE_PT_ADDBITS15
;
7436 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7437 dgst_size
= DGST_SIZE_4_5
;
7438 parse_func
= sha1s_parse_hash
;
7439 sort_by_digest
= sort_by_digest_4_5
;
7440 opti_type
= OPTI_TYPE_ZERO_BYTE
7441 | OPTI_TYPE_PRECOMPUTE_INIT
7442 | OPTI_TYPE_PRECOMPUTE_MERKLE
7443 | OPTI_TYPE_EARLY_SKIP
7444 | OPTI_TYPE_NOT_ITERATED
7445 | OPTI_TYPE_PREPENDED_SALT
7446 | OPTI_TYPE_RAW_HASH
;
7453 case 121: hash_type
= HASH_TYPE_SHA1
;
7454 salt_type
= SALT_TYPE_INTERN
;
7455 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7456 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7457 | OPTS_TYPE_PT_ADD80
7458 | OPTS_TYPE_PT_ADDBITS15
7459 | OPTS_TYPE_ST_LOWER
;
7460 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7461 dgst_size
= DGST_SIZE_4_5
;
7462 parse_func
= smf_parse_hash
;
7463 sort_by_digest
= sort_by_digest_4_5
;
7464 opti_type
= OPTI_TYPE_ZERO_BYTE
7465 | OPTI_TYPE_PRECOMPUTE_INIT
7466 | OPTI_TYPE_PRECOMPUTE_MERKLE
7467 | OPTI_TYPE_EARLY_SKIP
7468 | OPTI_TYPE_NOT_ITERATED
7469 | OPTI_TYPE_PREPENDED_SALT
7470 | OPTI_TYPE_RAW_HASH
;
7477 case 122: hash_type
= HASH_TYPE_SHA1
;
7478 salt_type
= SALT_TYPE_EMBEDDED
;
7479 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7480 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7481 | OPTS_TYPE_PT_ADD80
7482 | OPTS_TYPE_PT_ADDBITS15
7484 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7485 dgst_size
= DGST_SIZE_4_5
;
7486 parse_func
= osx1_parse_hash
;
7487 sort_by_digest
= sort_by_digest_4_5
;
7488 opti_type
= OPTI_TYPE_ZERO_BYTE
7489 | OPTI_TYPE_PRECOMPUTE_INIT
7490 | OPTI_TYPE_PRECOMPUTE_MERKLE
7491 | OPTI_TYPE_EARLY_SKIP
7492 | OPTI_TYPE_NOT_ITERATED
7493 | OPTI_TYPE_PREPENDED_SALT
7494 | OPTI_TYPE_RAW_HASH
;
7501 case 124: hash_type
= HASH_TYPE_SHA1
;
7502 salt_type
= SALT_TYPE_EMBEDDED
;
7503 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7504 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7505 | OPTS_TYPE_PT_ADD80
7506 | OPTS_TYPE_PT_ADDBITS15
;
7507 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7508 dgst_size
= DGST_SIZE_4_5
;
7509 parse_func
= djangosha1_parse_hash
;
7510 sort_by_digest
= sort_by_digest_4_5
;
7511 opti_type
= OPTI_TYPE_ZERO_BYTE
7512 | OPTI_TYPE_PRECOMPUTE_INIT
7513 | OPTI_TYPE_PRECOMPUTE_MERKLE
7514 | OPTI_TYPE_EARLY_SKIP
7515 | OPTI_TYPE_NOT_ITERATED
7516 | OPTI_TYPE_PREPENDED_SALT
7517 | OPTI_TYPE_RAW_HASH
;
7524 case 125: hash_type
= HASH_TYPE_SHA1
;
7525 salt_type
= SALT_TYPE_EMBEDDED
;
7526 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7527 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7528 | OPTS_TYPE_PT_ADD80
7529 | OPTS_TYPE_PT_ADDBITS15
7531 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7532 dgst_size
= DGST_SIZE_4_5
;
7533 parse_func
= arubaos_parse_hash
;
7534 sort_by_digest
= sort_by_digest_4_5
;
7535 opti_type
= OPTI_TYPE_ZERO_BYTE
7536 | OPTI_TYPE_PRECOMPUTE_INIT
7537 | OPTI_TYPE_PRECOMPUTE_MERKLE
7538 | OPTI_TYPE_EARLY_SKIP
7539 | OPTI_TYPE_NOT_ITERATED
7540 | OPTI_TYPE_PREPENDED_SALT
7541 | OPTI_TYPE_RAW_HASH
;
7548 case 130: hash_type
= HASH_TYPE_SHA1
;
7549 salt_type
= SALT_TYPE_INTERN
;
7550 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7551 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7552 | OPTS_TYPE_PT_UNICODE
7553 | OPTS_TYPE_ST_ADD80
7554 | OPTS_TYPE_ST_ADDBITS15
;
7555 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7556 dgst_size
= DGST_SIZE_4_5
;
7557 parse_func
= sha1s_parse_hash
;
7558 sort_by_digest
= sort_by_digest_4_5
;
7559 opti_type
= OPTI_TYPE_ZERO_BYTE
7560 | OPTI_TYPE_PRECOMPUTE_INIT
7561 | OPTI_TYPE_PRECOMPUTE_MERKLE
7562 | OPTI_TYPE_EARLY_SKIP
7563 | OPTI_TYPE_NOT_ITERATED
7564 | OPTI_TYPE_APPENDED_SALT
7565 | OPTI_TYPE_RAW_HASH
;
7572 case 131: hash_type
= HASH_TYPE_SHA1
;
7573 salt_type
= SALT_TYPE_EMBEDDED
;
7574 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7575 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7576 | OPTS_TYPE_PT_UNICODE
7577 | OPTS_TYPE_PT_UPPER
7578 | OPTS_TYPE_ST_ADD80
7579 | OPTS_TYPE_ST_ADDBITS15
7581 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7582 dgst_size
= DGST_SIZE_4_5
;
7583 parse_func
= mssql2000_parse_hash
;
7584 sort_by_digest
= sort_by_digest_4_5
;
7585 opti_type
= OPTI_TYPE_ZERO_BYTE
7586 | OPTI_TYPE_PRECOMPUTE_INIT
7587 | OPTI_TYPE_PRECOMPUTE_MERKLE
7588 | OPTI_TYPE_EARLY_SKIP
7589 | OPTI_TYPE_NOT_ITERATED
7590 | OPTI_TYPE_APPENDED_SALT
7591 | OPTI_TYPE_RAW_HASH
;
7598 case 132: hash_type
= HASH_TYPE_SHA1
;
7599 salt_type
= SALT_TYPE_EMBEDDED
;
7600 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7601 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7602 | OPTS_TYPE_PT_UNICODE
7603 | OPTS_TYPE_ST_ADD80
7604 | OPTS_TYPE_ST_ADDBITS15
7606 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7607 dgst_size
= DGST_SIZE_4_5
;
7608 parse_func
= mssql2005_parse_hash
;
7609 sort_by_digest
= sort_by_digest_4_5
;
7610 opti_type
= OPTI_TYPE_ZERO_BYTE
7611 | OPTI_TYPE_PRECOMPUTE_INIT
7612 | OPTI_TYPE_PRECOMPUTE_MERKLE
7613 | OPTI_TYPE_EARLY_SKIP
7614 | OPTI_TYPE_NOT_ITERATED
7615 | OPTI_TYPE_APPENDED_SALT
7616 | OPTI_TYPE_RAW_HASH
;
7623 case 133: hash_type
= HASH_TYPE_SHA1
;
7624 salt_type
= SALT_TYPE_EMBEDDED
;
7625 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7626 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7627 | OPTS_TYPE_PT_UNICODE
7628 | OPTS_TYPE_ST_ADD80
7629 | OPTS_TYPE_ST_ADDBITS15
;
7630 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7631 dgst_size
= DGST_SIZE_4_5
;
7632 parse_func
= peoplesoft_parse_hash
;
7633 sort_by_digest
= sort_by_digest_4_5
;
7634 opti_type
= OPTI_TYPE_ZERO_BYTE
7635 | OPTI_TYPE_PRECOMPUTE_INIT
7636 | OPTI_TYPE_PRECOMPUTE_MERKLE
7637 | OPTI_TYPE_EARLY_SKIP
7638 | OPTI_TYPE_NOT_ITERATED
7639 | OPTI_TYPE_APPENDED_SALT
7640 | OPTI_TYPE_RAW_HASH
;
7647 case 140: hash_type
= HASH_TYPE_SHA1
;
7648 salt_type
= SALT_TYPE_INTERN
;
7649 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7650 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7651 | OPTS_TYPE_PT_ADD80
7652 | OPTS_TYPE_PT_ADDBITS15
7653 | OPTS_TYPE_PT_UNICODE
;
7654 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7655 dgst_size
= DGST_SIZE_4_5
;
7656 parse_func
= sha1s_parse_hash
;
7657 sort_by_digest
= sort_by_digest_4_5
;
7658 opti_type
= OPTI_TYPE_ZERO_BYTE
7659 | OPTI_TYPE_PRECOMPUTE_INIT
7660 | OPTI_TYPE_PRECOMPUTE_MERKLE
7661 | OPTI_TYPE_EARLY_SKIP
7662 | OPTI_TYPE_NOT_ITERATED
7663 | OPTI_TYPE_PREPENDED_SALT
7664 | OPTI_TYPE_RAW_HASH
;
7671 case 141: hash_type
= HASH_TYPE_SHA1
;
7672 salt_type
= SALT_TYPE_EMBEDDED
;
7673 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7674 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7675 | OPTS_TYPE_PT_ADD80
7676 | OPTS_TYPE_PT_ADDBITS15
7677 | OPTS_TYPE_PT_UNICODE
7678 | OPTS_TYPE_ST_BASE64
;
7679 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7680 dgst_size
= DGST_SIZE_4_5
;
7681 parse_func
= episerver_parse_hash
;
7682 sort_by_digest
= sort_by_digest_4_5
;
7683 opti_type
= OPTI_TYPE_ZERO_BYTE
7684 | OPTI_TYPE_PRECOMPUTE_INIT
7685 | OPTI_TYPE_PRECOMPUTE_MERKLE
7686 | OPTI_TYPE_EARLY_SKIP
7687 | OPTI_TYPE_NOT_ITERATED
7688 | OPTI_TYPE_PREPENDED_SALT
7689 | OPTI_TYPE_RAW_HASH
;
7696 case 150: hash_type
= HASH_TYPE_SHA1
;
7697 salt_type
= SALT_TYPE_INTERN
;
7698 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7699 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7700 | OPTS_TYPE_ST_ADD80
7701 | OPTS_TYPE_ST_ADDBITS15
;
7702 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7703 dgst_size
= DGST_SIZE_4_5
;
7704 parse_func
= hmacsha1_parse_hash
;
7705 sort_by_digest
= sort_by_digest_4_5
;
7706 opti_type
= OPTI_TYPE_ZERO_BYTE
7707 | OPTI_TYPE_NOT_ITERATED
;
7714 case 160: hash_type
= HASH_TYPE_SHA1
;
7715 salt_type
= SALT_TYPE_INTERN
;
7716 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7717 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7718 | OPTS_TYPE_PT_ADD80
7719 | OPTS_TYPE_PT_ADDBITS15
;
7720 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7721 dgst_size
= DGST_SIZE_4_5
;
7722 parse_func
= hmacsha1_parse_hash
;
7723 sort_by_digest
= sort_by_digest_4_5
;
7724 opti_type
= OPTI_TYPE_ZERO_BYTE
7725 | OPTI_TYPE_NOT_ITERATED
;
7732 case 190: hash_type
= HASH_TYPE_SHA1
;
7733 salt_type
= SALT_TYPE_NONE
;
7734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7735 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7736 | OPTS_TYPE_PT_ADD80
7737 | OPTS_TYPE_PT_ADDBITS15
;
7738 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7739 dgst_size
= DGST_SIZE_4_5
;
7740 parse_func
= sha1linkedin_parse_hash
;
7741 sort_by_digest
= sort_by_digest_4_5
;
7742 opti_type
= OPTI_TYPE_ZERO_BYTE
7743 | OPTI_TYPE_PRECOMPUTE_INIT
7744 | OPTI_TYPE_EARLY_SKIP
7745 | OPTI_TYPE_NOT_ITERATED
7746 | OPTI_TYPE_NOT_SALTED
;
7753 case 200: hash_type
= HASH_TYPE_MYSQL
;
7754 salt_type
= SALT_TYPE_NONE
;
7755 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7757 kern_type
= KERN_TYPE_MYSQL
;
7758 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7759 parse_func
= mysql323_parse_hash
;
7760 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7761 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7768 case 300: hash_type
= HASH_TYPE_SHA1
;
7769 salt_type
= SALT_TYPE_NONE
;
7770 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7771 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7772 | OPTS_TYPE_PT_ADD80
7773 | OPTS_TYPE_PT_ADDBITS15
;
7774 kern_type
= KERN_TYPE_MYSQL41
;
7775 dgst_size
= DGST_SIZE_4_5
;
7776 parse_func
= sha1_parse_hash
;
7777 sort_by_digest
= sort_by_digest_4_5
;
7778 opti_type
= OPTI_TYPE_ZERO_BYTE
7779 | OPTI_TYPE_PRECOMPUTE_INIT
7780 | OPTI_TYPE_PRECOMPUTE_MERKLE
7781 | OPTI_TYPE_EARLY_SKIP
7782 | OPTI_TYPE_NOT_ITERATED
7783 | OPTI_TYPE_NOT_SALTED
;
7790 case 400: hash_type
= HASH_TYPE_MD5
;
7791 salt_type
= SALT_TYPE_EMBEDDED
;
7792 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7793 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7794 kern_type
= KERN_TYPE_PHPASS
;
7795 dgst_size
= DGST_SIZE_4_4
;
7796 parse_func
= phpass_parse_hash
;
7797 sort_by_digest
= sort_by_digest_4_4
;
7798 opti_type
= OPTI_TYPE_ZERO_BYTE
7799 | OPTI_TYPE_SLOW_HASH_SIMD
;
7806 case 500: hash_type
= HASH_TYPE_MD5
;
7807 salt_type
= SALT_TYPE_EMBEDDED
;
7808 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7810 kern_type
= KERN_TYPE_MD5CRYPT
;
7811 dgst_size
= DGST_SIZE_4_4
;
7812 parse_func
= md5crypt_parse_hash
;
7813 sort_by_digest
= sort_by_digest_4_4
;
7814 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7821 case 501: hash_type
= HASH_TYPE_MD5
;
7822 salt_type
= SALT_TYPE_EMBEDDED
;
7823 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7824 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7825 | OPTS_TYPE_HASH_COPY
;
7826 kern_type
= KERN_TYPE_MD5CRYPT
;
7827 dgst_size
= DGST_SIZE_4_4
;
7828 parse_func
= juniper_parse_hash
;
7829 sort_by_digest
= sort_by_digest_4_4
;
7830 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7837 case 900: hash_type
= HASH_TYPE_MD4
;
7838 salt_type
= SALT_TYPE_NONE
;
7839 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7840 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7841 | OPTS_TYPE_PT_ADD80
7842 | OPTS_TYPE_PT_ADDBITS14
;
7843 kern_type
= KERN_TYPE_MD4
;
7844 dgst_size
= DGST_SIZE_4_4
;
7845 parse_func
= md4_parse_hash
;
7846 sort_by_digest
= sort_by_digest_4_4
;
7847 opti_type
= OPTI_TYPE_ZERO_BYTE
7848 | OPTI_TYPE_PRECOMPUTE_INIT
7849 | OPTI_TYPE_PRECOMPUTE_MERKLE
7850 | OPTI_TYPE_MEET_IN_MIDDLE
7851 | OPTI_TYPE_EARLY_SKIP
7852 | OPTI_TYPE_NOT_ITERATED
7853 | OPTI_TYPE_NOT_SALTED
7854 | OPTI_TYPE_RAW_HASH
;
7861 case 1000: hash_type
= HASH_TYPE_MD4
;
7862 salt_type
= SALT_TYPE_NONE
;
7863 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7864 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7865 | OPTS_TYPE_PT_ADD80
7866 | OPTS_TYPE_PT_ADDBITS14
7867 | OPTS_TYPE_PT_UNICODE
;
7868 kern_type
= KERN_TYPE_MD4_PWU
;
7869 dgst_size
= DGST_SIZE_4_4
;
7870 parse_func
= md4_parse_hash
;
7871 sort_by_digest
= sort_by_digest_4_4
;
7872 opti_type
= OPTI_TYPE_ZERO_BYTE
7873 | OPTI_TYPE_PRECOMPUTE_INIT
7874 | OPTI_TYPE_PRECOMPUTE_MERKLE
7875 | OPTI_TYPE_MEET_IN_MIDDLE
7876 | OPTI_TYPE_EARLY_SKIP
7877 | OPTI_TYPE_NOT_ITERATED
7878 | OPTI_TYPE_NOT_SALTED
7879 | OPTI_TYPE_RAW_HASH
;
7886 case 1100: hash_type
= HASH_TYPE_MD4
;
7887 salt_type
= SALT_TYPE_INTERN
;
7888 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7889 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7890 | OPTS_TYPE_PT_ADD80
7891 | OPTS_TYPE_PT_ADDBITS14
7892 | OPTS_TYPE_PT_UNICODE
7893 | OPTS_TYPE_ST_ADD80
7894 | OPTS_TYPE_ST_UNICODE
7895 | OPTS_TYPE_ST_LOWER
;
7896 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7897 dgst_size
= DGST_SIZE_4_4
;
7898 parse_func
= dcc_parse_hash
;
7899 sort_by_digest
= sort_by_digest_4_4
;
7900 opti_type
= OPTI_TYPE_ZERO_BYTE
7901 | OPTI_TYPE_PRECOMPUTE_INIT
7902 | OPTI_TYPE_PRECOMPUTE_MERKLE
7903 | OPTI_TYPE_EARLY_SKIP
7904 | OPTI_TYPE_NOT_ITERATED
;
7911 case 1400: hash_type
= HASH_TYPE_SHA256
;
7912 salt_type
= SALT_TYPE_NONE
;
7913 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7914 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7915 | OPTS_TYPE_PT_ADD80
7916 | OPTS_TYPE_PT_ADDBITS15
;
7917 kern_type
= KERN_TYPE_SHA256
;
7918 dgst_size
= DGST_SIZE_4_8
;
7919 parse_func
= sha256_parse_hash
;
7920 sort_by_digest
= sort_by_digest_4_8
;
7921 opti_type
= OPTI_TYPE_ZERO_BYTE
7922 | OPTI_TYPE_PRECOMPUTE_INIT
7923 | OPTI_TYPE_PRECOMPUTE_MERKLE
7924 | OPTI_TYPE_EARLY_SKIP
7925 | OPTI_TYPE_NOT_ITERATED
7926 | OPTI_TYPE_NOT_SALTED
7927 | OPTI_TYPE_RAW_HASH
;
7934 case 1410: hash_type
= HASH_TYPE_SHA256
;
7935 salt_type
= SALT_TYPE_INTERN
;
7936 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7937 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7938 | OPTS_TYPE_ST_ADD80
7939 | OPTS_TYPE_ST_ADDBITS15
;
7940 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7941 dgst_size
= DGST_SIZE_4_8
;
7942 parse_func
= sha256s_parse_hash
;
7943 sort_by_digest
= sort_by_digest_4_8
;
7944 opti_type
= OPTI_TYPE_ZERO_BYTE
7945 | OPTI_TYPE_PRECOMPUTE_INIT
7946 | OPTI_TYPE_PRECOMPUTE_MERKLE
7947 | OPTI_TYPE_EARLY_SKIP
7948 | OPTI_TYPE_NOT_ITERATED
7949 | OPTI_TYPE_APPENDED_SALT
7950 | OPTI_TYPE_RAW_HASH
;
7957 case 1420: hash_type
= HASH_TYPE_SHA256
;
7958 salt_type
= SALT_TYPE_INTERN
;
7959 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7960 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7961 | OPTS_TYPE_PT_ADD80
7962 | OPTS_TYPE_PT_ADDBITS15
;
7963 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7964 dgst_size
= DGST_SIZE_4_8
;
7965 parse_func
= sha256s_parse_hash
;
7966 sort_by_digest
= sort_by_digest_4_8
;
7967 opti_type
= OPTI_TYPE_ZERO_BYTE
7968 | OPTI_TYPE_PRECOMPUTE_INIT
7969 | OPTI_TYPE_PRECOMPUTE_MERKLE
7970 | OPTI_TYPE_EARLY_SKIP
7971 | OPTI_TYPE_NOT_ITERATED
7972 | OPTI_TYPE_PREPENDED_SALT
7973 | OPTI_TYPE_RAW_HASH
;
7980 case 1421: hash_type
= HASH_TYPE_SHA256
;
7981 salt_type
= SALT_TYPE_EMBEDDED
;
7982 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7983 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7984 | OPTS_TYPE_PT_ADD80
7985 | OPTS_TYPE_PT_ADDBITS15
;
7986 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7987 dgst_size
= DGST_SIZE_4_8
;
7988 parse_func
= hmailserver_parse_hash
;
7989 sort_by_digest
= sort_by_digest_4_8
;
7990 opti_type
= OPTI_TYPE_ZERO_BYTE
7991 | OPTI_TYPE_PRECOMPUTE_INIT
7992 | OPTI_TYPE_PRECOMPUTE_MERKLE
7993 | OPTI_TYPE_EARLY_SKIP
7994 | OPTI_TYPE_NOT_ITERATED
7995 | OPTI_TYPE_PREPENDED_SALT
7996 | OPTI_TYPE_RAW_HASH
;
8003 case 1430: hash_type
= HASH_TYPE_SHA256
;
8004 salt_type
= SALT_TYPE_INTERN
;
8005 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8006 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8007 | OPTS_TYPE_PT_UNICODE
8008 | OPTS_TYPE_ST_ADD80
8009 | OPTS_TYPE_ST_ADDBITS15
;
8010 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8011 dgst_size
= DGST_SIZE_4_8
;
8012 parse_func
= sha256s_parse_hash
;
8013 sort_by_digest
= sort_by_digest_4_8
;
8014 opti_type
= OPTI_TYPE_ZERO_BYTE
8015 | OPTI_TYPE_PRECOMPUTE_INIT
8016 | OPTI_TYPE_PRECOMPUTE_MERKLE
8017 | OPTI_TYPE_EARLY_SKIP
8018 | OPTI_TYPE_NOT_ITERATED
8019 | OPTI_TYPE_APPENDED_SALT
8020 | OPTI_TYPE_RAW_HASH
;
8027 case 1440: hash_type
= HASH_TYPE_SHA256
;
8028 salt_type
= SALT_TYPE_INTERN
;
8029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8030 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8031 | OPTS_TYPE_PT_ADD80
8032 | OPTS_TYPE_PT_ADDBITS15
8033 | OPTS_TYPE_PT_UNICODE
;
8034 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8035 dgst_size
= DGST_SIZE_4_8
;
8036 parse_func
= sha256s_parse_hash
;
8037 sort_by_digest
= sort_by_digest_4_8
;
8038 opti_type
= OPTI_TYPE_ZERO_BYTE
8039 | OPTI_TYPE_PRECOMPUTE_INIT
8040 | OPTI_TYPE_PRECOMPUTE_MERKLE
8041 | OPTI_TYPE_EARLY_SKIP
8042 | OPTI_TYPE_NOT_ITERATED
8043 | OPTI_TYPE_PREPENDED_SALT
8044 | OPTI_TYPE_RAW_HASH
;
8051 case 1441: hash_type
= HASH_TYPE_SHA256
;
8052 salt_type
= SALT_TYPE_EMBEDDED
;
8053 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8054 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8055 | OPTS_TYPE_PT_ADD80
8056 | OPTS_TYPE_PT_ADDBITS15
8057 | OPTS_TYPE_PT_UNICODE
8058 | OPTS_TYPE_ST_BASE64
;
8059 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8060 dgst_size
= DGST_SIZE_4_8
;
8061 parse_func
= episerver4_parse_hash
;
8062 sort_by_digest
= sort_by_digest_4_8
;
8063 opti_type
= OPTI_TYPE_ZERO_BYTE
8064 | OPTI_TYPE_PRECOMPUTE_INIT
8065 | OPTI_TYPE_PRECOMPUTE_MERKLE
8066 | OPTI_TYPE_EARLY_SKIP
8067 | OPTI_TYPE_NOT_ITERATED
8068 | OPTI_TYPE_PREPENDED_SALT
8069 | OPTI_TYPE_RAW_HASH
;
8076 case 1450: hash_type
= HASH_TYPE_SHA256
;
8077 salt_type
= SALT_TYPE_INTERN
;
8078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8079 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8080 | OPTS_TYPE_ST_ADD80
;
8081 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8082 dgst_size
= DGST_SIZE_4_8
;
8083 parse_func
= hmacsha256_parse_hash
;
8084 sort_by_digest
= sort_by_digest_4_8
;
8085 opti_type
= OPTI_TYPE_ZERO_BYTE
8086 | OPTI_TYPE_NOT_ITERATED
;
8093 case 1460: hash_type
= HASH_TYPE_SHA256
;
8094 salt_type
= SALT_TYPE_INTERN
;
8095 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8096 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8097 | OPTS_TYPE_PT_ADD80
8098 | OPTS_TYPE_PT_ADDBITS15
;
8099 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8100 dgst_size
= DGST_SIZE_4_8
;
8101 parse_func
= hmacsha256_parse_hash
;
8102 sort_by_digest
= sort_by_digest_4_8
;
8103 opti_type
= OPTI_TYPE_ZERO_BYTE
8104 | OPTI_TYPE_NOT_ITERATED
;
8111 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8112 salt_type
= SALT_TYPE_EMBEDDED
;
8113 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8115 | OPTS_TYPE_PT_BITSLICE
;
8116 kern_type
= KERN_TYPE_DESCRYPT
;
8117 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8118 parse_func
= descrypt_parse_hash
;
8119 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8120 opti_type
= OPTI_TYPE_ZERO_BYTE
8121 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8128 case 1600: hash_type
= HASH_TYPE_MD5
;
8129 salt_type
= SALT_TYPE_EMBEDDED
;
8130 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8131 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8132 kern_type
= KERN_TYPE_APR1CRYPT
;
8133 dgst_size
= DGST_SIZE_4_4
;
8134 parse_func
= md5apr1_parse_hash
;
8135 sort_by_digest
= sort_by_digest_4_4
;
8136 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8143 case 1700: hash_type
= HASH_TYPE_SHA512
;
8144 salt_type
= SALT_TYPE_NONE
;
8145 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8146 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8147 | OPTS_TYPE_PT_ADD80
8148 | OPTS_TYPE_PT_ADDBITS15
;
8149 kern_type
= KERN_TYPE_SHA512
;
8150 dgst_size
= DGST_SIZE_8_8
;
8151 parse_func
= sha512_parse_hash
;
8152 sort_by_digest
= sort_by_digest_8_8
;
8153 opti_type
= OPTI_TYPE_ZERO_BYTE
8154 | OPTI_TYPE_PRECOMPUTE_INIT
8155 | OPTI_TYPE_PRECOMPUTE_MERKLE
8156 | OPTI_TYPE_EARLY_SKIP
8157 | OPTI_TYPE_NOT_ITERATED
8158 | OPTI_TYPE_NOT_SALTED
8159 | OPTI_TYPE_USES_BITS_64
8160 | OPTI_TYPE_RAW_HASH
;
8167 case 1710: hash_type
= HASH_TYPE_SHA512
;
8168 salt_type
= SALT_TYPE_INTERN
;
8169 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8170 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8171 | OPTS_TYPE_ST_ADD80
8172 | OPTS_TYPE_ST_ADDBITS15
;
8173 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8174 dgst_size
= DGST_SIZE_8_8
;
8175 parse_func
= sha512s_parse_hash
;
8176 sort_by_digest
= sort_by_digest_8_8
;
8177 opti_type
= OPTI_TYPE_ZERO_BYTE
8178 | OPTI_TYPE_PRECOMPUTE_INIT
8179 | OPTI_TYPE_PRECOMPUTE_MERKLE
8180 | OPTI_TYPE_EARLY_SKIP
8181 | OPTI_TYPE_NOT_ITERATED
8182 | OPTI_TYPE_APPENDED_SALT
8183 | OPTI_TYPE_USES_BITS_64
8184 | OPTI_TYPE_RAW_HASH
;
8191 case 1711: hash_type
= HASH_TYPE_SHA512
;
8192 salt_type
= SALT_TYPE_EMBEDDED
;
8193 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8194 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8195 | OPTS_TYPE_ST_ADD80
8196 | OPTS_TYPE_ST_ADDBITS15
;
8197 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8198 dgst_size
= DGST_SIZE_8_8
;
8199 parse_func
= sha512b64s_parse_hash
;
8200 sort_by_digest
= sort_by_digest_8_8
;
8201 opti_type
= OPTI_TYPE_ZERO_BYTE
8202 | OPTI_TYPE_PRECOMPUTE_INIT
8203 | OPTI_TYPE_PRECOMPUTE_MERKLE
8204 | OPTI_TYPE_EARLY_SKIP
8205 | OPTI_TYPE_NOT_ITERATED
8206 | OPTI_TYPE_APPENDED_SALT
8207 | OPTI_TYPE_USES_BITS_64
8208 | OPTI_TYPE_RAW_HASH
;
8215 case 1720: hash_type
= HASH_TYPE_SHA512
;
8216 salt_type
= SALT_TYPE_INTERN
;
8217 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8218 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8219 | OPTS_TYPE_PT_ADD80
8220 | OPTS_TYPE_PT_ADDBITS15
;
8221 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8222 dgst_size
= DGST_SIZE_8_8
;
8223 parse_func
= sha512s_parse_hash
;
8224 sort_by_digest
= sort_by_digest_8_8
;
8225 opti_type
= OPTI_TYPE_ZERO_BYTE
8226 | OPTI_TYPE_PRECOMPUTE_INIT
8227 | OPTI_TYPE_PRECOMPUTE_MERKLE
8228 | OPTI_TYPE_EARLY_SKIP
8229 | OPTI_TYPE_NOT_ITERATED
8230 | OPTI_TYPE_PREPENDED_SALT
8231 | OPTI_TYPE_USES_BITS_64
8232 | OPTI_TYPE_RAW_HASH
;
8239 case 1722: hash_type
= HASH_TYPE_SHA512
;
8240 salt_type
= SALT_TYPE_EMBEDDED
;
8241 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8242 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8243 | OPTS_TYPE_PT_ADD80
8244 | OPTS_TYPE_PT_ADDBITS15
8246 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8247 dgst_size
= DGST_SIZE_8_8
;
8248 parse_func
= osx512_parse_hash
;
8249 sort_by_digest
= sort_by_digest_8_8
;
8250 opti_type
= OPTI_TYPE_ZERO_BYTE
8251 | OPTI_TYPE_PRECOMPUTE_INIT
8252 | OPTI_TYPE_PRECOMPUTE_MERKLE
8253 | OPTI_TYPE_EARLY_SKIP
8254 | OPTI_TYPE_NOT_ITERATED
8255 | OPTI_TYPE_PREPENDED_SALT
8256 | OPTI_TYPE_USES_BITS_64
8257 | OPTI_TYPE_RAW_HASH
;
8264 case 1730: hash_type
= HASH_TYPE_SHA512
;
8265 salt_type
= SALT_TYPE_INTERN
;
8266 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8267 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8268 | OPTS_TYPE_PT_UNICODE
8269 | OPTS_TYPE_ST_ADD80
8270 | OPTS_TYPE_ST_ADDBITS15
;
8271 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8272 dgst_size
= DGST_SIZE_8_8
;
8273 parse_func
= sha512s_parse_hash
;
8274 sort_by_digest
= sort_by_digest_8_8
;
8275 opti_type
= OPTI_TYPE_ZERO_BYTE
8276 | OPTI_TYPE_PRECOMPUTE_INIT
8277 | OPTI_TYPE_PRECOMPUTE_MERKLE
8278 | OPTI_TYPE_EARLY_SKIP
8279 | OPTI_TYPE_NOT_ITERATED
8280 | OPTI_TYPE_APPENDED_SALT
8281 | OPTI_TYPE_USES_BITS_64
8282 | OPTI_TYPE_RAW_HASH
;
8289 case 1731: hash_type
= HASH_TYPE_SHA512
;
8290 salt_type
= SALT_TYPE_EMBEDDED
;
8291 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8292 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8293 | OPTS_TYPE_PT_UNICODE
8294 | OPTS_TYPE_ST_ADD80
8295 | OPTS_TYPE_ST_ADDBITS15
8297 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8298 dgst_size
= DGST_SIZE_8_8
;
8299 parse_func
= mssql2012_parse_hash
;
8300 sort_by_digest
= sort_by_digest_8_8
;
8301 opti_type
= OPTI_TYPE_ZERO_BYTE
8302 | OPTI_TYPE_PRECOMPUTE_INIT
8303 | OPTI_TYPE_PRECOMPUTE_MERKLE
8304 | OPTI_TYPE_EARLY_SKIP
8305 | OPTI_TYPE_NOT_ITERATED
8306 | OPTI_TYPE_APPENDED_SALT
8307 | OPTI_TYPE_USES_BITS_64
8308 | OPTI_TYPE_RAW_HASH
;
8315 case 1740: hash_type
= HASH_TYPE_SHA512
;
8316 salt_type
= SALT_TYPE_INTERN
;
8317 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8318 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8319 | OPTS_TYPE_PT_ADD80
8320 | OPTS_TYPE_PT_ADDBITS15
8321 | OPTS_TYPE_PT_UNICODE
;
8322 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8323 dgst_size
= DGST_SIZE_8_8
;
8324 parse_func
= sha512s_parse_hash
;
8325 sort_by_digest
= sort_by_digest_8_8
;
8326 opti_type
= OPTI_TYPE_ZERO_BYTE
8327 | OPTI_TYPE_PRECOMPUTE_INIT
8328 | OPTI_TYPE_PRECOMPUTE_MERKLE
8329 | OPTI_TYPE_EARLY_SKIP
8330 | OPTI_TYPE_NOT_ITERATED
8331 | OPTI_TYPE_PREPENDED_SALT
8332 | OPTI_TYPE_USES_BITS_64
8333 | OPTI_TYPE_RAW_HASH
;
8340 case 1750: hash_type
= HASH_TYPE_SHA512
;
8341 salt_type
= SALT_TYPE_INTERN
;
8342 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8343 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8344 | OPTS_TYPE_ST_ADD80
;
8345 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8346 dgst_size
= DGST_SIZE_8_8
;
8347 parse_func
= hmacsha512_parse_hash
;
8348 sort_by_digest
= sort_by_digest_8_8
;
8349 opti_type
= OPTI_TYPE_ZERO_BYTE
8350 | OPTI_TYPE_USES_BITS_64
8351 | OPTI_TYPE_NOT_ITERATED
;
8358 case 1760: hash_type
= HASH_TYPE_SHA512
;
8359 salt_type
= SALT_TYPE_INTERN
;
8360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8361 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8362 | OPTS_TYPE_PT_ADD80
8363 | OPTS_TYPE_PT_ADDBITS15
;
8364 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8365 dgst_size
= DGST_SIZE_8_8
;
8366 parse_func
= hmacsha512_parse_hash
;
8367 sort_by_digest
= sort_by_digest_8_8
;
8368 opti_type
= OPTI_TYPE_ZERO_BYTE
8369 | OPTI_TYPE_USES_BITS_64
8370 | OPTI_TYPE_NOT_ITERATED
;
8377 case 1800: hash_type
= HASH_TYPE_SHA512
;
8378 salt_type
= SALT_TYPE_EMBEDDED
;
8379 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8381 kern_type
= KERN_TYPE_SHA512CRYPT
;
8382 dgst_size
= DGST_SIZE_8_8
;
8383 parse_func
= sha512crypt_parse_hash
;
8384 sort_by_digest
= sort_by_digest_8_8
;
8385 opti_type
= OPTI_TYPE_ZERO_BYTE
8386 | OPTI_TYPE_USES_BITS_64
;
8393 case 2100: hash_type
= HASH_TYPE_DCC2
;
8394 salt_type
= SALT_TYPE_EMBEDDED
;
8395 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8396 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8397 | OPTS_TYPE_ST_LOWER
8398 | OPTS_TYPE_ST_UNICODE
;
8399 kern_type
= KERN_TYPE_DCC2
;
8400 dgst_size
= DGST_SIZE_4_4
;
8401 parse_func
= dcc2_parse_hash
;
8402 sort_by_digest
= sort_by_digest_4_4
;
8403 opti_type
= OPTI_TYPE_ZERO_BYTE
8404 | OPTI_TYPE_SLOW_HASH_SIMD
;
8411 case 2400: hash_type
= HASH_TYPE_MD5
;
8412 salt_type
= SALT_TYPE_NONE
;
8413 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8414 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8415 kern_type
= KERN_TYPE_MD5PIX
;
8416 dgst_size
= DGST_SIZE_4_4
;
8417 parse_func
= md5pix_parse_hash
;
8418 sort_by_digest
= sort_by_digest_4_4
;
8419 opti_type
= OPTI_TYPE_ZERO_BYTE
8420 | OPTI_TYPE_PRECOMPUTE_INIT
8421 | OPTI_TYPE_PRECOMPUTE_MERKLE
8422 | OPTI_TYPE_EARLY_SKIP
8423 | OPTI_TYPE_NOT_ITERATED
8424 | OPTI_TYPE_NOT_SALTED
;
8431 case 2410: hash_type
= HASH_TYPE_MD5
;
8432 salt_type
= SALT_TYPE_INTERN
;
8433 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8434 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8435 kern_type
= KERN_TYPE_MD5ASA
;
8436 dgst_size
= DGST_SIZE_4_4
;
8437 parse_func
= md5asa_parse_hash
;
8438 sort_by_digest
= sort_by_digest_4_4
;
8439 opti_type
= OPTI_TYPE_ZERO_BYTE
8440 | OPTI_TYPE_PRECOMPUTE_INIT
8441 | OPTI_TYPE_PRECOMPUTE_MERKLE
8442 | OPTI_TYPE_EARLY_SKIP
8443 | OPTI_TYPE_NOT_ITERATED
;
8450 case 2500: hash_type
= HASH_TYPE_WPA
;
8451 salt_type
= SALT_TYPE_EMBEDDED
;
8452 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8453 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8454 kern_type
= KERN_TYPE_WPA
;
8455 dgst_size
= DGST_SIZE_4_4
;
8456 parse_func
= wpa_parse_hash
;
8457 sort_by_digest
= sort_by_digest_4_4
;
8458 opti_type
= OPTI_TYPE_ZERO_BYTE
8459 | OPTI_TYPE_SLOW_HASH_SIMD
;
8466 case 2600: hash_type
= HASH_TYPE_MD5
;
8467 salt_type
= SALT_TYPE_VIRTUAL
;
8468 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8469 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8470 | OPTS_TYPE_PT_ADD80
8471 | OPTS_TYPE_PT_ADDBITS14
8472 | OPTS_TYPE_ST_ADD80
;
8473 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8474 dgst_size
= DGST_SIZE_4_4
;
8475 parse_func
= md5md5_parse_hash
;
8476 sort_by_digest
= sort_by_digest_4_4
;
8477 opti_type
= OPTI_TYPE_ZERO_BYTE
8478 | OPTI_TYPE_PRECOMPUTE_INIT
8479 | OPTI_TYPE_PRECOMPUTE_MERKLE
8480 | OPTI_TYPE_EARLY_SKIP
;
8487 case 2611: hash_type
= HASH_TYPE_MD5
;
8488 salt_type
= SALT_TYPE_INTERN
;
8489 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8491 | OPTS_TYPE_PT_ADD80
8492 | OPTS_TYPE_PT_ADDBITS14
8493 | OPTS_TYPE_ST_ADD80
;
8494 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8495 dgst_size
= DGST_SIZE_4_4
;
8496 parse_func
= vb3_parse_hash
;
8497 sort_by_digest
= sort_by_digest_4_4
;
8498 opti_type
= OPTI_TYPE_ZERO_BYTE
8499 | OPTI_TYPE_PRECOMPUTE_INIT
8500 | OPTI_TYPE_PRECOMPUTE_MERKLE
8501 | OPTI_TYPE_EARLY_SKIP
;
8508 case 2612: hash_type
= HASH_TYPE_MD5
;
8509 salt_type
= SALT_TYPE_EMBEDDED
;
8510 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8511 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8512 | OPTS_TYPE_PT_ADD80
8513 | OPTS_TYPE_PT_ADDBITS14
8514 | OPTS_TYPE_ST_ADD80
8516 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8517 dgst_size
= DGST_SIZE_4_4
;
8518 parse_func
= phps_parse_hash
;
8519 sort_by_digest
= sort_by_digest_4_4
;
8520 opti_type
= OPTI_TYPE_ZERO_BYTE
8521 | OPTI_TYPE_PRECOMPUTE_INIT
8522 | OPTI_TYPE_PRECOMPUTE_MERKLE
8523 | OPTI_TYPE_EARLY_SKIP
;
8530 case 2711: hash_type
= HASH_TYPE_MD5
;
8531 salt_type
= SALT_TYPE_INTERN
;
8532 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8533 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8534 | OPTS_TYPE_PT_ADD80
8535 | OPTS_TYPE_PT_ADDBITS14
8536 | OPTS_TYPE_ST_ADD80
;
8537 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8538 dgst_size
= DGST_SIZE_4_4
;
8539 parse_func
= vb30_parse_hash
;
8540 sort_by_digest
= sort_by_digest_4_4
;
8541 opti_type
= OPTI_TYPE_ZERO_BYTE
8542 | OPTI_TYPE_PRECOMPUTE_INIT
8543 | OPTI_TYPE_EARLY_SKIP
;
8550 case 2811: hash_type
= HASH_TYPE_MD5
;
8551 salt_type
= SALT_TYPE_INTERN
;
8552 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8554 | OPTS_TYPE_PT_ADD80
8555 | OPTS_TYPE_PT_ADDBITS14
;
8556 kern_type
= KERN_TYPE_MD55_SLTPW
;
8557 dgst_size
= DGST_SIZE_4_4
;
8558 parse_func
= ipb2_parse_hash
;
8559 sort_by_digest
= sort_by_digest_4_4
;
8560 opti_type
= OPTI_TYPE_ZERO_BYTE
8561 | OPTI_TYPE_PRECOMPUTE_INIT
8562 | OPTI_TYPE_EARLY_SKIP
;
8569 case 3000: hash_type
= HASH_TYPE_LM
;
8570 salt_type
= SALT_TYPE_NONE
;
8571 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8572 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8573 | OPTS_TYPE_PT_UPPER
8574 | OPTS_TYPE_PT_BITSLICE
;
8575 kern_type
= KERN_TYPE_LM
;
8576 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8577 parse_func
= lm_parse_hash
;
8578 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8579 opti_type
= OPTI_TYPE_ZERO_BYTE
8580 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8587 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8588 salt_type
= SALT_TYPE_INTERN
;
8589 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8590 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8591 | OPTS_TYPE_PT_UPPER
8592 | OPTS_TYPE_ST_UPPER
;
8593 kern_type
= KERN_TYPE_ORACLEH
;
8594 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8595 parse_func
= oracleh_parse_hash
;
8596 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8597 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8604 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8605 salt_type
= SALT_TYPE_EMBEDDED
;
8606 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8607 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8608 | OPTS_TYPE_ST_GENERATE_LE
;
8609 kern_type
= KERN_TYPE_BCRYPT
;
8610 dgst_size
= DGST_SIZE_4_6
;
8611 parse_func
= bcrypt_parse_hash
;
8612 sort_by_digest
= sort_by_digest_4_6
;
8613 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8620 case 3710: hash_type
= HASH_TYPE_MD5
;
8621 salt_type
= SALT_TYPE_INTERN
;
8622 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8623 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8624 | OPTS_TYPE_PT_ADD80
8625 | OPTS_TYPE_PT_ADDBITS14
;
8626 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8627 dgst_size
= DGST_SIZE_4_4
;
8628 parse_func
= md5s_parse_hash
;
8629 sort_by_digest
= sort_by_digest_4_4
;
8630 opti_type
= OPTI_TYPE_ZERO_BYTE
8631 | OPTI_TYPE_PRECOMPUTE_INIT
8632 | OPTI_TYPE_PRECOMPUTE_MERKLE
8633 | OPTI_TYPE_EARLY_SKIP
;
8640 case 3711: hash_type
= HASH_TYPE_MD5
;
8641 salt_type
= SALT_TYPE_EMBEDDED
;
8642 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8643 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8644 | OPTS_TYPE_PT_ADD80
8645 | OPTS_TYPE_PT_ADDBITS14
;
8646 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8647 dgst_size
= DGST_SIZE_4_4
;
8648 parse_func
= mediawiki_b_parse_hash
;
8649 sort_by_digest
= sort_by_digest_4_4
;
8650 opti_type
= OPTI_TYPE_ZERO_BYTE
8651 | OPTI_TYPE_PRECOMPUTE_INIT
8652 | OPTI_TYPE_PRECOMPUTE_MERKLE
8653 | OPTI_TYPE_EARLY_SKIP
;
8660 case 3800: hash_type
= HASH_TYPE_MD5
;
8661 salt_type
= SALT_TYPE_INTERN
;
8662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8664 | OPTS_TYPE_ST_ADDBITS14
;
8665 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8666 dgst_size
= DGST_SIZE_4_4
;
8667 parse_func
= md5s_parse_hash
;
8668 sort_by_digest
= sort_by_digest_4_4
;
8669 opti_type
= OPTI_TYPE_ZERO_BYTE
8670 | OPTI_TYPE_PRECOMPUTE_INIT
8671 | OPTI_TYPE_PRECOMPUTE_MERKLE
8672 | OPTI_TYPE_EARLY_SKIP
8673 | OPTI_TYPE_NOT_ITERATED
8674 | OPTI_TYPE_RAW_HASH
;
8681 case 4300: hash_type
= HASH_TYPE_MD5
;
8682 salt_type
= SALT_TYPE_VIRTUAL
;
8683 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8684 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8685 | OPTS_TYPE_PT_ADD80
8686 | OPTS_TYPE_PT_ADDBITS14
8687 | OPTS_TYPE_ST_ADD80
;
8688 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8689 dgst_size
= DGST_SIZE_4_4
;
8690 parse_func
= md5md5_parse_hash
;
8691 sort_by_digest
= sort_by_digest_4_4
;
8692 opti_type
= OPTI_TYPE_ZERO_BYTE
8693 | OPTI_TYPE_PRECOMPUTE_INIT
8694 | OPTI_TYPE_PRECOMPUTE_MERKLE
8695 | OPTI_TYPE_EARLY_SKIP
;
8703 case 4400: hash_type
= HASH_TYPE_MD5
;
8704 salt_type
= SALT_TYPE_NONE
;
8705 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8706 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8707 | OPTS_TYPE_PT_ADD80
8708 | OPTS_TYPE_PT_ADDBITS15
;
8709 kern_type
= KERN_TYPE_MD5_SHA1
;
8710 dgst_size
= DGST_SIZE_4_4
;
8711 parse_func
= md5_parse_hash
;
8712 sort_by_digest
= sort_by_digest_4_4
;
8713 opti_type
= OPTI_TYPE_ZERO_BYTE
8714 | OPTI_TYPE_PRECOMPUTE_INIT
8715 | OPTI_TYPE_PRECOMPUTE_MERKLE
8716 | OPTI_TYPE_EARLY_SKIP
8717 | OPTI_TYPE_NOT_ITERATED
8718 | OPTI_TYPE_NOT_SALTED
8719 | OPTI_TYPE_RAW_HASH
;
8726 case 4500: hash_type
= HASH_TYPE_SHA1
;
8727 salt_type
= SALT_TYPE_NONE
;
8728 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8729 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8730 | OPTS_TYPE_PT_ADD80
8731 | OPTS_TYPE_PT_ADDBITS15
;
8732 kern_type
= KERN_TYPE_SHA11
;
8733 dgst_size
= DGST_SIZE_4_5
;
8734 parse_func
= sha1_parse_hash
;
8735 sort_by_digest
= sort_by_digest_4_5
;
8736 opti_type
= OPTI_TYPE_ZERO_BYTE
8737 | OPTI_TYPE_PRECOMPUTE_INIT
8738 | OPTI_TYPE_PRECOMPUTE_MERKLE
8739 | OPTI_TYPE_EARLY_SKIP
8740 | OPTI_TYPE_NOT_SALTED
;
8747 case 4700: hash_type
= HASH_TYPE_SHA1
;
8748 salt_type
= SALT_TYPE_NONE
;
8749 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8750 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8751 | OPTS_TYPE_PT_ADD80
8752 | OPTS_TYPE_PT_ADDBITS14
;
8753 kern_type
= KERN_TYPE_SHA1_MD5
;
8754 dgst_size
= DGST_SIZE_4_5
;
8755 parse_func
= sha1_parse_hash
;
8756 sort_by_digest
= sort_by_digest_4_5
;
8757 opti_type
= OPTI_TYPE_ZERO_BYTE
8758 | OPTI_TYPE_PRECOMPUTE_INIT
8759 | OPTI_TYPE_PRECOMPUTE_MERKLE
8760 | OPTI_TYPE_EARLY_SKIP
8761 | OPTI_TYPE_NOT_ITERATED
8762 | OPTI_TYPE_NOT_SALTED
8763 | OPTI_TYPE_RAW_HASH
;
8770 case 4800: hash_type
= HASH_TYPE_MD5
;
8771 salt_type
= SALT_TYPE_EMBEDDED
;
8772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8774 | OPTS_TYPE_PT_ADDBITS14
;
8775 kern_type
= KERN_TYPE_MD5_CHAP
;
8776 dgst_size
= DGST_SIZE_4_4
;
8777 parse_func
= chap_parse_hash
;
8778 sort_by_digest
= sort_by_digest_4_4
;
8779 opti_type
= OPTI_TYPE_ZERO_BYTE
8780 | OPTI_TYPE_PRECOMPUTE_INIT
8781 | OPTI_TYPE_PRECOMPUTE_MERKLE
8782 | OPTI_TYPE_MEET_IN_MIDDLE
8783 | OPTI_TYPE_EARLY_SKIP
8784 | OPTI_TYPE_NOT_ITERATED
8785 | OPTI_TYPE_RAW_HASH
;
8792 case 4900: hash_type
= HASH_TYPE_SHA1
;
8793 salt_type
= SALT_TYPE_INTERN
;
8794 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8795 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8796 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8797 dgst_size
= DGST_SIZE_4_5
;
8798 parse_func
= sha1s_parse_hash
;
8799 sort_by_digest
= sort_by_digest_4_5
;
8800 opti_type
= OPTI_TYPE_ZERO_BYTE
8801 | OPTI_TYPE_PRECOMPUTE_INIT
8802 | OPTI_TYPE_PRECOMPUTE_MERKLE
8803 | OPTI_TYPE_EARLY_SKIP
;
8810 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8811 salt_type
= SALT_TYPE_EMBEDDED
;
8812 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8813 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8814 | OPTS_TYPE_PT_ADD01
;
8815 kern_type
= KERN_TYPE_KECCAK
;
8816 dgst_size
= DGST_SIZE_8_25
;
8817 parse_func
= keccak_parse_hash
;
8818 sort_by_digest
= sort_by_digest_8_25
;
8819 opti_type
= OPTI_TYPE_ZERO_BYTE
8820 | OPTI_TYPE_USES_BITS_64
8821 | OPTI_TYPE_RAW_HASH
;
8828 case 5100: hash_type
= HASH_TYPE_MD5H
;
8829 salt_type
= SALT_TYPE_NONE
;
8830 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8831 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8832 | OPTS_TYPE_PT_ADD80
8833 | OPTS_TYPE_PT_ADDBITS14
;
8834 kern_type
= KERN_TYPE_MD5H
;
8835 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8836 parse_func
= md5half_parse_hash
;
8837 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8838 opti_type
= OPTI_TYPE_ZERO_BYTE
8839 | OPTI_TYPE_RAW_HASH
;
8846 case 5200: hash_type
= HASH_TYPE_SHA256
;
8847 salt_type
= SALT_TYPE_EMBEDDED
;
8848 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8849 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8850 kern_type
= KERN_TYPE_PSAFE3
;
8851 dgst_size
= DGST_SIZE_4_8
;
8852 parse_func
= psafe3_parse_hash
;
8853 sort_by_digest
= sort_by_digest_4_8
;
8854 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8861 case 5300: hash_type
= HASH_TYPE_MD5
;
8862 salt_type
= SALT_TYPE_EMBEDDED
;
8863 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8864 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8865 | OPTS_TYPE_ST_ADD80
;
8866 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8867 dgst_size
= DGST_SIZE_4_4
;
8868 parse_func
= ikepsk_md5_parse_hash
;
8869 sort_by_digest
= sort_by_digest_4_4
;
8870 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8877 case 5400: hash_type
= HASH_TYPE_SHA1
;
8878 salt_type
= SALT_TYPE_EMBEDDED
;
8879 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8880 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8881 | OPTS_TYPE_ST_ADD80
;
8882 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8883 dgst_size
= DGST_SIZE_4_5
;
8884 parse_func
= ikepsk_sha1_parse_hash
;
8885 sort_by_digest
= sort_by_digest_4_5
;
8886 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8893 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8894 salt_type
= SALT_TYPE_EMBEDDED
;
8895 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8896 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8897 | OPTS_TYPE_PT_ADD80
8898 | OPTS_TYPE_PT_ADDBITS14
8899 | OPTS_TYPE_PT_UNICODE
8901 kern_type
= KERN_TYPE_NETNTLMv1
;
8902 dgst_size
= DGST_SIZE_4_4
;
8903 parse_func
= netntlmv1_parse_hash
;
8904 sort_by_digest
= sort_by_digest_4_4
;
8905 opti_type
= OPTI_TYPE_ZERO_BYTE
8906 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8913 case 5600: hash_type
= HASH_TYPE_MD5
;
8914 salt_type
= SALT_TYPE_EMBEDDED
;
8915 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8916 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8917 | OPTS_TYPE_PT_ADD80
8918 | OPTS_TYPE_PT_ADDBITS14
8919 | OPTS_TYPE_PT_UNICODE
;
8920 kern_type
= KERN_TYPE_NETNTLMv2
;
8921 dgst_size
= DGST_SIZE_4_4
;
8922 parse_func
= netntlmv2_parse_hash
;
8923 sort_by_digest
= sort_by_digest_4_4
;
8924 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8931 case 5700: hash_type
= HASH_TYPE_SHA256
;
8932 salt_type
= SALT_TYPE_NONE
;
8933 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8934 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8935 | OPTS_TYPE_PT_ADD80
8936 | OPTS_TYPE_PT_ADDBITS15
;
8937 kern_type
= KERN_TYPE_SHA256
;
8938 dgst_size
= DGST_SIZE_4_8
;
8939 parse_func
= cisco4_parse_hash
;
8940 sort_by_digest
= sort_by_digest_4_8
;
8941 opti_type
= OPTI_TYPE_ZERO_BYTE
8942 | OPTI_TYPE_PRECOMPUTE_INIT
8943 | OPTI_TYPE_PRECOMPUTE_MERKLE
8944 | OPTI_TYPE_EARLY_SKIP
8945 | OPTI_TYPE_NOT_ITERATED
8946 | OPTI_TYPE_NOT_SALTED
8947 | OPTI_TYPE_RAW_HASH
;
8954 case 5800: hash_type
= HASH_TYPE_SHA1
;
8955 salt_type
= SALT_TYPE_INTERN
;
8956 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8957 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8958 | OPTS_TYPE_ST_ADD80
;
8959 kern_type
= KERN_TYPE_ANDROIDPIN
;
8960 dgst_size
= DGST_SIZE_4_5
;
8961 parse_func
= androidpin_parse_hash
;
8962 sort_by_digest
= sort_by_digest_4_5
;
8963 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8970 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
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_ADD80
;
8975 kern_type
= KERN_TYPE_RIPEMD160
;
8976 dgst_size
= DGST_SIZE_4_5
;
8977 parse_func
= ripemd160_parse_hash
;
8978 sort_by_digest
= sort_by_digest_4_5
;
8979 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8986 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8987 salt_type
= SALT_TYPE_NONE
;
8988 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8989 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8990 | OPTS_TYPE_PT_ADD80
;
8991 kern_type
= KERN_TYPE_WHIRLPOOL
;
8992 dgst_size
= DGST_SIZE_4_16
;
8993 parse_func
= whirlpool_parse_hash
;
8994 sort_by_digest
= sort_by_digest_4_16
;
8995 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9002 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9003 salt_type
= SALT_TYPE_EMBEDDED
;
9004 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9005 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9006 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9007 dgst_size
= DGST_SIZE_4_5
;
9008 parse_func
= truecrypt_parse_hash_2k
;
9009 sort_by_digest
= sort_by_digest_4_5
;
9010 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9017 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9018 salt_type
= SALT_TYPE_EMBEDDED
;
9019 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9020 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9021 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9022 dgst_size
= DGST_SIZE_4_5
;
9023 parse_func
= truecrypt_parse_hash_2k
;
9024 sort_by_digest
= sort_by_digest_4_5
;
9025 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9032 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9033 salt_type
= SALT_TYPE_EMBEDDED
;
9034 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9035 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9036 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9037 dgst_size
= DGST_SIZE_4_5
;
9038 parse_func
= truecrypt_parse_hash_2k
;
9039 sort_by_digest
= sort_by_digest_4_5
;
9040 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9047 case 6221: hash_type
= HASH_TYPE_SHA512
;
9048 salt_type
= SALT_TYPE_EMBEDDED
;
9049 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9050 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9051 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9052 dgst_size
= DGST_SIZE_8_8
;
9053 parse_func
= truecrypt_parse_hash_1k
;
9054 sort_by_digest
= sort_by_digest_8_8
;
9055 opti_type
= OPTI_TYPE_ZERO_BYTE
9056 | OPTI_TYPE_USES_BITS_64
;
9063 case 6222: hash_type
= HASH_TYPE_SHA512
;
9064 salt_type
= SALT_TYPE_EMBEDDED
;
9065 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9066 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9067 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9068 dgst_size
= DGST_SIZE_8_8
;
9069 parse_func
= truecrypt_parse_hash_1k
;
9070 sort_by_digest
= sort_by_digest_8_8
;
9071 opti_type
= OPTI_TYPE_ZERO_BYTE
9072 | OPTI_TYPE_USES_BITS_64
;
9079 case 6223: hash_type
= HASH_TYPE_SHA512
;
9080 salt_type
= SALT_TYPE_EMBEDDED
;
9081 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9082 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9083 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9084 dgst_size
= DGST_SIZE_8_8
;
9085 parse_func
= truecrypt_parse_hash_1k
;
9086 sort_by_digest
= sort_by_digest_8_8
;
9087 opti_type
= OPTI_TYPE_ZERO_BYTE
9088 | OPTI_TYPE_USES_BITS_64
;
9095 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9096 salt_type
= SALT_TYPE_EMBEDDED
;
9097 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9099 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9100 dgst_size
= DGST_SIZE_4_8
;
9101 parse_func
= truecrypt_parse_hash_1k
;
9102 sort_by_digest
= sort_by_digest_4_8
;
9103 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9110 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9111 salt_type
= SALT_TYPE_EMBEDDED
;
9112 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9113 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9114 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9115 dgst_size
= DGST_SIZE_4_8
;
9116 parse_func
= truecrypt_parse_hash_1k
;
9117 sort_by_digest
= sort_by_digest_4_8
;
9118 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9125 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9126 salt_type
= SALT_TYPE_EMBEDDED
;
9127 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9129 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9130 dgst_size
= DGST_SIZE_4_8
;
9131 parse_func
= truecrypt_parse_hash_1k
;
9132 sort_by_digest
= sort_by_digest_4_8
;
9133 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9140 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9141 salt_type
= SALT_TYPE_EMBEDDED
;
9142 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9143 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9144 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9145 dgst_size
= DGST_SIZE_4_5
;
9146 parse_func
= truecrypt_parse_hash_1k
;
9147 sort_by_digest
= sort_by_digest_4_5
;
9148 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9155 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9156 salt_type
= SALT_TYPE_EMBEDDED
;
9157 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9158 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9159 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9160 dgst_size
= DGST_SIZE_4_5
;
9161 parse_func
= truecrypt_parse_hash_1k
;
9162 sort_by_digest
= sort_by_digest_4_5
;
9163 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9170 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9171 salt_type
= SALT_TYPE_EMBEDDED
;
9172 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9173 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9174 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9175 dgst_size
= DGST_SIZE_4_5
;
9176 parse_func
= truecrypt_parse_hash_1k
;
9177 sort_by_digest
= sort_by_digest_4_5
;
9178 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9185 case 6300: hash_type
= HASH_TYPE_MD5
;
9186 salt_type
= SALT_TYPE_EMBEDDED
;
9187 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9189 kern_type
= KERN_TYPE_MD5AIX
;
9190 dgst_size
= DGST_SIZE_4_4
;
9191 parse_func
= md5aix_parse_hash
;
9192 sort_by_digest
= sort_by_digest_4_4
;
9193 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9200 case 6400: hash_type
= HASH_TYPE_SHA256
;
9201 salt_type
= SALT_TYPE_EMBEDDED
;
9202 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9204 kern_type
= KERN_TYPE_SHA256AIX
;
9205 dgst_size
= DGST_SIZE_4_8
;
9206 parse_func
= sha256aix_parse_hash
;
9207 sort_by_digest
= sort_by_digest_4_8
;
9208 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9215 case 6500: hash_type
= HASH_TYPE_SHA512
;
9216 salt_type
= SALT_TYPE_EMBEDDED
;
9217 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9218 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9219 kern_type
= KERN_TYPE_SHA512AIX
;
9220 dgst_size
= DGST_SIZE_8_8
;
9221 parse_func
= sha512aix_parse_hash
;
9222 sort_by_digest
= sort_by_digest_8_8
;
9223 opti_type
= OPTI_TYPE_ZERO_BYTE
9224 | OPTI_TYPE_USES_BITS_64
;
9231 case 6600: hash_type
= HASH_TYPE_AES
;
9232 salt_type
= SALT_TYPE_EMBEDDED
;
9233 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9235 kern_type
= KERN_TYPE_AGILEKEY
;
9236 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9237 parse_func
= agilekey_parse_hash
;
9238 sort_by_digest
= sort_by_digest_4_5
;
9239 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9246 case 6700: hash_type
= HASH_TYPE_SHA1
;
9247 salt_type
= SALT_TYPE_EMBEDDED
;
9248 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9249 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9250 kern_type
= KERN_TYPE_SHA1AIX
;
9251 dgst_size
= DGST_SIZE_4_5
;
9252 parse_func
= sha1aix_parse_hash
;
9253 sort_by_digest
= sort_by_digest_4_5
;
9254 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9261 case 6800: hash_type
= HASH_TYPE_AES
;
9262 salt_type
= SALT_TYPE_EMBEDDED
;
9263 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9264 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9265 kern_type
= KERN_TYPE_LASTPASS
;
9266 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9267 parse_func
= lastpass_parse_hash
;
9268 sort_by_digest
= sort_by_digest_4_8
;
9269 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9276 case 6900: hash_type
= HASH_TYPE_GOST
;
9277 salt_type
= SALT_TYPE_NONE
;
9278 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9279 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9280 kern_type
= KERN_TYPE_GOST
;
9281 dgst_size
= DGST_SIZE_4_8
;
9282 parse_func
= gost_parse_hash
;
9283 sort_by_digest
= sort_by_digest_4_8
;
9284 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9291 case 7100: hash_type
= HASH_TYPE_SHA512
;
9292 salt_type
= SALT_TYPE_EMBEDDED
;
9293 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9294 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9295 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9296 dgst_size
= DGST_SIZE_8_16
;
9297 parse_func
= sha512osx_parse_hash
;
9298 sort_by_digest
= sort_by_digest_8_16
;
9299 opti_type
= OPTI_TYPE_ZERO_BYTE
9300 | OPTI_TYPE_USES_BITS_64
9301 | OPTI_TYPE_SLOW_HASH_SIMD
;
9308 case 7200: hash_type
= HASH_TYPE_SHA512
;
9309 salt_type
= SALT_TYPE_EMBEDDED
;
9310 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9311 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9312 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9313 dgst_size
= DGST_SIZE_8_16
;
9314 parse_func
= sha512grub_parse_hash
;
9315 sort_by_digest
= sort_by_digest_8_16
;
9316 opti_type
= OPTI_TYPE_ZERO_BYTE
9317 | OPTI_TYPE_USES_BITS_64
9318 | OPTI_TYPE_SLOW_HASH_SIMD
;
9325 case 7300: hash_type
= HASH_TYPE_SHA1
;
9326 salt_type
= SALT_TYPE_EMBEDDED
;
9327 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9328 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9329 | OPTS_TYPE_ST_ADD80
9330 | OPTS_TYPE_ST_ADDBITS15
;
9331 kern_type
= KERN_TYPE_RAKP
;
9332 dgst_size
= DGST_SIZE_4_5
;
9333 parse_func
= rakp_parse_hash
;
9334 sort_by_digest
= sort_by_digest_4_5
;
9335 opti_type
= OPTI_TYPE_ZERO_BYTE
9336 | OPTI_TYPE_NOT_ITERATED
;
9343 case 7400: hash_type
= HASH_TYPE_SHA256
;
9344 salt_type
= SALT_TYPE_EMBEDDED
;
9345 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9346 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9347 kern_type
= KERN_TYPE_SHA256CRYPT
;
9348 dgst_size
= DGST_SIZE_4_8
;
9349 parse_func
= sha256crypt_parse_hash
;
9350 sort_by_digest
= sort_by_digest_4_8
;
9351 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9358 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9359 salt_type
= SALT_TYPE_EMBEDDED
;
9360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9362 kern_type
= KERN_TYPE_KRB5PA
;
9363 dgst_size
= DGST_SIZE_4_4
;
9364 parse_func
= krb5pa_parse_hash
;
9365 sort_by_digest
= sort_by_digest_4_4
;
9366 opti_type
= OPTI_TYPE_ZERO_BYTE
9367 | OPTI_TYPE_NOT_ITERATED
;
9374 case 7600: hash_type
= HASH_TYPE_SHA1
;
9375 salt_type
= SALT_TYPE_INTERN
;
9376 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9377 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9378 | OPTS_TYPE_PT_ADD80
9379 | OPTS_TYPE_PT_ADDBITS15
;
9380 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9381 dgst_size
= DGST_SIZE_4_5
;
9382 parse_func
= redmine_parse_hash
;
9383 sort_by_digest
= sort_by_digest_4_5
;
9384 opti_type
= OPTI_TYPE_ZERO_BYTE
9385 | OPTI_TYPE_PRECOMPUTE_INIT
9386 | OPTI_TYPE_EARLY_SKIP
9387 | OPTI_TYPE_NOT_ITERATED
9388 | OPTI_TYPE_PREPENDED_SALT
;
9395 case 7700: hash_type
= HASH_TYPE_SAPB
;
9396 salt_type
= SALT_TYPE_EMBEDDED
;
9397 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9398 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9399 | OPTS_TYPE_PT_UPPER
9400 | OPTS_TYPE_ST_UPPER
;
9401 kern_type
= KERN_TYPE_SAPB
;
9402 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9403 parse_func
= sapb_parse_hash
;
9404 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9405 opti_type
= OPTI_TYPE_ZERO_BYTE
9406 | OPTI_TYPE_PRECOMPUTE_INIT
9407 | OPTI_TYPE_NOT_ITERATED
;
9414 case 7800: hash_type
= HASH_TYPE_SAPG
;
9415 salt_type
= SALT_TYPE_EMBEDDED
;
9416 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9417 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9418 | OPTS_TYPE_ST_ADD80
9419 | OPTS_TYPE_ST_UPPER
;
9420 kern_type
= KERN_TYPE_SAPG
;
9421 dgst_size
= DGST_SIZE_4_5
;
9422 parse_func
= sapg_parse_hash
;
9423 sort_by_digest
= sort_by_digest_4_5
;
9424 opti_type
= OPTI_TYPE_ZERO_BYTE
9425 | OPTI_TYPE_PRECOMPUTE_INIT
9426 | OPTI_TYPE_NOT_ITERATED
;
9433 case 7900: hash_type
= HASH_TYPE_SHA512
;
9434 salt_type
= SALT_TYPE_EMBEDDED
;
9435 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9436 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9437 kern_type
= KERN_TYPE_DRUPAL7
;
9438 dgst_size
= DGST_SIZE_8_8
;
9439 parse_func
= drupal7_parse_hash
;
9440 sort_by_digest
= sort_by_digest_8_8
;
9441 opti_type
= OPTI_TYPE_ZERO_BYTE
9442 | OPTI_TYPE_USES_BITS_64
;
9449 case 8000: hash_type
= HASH_TYPE_SHA256
;
9450 salt_type
= SALT_TYPE_EMBEDDED
;
9451 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9452 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9453 | OPTS_TYPE_PT_UNICODE
9454 | OPTS_TYPE_ST_ADD80
9456 kern_type
= KERN_TYPE_SYBASEASE
;
9457 dgst_size
= DGST_SIZE_4_8
;
9458 parse_func
= sybasease_parse_hash
;
9459 sort_by_digest
= sort_by_digest_4_8
;
9460 opti_type
= OPTI_TYPE_ZERO_BYTE
9461 | OPTI_TYPE_PRECOMPUTE_INIT
9462 | OPTI_TYPE_EARLY_SKIP
9463 | OPTI_TYPE_NOT_ITERATED
9464 | OPTI_TYPE_RAW_HASH
;
9471 case 8100: hash_type
= HASH_TYPE_SHA1
;
9472 salt_type
= SALT_TYPE_EMBEDDED
;
9473 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9474 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9475 kern_type
= KERN_TYPE_NETSCALER
;
9476 dgst_size
= DGST_SIZE_4_5
;
9477 parse_func
= netscaler_parse_hash
;
9478 sort_by_digest
= sort_by_digest_4_5
;
9479 opti_type
= OPTI_TYPE_ZERO_BYTE
9480 | OPTI_TYPE_PRECOMPUTE_INIT
9481 | OPTI_TYPE_PRECOMPUTE_MERKLE
9482 | OPTI_TYPE_EARLY_SKIP
9483 | OPTI_TYPE_NOT_ITERATED
9484 | OPTI_TYPE_PREPENDED_SALT
9485 | OPTI_TYPE_RAW_HASH
;
9492 case 8200: hash_type
= HASH_TYPE_SHA256
;
9493 salt_type
= SALT_TYPE_EMBEDDED
;
9494 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9495 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9496 kern_type
= KERN_TYPE_CLOUDKEY
;
9497 dgst_size
= DGST_SIZE_4_8
;
9498 parse_func
= cloudkey_parse_hash
;
9499 sort_by_digest
= sort_by_digest_4_8
;
9500 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9507 case 8300: hash_type
= HASH_TYPE_SHA1
;
9508 salt_type
= SALT_TYPE_EMBEDDED
;
9509 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9510 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9512 | OPTS_TYPE_ST_ADD80
;
9513 kern_type
= KERN_TYPE_NSEC3
;
9514 dgst_size
= DGST_SIZE_4_5
;
9515 parse_func
= nsec3_parse_hash
;
9516 sort_by_digest
= sort_by_digest_4_5
;
9517 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9524 case 8400: hash_type
= HASH_TYPE_SHA1
;
9525 salt_type
= SALT_TYPE_INTERN
;
9526 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9527 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9528 | OPTS_TYPE_PT_ADD80
9529 | OPTS_TYPE_PT_ADDBITS15
;
9530 kern_type
= KERN_TYPE_WBB3
;
9531 dgst_size
= DGST_SIZE_4_5
;
9532 parse_func
= wbb3_parse_hash
;
9533 sort_by_digest
= sort_by_digest_4_5
;
9534 opti_type
= OPTI_TYPE_ZERO_BYTE
9535 | OPTI_TYPE_PRECOMPUTE_INIT
9536 | OPTI_TYPE_NOT_ITERATED
;
9543 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9544 salt_type
= SALT_TYPE_EMBEDDED
;
9545 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9546 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9547 | OPTS_TYPE_ST_UPPER
;
9548 kern_type
= KERN_TYPE_RACF
;
9549 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9550 parse_func
= racf_parse_hash
;
9551 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9552 opti_type
= OPTI_TYPE_ZERO_BYTE
9553 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9560 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9561 salt_type
= SALT_TYPE_NONE
;
9562 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9563 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9564 kern_type
= KERN_TYPE_LOTUS5
;
9565 dgst_size
= DGST_SIZE_4_4
;
9566 parse_func
= lotus5_parse_hash
;
9567 sort_by_digest
= sort_by_digest_4_4
;
9568 opti_type
= OPTI_TYPE_EARLY_SKIP
9569 | OPTI_TYPE_NOT_ITERATED
9570 | OPTI_TYPE_NOT_SALTED
9571 | OPTI_TYPE_RAW_HASH
;
9578 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9579 salt_type
= SALT_TYPE_EMBEDDED
;
9580 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9582 kern_type
= KERN_TYPE_LOTUS6
;
9583 dgst_size
= DGST_SIZE_4_4
;
9584 parse_func
= lotus6_parse_hash
;
9585 sort_by_digest
= sort_by_digest_4_4
;
9586 opti_type
= OPTI_TYPE_EARLY_SKIP
9587 | OPTI_TYPE_NOT_ITERATED
9588 | OPTI_TYPE_RAW_HASH
;
9595 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9596 salt_type
= SALT_TYPE_EMBEDDED
;
9597 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9599 kern_type
= KERN_TYPE_ANDROIDFDE
;
9600 dgst_size
= DGST_SIZE_4_4
;
9601 parse_func
= androidfde_parse_hash
;
9602 sort_by_digest
= sort_by_digest_4_4
;
9603 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9610 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9611 salt_type
= SALT_TYPE_EMBEDDED
;
9612 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9613 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9614 kern_type
= KERN_TYPE_SCRYPT
;
9615 dgst_size
= DGST_SIZE_4_8
;
9616 parse_func
= scrypt_parse_hash
;
9617 sort_by_digest
= sort_by_digest_4_8
;
9618 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9625 case 9000: hash_type
= HASH_TYPE_SHA1
;
9626 salt_type
= SALT_TYPE_EMBEDDED
;
9627 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9628 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9629 | OPTS_TYPE_ST_GENERATE_LE
;
9630 kern_type
= KERN_TYPE_PSAFE2
;
9631 dgst_size
= DGST_SIZE_4_5
;
9632 parse_func
= psafe2_parse_hash
;
9633 sort_by_digest
= sort_by_digest_4_5
;
9634 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9641 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9642 salt_type
= SALT_TYPE_EMBEDDED
;
9643 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9645 kern_type
= KERN_TYPE_LOTUS8
;
9646 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9647 parse_func
= lotus8_parse_hash
;
9648 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9649 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9656 case 9200: hash_type
= HASH_TYPE_SHA256
;
9657 salt_type
= SALT_TYPE_EMBEDDED
;
9658 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9660 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9661 dgst_size
= DGST_SIZE_4_32
;
9662 parse_func
= cisco8_parse_hash
;
9663 sort_by_digest
= sort_by_digest_4_32
;
9664 opti_type
= OPTI_TYPE_ZERO_BYTE
9665 | OPTI_TYPE_SLOW_HASH_SIMD
;
9672 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9673 salt_type
= SALT_TYPE_EMBEDDED
;
9674 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9675 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9676 kern_type
= KERN_TYPE_SCRYPT
;
9677 dgst_size
= DGST_SIZE_4_8
;
9678 parse_func
= cisco9_parse_hash
;
9679 sort_by_digest
= sort_by_digest_4_8
;
9680 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9687 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9688 salt_type
= SALT_TYPE_EMBEDDED
;
9689 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9690 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9691 kern_type
= KERN_TYPE_OFFICE2007
;
9692 dgst_size
= DGST_SIZE_4_4
;
9693 parse_func
= office2007_parse_hash
;
9694 sort_by_digest
= sort_by_digest_4_4
;
9695 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9702 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9703 salt_type
= SALT_TYPE_EMBEDDED
;
9704 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9705 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9706 kern_type
= KERN_TYPE_OFFICE2010
;
9707 dgst_size
= DGST_SIZE_4_4
;
9708 parse_func
= office2010_parse_hash
;
9709 sort_by_digest
= sort_by_digest_4_4
;
9710 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9717 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9718 salt_type
= SALT_TYPE_EMBEDDED
;
9719 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9720 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9721 kern_type
= KERN_TYPE_OFFICE2013
;
9722 dgst_size
= DGST_SIZE_4_4
;
9723 parse_func
= office2013_parse_hash
;
9724 sort_by_digest
= sort_by_digest_4_4
;
9725 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9732 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9733 salt_type
= SALT_TYPE_EMBEDDED
;
9734 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9735 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9736 | OPTS_TYPE_PT_ADD80
9737 | OPTS_TYPE_PT_UNICODE
;
9738 kern_type
= KERN_TYPE_OLDOFFICE01
;
9739 dgst_size
= DGST_SIZE_4_4
;
9740 parse_func
= oldoffice01_parse_hash
;
9741 sort_by_digest
= sort_by_digest_4_4
;
9742 opti_type
= OPTI_TYPE_ZERO_BYTE
9743 | OPTI_TYPE_PRECOMPUTE_INIT
9744 | OPTI_TYPE_NOT_ITERATED
;
9751 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9752 salt_type
= SALT_TYPE_EMBEDDED
;
9753 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9754 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9755 | OPTS_TYPE_PT_ADD80
;
9756 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9757 dgst_size
= DGST_SIZE_4_4
;
9758 parse_func
= oldoffice01cm1_parse_hash
;
9759 sort_by_digest
= sort_by_digest_4_4
;
9760 opti_type
= OPTI_TYPE_ZERO_BYTE
9761 | OPTI_TYPE_PRECOMPUTE_INIT
9762 | OPTI_TYPE_NOT_ITERATED
;
9769 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9770 salt_type
= SALT_TYPE_EMBEDDED
;
9771 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9772 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9773 | OPTS_TYPE_PT_ADD80
9774 | OPTS_TYPE_PT_UNICODE
9775 | OPTS_TYPE_PT_NEVERCRACK
;
9776 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9777 dgst_size
= DGST_SIZE_4_4
;
9778 parse_func
= oldoffice01cm2_parse_hash
;
9779 sort_by_digest
= sort_by_digest_4_4
;
9780 opti_type
= OPTI_TYPE_ZERO_BYTE
9781 | OPTI_TYPE_PRECOMPUTE_INIT
9782 | OPTI_TYPE_NOT_ITERATED
;
9789 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9790 salt_type
= SALT_TYPE_EMBEDDED
;
9791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9792 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9793 | OPTS_TYPE_PT_ADD80
9794 | OPTS_TYPE_PT_UNICODE
;
9795 kern_type
= KERN_TYPE_OLDOFFICE34
;
9796 dgst_size
= DGST_SIZE_4_4
;
9797 parse_func
= oldoffice34_parse_hash
;
9798 sort_by_digest
= sort_by_digest_4_4
;
9799 opti_type
= OPTI_TYPE_ZERO_BYTE
9800 | OPTI_TYPE_PRECOMPUTE_INIT
9801 | OPTI_TYPE_NOT_ITERATED
;
9808 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9809 salt_type
= SALT_TYPE_EMBEDDED
;
9810 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9811 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9812 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9813 dgst_size
= DGST_SIZE_4_4
;
9814 parse_func
= oldoffice34cm1_parse_hash
;
9815 sort_by_digest
= sort_by_digest_4_4
;
9816 opti_type
= OPTI_TYPE_ZERO_BYTE
9817 | OPTI_TYPE_PRECOMPUTE_INIT
9818 | OPTI_TYPE_NOT_ITERATED
;
9825 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9826 salt_type
= SALT_TYPE_EMBEDDED
;
9827 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9828 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9829 | OPTS_TYPE_PT_ADD80
9830 | OPTS_TYPE_PT_UNICODE
9831 | OPTS_TYPE_PT_NEVERCRACK
;
9832 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9833 dgst_size
= DGST_SIZE_4_4
;
9834 parse_func
= oldoffice34cm2_parse_hash
;
9835 sort_by_digest
= sort_by_digest_4_4
;
9836 opti_type
= OPTI_TYPE_ZERO_BYTE
9837 | OPTI_TYPE_PRECOMPUTE_INIT
9838 | OPTI_TYPE_NOT_ITERATED
;
9845 case 9900: hash_type
= HASH_TYPE_MD5
;
9846 salt_type
= SALT_TYPE_NONE
;
9847 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9848 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9849 kern_type
= KERN_TYPE_RADMIN2
;
9850 dgst_size
= DGST_SIZE_4_4
;
9851 parse_func
= radmin2_parse_hash
;
9852 sort_by_digest
= sort_by_digest_4_4
;
9853 opti_type
= OPTI_TYPE_ZERO_BYTE
9854 | OPTI_TYPE_PRECOMPUTE_INIT
9855 | OPTI_TYPE_EARLY_SKIP
9856 | OPTI_TYPE_NOT_ITERATED
9857 | OPTI_TYPE_NOT_SALTED
;
9864 case 10000: hash_type
= HASH_TYPE_SHA256
;
9865 salt_type
= SALT_TYPE_EMBEDDED
;
9866 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9867 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9868 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9869 dgst_size
= DGST_SIZE_4_32
;
9870 parse_func
= djangopbkdf2_parse_hash
;
9871 sort_by_digest
= sort_by_digest_4_32
;
9872 opti_type
= OPTI_TYPE_ZERO_BYTE
9873 | OPTI_TYPE_SLOW_HASH_SIMD
;
9880 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9881 salt_type
= SALT_TYPE_EMBEDDED
;
9882 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9883 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9884 kern_type
= KERN_TYPE_SIPHASH
;
9885 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9886 parse_func
= siphash_parse_hash
;
9887 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9888 opti_type
= OPTI_TYPE_ZERO_BYTE
9889 | OPTI_TYPE_NOT_ITERATED
9890 | OPTI_TYPE_RAW_HASH
;
9897 case 10200: hash_type
= HASH_TYPE_MD5
;
9898 salt_type
= SALT_TYPE_EMBEDDED
;
9899 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9901 | OPTS_TYPE_ST_ADD80
9902 | OPTS_TYPE_ST_ADDBITS14
;
9903 kern_type
= KERN_TYPE_HMACMD5_PW
;
9904 dgst_size
= DGST_SIZE_4_4
;
9905 parse_func
= crammd5_parse_hash
;
9906 sort_by_digest
= sort_by_digest_4_4
;
9907 opti_type
= OPTI_TYPE_ZERO_BYTE
9908 | OPTI_TYPE_NOT_ITERATED
;
9915 case 10300: hash_type
= HASH_TYPE_SHA1
;
9916 salt_type
= SALT_TYPE_EMBEDDED
;
9917 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9918 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9919 kern_type
= KERN_TYPE_SAPH_SHA1
;
9920 dgst_size
= DGST_SIZE_4_5
;
9921 parse_func
= saph_sha1_parse_hash
;
9922 sort_by_digest
= sort_by_digest_4_5
;
9923 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9930 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9931 salt_type
= SALT_TYPE_EMBEDDED
;
9932 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9933 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9934 kern_type
= KERN_TYPE_PDF11
;
9935 dgst_size
= DGST_SIZE_4_4
;
9936 parse_func
= pdf11_parse_hash
;
9937 sort_by_digest
= sort_by_digest_4_4
;
9938 opti_type
= OPTI_TYPE_ZERO_BYTE
9939 | OPTI_TYPE_NOT_ITERATED
;
9946 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9947 salt_type
= SALT_TYPE_EMBEDDED
;
9948 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9950 kern_type
= KERN_TYPE_PDF11CM1
;
9951 dgst_size
= DGST_SIZE_4_4
;
9952 parse_func
= pdf11cm1_parse_hash
;
9953 sort_by_digest
= sort_by_digest_4_4
;
9954 opti_type
= OPTI_TYPE_ZERO_BYTE
9955 | OPTI_TYPE_NOT_ITERATED
;
9962 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9963 salt_type
= SALT_TYPE_EMBEDDED
;
9964 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9965 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9966 kern_type
= KERN_TYPE_PDF11CM2
;
9967 dgst_size
= DGST_SIZE_4_4
;
9968 parse_func
= pdf11cm2_parse_hash
;
9969 sort_by_digest
= sort_by_digest_4_4
;
9970 opti_type
= OPTI_TYPE_ZERO_BYTE
9971 | OPTI_TYPE_NOT_ITERATED
;
9978 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9979 salt_type
= SALT_TYPE_EMBEDDED
;
9980 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9981 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9982 kern_type
= KERN_TYPE_PDF14
;
9983 dgst_size
= DGST_SIZE_4_4
;
9984 parse_func
= pdf14_parse_hash
;
9985 sort_by_digest
= sort_by_digest_4_4
;
9986 opti_type
= OPTI_TYPE_ZERO_BYTE
9987 | OPTI_TYPE_NOT_ITERATED
;
9994 case 10600: hash_type
= HASH_TYPE_SHA256
;
9995 salt_type
= SALT_TYPE_EMBEDDED
;
9996 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9997 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9998 | OPTS_TYPE_ST_ADD80
9999 | OPTS_TYPE_ST_ADDBITS15
10000 | OPTS_TYPE_HASH_COPY
;
10001 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10002 dgst_size
= DGST_SIZE_4_8
;
10003 parse_func
= pdf17l3_parse_hash
;
10004 sort_by_digest
= sort_by_digest_4_8
;
10005 opti_type
= OPTI_TYPE_ZERO_BYTE
10006 | OPTI_TYPE_PRECOMPUTE_INIT
10007 | OPTI_TYPE_PRECOMPUTE_MERKLE
10008 | OPTI_TYPE_EARLY_SKIP
10009 | OPTI_TYPE_NOT_ITERATED
10010 | OPTI_TYPE_APPENDED_SALT
10011 | OPTI_TYPE_RAW_HASH
;
10018 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10019 salt_type
= SALT_TYPE_EMBEDDED
;
10020 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10021 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10022 | OPTS_TYPE_HASH_COPY
;
10023 kern_type
= KERN_TYPE_PDF17L8
;
10024 dgst_size
= DGST_SIZE_4_8
;
10025 parse_func
= pdf17l8_parse_hash
;
10026 sort_by_digest
= sort_by_digest_4_8
;
10027 opti_type
= OPTI_TYPE_ZERO_BYTE
10028 | OPTI_TYPE_NOT_ITERATED
;
10035 case 10800: hash_type
= HASH_TYPE_SHA384
;
10036 salt_type
= SALT_TYPE_NONE
;
10037 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10038 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10039 | OPTS_TYPE_PT_ADD80
10040 | OPTS_TYPE_PT_ADDBITS15
;
10041 kern_type
= KERN_TYPE_SHA384
;
10042 dgst_size
= DGST_SIZE_8_8
;
10043 parse_func
= sha384_parse_hash
;
10044 sort_by_digest
= sort_by_digest_8_8
;
10045 opti_type
= OPTI_TYPE_ZERO_BYTE
10046 | OPTI_TYPE_PRECOMPUTE_INIT
10047 | OPTI_TYPE_PRECOMPUTE_MERKLE
10048 | OPTI_TYPE_EARLY_SKIP
10049 | OPTI_TYPE_NOT_ITERATED
10050 | OPTI_TYPE_NOT_SALTED
10051 | OPTI_TYPE_USES_BITS_64
10052 | OPTI_TYPE_RAW_HASH
;
10059 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10060 salt_type
= SALT_TYPE_EMBEDDED
;
10061 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10062 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10063 | OPTS_TYPE_ST_BASE64
10064 | OPTS_TYPE_HASH_COPY
;
10065 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10066 dgst_size
= DGST_SIZE_4_32
;
10067 parse_func
= pbkdf2_sha256_parse_hash
;
10068 sort_by_digest
= sort_by_digest_4_32
;
10069 opti_type
= OPTI_TYPE_ZERO_BYTE
10070 | OPTI_TYPE_SLOW_HASH_SIMD
;
10077 case 11000: hash_type
= HASH_TYPE_MD5
;
10078 salt_type
= SALT_TYPE_INTERN
;
10079 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10081 | OPTS_TYPE_PT_ADD80
;
10082 kern_type
= KERN_TYPE_PRESTASHOP
;
10083 dgst_size
= DGST_SIZE_4_4
;
10084 parse_func
= prestashop_parse_hash
;
10085 sort_by_digest
= sort_by_digest_4_4
;
10086 opti_type
= OPTI_TYPE_ZERO_BYTE
10087 | OPTI_TYPE_PRECOMPUTE_INIT
10088 | OPTI_TYPE_NOT_ITERATED
10089 | OPTI_TYPE_PREPENDED_SALT
;
10096 case 11100: hash_type
= HASH_TYPE_MD5
;
10097 salt_type
= SALT_TYPE_EMBEDDED
;
10098 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10099 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10100 | OPTS_TYPE_ST_ADD80
;
10101 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10102 dgst_size
= DGST_SIZE_4_4
;
10103 parse_func
= postgresql_auth_parse_hash
;
10104 sort_by_digest
= sort_by_digest_4_4
;
10105 opti_type
= OPTI_TYPE_ZERO_BYTE
10106 | OPTI_TYPE_PRECOMPUTE_INIT
10107 | OPTI_TYPE_PRECOMPUTE_MERKLE
10108 | OPTI_TYPE_EARLY_SKIP
;
10115 case 11200: hash_type
= HASH_TYPE_SHA1
;
10116 salt_type
= SALT_TYPE_EMBEDDED
;
10117 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10118 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10119 | OPTS_TYPE_PT_ADD80
10120 | OPTS_TYPE_ST_HEX
;
10121 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10122 dgst_size
= DGST_SIZE_4_5
;
10123 parse_func
= mysql_auth_parse_hash
;
10124 sort_by_digest
= sort_by_digest_4_5
;
10125 opti_type
= OPTI_TYPE_ZERO_BYTE
10126 | OPTI_TYPE_EARLY_SKIP
;
10133 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10134 salt_type
= SALT_TYPE_EMBEDDED
;
10135 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10138 | OPTS_TYPE_ST_ADD80
;
10139 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10140 dgst_size
= DGST_SIZE_4_4
;
10141 parse_func
= bitcoin_wallet_parse_hash
;
10142 sort_by_digest
= sort_by_digest_4_4
;
10143 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10150 case 11400: hash_type
= HASH_TYPE_MD5
;
10151 salt_type
= SALT_TYPE_EMBEDDED
;
10152 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10153 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10154 | OPTS_TYPE_PT_ADD80
10155 | OPTS_TYPE_HASH_COPY
;
10156 kern_type
= KERN_TYPE_SIP_AUTH
;
10157 dgst_size
= DGST_SIZE_4_4
;
10158 parse_func
= sip_auth_parse_hash
;
10159 sort_by_digest
= sort_by_digest_4_4
;
10160 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10167 case 11500: hash_type
= HASH_TYPE_CRC32
;
10168 salt_type
= SALT_TYPE_INTERN
;
10169 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10170 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10171 | OPTS_TYPE_ST_GENERATE_LE
10172 | OPTS_TYPE_ST_HEX
;
10173 kern_type
= KERN_TYPE_CRC32
;
10174 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10175 parse_func
= crc32_parse_hash
;
10176 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10177 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10184 case 11600: hash_type
= HASH_TYPE_AES
;
10185 salt_type
= SALT_TYPE_EMBEDDED
;
10186 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10187 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10188 | OPTS_TYPE_PT_NEVERCRACK
;
10189 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10190 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10191 parse_func
= seven_zip_parse_hash
;
10192 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10193 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10200 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10201 salt_type
= SALT_TYPE_NONE
;
10202 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10204 | OPTS_TYPE_PT_ADD01
;
10205 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10206 dgst_size
= DGST_SIZE_4_8
;
10207 parse_func
= gost2012sbog_256_parse_hash
;
10208 sort_by_digest
= sort_by_digest_4_8
;
10209 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10216 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10217 salt_type
= SALT_TYPE_NONE
;
10218 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10219 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10220 | OPTS_TYPE_PT_ADD01
;
10221 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10222 dgst_size
= DGST_SIZE_4_16
;
10223 parse_func
= gost2012sbog_512_parse_hash
;
10224 sort_by_digest
= sort_by_digest_4_16
;
10225 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10232 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10233 salt_type
= SALT_TYPE_EMBEDDED
;
10234 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10235 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10236 | OPTS_TYPE_ST_BASE64
10237 | OPTS_TYPE_HASH_COPY
;
10238 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10239 dgst_size
= DGST_SIZE_4_32
;
10240 parse_func
= pbkdf2_md5_parse_hash
;
10241 sort_by_digest
= sort_by_digest_4_32
;
10242 opti_type
= OPTI_TYPE_ZERO_BYTE
10243 | OPTI_TYPE_SLOW_HASH_SIMD
;
10250 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10251 salt_type
= SALT_TYPE_EMBEDDED
;
10252 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10253 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10254 | OPTS_TYPE_ST_BASE64
10255 | OPTS_TYPE_HASH_COPY
;
10256 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10257 dgst_size
= DGST_SIZE_4_32
;
10258 parse_func
= pbkdf2_sha1_parse_hash
;
10259 sort_by_digest
= sort_by_digest_4_32
;
10260 opti_type
= OPTI_TYPE_ZERO_BYTE
10261 | OPTI_TYPE_SLOW_HASH_SIMD
;
10268 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10269 salt_type
= SALT_TYPE_EMBEDDED
;
10270 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10271 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10272 | OPTS_TYPE_ST_BASE64
10273 | OPTS_TYPE_HASH_COPY
;
10274 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10275 dgst_size
= DGST_SIZE_8_16
;
10276 parse_func
= pbkdf2_sha512_parse_hash
;
10277 sort_by_digest
= sort_by_digest_8_16
;
10278 opti_type
= OPTI_TYPE_ZERO_BYTE
10279 | OPTI_TYPE_USES_BITS_64
10280 | OPTI_TYPE_SLOW_HASH_SIMD
;
10287 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10288 salt_type
= SALT_TYPE_EMBEDDED
;
10289 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10290 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10291 kern_type
= KERN_TYPE_ECRYPTFS
;
10292 dgst_size
= DGST_SIZE_8_8
;
10293 parse_func
= ecryptfs_parse_hash
;
10294 sort_by_digest
= sort_by_digest_8_8
;
10295 opti_type
= OPTI_TYPE_ZERO_BYTE
10296 | OPTI_TYPE_USES_BITS_64
;
10303 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10304 salt_type
= SALT_TYPE_EMBEDDED
;
10305 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10306 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10307 kern_type
= KERN_TYPE_ORACLET
;
10308 dgst_size
= DGST_SIZE_8_16
;
10309 parse_func
= oraclet_parse_hash
;
10310 sort_by_digest
= sort_by_digest_8_16
;
10311 opti_type
= OPTI_TYPE_ZERO_BYTE
10312 | OPTI_TYPE_USES_BITS_64
;
10319 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10320 salt_type
= SALT_TYPE_EMBEDDED
;
10321 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10322 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10323 kern_type
= KERN_TYPE_BSDICRYPT
;
10324 dgst_size
= DGST_SIZE_4_4
;
10325 parse_func
= bsdicrypt_parse_hash
;
10326 sort_by_digest
= sort_by_digest_4_4
;
10327 opti_type
= OPTI_TYPE_ZERO_BYTE
10328 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10335 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10336 salt_type
= SALT_TYPE_EMBEDDED
;
10337 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10338 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10339 kern_type
= KERN_TYPE_RAR3
;
10340 dgst_size
= DGST_SIZE_4_4
;
10341 parse_func
= rar3hp_parse_hash
;
10342 sort_by_digest
= sort_by_digest_4_4
;
10343 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10350 case 12600: hash_type
= HASH_TYPE_SHA256
;
10351 salt_type
= SALT_TYPE_INTERN
;
10352 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10353 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10354 | OPTS_TYPE_PT_ADD80
;
10355 kern_type
= KERN_TYPE_CF10
;
10356 dgst_size
= DGST_SIZE_4_8
;
10357 parse_func
= cf10_parse_hash
;
10358 sort_by_digest
= sort_by_digest_4_8
;
10359 opti_type
= OPTI_TYPE_ZERO_BYTE
10360 | OPTI_TYPE_PRECOMPUTE_INIT
10361 | OPTI_TYPE_EARLY_SKIP
10362 | OPTI_TYPE_NOT_ITERATED
;
10369 case 12700: hash_type
= HASH_TYPE_AES
;
10370 salt_type
= SALT_TYPE_EMBEDDED
;
10371 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10372 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10373 | OPTS_TYPE_HASH_COPY
;
10374 kern_type
= KERN_TYPE_MYWALLET
;
10375 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10376 parse_func
= mywallet_parse_hash
;
10377 sort_by_digest
= sort_by_digest_4_5
;
10378 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10385 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10386 salt_type
= SALT_TYPE_EMBEDDED
;
10387 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10388 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10389 kern_type
= KERN_TYPE_MS_DRSR
;
10390 dgst_size
= DGST_SIZE_4_8
;
10391 parse_func
= ms_drsr_parse_hash
;
10392 sort_by_digest
= sort_by_digest_4_8
;
10393 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10400 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10401 salt_type
= SALT_TYPE_EMBEDDED
;
10402 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10403 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10404 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10405 dgst_size
= DGST_SIZE_4_8
;
10406 parse_func
= androidfde_samsung_parse_hash
;
10407 sort_by_digest
= sort_by_digest_4_8
;
10408 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10415 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10416 salt_type
= SALT_TYPE_EMBEDDED
;
10417 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10418 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10419 kern_type
= KERN_TYPE_RAR5
;
10420 dgst_size
= DGST_SIZE_4_4
;
10421 parse_func
= rar5_parse_hash
;
10422 sort_by_digest
= sort_by_digest_4_4
;
10423 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10430 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10431 salt_type
= SALT_TYPE_EMBEDDED
;
10432 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10433 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10434 kern_type
= KERN_TYPE_KRB5TGS
;
10435 dgst_size
= DGST_SIZE_4_4
;
10436 parse_func
= krb5tgs_parse_hash
;
10437 sort_by_digest
= sort_by_digest_4_4
;
10438 opti_type
= OPTI_TYPE_ZERO_BYTE
10439 | OPTI_TYPE_NOT_ITERATED
;
10446 case 13200: hash_type
= HASH_TYPE_AES
;
10447 salt_type
= SALT_TYPE_EMBEDDED
;
10448 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10449 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10450 kern_type
= KERN_TYPE_AXCRYPT
;
10451 dgst_size
= DGST_SIZE_4_4
;
10452 parse_func
= axcrypt_parse_hash
;
10453 sort_by_digest
= sort_by_digest_4_4
;
10454 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10461 case 13300: hash_type
= HASH_TYPE_SHA1
;
10462 salt_type
= SALT_TYPE_NONE
;
10463 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10464 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10465 | OPTS_TYPE_PT_ADD80
10466 | OPTS_TYPE_PT_ADDBITS15
;
10467 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10468 dgst_size
= DGST_SIZE_4_5
;
10469 parse_func
= sha1axcrypt_parse_hash
;
10470 sort_by_digest
= sort_by_digest_4_5
;
10471 opti_type
= OPTI_TYPE_ZERO_BYTE
10472 | OPTI_TYPE_PRECOMPUTE_INIT
10473 | OPTI_TYPE_EARLY_SKIP
10474 | OPTI_TYPE_NOT_ITERATED
10475 | OPTI_TYPE_NOT_SALTED
;
10482 case 13400: hash_type
= HASH_TYPE_AES
;
10483 salt_type
= SALT_TYPE_EMBEDDED
;
10484 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10485 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10486 kern_type
= KERN_TYPE_KEEPASS
;
10487 dgst_size
= DGST_SIZE_4_4
;
10488 parse_func
= keepass_parse_hash
;
10489 sort_by_digest
= sort_by_digest_4_4
;
10490 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10497 case 13500: hash_type
= HASH_TYPE_SHA1
;
10498 salt_type
= SALT_TYPE_EMBEDDED
;
10499 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10500 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10501 | OPTS_TYPE_PT_UNICODE
10502 | OPTS_TYPE_PT_ADD80
;
10503 kern_type
= KERN_TYPE_PSTOKEN
;
10504 dgst_size
= DGST_SIZE_4_5
;
10505 parse_func
= pstoken_parse_hash
;
10506 sort_by_digest
= sort_by_digest_4_5
;
10507 opti_type
= OPTI_TYPE_ZERO_BYTE
10508 | OPTI_TYPE_PRECOMPUTE_INIT
10509 | OPTI_TYPE_EARLY_SKIP
10510 | OPTI_TYPE_NOT_ITERATED
10511 | OPTI_TYPE_PREPENDED_SALT
10512 | OPTI_TYPE_RAW_HASH
;
10519 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10520 salt_type
= SALT_TYPE_EMBEDDED
;
10521 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10522 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10523 kern_type
= KERN_TYPE_ZIP2
;
10524 dgst_size
= DGST_SIZE_4_4
;
10525 parse_func
= zip2_parse_hash
;
10526 sort_by_digest
= sort_by_digest_4_4
;
10527 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10534 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10535 salt_type
= SALT_TYPE_EMBEDDED
;
10536 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10537 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10538 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10539 dgst_size
= DGST_SIZE_4_5
;
10540 parse_func
= veracrypt_parse_hash_655331
;
10541 sort_by_digest
= sort_by_digest_4_5
;
10542 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10549 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10550 salt_type
= SALT_TYPE_EMBEDDED
;
10551 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10553 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10554 dgst_size
= DGST_SIZE_4_5
;
10555 parse_func
= veracrypt_parse_hash_655331
;
10556 sort_by_digest
= sort_by_digest_4_5
;
10557 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10564 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10565 salt_type
= SALT_TYPE_EMBEDDED
;
10566 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10567 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10568 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10569 dgst_size
= DGST_SIZE_4_5
;
10570 parse_func
= veracrypt_parse_hash_655331
;
10571 sort_by_digest
= sort_by_digest_4_5
;
10572 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10579 case 13721: hash_type
= HASH_TYPE_SHA512
;
10580 salt_type
= SALT_TYPE_EMBEDDED
;
10581 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10582 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10583 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10584 dgst_size
= DGST_SIZE_8_8
;
10585 parse_func
= veracrypt_parse_hash_500000
;
10586 sort_by_digest
= sort_by_digest_8_8
;
10587 opti_type
= OPTI_TYPE_ZERO_BYTE
10588 | OPTI_TYPE_USES_BITS_64
;
10595 case 13722: hash_type
= HASH_TYPE_SHA512
;
10596 salt_type
= SALT_TYPE_EMBEDDED
;
10597 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10599 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10600 dgst_size
= DGST_SIZE_8_8
;
10601 parse_func
= veracrypt_parse_hash_500000
;
10602 sort_by_digest
= sort_by_digest_8_8
;
10603 opti_type
= OPTI_TYPE_ZERO_BYTE
10604 | OPTI_TYPE_USES_BITS_64
;
10611 case 13723: hash_type
= HASH_TYPE_SHA512
;
10612 salt_type
= SALT_TYPE_EMBEDDED
;
10613 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10614 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10615 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10616 dgst_size
= DGST_SIZE_8_8
;
10617 parse_func
= veracrypt_parse_hash_500000
;
10618 sort_by_digest
= sort_by_digest_8_8
;
10619 opti_type
= OPTI_TYPE_ZERO_BYTE
10620 | OPTI_TYPE_USES_BITS_64
;
10627 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10628 salt_type
= SALT_TYPE_EMBEDDED
;
10629 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10630 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10631 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10632 dgst_size
= DGST_SIZE_4_8
;
10633 parse_func
= veracrypt_parse_hash_500000
;
10634 sort_by_digest
= sort_by_digest_4_8
;
10635 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10642 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10643 salt_type
= SALT_TYPE_EMBEDDED
;
10644 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10645 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10646 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10647 dgst_size
= DGST_SIZE_4_8
;
10648 parse_func
= veracrypt_parse_hash_500000
;
10649 sort_by_digest
= sort_by_digest_4_8
;
10650 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10657 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10658 salt_type
= SALT_TYPE_EMBEDDED
;
10659 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10660 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10661 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10662 dgst_size
= DGST_SIZE_4_8
;
10663 parse_func
= veracrypt_parse_hash_500000
;
10664 sort_by_digest
= sort_by_digest_4_8
;
10665 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10672 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10673 salt_type
= SALT_TYPE_EMBEDDED
;
10674 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10675 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10676 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10677 dgst_size
= DGST_SIZE_4_5
;
10678 parse_func
= veracrypt_parse_hash_327661
;
10679 sort_by_digest
= sort_by_digest_4_5
;
10680 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10687 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10688 salt_type
= SALT_TYPE_EMBEDDED
;
10689 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10690 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10691 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10692 dgst_size
= DGST_SIZE_4_5
;
10693 parse_func
= veracrypt_parse_hash_327661
;
10694 sort_by_digest
= sort_by_digest_4_5
;
10695 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10702 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10703 salt_type
= SALT_TYPE_EMBEDDED
;
10704 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10705 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10706 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10707 dgst_size
= DGST_SIZE_4_5
;
10708 parse_func
= veracrypt_parse_hash_327661
;
10709 sort_by_digest
= sort_by_digest_4_5
;
10710 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10717 case 13751: hash_type
= HASH_TYPE_SHA256
;
10718 salt_type
= SALT_TYPE_EMBEDDED
;
10719 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10720 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10721 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10722 dgst_size
= DGST_SIZE_4_8
;
10723 parse_func
= veracrypt_parse_hash_500000
;
10724 sort_by_digest
= sort_by_digest_4_8
;
10725 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10732 case 13752: hash_type
= HASH_TYPE_SHA256
;
10733 salt_type
= SALT_TYPE_EMBEDDED
;
10734 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10735 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10736 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10737 dgst_size
= DGST_SIZE_4_8
;
10738 parse_func
= veracrypt_parse_hash_500000
;
10739 sort_by_digest
= sort_by_digest_4_8
;
10740 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10747 case 13753: hash_type
= HASH_TYPE_SHA256
;
10748 salt_type
= SALT_TYPE_EMBEDDED
;
10749 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10750 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10751 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10752 dgst_size
= DGST_SIZE_4_8
;
10753 parse_func
= veracrypt_parse_hash_500000
;
10754 sort_by_digest
= sort_by_digest_4_8
;
10755 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10762 case 13761: hash_type
= HASH_TYPE_SHA256
;
10763 salt_type
= SALT_TYPE_EMBEDDED
;
10764 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10765 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10766 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10767 dgst_size
= DGST_SIZE_4_8
;
10768 parse_func
= veracrypt_parse_hash_200000
;
10769 sort_by_digest
= sort_by_digest_4_8
;
10770 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10777 case 13762: hash_type
= HASH_TYPE_SHA256
;
10778 salt_type
= SALT_TYPE_EMBEDDED
;
10779 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10780 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10781 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10782 dgst_size
= DGST_SIZE_4_8
;
10783 parse_func
= veracrypt_parse_hash_200000
;
10784 sort_by_digest
= sort_by_digest_4_8
;
10785 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10792 case 13763: hash_type
= HASH_TYPE_SHA256
;
10793 salt_type
= SALT_TYPE_EMBEDDED
;
10794 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10795 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10796 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10797 dgst_size
= DGST_SIZE_4_8
;
10798 parse_func
= veracrypt_parse_hash_200000
;
10799 sort_by_digest
= sort_by_digest_4_8
;
10800 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10808 default: usage_mini_print (PROGNAME
); return (-1);
10815 data
.parse_func
= parse_func
;
10823 if (salt_type
== SALT_TYPE_INTERN
)
10825 opts_type
|= OPTS_TYPE_ST_HEX
;
10829 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10835 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10836 | (salt_type
== SALT_TYPE_EXTERN
)
10837 | (salt_type
== SALT_TYPE_EMBEDDED
)
10838 | (salt_type
== SALT_TYPE_VIRTUAL
));
10840 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10842 data
.hash_type
= hash_type
;
10843 data
.attack_mode
= attack_mode
;
10844 data
.attack_kern
= attack_kern
;
10845 data
.attack_exec
= attack_exec
;
10846 data
.kern_type
= kern_type
;
10847 data
.opts_type
= opts_type
;
10848 data
.dgst_size
= dgst_size
;
10849 data
.salt_type
= salt_type
;
10850 data
.isSalted
= isSalted
;
10851 data
.sort_by_digest
= sort_by_digest
;
10852 data
.dgst_pos0
= dgst_pos0
;
10853 data
.dgst_pos1
= dgst_pos1
;
10854 data
.dgst_pos2
= dgst_pos2
;
10855 data
.dgst_pos3
= dgst_pos3
;
10861 case 2500: esalt_size
= sizeof (wpa_t
); break;
10862 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10863 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10864 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10865 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10866 case 6211: esalt_size
= sizeof (tc_t
); break;
10867 case 6212: esalt_size
= sizeof (tc_t
); break;
10868 case 6213: esalt_size
= sizeof (tc_t
); break;
10869 case 6221: esalt_size
= sizeof (tc_t
); break;
10870 case 6222: esalt_size
= sizeof (tc_t
); break;
10871 case 6223: esalt_size
= sizeof (tc_t
); break;
10872 case 6231: esalt_size
= sizeof (tc_t
); break;
10873 case 6232: esalt_size
= sizeof (tc_t
); break;
10874 case 6233: esalt_size
= sizeof (tc_t
); break;
10875 case 6241: esalt_size
= sizeof (tc_t
); break;
10876 case 6242: esalt_size
= sizeof (tc_t
); break;
10877 case 6243: esalt_size
= sizeof (tc_t
); break;
10878 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10879 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10880 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10881 case 7300: esalt_size
= sizeof (rakp_t
); break;
10882 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10883 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10884 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10885 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10886 case 9400: esalt_size
= sizeof (office2007_t
); break;
10887 case 9500: esalt_size
= sizeof (office2010_t
); break;
10888 case 9600: esalt_size
= sizeof (office2013_t
); break;
10889 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10890 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10891 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10892 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10893 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10894 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10895 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10896 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10897 case 10400: esalt_size
= sizeof (pdf_t
); break;
10898 case 10410: esalt_size
= sizeof (pdf_t
); break;
10899 case 10420: esalt_size
= sizeof (pdf_t
); break;
10900 case 10500: esalt_size
= sizeof (pdf_t
); break;
10901 case 10600: esalt_size
= sizeof (pdf_t
); break;
10902 case 10700: esalt_size
= sizeof (pdf_t
); break;
10903 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10904 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10905 case 11400: esalt_size
= sizeof (sip_t
); break;
10906 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10907 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10908 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10909 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10910 case 13000: esalt_size
= sizeof (rar5_t
); break;
10911 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10912 case 13400: esalt_size
= sizeof (keepass_t
); break;
10913 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10914 case 13600: esalt_size
= sizeof (zip2_t
); break;
10915 case 13711: esalt_size
= sizeof (tc_t
); break;
10916 case 13712: esalt_size
= sizeof (tc_t
); break;
10917 case 13713: esalt_size
= sizeof (tc_t
); break;
10918 case 13721: esalt_size
= sizeof (tc_t
); break;
10919 case 13722: esalt_size
= sizeof (tc_t
); break;
10920 case 13723: esalt_size
= sizeof (tc_t
); break;
10921 case 13731: esalt_size
= sizeof (tc_t
); break;
10922 case 13732: esalt_size
= sizeof (tc_t
); break;
10923 case 13733: esalt_size
= sizeof (tc_t
); break;
10924 case 13741: esalt_size
= sizeof (tc_t
); break;
10925 case 13742: esalt_size
= sizeof (tc_t
); break;
10926 case 13743: esalt_size
= sizeof (tc_t
); break;
10927 case 13751: esalt_size
= sizeof (tc_t
); break;
10928 case 13752: esalt_size
= sizeof (tc_t
); break;
10929 case 13753: esalt_size
= sizeof (tc_t
); break;
10930 case 13761: esalt_size
= sizeof (tc_t
); break;
10931 case 13762: esalt_size
= sizeof (tc_t
); break;
10932 case 13763: esalt_size
= sizeof (tc_t
); break;
10935 data
.esalt_size
= esalt_size
;
10938 * choose dictionary parser
10941 if (hash_type
== HASH_TYPE_LM
)
10943 get_next_word_func
= get_next_word_lm
;
10945 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10947 get_next_word_func
= get_next_word_uc
;
10951 get_next_word_func
= get_next_word_std
;
10958 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10961 size_t dictstat_nmemb
= 0;
10965 uint dictstat_nmemb
= 0;
10968 char dictstat
[256] = { 0 };
10970 FILE *dictstat_fp
= NULL
;
10974 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10976 dictstat_fp
= fopen (dictstat
, "rb");
10981 struct stat tmpstat
;
10983 fstat (fileno (dictstat_fp
), &tmpstat
);
10987 struct stat64 tmpstat
;
10989 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10992 if (tmpstat
.st_mtime
< COMPTIME
)
10994 /* with v0.15 the format changed so we have to ensure user is using a good version
10995 since there is no version-header in the dictstat file */
10997 fclose (dictstat_fp
);
11003 while (!feof (dictstat_fp
))
11007 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11009 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11011 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11013 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11019 fclose (dictstat_fp
);
11028 char potfile
[256] = { 0 };
11030 if (potfile_path
== NULL
)
11032 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11036 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11039 data
.pot_fp
= NULL
;
11041 FILE *out_fp
= NULL
;
11042 FILE *pot_fp
= NULL
;
11044 if (show
== 1 || left
== 1)
11046 pot_fp
= fopen (potfile
, "rb");
11048 if (pot_fp
== NULL
)
11050 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11055 if (outfile
!= NULL
)
11057 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11059 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11073 if (potfile_disable
== 0)
11075 pot_fp
= fopen (potfile
, "ab");
11077 if (pot_fp
== NULL
)
11079 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11084 data
.pot_fp
= pot_fp
;
11091 uint pot_avail
= 0;
11093 if (show
== 1 || left
== 1)
11095 SUPPRESS_OUTPUT
= 1;
11097 pot_avail
= count_lines (pot_fp
);
11101 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11103 uint pot_hashes_avail
= 0;
11107 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11109 while (!feof (pot_fp
))
11113 int line_len
= fgetl (pot_fp
, line_buf
);
11115 if (line_len
== 0) continue;
11117 char *plain_buf
= line_buf
+ line_len
;
11119 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11121 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11123 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11124 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11126 if (pot_cnt
== pot_hashes_avail
)
11130 for (pos
= 0; pos
< INCR_POT
; pos
++)
11132 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11134 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11136 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11138 tmp_hash
->digest
= mymalloc (dgst_size
);
11142 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11147 tmp_hash
->esalt
= mymalloc (esalt_size
);
11150 pot_hashes_avail
++;
11158 int iter
= MAX_CUT_TRIES
;
11162 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11164 if (line_buf
[i
] == ':')
11172 if (data
.hash_mode
!= 2500)
11174 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11178 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11180 if (line_len
> max_salt_size
)
11182 parser_status
= PARSER_GLOBAL_LENGTH
;
11186 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11188 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11190 hashes_buf
->salt
->salt_len
= line_len
;
11192 parser_status
= PARSER_OK
;
11196 // if NOT parsed without error, we add the ":" to the plain
11198 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11204 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11206 if (parser_status
< PARSER_GLOBAL_ZERO
)
11208 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11213 if (plain_len
>= 255) continue;
11215 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11217 pot_ptr
->plain_len
= plain_len
;
11226 SUPPRESS_OUTPUT
= 0;
11228 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11235 uint pw_min
= PW_MIN
;
11236 uint pw_max
= PW_MAX
;
11240 case 125: if (pw_max
> 32) pw_max
= 32;
11242 case 400: if (pw_max
> 40) pw_max
= 40;
11244 case 500: if (pw_max
> 16) pw_max
= 16;
11246 case 1500: if (pw_max
> 8) pw_max
= 8;
11248 case 1600: if (pw_max
> 16) pw_max
= 16;
11250 case 1800: if (pw_max
> 16) pw_max
= 16;
11252 case 2100: if (pw_max
> 16) pw_max
= 16;
11254 case 2500: if (pw_min
< 8) pw_min
= 8;
11256 case 3000: if (pw_max
> 7) pw_max
= 7;
11258 case 5200: if (pw_max
> 24) pw_max
= 24;
11260 case 5800: if (pw_max
> 16) pw_max
= 16;
11262 case 6300: if (pw_max
> 16) pw_max
= 16;
11264 case 7400: if (pw_max
> 16) pw_max
= 16;
11266 case 7500: if (pw_max
> 8) pw_max
= 8;
11268 case 7900: if (pw_max
> 48) pw_max
= 48;
11270 case 8500: if (pw_max
> 8) pw_max
= 8;
11272 case 8600: if (pw_max
> 16) pw_max
= 16;
11274 case 9710: pw_min
= 5;
11277 case 9810: pw_min
= 5;
11280 case 10410: pw_min
= 5;
11283 case 10300: if (pw_max
< 3) pw_min
= 3;
11284 if (pw_max
> 40) pw_max
= 40;
11286 case 10500: if (pw_max
< 3) pw_min
= 3;
11287 if (pw_max
> 40) pw_max
= 40;
11289 case 10700: if (pw_max
> 16) pw_max
= 16;
11291 case 11300: if (pw_max
> 40) pw_max
= 40;
11293 case 11600: if (pw_max
> 32) pw_max
= 32;
11295 case 12500: if (pw_max
> 20) pw_max
= 20;
11297 case 12800: if (pw_max
> 24) pw_max
= 24;
11301 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11303 switch (attack_kern
)
11305 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11307 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11313 * charsets : keep them together for more easy maintainnce
11316 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11317 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11319 mp_setup_sys (mp_sys
);
11321 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11322 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11323 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11324 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11327 * load hashes, part I: find input mode, count hashes
11330 uint hashlist_mode
= 0;
11331 uint hashlist_format
= HLFMT_HASHCAT
;
11333 uint hashes_avail
= 0;
11335 if (benchmark
== 0)
11339 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11341 if ((hash_mode
== 2500) ||
11342 (hash_mode
== 5200) ||
11343 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11344 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11345 (hash_mode
== 9000))
11347 hashlist_mode
= HL_MODE_ARG
;
11349 char *hashfile
= myargv
[optind
];
11351 data
.hashfile
= hashfile
;
11353 logfile_top_var_string ("target", hashfile
);
11356 if (hashlist_mode
== HL_MODE_ARG
)
11358 if (hash_mode
== 2500)
11362 if (stat (data
.hashfile
, &st
) == -1)
11364 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11369 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11376 else if (hashlist_mode
== HL_MODE_FILE
)
11378 char *hashfile
= myargv
[optind
];
11380 data
.hashfile
= hashfile
;
11382 logfile_top_var_string ("target", hashfile
);
11386 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11388 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11393 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11395 hashes_avail
= count_lines (fp
);
11399 if (hashes_avail
== 0)
11401 log_error ("ERROR: hashfile is empty or corrupt");
11408 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11410 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11412 log_error ("ERROR: remove not supported in native hashfile-format mode");
11424 hashlist_mode
= HL_MODE_ARG
;
11429 if (hash_mode
== 3000) hashes_avail
*= 2;
11431 data
.hashlist_mode
= hashlist_mode
;
11432 data
.hashlist_format
= hashlist_format
;
11434 logfile_top_uint (hashlist_mode
);
11435 logfile_top_uint (hashlist_format
);
11438 * load hashes, part II: allocate required memory, set pointers
11441 hash_t
*hashes_buf
= NULL
;
11442 void *digests_buf
= NULL
;
11443 salt_t
*salts_buf
= NULL
;
11444 void *esalts_buf
= NULL
;
11446 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11448 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11450 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11454 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11456 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11458 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11460 if (username
&& (remove
|| show
|| left
))
11462 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11467 hash_info
->orighash
= (char *) mymalloc (256);
11474 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11478 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11483 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11486 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11488 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11492 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11496 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11501 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11506 * load hashes, part III: parse hashes or generate them if benchmark
11509 uint hashes_cnt
= 0;
11511 if (benchmark
== 0)
11515 // useless to read hash file for keyspace, cheat a little bit w/ optind
11517 else if (hashes_avail
== 0)
11520 else if (hashlist_mode
== HL_MODE_ARG
)
11522 char *input_buf
= myargv
[optind
];
11524 uint input_len
= strlen (input_buf
);
11526 logfile_top_var_string ("target", input_buf
);
11528 char *hash_buf
= NULL
;
11531 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11533 bool hash_fmt_error
= 0;
11535 if (hash_len
< 1) hash_fmt_error
= 1;
11536 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11538 if (hash_fmt_error
)
11540 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11544 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11546 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11548 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11553 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11556 int parser_status
= PARSER_OK
;
11558 if (hash_mode
== 2500)
11562 log_error ("ERROR: hccap file not specified");
11567 hashlist_mode
= HL_MODE_FILE
;
11569 data
.hashlist_mode
= hashlist_mode
;
11571 FILE *fp
= fopen (hash_buf
, "rb");
11575 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11580 if (hashes_avail
< 1)
11582 log_error ("ERROR: hccap file is empty or corrupt");
11589 uint hccap_size
= sizeof (hccap_t
);
11591 char *in
= (char *) mymalloc (hccap_size
);
11595 int n
= fread (in
, hccap_size
, 1, fp
);
11599 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11604 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11606 if (parser_status
!= PARSER_OK
)
11608 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11613 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11615 if ((show
== 1) || (left
== 1))
11617 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11619 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11621 int cur_pos
= tmp_salt
->salt_len
;
11622 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11624 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11626 // do the appending task
11628 snprintf (salt_ptr
+ cur_pos
,
11630 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11642 wpa
->orig_mac2
[5]);
11644 // memset () the remaining part of the salt
11646 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11647 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11649 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11651 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11654 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
);
11655 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
);
11664 else if (hash_mode
== 3000)
11666 if (hash_len
== 32)
11668 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11670 hash_t
*lm_hash_left
= NULL
;
11672 if (parser_status
== PARSER_OK
)
11674 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11680 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11683 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11685 hash_t
*lm_hash_right
= NULL
;
11687 if (parser_status
== PARSER_OK
)
11689 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11695 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11700 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11702 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
);
11703 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
);
11708 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11710 if (parser_status
== PARSER_OK
)
11712 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11713 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11716 if (parser_status
== PARSER_OK
)
11722 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11728 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11730 if (parser_status
== PARSER_OK
)
11732 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11733 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11736 if (parser_status
== PARSER_OK
)
11742 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11747 else if (hashlist_mode
== HL_MODE_FILE
)
11749 char *hashfile
= data
.hashfile
;
11753 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11755 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11762 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11768 int line_len
= fgetl (fp
, line_buf
);
11770 if (line_len
== 0) continue;
11772 char *hash_buf
= NULL
;
11775 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11777 bool hash_fmt_error
= 0;
11779 if (hash_len
< 1) hash_fmt_error
= 1;
11780 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11782 if (hash_fmt_error
)
11784 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11791 char *user_buf
= NULL
;
11794 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11796 if (remove
|| show
)
11798 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11800 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11802 user_t
*user_ptr
= *user
;
11804 if (user_buf
!= NULL
)
11806 user_ptr
->user_name
= mystrdup (user_buf
);
11810 user_ptr
->user_name
= mystrdup ("");
11813 user_ptr
->user_len
= user_len
;
11817 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11819 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11821 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11826 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11829 if (hash_mode
== 3000)
11831 if (hash_len
== 32)
11833 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11835 if (parser_status
< PARSER_GLOBAL_ZERO
)
11837 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11842 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11846 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11848 if (parser_status
< PARSER_GLOBAL_ZERO
)
11850 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11855 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11857 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);
11863 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
);
11864 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
);
11868 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11870 if (parser_status
< PARSER_GLOBAL_ZERO
)
11872 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11877 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11879 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11880 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11887 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11889 if (parser_status
< PARSER_GLOBAL_ZERO
)
11891 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11896 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);
11898 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11899 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11909 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11911 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11918 hashes_buf
[0].salt
->salt_len
= 8;
11920 // special salt handling
11924 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11925 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11927 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11929 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11931 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11933 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11935 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11937 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11939 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11941 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11943 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11945 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11946 hashes_buf
[0].salt
->scrypt_N
= 1024;
11947 hashes_buf
[0].salt
->scrypt_r
= 1;
11948 hashes_buf
[0].salt
->scrypt_p
= 1;
11950 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11952 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11953 hashes_buf
[0].salt
->scrypt_N
= 16384;
11954 hashes_buf
[0].salt
->scrypt_r
= 1;
11955 hashes_buf
[0].salt
->scrypt_p
= 1;
11957 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11959 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11961 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11963 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11965 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11967 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11969 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11971 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11973 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11975 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11977 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11979 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11981 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11983 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11985 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11989 // special esalt handling
11993 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11995 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11996 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11998 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11999 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12001 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12002 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12003 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12004 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12006 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12007 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12008 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12009 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12011 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12013 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12014 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12015 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12017 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12018 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12019 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12021 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12022 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12023 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12025 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12026 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12027 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12029 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12030 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12031 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12033 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12034 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12035 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12037 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12038 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12039 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12041 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12043 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12045 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12046 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12047 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12056 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12058 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12060 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12062 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12064 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12066 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12068 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12070 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12072 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12074 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12076 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12078 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12080 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12082 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12084 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12086 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12088 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12090 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12092 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12094 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12096 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12098 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12100 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12102 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12104 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12106 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12108 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12110 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12112 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12114 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12116 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12118 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12120 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12122 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12124 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12126 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12130 // set default iterations
12134 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12136 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12138 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12140 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12142 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12144 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12146 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12148 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12150 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12152 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12154 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12156 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12158 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12160 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12162 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12164 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12166 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12168 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12170 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12172 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12174 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12176 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12178 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12180 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12182 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12184 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12186 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12188 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12190 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12192 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12194 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12196 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12198 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12200 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12202 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12204 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12206 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12208 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12210 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12212 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12214 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12216 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12218 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12220 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12222 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12224 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12226 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12228 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12230 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12232 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12234 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12236 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12238 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12240 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12242 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12244 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12246 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12248 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12250 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12252 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12254 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12256 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12258 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12260 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12262 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12264 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12266 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12268 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12270 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12272 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12274 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12276 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12278 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12280 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12282 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12284 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12286 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12288 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12290 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12292 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12294 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12296 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12303 if (show
== 1 || left
== 1)
12305 for (uint i
= 0; i
< pot_cnt
; i
++)
12307 pot_t
*pot_ptr
= &pot
[i
];
12309 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12311 local_free (hashes_buf
->digest
);
12315 local_free (hashes_buf
->salt
);
12321 if (data
.quiet
== 0) log_info_nn ("");
12328 if (hashes_cnt
== 0)
12330 log_error ("ERROR: No hashes loaded");
12337 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12340 if (data
.outfile
!= NULL
)
12342 if (data
.hashfile
!= NULL
)
12345 struct stat tmpstat_outfile
;
12346 struct stat tmpstat_hashfile
;
12350 struct stat64 tmpstat_outfile
;
12351 struct stat64 tmpstat_hashfile
;
12354 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12356 if (tmp_outfile_fp
)
12359 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12363 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12366 fclose (tmp_outfile_fp
);
12369 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12371 if (tmp_hashfile_fp
)
12374 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12378 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12381 fclose (tmp_hashfile_fp
);
12384 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12386 tmpstat_outfile
.st_mode
= 0;
12387 tmpstat_outfile
.st_nlink
= 0;
12388 tmpstat_outfile
.st_uid
= 0;
12389 tmpstat_outfile
.st_gid
= 0;
12390 tmpstat_outfile
.st_rdev
= 0;
12391 tmpstat_outfile
.st_atime
= 0;
12393 tmpstat_hashfile
.st_mode
= 0;
12394 tmpstat_hashfile
.st_nlink
= 0;
12395 tmpstat_hashfile
.st_uid
= 0;
12396 tmpstat_hashfile
.st_gid
= 0;
12397 tmpstat_hashfile
.st_rdev
= 0;
12398 tmpstat_hashfile
.st_atime
= 0;
12401 tmpstat_outfile
.st_blksize
= 0;
12402 tmpstat_outfile
.st_blocks
= 0;
12404 tmpstat_hashfile
.st_blksize
= 0;
12405 tmpstat_hashfile
.st_blocks
= 0;
12409 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12411 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12418 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12420 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12430 * Remove duplicates
12433 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12437 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12441 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12444 uint hashes_cnt_orig
= hashes_cnt
;
12448 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12452 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12454 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12459 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12462 if (hashes_pos
> hashes_cnt
)
12464 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12474 uint potfile_remove_cracks
= 0;
12476 if (potfile_disable
== 0)
12480 hash_buf
.digest
= mymalloc (dgst_size
);
12481 hash_buf
.salt
= NULL
;
12482 hash_buf
.esalt
= NULL
;
12483 hash_buf
.hash_info
= NULL
;
12484 hash_buf
.cracked
= 0;
12488 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12493 hash_buf
.esalt
= mymalloc (esalt_size
);
12496 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12498 // no solution for these special hash types (for instane because they use hashfile in output etc)
12499 if ((hash_mode
!= 5200) &&
12500 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12501 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12502 (hash_mode
!= 9000))
12504 FILE *fp
= fopen (potfile
, "rb");
12508 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12510 // to be safe work with a copy (because of line_len loop, i etc)
12511 // moved up here because it's easier to handle continue case
12514 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12518 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12520 if (ptr
== NULL
) break;
12522 int line_len
= strlen (line_buf
);
12524 if (line_len
== 0) continue;
12526 int iter
= MAX_CUT_TRIES
;
12528 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12530 if (line_buf
[i
] != ':') continue;
12534 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12537 hash_t
*found
= NULL
;
12539 if (hash_mode
== 6800)
12541 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12543 // manipulate salt_buf
12544 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12546 hash_buf
.salt
->salt_len
= i
;
12548 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12551 else if (hash_mode
== 2500)
12553 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12555 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12556 // manipulate salt_buf
12558 memcpy (line_buf_cpy
, line_buf
, i
);
12560 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12562 if (mac2_pos
== NULL
) continue;
12567 if (strlen (mac2_pos
) != 12) continue;
12569 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12571 if (mac1_pos
== NULL
) continue;
12576 if (strlen (mac1_pos
) != 12) continue;
12578 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12580 // here we need the ESSID
12581 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12583 hash_buf
.salt
->salt_len
= essid_length
;
12585 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12589 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12591 // compare hex string(s) vs binary MAC address(es)
12593 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12595 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12604 if (!found
) continue;
12606 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12608 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12620 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12622 if (parser_status
== PARSER_OK
)
12626 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12630 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12635 if (found
== NULL
) continue;
12637 if (!found
->cracked
) potfile_remove_cracks
++;
12639 found
->cracked
= 1;
12647 myfree (line_buf_cpy
);
12657 local_free (hash_buf
.esalt
);
12662 local_free (hash_buf
.salt
);
12665 local_free (hash_buf
.digest
);
12669 * Now generate all the buffers required for later
12672 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12674 salt_t
*salts_buf_new
= NULL
;
12675 void *esalts_buf_new
= NULL
;
12679 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12683 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12688 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12691 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12693 uint digests_cnt
= hashes_cnt
;
12694 uint digests_done
= 0;
12696 size_t size_digests
= digests_cnt
* dgst_size
;
12697 size_t size_shown
= digests_cnt
* sizeof (uint
);
12699 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12700 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12702 uint salts_cnt
= 0;
12703 uint salts_done
= 0;
12705 hashinfo_t
**hash_info
= NULL
;
12707 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12709 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12711 if (username
&& (remove
|| show
))
12715 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12717 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12719 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12724 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12729 // copied from inner loop
12731 salt_buf
= &salts_buf_new
[salts_cnt
];
12733 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12737 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12740 salt_buf
->digests_cnt
= 0;
12741 salt_buf
->digests_done
= 0;
12742 salt_buf
->digests_offset
= 0;
12747 if (hashes_buf
[0].cracked
== 1)
12749 digests_shown
[0] = 1;
12753 salt_buf
->digests_done
++;
12756 salt_buf
->digests_cnt
++;
12758 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12760 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12762 hash_info
[0] = hashes_buf
[0].hash_info
;
12765 // copy from inner loop
12767 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12771 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12773 salt_buf
= &salts_buf_new
[salts_cnt
];
12775 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12779 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12782 salt_buf
->digests_cnt
= 0;
12783 salt_buf
->digests_done
= 0;
12784 salt_buf
->digests_offset
= hashes_pos
;
12790 if (hashes_buf
[hashes_pos
].cracked
== 1)
12792 digests_shown
[hashes_pos
] = 1;
12796 salt_buf
->digests_done
++;
12799 salt_buf
->digests_cnt
++;
12801 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12803 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12805 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12809 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12811 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12813 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12815 salts_shown
[salt_pos
] = 1;
12820 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12823 local_free (digests_buf
);
12824 local_free (salts_buf
);
12825 local_free (esalts_buf
);
12827 digests_buf
= digests_buf_new
;
12828 salts_buf
= salts_buf_new
;
12829 esalts_buf
= esalts_buf_new
;
12831 local_free (hashes_buf
);
12834 * special modification not set from parser
12839 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12840 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12841 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12842 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12843 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12844 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12845 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12846 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12847 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12848 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12849 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12850 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12851 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12852 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12853 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12854 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12855 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12856 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12857 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12858 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12859 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12860 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12861 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12862 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12863 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12864 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12865 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12866 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12867 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12868 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12871 if (truecrypt_keyfiles
)
12873 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12875 char *keyfiles
= strdup (truecrypt_keyfiles
);
12877 char *keyfile
= strtok (keyfiles
, ",");
12881 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12883 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12888 if (veracrypt_keyfiles
)
12890 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12892 char *keyfiles
= strdup (veracrypt_keyfiles
);
12894 char *keyfile
= strtok (keyfiles
, ",");
12898 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12900 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12905 data
.digests_cnt
= digests_cnt
;
12906 data
.digests_done
= digests_done
;
12907 data
.digests_buf
= digests_buf
;
12908 data
.digests_shown
= digests_shown
;
12909 data
.digests_shown_tmp
= digests_shown_tmp
;
12911 data
.salts_cnt
= salts_cnt
;
12912 data
.salts_done
= salts_done
;
12913 data
.salts_buf
= salts_buf
;
12914 data
.salts_shown
= salts_shown
;
12916 data
.esalts_buf
= esalts_buf
;
12917 data
.hash_info
= hash_info
;
12920 * Automatic Optimizers
12923 if (salts_cnt
== 1)
12924 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12926 if (digests_cnt
== 1)
12927 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12929 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12930 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12932 if (attack_mode
== ATTACK_MODE_BF
)
12933 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12935 data
.opti_type
= opti_type
;
12937 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12939 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12941 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12943 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12945 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12946 opts_type
|= OPTS_TYPE_PT_ADD80
;
12949 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12951 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12952 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12955 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12957 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12958 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12965 * Some algorithm, like descrypt, can benefit from JIT compilation
12968 int force_jit_compilation
= -1;
12970 if (hash_mode
== 8900)
12972 force_jit_compilation
= 8900;
12974 else if (hash_mode
== 9300)
12976 force_jit_compilation
= 8900;
12978 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12980 force_jit_compilation
= 1500;
12984 * generate bitmap tables
12987 const uint bitmap_shift1
= 5;
12988 const uint bitmap_shift2
= 13;
12990 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12992 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12993 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12994 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12995 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12996 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12997 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12998 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12999 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13006 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13008 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13010 bitmap_nums
= 1 << bitmap_bits
;
13012 bitmap_mask
= bitmap_nums
- 1;
13014 bitmap_size
= bitmap_nums
* sizeof (uint
);
13016 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13018 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;
13019 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;
13024 bitmap_nums
= 1 << bitmap_bits
;
13026 bitmap_mask
= bitmap_nums
- 1;
13028 bitmap_size
= bitmap_nums
* sizeof (uint
);
13030 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);
13031 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);
13034 * prepare quick rule
13037 data
.rule_buf_l
= rule_buf_l
;
13038 data
.rule_buf_r
= rule_buf_r
;
13040 int rule_len_l
= (int) strlen (rule_buf_l
);
13041 int rule_len_r
= (int) strlen (rule_buf_r
);
13043 data
.rule_len_l
= rule_len_l
;
13044 data
.rule_len_r
= rule_len_r
;
13050 uint
*all_kernel_rules_cnt
= NULL
;
13052 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13056 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13058 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13061 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13065 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13067 uint kernel_rules_avail
= 0;
13069 uint kernel_rules_cnt
= 0;
13071 kernel_rule_t
*kernel_rules_buf
= NULL
;
13073 char *rp_file
= rp_files
[i
];
13075 char in
[BLOCK_SIZE
] = { 0 };
13076 char out
[BLOCK_SIZE
] = { 0 };
13080 uint rule_line
= 0;
13082 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13084 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13091 memset (rule_buf
, 0, HCBUFSIZ
);
13093 rule_len
= fgetl (fp
, rule_buf
);
13097 if (rule_len
== 0) continue;
13099 if (rule_buf
[0] == '#') continue;
13101 if (kernel_rules_avail
== kernel_rules_cnt
)
13103 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13105 kernel_rules_avail
+= INCR_RULES
;
13108 memset (in
, 0, BLOCK_SIZE
);
13109 memset (out
, 0, BLOCK_SIZE
);
13111 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13115 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13120 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13122 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13124 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13130 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13132 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13138 kernel_rules_cnt
++;
13143 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13145 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13149 * merge rules or automatic rule generator
13152 uint kernel_rules_cnt
= 0;
13154 kernel_rule_t
*kernel_rules_buf
= NULL
;
13156 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13160 kernel_rules_cnt
= 1;
13162 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13164 repeats
[0] = kernel_rules_cnt
;
13166 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13168 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13170 repeats
[i
+ 1] = kernel_rules_cnt
;
13173 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13175 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13177 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13181 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13183 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13185 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13188 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13190 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13192 if (out_pos
== RULES_MAX
- 1)
13194 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13199 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13204 local_free (repeats
);
13208 uint kernel_rules_avail
= 0;
13210 while (kernel_rules_cnt
< rp_gen
)
13212 if (kernel_rules_avail
== kernel_rules_cnt
)
13214 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13216 kernel_rules_avail
+= INCR_RULES
;
13219 memset (rule_buf
, 0, HCBUFSIZ
);
13221 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13223 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13225 kernel_rules_cnt
++;
13233 * generate NOP rules
13236 if (kernel_rules_cnt
== 0)
13238 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13240 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13242 kernel_rules_cnt
++;
13245 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13246 data
.kernel_rules_buf
= kernel_rules_buf
;
13249 * OpenCL platforms: detect
13252 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13253 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13255 cl_uint platforms_cnt
= 0;
13256 cl_uint platform_devices_cnt
= 0;
13260 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13262 if (platforms_cnt
== 0)
13265 log_info ("ATTENTION! No OpenCL compatible platform found");
13267 log_info ("You're probably missing the OpenCL runtime installation");
13268 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13269 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13270 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13276 if (opencl_platforms_filter
!= (uint
) -1)
13278 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13280 if (opencl_platforms_filter
> platform_cnt_mask
)
13282 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13290 * OpenCL device types:
13291 * 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.
13292 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13295 if (opencl_device_types
== NULL
)
13297 cl_device_type device_types_all
= 0;
13299 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13301 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13303 cl_platform_id platform
= platforms
[platform_id
];
13305 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13307 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13309 cl_device_id device
= platform_devices
[platform_devices_id
];
13311 cl_device_type device_type
;
13313 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13315 device_types_all
|= device_type
;
13319 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13321 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13326 * OpenCL devices: simply push all devices from all platforms into the same device array
13329 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13331 data
.devices_param
= devices_param
;
13333 uint devices_cnt
= 0;
13335 uint devices_active
= 0;
13337 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13339 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13341 cl_platform_id platform
= platforms
[platform_id
];
13343 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13345 char platform_vendor
[INFOSZ
] = { 0 };
13347 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13349 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13350 // this causes trouble with vendor id based macros
13351 // we'll assign generic to those without special optimization available
13353 cl_uint platform_vendor_id
= 0;
13355 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13357 platform_vendor_id
= VENDOR_ID_AMD
;
13359 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13361 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13363 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13365 platform_vendor_id
= VENDOR_ID_APPLE
;
13367 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13369 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13371 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13373 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13375 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13377 platform_vendor_id
= VENDOR_ID_MESA
;
13379 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13381 platform_vendor_id
= VENDOR_ID_NV
;
13383 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13385 platform_vendor_id
= VENDOR_ID_POCL
;
13389 platform_vendor_id
= VENDOR_ID_GENERIC
;
13392 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13394 size_t param_value_size
= 0;
13396 const uint device_id
= devices_cnt
;
13398 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13400 device_param
->platform_vendor_id
= platform_vendor_id
;
13402 device_param
->device
= platform_devices
[platform_devices_id
];
13404 device_param
->device_id
= device_id
;
13406 device_param
->platform_devices_id
= platform_devices_id
;
13410 cl_device_type device_type
;
13412 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13414 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13416 device_param
->device_type
= device_type
;
13420 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13422 char *device_name
= (char *) mymalloc (param_value_size
);
13424 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13426 device_param
->device_name
= device_name
;
13430 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13432 char *device_vendor
= (char *) mymalloc (param_value_size
);
13434 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13436 device_param
->device_vendor
= device_vendor
;
13438 cl_uint device_vendor_id
= 0;
13440 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13442 device_vendor_id
= VENDOR_ID_AMD
;
13444 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13446 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13448 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13450 device_vendor_id
= VENDOR_ID_APPLE
;
13452 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13454 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13456 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13458 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13460 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13462 device_vendor_id
= VENDOR_ID_MESA
;
13464 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13466 device_vendor_id
= VENDOR_ID_NV
;
13468 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13470 device_vendor_id
= VENDOR_ID_POCL
;
13474 device_vendor_id
= VENDOR_ID_GENERIC
;
13477 device_param
->device_vendor_id
= device_vendor_id
;
13481 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13485 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13487 char *device_version
= (char *) mymalloc (param_value_size
);
13489 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13491 device_param
->device_version
= device_version
;
13493 // device_opencl_version
13495 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13497 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13499 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13501 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13503 myfree (device_opencl_version
);
13507 cl_uint vector_width
;
13509 if (opencl_vector_width_chgd
== 0)
13511 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13513 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13515 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13519 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13524 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13529 vector_width
= opencl_vector_width
;
13532 if (vector_width
> 16) vector_width
= 16;
13534 device_param
->vector_width
= vector_width
;
13536 // max_compute_units
13538 cl_uint device_processors
;
13540 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13542 device_param
->device_processors
= device_processors
;
13544 // device_maxmem_alloc
13545 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13547 cl_ulong device_maxmem_alloc
;
13549 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13551 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13553 // device_global_mem
13555 cl_ulong device_global_mem
;
13557 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13559 device_param
->device_global_mem
= device_global_mem
;
13561 // max_work_group_size
13563 size_t device_maxworkgroup_size
;
13565 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13567 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13569 // max_clock_frequency
13571 cl_uint device_maxclock_frequency
;
13573 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13575 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13577 // device_endian_little
13579 cl_bool device_endian_little
;
13581 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13583 if (device_endian_little
== CL_FALSE
)
13585 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13587 device_param
->skipped
= 1;
13590 // device_available
13592 cl_bool device_available
;
13594 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13596 if (device_available
== CL_FALSE
)
13598 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13600 device_param
->skipped
= 1;
13603 // device_compiler_available
13605 cl_bool device_compiler_available
;
13607 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13609 if (device_compiler_available
== CL_FALSE
)
13611 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13613 device_param
->skipped
= 1;
13616 // device_execution_capabilities
13618 cl_device_exec_capabilities device_execution_capabilities
;
13620 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13622 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13624 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13626 device_param
->skipped
= 1;
13629 // device_extensions
13631 size_t device_extensions_size
;
13633 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13635 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13637 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13639 if (strstr (device_extensions
, "base_atomics") == 0)
13641 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13643 device_param
->skipped
= 1;
13646 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13648 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13650 device_param
->skipped
= 1;
13653 myfree (device_extensions
);
13655 // device_local_mem_size
13657 cl_ulong device_local_mem_size
;
13659 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13661 if (device_local_mem_size
< 32768)
13663 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13665 device_param
->skipped
= 1;
13668 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13669 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13670 // This results in both utilizing it for 50%
13671 // However, Intel has much better SIMD control over their own hardware
13672 // It makes sense to give them full control over their own hardware
13674 if (device_type
& CL_DEVICE_TYPE_CPU
)
13676 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13678 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13680 device_param
->skipped
= 1;
13686 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13687 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13691 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13693 char *driver_version
= (char *) mymalloc (param_value_size
);
13695 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13697 device_param
->driver_version
= driver_version
;
13699 // device_name_chksum
13701 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13704 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
13706 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
13709 uint device_name_digest
[4] = { 0 };
13711 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13713 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13715 device_param
->device_name_chksum
= device_name_chksum
;
13717 // device_processor_cores
13719 if (device_type
& CL_DEVICE_TYPE_CPU
)
13721 cl_uint device_processor_cores
= 1;
13723 device_param
->device_processor_cores
= device_processor_cores
;
13726 if (device_type
& CL_DEVICE_TYPE_GPU
)
13728 if (device_vendor_id
== VENDOR_ID_AMD
)
13730 cl_uint device_processor_cores
= 0;
13732 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13734 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13736 device_param
->device_processor_cores
= device_processor_cores
;
13738 else if (device_vendor_id
== VENDOR_ID_NV
)
13740 cl_uint kernel_exec_timeout
= 0;
13742 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13744 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13746 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13748 cl_uint device_processor_cores
= 0;
13750 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13752 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13754 device_param
->device_processor_cores
= device_processor_cores
;
13756 cl_uint sm_minor
= 0;
13757 cl_uint sm_major
= 0;
13759 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13760 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13762 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13763 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13765 device_param
->sm_minor
= sm_minor
;
13766 device_param
->sm_major
= sm_major
;
13770 cl_uint device_processor_cores
= 1;
13772 device_param
->device_processor_cores
= device_processor_cores
;
13778 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13780 if (machine_readable
== 0)
13782 if (device_param
->skipped
== 0)
13784 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
13787 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13788 (unsigned int) (device_global_mem
/ 1024 / 1024),
13789 (unsigned int) device_processors
);
13793 log_info ("Device #%u: %s, skipped",
13800 // common driver check
13802 if (device_param
->skipped
== 0)
13804 if (device_type
& CL_DEVICE_TYPE_GPU
)
13806 if (platform_vendor_id
== VENDOR_ID_AMD
)
13808 int catalyst_check
= (force
== 1) ? 0 : 1;
13810 int catalyst_warn
= 0;
13812 int catalyst_broken
= 0;
13814 if (catalyst_check
== 1)
13818 // v14.9 and higher
13819 if (atoi (device_param
->driver_version
) >= 1573)
13824 catalyst_check
= 0;
13827 if (catalyst_broken
== 1)
13830 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13831 log_info ("It will pass over cracked hashes and does not report them as cracked");
13832 log_info ("You are STRONGLY encouraged not to use it");
13833 log_info ("You can use --force to override this but do not post error reports if you do so");
13839 if (catalyst_warn
== 1)
13842 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13843 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13844 log_info ("See hashcat's homepage for official supported catalyst drivers");
13846 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13848 log_info ("You can use --force to override this but do not post error reports if you do so");
13854 else if (platform_vendor_id
== VENDOR_ID_NV
)
13856 if (device_param
->kernel_exec_timeout
!= 0)
13858 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);
13859 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13864 /* turns out pocl still creates segfaults (because of llvm)
13865 if (device_type & CL_DEVICE_TYPE_CPU)
13867 if (platform_vendor_id == VENDOR_ID_AMD)
13872 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13873 log_info ("You are STRONGLY encouraged not to use it");
13874 log_info ("You can use --force to override this but do not post error reports if you do so");
13875 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13885 * kernel accel and loops tuning db adjustment
13888 device_param
->kernel_accel_min
= 1;
13889 device_param
->kernel_accel_max
= 1024;
13891 device_param
->kernel_loops_min
= 1;
13892 device_param
->kernel_loops_max
= 1024;
13894 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13896 if (tuningdb_entry
)
13898 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13899 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13903 device_param
->kernel_accel_min
= _kernel_accel
;
13904 device_param
->kernel_accel_max
= _kernel_accel
;
13909 if (workload_profile
== 1)
13911 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13913 else if (workload_profile
== 2)
13915 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13918 device_param
->kernel_loops_min
= _kernel_loops
;
13919 device_param
->kernel_loops_max
= _kernel_loops
;
13923 // commandline parameters overwrite tuningdb entries
13927 device_param
->kernel_accel_min
= kernel_accel
;
13928 device_param
->kernel_accel_max
= kernel_accel
;
13933 device_param
->kernel_loops_min
= kernel_loops
;
13934 device_param
->kernel_loops_max
= kernel_loops
;
13950 if (keyspace
== 0 && devices_active
== 0)
13952 log_error ("ERROR: No devices found/left");
13957 // 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)
13959 if (devices_filter
!= (uint
) -1)
13961 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13963 if (devices_filter
> devices_cnt_mask
)
13965 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13971 data
.devices_cnt
= devices_cnt
;
13973 data
.devices_active
= devices_active
;
13975 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13977 if (machine_readable
== 0)
13988 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0, 0 } };
13989 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0, 0, 0, 0 } };
13991 if (gpu_temp_disable
== 0)
13994 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
13996 if (nvapi_init (nvapi
) == 0)
13997 data
.hm_nv
= nvapi
;
14001 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
14003 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14005 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14009 for (int i
= 0; i
< tmp_in
; i
++)
14011 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14014 for (int i
= 0; i
< tmp_out
; i
++)
14016 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
14018 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
14020 if (hm_NvAPI_GPU_GetCoolerSettings (data
.hm_nv
, hm_adapters_nv
[i
].adapter_index
.nv
, 0, &pCoolerSettings
) != NVAPI_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_get_supported
= 1;
14027 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
14029 if (nvml_init (nvml
) == 0)
14034 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
14036 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
14038 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14042 for (int i
= 0; i
< tmp_in
; i
++)
14044 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14047 for (int i
= 0; i
< tmp_out
; i
++)
14049 unsigned int speed
;
14051 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nv
, 1, hm_adapters_nv
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_get_supported
= 1;
14057 data
.hm_amd
= NULL
;
14059 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14061 if (adl_init (adl
) == 0)
14066 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14068 // total number of adapters
14070 int hm_adapters_num
;
14072 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14076 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14078 if (lpAdapterInfo
== NULL
) return (-1);
14080 // get a list (of ids of) valid/usable adapters
14082 int num_adl_adapters
= 0;
14084 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14086 if (num_adl_adapters
> 0)
14088 hc_thread_mutex_lock (mux_adl
);
14090 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14092 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14094 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14095 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14097 hc_thread_mutex_unlock (mux_adl
);
14100 myfree (valid_adl_device_list
);
14101 myfree (lpAdapterInfo
);
14105 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14107 gpu_temp_disable
= 1;
14112 * OpenCL devices: allocate buffer for device specific information
14115 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14116 int *temp_retain_fanpolicy_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14118 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14120 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14123 * User-defined GPU temp handling
14126 if (gpu_temp_disable
== 1)
14128 gpu_temp_abort
= 0;
14129 gpu_temp_retain
= 0;
14132 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14134 if (gpu_temp_abort
< gpu_temp_retain
)
14136 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14142 data
.gpu_temp_disable
= gpu_temp_disable
;
14143 data
.gpu_temp_abort
= gpu_temp_abort
;
14144 data
.gpu_temp_retain
= gpu_temp_retain
;
14148 * enable custom signal handler(s)
14151 if (benchmark
== 0)
14153 hc_signal (sigHandler_default
);
14157 hc_signal (sigHandler_benchmark
);
14164 if (data
.quiet
== 0)
14166 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14168 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
);
14170 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14172 log_info ("Rules: %u", kernel_rules_cnt
);
14177 log_info ("Applicable Optimizers:");
14179 for (uint i
= 0; i
< 32; i
++)
14181 const uint opti_bit
= 1u << i
;
14183 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14188 * Watchdog and Temperature balance
14192 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14194 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14197 if (gpu_temp_abort
== 0)
14199 log_info ("Watchdog: Temperature abort trigger disabled");
14203 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14206 if (gpu_temp_retain
== 0)
14208 log_info ("Watchdog: Temperature retain trigger disabled");
14212 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14215 if (data
.quiet
== 0) log_info ("");
14225 if (gpu_temp_disable
== 0)
14227 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14229 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14231 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14233 if (device_param
->skipped
) continue;
14235 const uint platform_devices_id
= device_param
->platform_devices_id
;
14237 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14239 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14242 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14244 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14251 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14252 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14253 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14254 * Driver / ADL bug?
14257 if (powertune_enable
== 1)
14259 hc_thread_mutex_lock (mux_adl
);
14261 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14263 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14265 if (device_param
->skipped
) continue;
14267 if (data
.hm_device
[device_id
].od_version
== 6)
14269 // set powertune value only
14271 int powertune_supported
= 0;
14275 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14277 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14282 if (powertune_supported
!= 0)
14285 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14287 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14289 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14294 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14296 log_error ("ERROR: Failed to set new ADL PowerControl values");
14304 hc_thread_mutex_unlock (mux_adl
);
14307 #endif // HAVE_HWMON
14310 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14313 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14315 uint kernel_power_all
= 0;
14317 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14323 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14325 if (device_param
->skipped
) continue;
14328 * device properties
14331 const char *device_name_chksum
= device_param
->device_name_chksum
;
14332 const u32 device_processors
= device_param
->device_processors
;
14333 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14336 * create context for each device
14339 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14342 * create command-queue
14345 // not supported with NV
14346 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14348 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14351 * kernel threads: some algorithms need a fixed kernel-threads count
14352 * because of shared memory usage or bitslice
14353 * there needs to be some upper limit, otherwise there's too much overhead
14356 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14358 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14360 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14363 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14364 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14365 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14366 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14367 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14368 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14369 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14370 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14371 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14372 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14373 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14374 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14375 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14378 * create input buffers on device : calculate size of fixed memory buffers
14381 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14382 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14384 device_param
->size_root_css
= size_root_css
;
14385 device_param
->size_markov_css
= size_markov_css
;
14387 size_t size_results
= sizeof (uint
);
14389 device_param
->size_results
= size_results
;
14391 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14392 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14394 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14395 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14396 size_t size_esalts
= salts_cnt
* esalt_size
;
14398 device_param
->size_plains
= size_plains
;
14399 device_param
->size_digests
= size_digests
;
14400 device_param
->size_shown
= size_shown
;
14401 device_param
->size_salts
= size_salts
;
14403 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14404 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14405 size_t size_tm
= 32 * sizeof (bs_word_t
);
14409 size_t size_scryptV
= 1;
14411 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14413 uint tmto_start
= 0;
14414 uint tmto_stop
= 10;
14418 tmto_start
= scrypt_tmto
;
14422 // in case the user did not specify the tmto manually
14423 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14424 // but set the lower end only in case the user has a device with too less memory
14426 if (hash_mode
== 8900)
14428 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14432 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14437 else if (hash_mode
== 9300)
14439 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14443 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14450 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14452 // TODO: in theory the following calculation needs to be done per salt, not global
14453 // we assume all hashes have the same scrypt settings
14455 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14457 size_scryptV
/= 1 << tmto
;
14459 size_scryptV
*= device_processors
* device_processor_cores
;
14461 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14463 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14468 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14470 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14471 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14477 if (data
.salts_buf
[0].scrypt_phy
== 0)
14479 log_error ("ERROR: can't allocate enough device memory");
14484 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14488 * some algorithms need a fixed kernel-loops count
14491 if (hash_mode
== 1500)
14493 const u32 kernel_loops_fixed
= 1024;
14495 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14496 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14499 if (hash_mode
== 3000)
14501 const u32 kernel_loops_fixed
= 1024;
14503 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14504 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14507 if (hash_mode
== 8900)
14509 const u32 kernel_loops_fixed
= 1;
14511 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14512 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14515 if (hash_mode
== 9300)
14517 const u32 kernel_loops_fixed
= 1;
14519 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14520 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14523 if (hash_mode
== 12500)
14525 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14527 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14528 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14532 * some algorithms have a maximum kernel-loops count
14535 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14537 u32 innerloop_cnt
= 0;
14539 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14541 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14542 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14543 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14547 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14550 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14551 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14553 device_param
->kernel_loops_max
= innerloop_cnt
;
14557 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14558 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14560 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14562 size_t size_pws
= 4;
14563 size_t size_tmps
= 4;
14564 size_t size_hooks
= 4;
14566 while (kernel_accel_max
>= kernel_accel_min
)
14568 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14572 size_pws
= kernel_power_max
* sizeof (pw_t
);
14578 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14579 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14580 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14581 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14582 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14583 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14584 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14585 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14586 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14587 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14588 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14589 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14590 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14591 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14592 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14593 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14594 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14595 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14596 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14597 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14598 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14599 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14600 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14601 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14602 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14603 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14604 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14605 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14606 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14607 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14608 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14609 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14610 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14611 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14612 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14613 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14614 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14615 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14616 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14617 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14618 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14619 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14620 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14621 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14622 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14623 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14624 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14625 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14626 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14627 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14628 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14629 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14630 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14631 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14632 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14633 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14634 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14635 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14636 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14637 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14638 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14639 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14640 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14641 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14642 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14643 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14644 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14645 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14646 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14647 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14648 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14649 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14650 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14651 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14652 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14653 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14654 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14655 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14656 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14657 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14658 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14659 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14664 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14669 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14670 // if not, decrease amplifier and try again
14674 const u64 size_total
14691 + size_pws
// not a bug
14702 // Don't ask me, ask AMD!
14704 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14705 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14709 kernel_accel_max
--;
14718 if (kernel_accel_max == 0)
14720 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14726 device_param
->kernel_accel_min
= kernel_accel_min
;
14727 device_param
->kernel_accel_max
= kernel_accel_max
;
14730 if (kernel_accel_max < kernel_accel)
14732 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14734 device_param->kernel_accel = kernel_accel_max;
14738 device_param
->size_bfs
= size_bfs
;
14739 device_param
->size_combs
= size_combs
;
14740 device_param
->size_rules
= size_rules
;
14741 device_param
->size_rules_c
= size_rules_c
;
14742 device_param
->size_pws
= size_pws
;
14743 device_param
->size_tmps
= size_tmps
;
14744 device_param
->size_hooks
= size_hooks
;
14746 // do not confuse kernel_accel_max with kernel_accel here
14748 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14750 device_param
->kernel_threads
= kernel_threads
;
14751 device_param
->kernel_power_user
= kernel_power
;
14753 kernel_power_all
+= kernel_power
;
14756 * default building options
14759 char build_opts
[1024] = { 0 };
14761 // we don't have sm_* on vendors not NV but it doesn't matter
14764 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\\OpenCL\\\" -I '%s\\OpenCL\\' -I %s\\OpenCL\\ -I\"%s\\OpenCL\\\" -I'%s\\OpenCL\\' -I%s\\OpenCL\\", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14766 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s/OpenCL/\" -I '%s/OpenCL/' -I %s/OpenCL/ -I\"%s/OpenCL/\" -I'%s/OpenCL/' -I%s/OpenCL/", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14769 char build_opts_new
[1024] = { 0 };
14771 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -DVENDOR_ID=%u -DCUDA_ARCH=%d -DVECT_SIZE=%u -DDEVICE_TYPE=%u -DKERN_TYPE=%u -D_unroll -cl-std=CL1.1", build_opts
, device_param
->device_vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
, device_param
->vector_width
, (u32
) device_param
->device_type
, kern_type
);
14773 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14776 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14778 // we do vectorizing much better than the auto-vectorizer
14780 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14782 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14787 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14796 * kernel source filename
14799 char source_file
[256] = { 0 };
14801 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14805 if (stat (source_file
, &sst
) == -1)
14807 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14813 * kernel cached filename
14816 char cached_file
[256] = { 0 };
14818 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14824 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14830 * kernel compile or load
14833 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14835 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14837 if (force_jit_compilation
== -1)
14841 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14843 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14845 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14847 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14850 size_t build_log_size
= 0;
14852 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14854 if (build_log_size
> 1)
14856 char *build_log
= (char *) malloc (build_log_size
+ 1);
14858 memset (build_log
, 0, build_log_size
+ 1);
14860 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14870 device_param
->skipped
= true;
14872 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14877 size_t binary_size
;
14879 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14881 u8
*binary
= (u8
*) mymalloc (binary_size
);
14883 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14885 writeProgramBin (cached_file
, binary
, binary_size
);
14887 local_free (binary
);
14892 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14895 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14897 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14899 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14905 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14908 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14910 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14912 char build_opts_update
[1024] = { 0 };
14914 if (force_jit_compilation
== 1500)
14916 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14918 else if (force_jit_compilation
== 8900)
14920 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.salts_buf
[0].scrypt_tmto
);
14924 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14927 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14930 size_t build_log_size
= 0;
14932 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14934 if (build_log_size
> 1)
14936 char *build_log
= (char *) malloc (build_log_size
+ 1);
14938 memset (build_log
, 0, build_log_size
+ 1);
14940 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14950 device_param
->skipped
= true;
14952 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14956 local_free (kernel_lengths
);
14957 local_free (kernel_sources
[0]);
14958 local_free (kernel_sources
);
14962 * word generator kernel
14965 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14968 * kernel mp source filename
14971 char source_file
[256] = { 0 };
14973 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14977 if (stat (source_file
, &sst
) == -1)
14979 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14985 * kernel mp cached filename
14988 char cached_file
[256] = { 0 };
14990 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
14996 if (stat (cached_file
, &cst
) == -1)
15002 * kernel compile or load
15005 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15007 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15011 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15012 if (quiet
== 0) log_info ("");
15014 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15016 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15018 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15022 device_param
->skipped
= true;
15024 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15029 size_t binary_size
;
15031 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15033 u8
*binary
= (u8
*) mymalloc (binary_size
);
15035 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15037 writeProgramBin (cached_file
, binary
, binary_size
);
15039 local_free (binary
);
15044 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15047 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15049 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15051 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15054 local_free (kernel_lengths
);
15055 local_free (kernel_sources
[0]);
15056 local_free (kernel_sources
);
15063 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15070 * kernel amp source filename
15073 char source_file
[256] = { 0 };
15075 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15079 if (stat (source_file
, &sst
) == -1)
15081 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15087 * kernel amp cached filename
15090 char cached_file
[256] = { 0 };
15092 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15098 if (stat (cached_file
, &cst
) == -1)
15104 * kernel compile or load
15107 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15109 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15113 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15114 if (quiet
== 0) log_info ("");
15116 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15118 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15120 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15124 device_param
->skipped
= true;
15126 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15131 size_t binary_size
;
15133 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15135 u8
*binary
= (u8
*) mymalloc (binary_size
);
15137 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15139 writeProgramBin (cached_file
, binary
, binary_size
);
15141 local_free (binary
);
15146 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15149 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15151 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15153 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15156 local_free (kernel_lengths
);
15157 local_free (kernel_sources
[0]);
15158 local_free (kernel_sources
);
15161 // some algorithm collide too fast, make that impossible
15163 if (benchmark
== 1)
15165 ((uint
*) digests_buf
)[0] = -1;
15166 ((uint
*) digests_buf
)[1] = -1;
15167 ((uint
*) digests_buf
)[2] = -1;
15168 ((uint
*) digests_buf
)[3] = -1;
15175 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15176 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15177 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15178 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15179 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15180 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15181 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15182 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15183 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15184 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15185 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15186 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15187 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15188 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15189 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15190 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15191 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15192 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15194 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
);
15195 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
);
15196 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
);
15197 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
);
15198 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
);
15199 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
);
15200 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
);
15201 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
);
15202 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15203 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15204 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15210 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15212 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15213 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15215 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15217 else if (attack_kern
== ATTACK_KERN_COMBI
)
15219 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15220 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15221 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15222 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15224 else if (attack_kern
== ATTACK_KERN_BF
)
15226 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15227 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15228 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15229 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15230 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15235 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15237 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15244 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15246 device_param
->pws_buf
= pws_buf
;
15248 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15250 device_param
->combs_buf
= combs_buf
;
15252 void *hooks_buf
= mymalloc (size_hooks
);
15254 device_param
->hooks_buf
= hooks_buf
;
15260 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15261 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15262 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15263 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15264 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15265 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15266 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15267 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15268 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15269 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15270 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15272 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15273 ? &device_param
->d_pws_buf
15274 : &device_param
->d_pws_amp_buf
;
15275 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15276 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15277 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15278 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15279 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15280 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15281 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15282 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15283 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15284 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15285 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15286 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15287 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15288 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15289 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15290 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15291 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15292 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15293 device_param
->kernel_params
[19] = &device_param
->d_result
;
15294 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15295 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15296 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15297 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15298 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15299 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15300 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15301 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15302 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15303 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15304 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15305 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15307 device_param
->kernel_params_mp_buf64
[3] = 0;
15308 device_param
->kernel_params_mp_buf32
[4] = 0;
15309 device_param
->kernel_params_mp_buf32
[5] = 0;
15310 device_param
->kernel_params_mp_buf32
[6] = 0;
15311 device_param
->kernel_params_mp_buf32
[7] = 0;
15312 device_param
->kernel_params_mp_buf32
[8] = 0;
15314 device_param
->kernel_params_mp
[0] = NULL
;
15315 device_param
->kernel_params_mp
[1] = NULL
;
15316 device_param
->kernel_params_mp
[2] = NULL
;
15317 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15318 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15319 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15320 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15321 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15322 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15324 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15325 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15326 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15327 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15328 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15329 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15330 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15332 device_param
->kernel_params_mp_l
[0] = NULL
;
15333 device_param
->kernel_params_mp_l
[1] = NULL
;
15334 device_param
->kernel_params_mp_l
[2] = NULL
;
15335 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15336 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15337 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15338 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15339 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15340 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15341 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15343 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15344 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15345 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15346 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15347 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15348 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15350 device_param
->kernel_params_mp_r
[0] = NULL
;
15351 device_param
->kernel_params_mp_r
[1] = NULL
;
15352 device_param
->kernel_params_mp_r
[2] = NULL
;
15353 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15354 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15355 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15356 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15357 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15358 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15360 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15361 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15363 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15364 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15365 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15366 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15367 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15368 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15369 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15371 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15372 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15374 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15375 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15377 device_param
->kernel_params_memset
[0] = NULL
;
15378 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15379 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15385 size_t kernel_wgs_tmp
;
15387 char kernel_name
[64] = { 0 };
15389 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15391 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15393 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15395 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15397 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15399 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15401 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15403 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15407 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15409 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15411 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15413 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15415 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15417 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15420 if (data
.attack_mode
== ATTACK_MODE_BF
)
15422 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15424 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15426 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15428 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
);
15434 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15436 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15438 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15440 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15442 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15444 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15446 if (opts_type
& OPTS_TYPE_HOOK12
)
15448 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15450 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15452 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
);
15455 if (opts_type
& OPTS_TYPE_HOOK23
)
15457 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15459 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15461 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
);
15465 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
);
15466 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
);
15467 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
);
15469 for (uint i
= 0; i
<= 20; i
++)
15471 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15472 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15473 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15475 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15476 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15479 for (uint i
= 21; i
<= 31; i
++)
15481 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15482 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15483 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15485 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15486 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15491 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15493 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
);
15495 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15496 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15497 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15501 if (attack_mode
== ATTACK_MODE_BF
)
15503 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15504 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15506 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
);
15507 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
);
15509 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15511 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15512 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15515 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15517 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15519 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
);
15521 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15523 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15525 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
);
15528 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15534 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15536 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
);
15539 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15545 for (uint i
= 0; i
< 5; i
++)
15547 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15550 for (uint i
= 5; i
< 7; i
++)
15552 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15556 // maybe this has been updated by clGetKernelWorkGroupInfo()
15557 // value can only be decreased, so we don't need to reallocate buffers
15559 device_param
->kernel_threads
= kernel_threads
;
15561 // zero some data buffers
15563 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15564 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15565 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15566 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15567 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15568 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15574 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15576 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15578 else if (attack_kern
== ATTACK_KERN_COMBI
)
15580 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15581 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15582 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15583 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15585 else if (attack_kern
== ATTACK_KERN_BF
)
15587 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15588 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15589 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15590 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15591 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15594 #if defined(HAVE_HWMON)
15597 * Store thermal target temperature so we can send a notice to user
15600 if (gpu_temp_disable
== 0)
15602 const int gpu_temp_threshold_slowdown
= hm_get_threshold_slowdown_with_device_id (device_id
);
15604 data
.hm_device
[device_id
].gpu_temp_threshold_slowdown
= (gpu_temp_threshold_slowdown
== -1) ? 100000 : gpu_temp_threshold_slowdown
;
15608 * Store initial fanspeed if gpu_temp_retain is enabled
15611 if (gpu_temp_disable
== 0)
15613 if (gpu_temp_retain
!= 0)
15615 hc_thread_mutex_lock (mux_adl
);
15617 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
15619 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
15620 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
15622 temp_retain_fanspeed_value
[device_id
] = fanspeed
;
15623 temp_retain_fanpolicy_value
[device_id
] = fanpolicy
;
15625 // we also set it to tell the OS we take control over the fan and it's automatic controller
15626 // if it was set to automatic. we do not control user-defined fanspeeds.
15628 if (fanpolicy
== 1)
15630 data
.hm_device
[device_id
].fan_set_supported
= 1;
15634 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15636 rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
, 1);
15638 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15641 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
15647 data
.hm_device
[device_id
].fan_set_supported
= 1;
15651 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
15653 data
.hm_device
[device_id
].fan_set_supported
= 0;
15658 data
.hm_device
[device_id
].fan_set_supported
= 0;
15662 hc_thread_mutex_unlock (mux_adl
);
15667 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15670 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15672 hc_thread_mutex_lock (mux_adl
);
15674 if (data
.hm_device
[device_id
].od_version
== 6)
15678 // check powertune capabilities first, if not available then skip device
15680 int powertune_supported
= 0;
15682 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15684 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15689 if (powertune_supported
!= 0)
15691 // powercontrol settings
15693 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15695 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15697 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15700 if (ADL_rc
!= ADL_OK
)
15702 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15707 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15709 log_error ("ERROR: Failed to set new ADL PowerControl values");
15716 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15718 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15720 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15722 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15727 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15729 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15731 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15733 log_error ("ERROR: Failed to get ADL device capabilities");
15738 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15739 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15741 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15742 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15744 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15745 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15747 // warning if profile has too low max values
15749 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15751 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15754 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15756 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15759 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15761 performance_state
->iNumberOfPerformanceLevels
= 2;
15763 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15764 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15765 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15766 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15768 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15770 log_info ("ERROR: Failed to set ADL performance state");
15775 local_free (performance_state
);
15779 hc_thread_mutex_unlock (mux_adl
);
15782 #endif // HAVE_HWMON
15785 data
.kernel_power_all
= kernel_power_all
;
15787 if (data
.quiet
== 0) log_info_nn ("");
15790 * In benchmark-mode, inform user which algorithm is checked
15793 if (benchmark
== 1)
15795 if (machine_readable
== 0)
15799 data
.quiet
= quiet
;
15801 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15803 log_info ("Hashtype: %s", hash_type
);
15809 * keep track of the progress
15812 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15813 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15814 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15821 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15823 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15828 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15830 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15835 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15837 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15847 segment_size
*= (1024 * 1024);
15849 data
.segment_size
= segment_size
;
15851 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15853 wl_data
->buf
= (char *) mymalloc (segment_size
);
15854 wl_data
->avail
= segment_size
;
15855 wl_data
->incr
= segment_size
;
15859 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15861 data
.wordlist_mode
= wordlist_mode
;
15863 cs_t
*css_buf
= NULL
;
15867 char **masks
= NULL
;
15868 char **dictfiles
= NULL
;
15870 uint mask_from_file
= 0;
15872 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15874 if (wordlist_mode
== WL_MODE_FILE
)
15876 int wls_left
= myargc
- (optind
+ 1);
15878 for (int i
= 0; i
< wls_left
; i
++)
15880 char *l0_filename
= myargv
[optind
+ 1 + i
];
15882 struct stat l0_stat
;
15884 if (stat (l0_filename
, &l0_stat
) == -1)
15886 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15891 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15895 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15899 dictfiles
[dictcnt
- 1] = l0_filename
;
15903 // do not allow --keyspace w/ a directory
15907 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15912 char **dictionary_files
= NULL
;
15914 dictionary_files
= scan_directory (l0_filename
);
15916 if (dictionary_files
!= NULL
)
15918 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15920 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15922 char *l1_filename
= dictionary_files
[d
];
15924 struct stat l1_stat
;
15926 if (stat (l1_filename
, &l1_stat
) == -1)
15928 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15933 if (S_ISREG (l1_stat
.st_mode
))
15935 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15939 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15944 local_free (dictionary_files
);
15950 log_error ("ERROR: No usable dictionary file found.");
15955 else if (wordlist_mode
== WL_MODE_STDIN
)
15960 else if (attack_mode
== ATTACK_MODE_COMBI
)
15964 char *dictfile1
= myargv
[optind
+ 1 + 0];
15965 char *dictfile2
= myargv
[optind
+ 1 + 1];
15967 // find the bigger dictionary and use as base
15972 struct stat tmp_stat
;
15974 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15976 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15981 if (stat (dictfile1
, &tmp_stat
) == -1)
15983 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15990 if (S_ISDIR (tmp_stat
.st_mode
))
15992 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
15999 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
16001 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16008 if (stat (dictfile2
, &tmp_stat
) == -1)
16010 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
16018 if (S_ISDIR (tmp_stat
.st_mode
))
16020 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
16028 data
.combs_cnt
= 1;
16032 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
16034 data
.quiet
= quiet
;
16036 if (words1_cnt
== 0)
16038 log_error ("ERROR: %s: empty file", dictfile1
);
16046 data
.combs_cnt
= 1;
16050 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16052 data
.quiet
= quiet
;
16054 if (words2_cnt
== 0)
16056 log_error ("ERROR: %s: empty file", dictfile2
);
16067 data
.dictfile
= dictfile1
;
16068 data
.dictfile2
= dictfile2
;
16070 if (words1_cnt
>= words2_cnt
)
16072 data
.combs_cnt
= words2_cnt
;
16073 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16075 dictfiles
= &data
.dictfile
;
16081 data
.combs_cnt
= words1_cnt
;
16082 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16084 dictfiles
= &data
.dictfile2
;
16088 // we also have to switch wordlist related rules!
16090 char *tmpc
= data
.rule_buf_l
;
16092 data
.rule_buf_l
= data
.rule_buf_r
;
16093 data
.rule_buf_r
= tmpc
;
16095 int tmpi
= data
.rule_len_l
;
16097 data
.rule_len_l
= data
.rule_len_r
;
16098 data
.rule_len_r
= tmpi
;
16101 else if (attack_mode
== ATTACK_MODE_BF
)
16107 if (benchmark
== 0)
16109 mask
= myargv
[optind
+ 1];
16111 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16113 if ((optind
+ 2) <= myargc
)
16115 struct stat file_stat
;
16117 if (stat (mask
, &file_stat
) == -1)
16121 masks
[maskcnt
- 1] = mystrdup (mask
);
16125 int wls_left
= myargc
- (optind
+ 1);
16127 uint masks_avail
= INCR_MASKS
;
16129 for (int i
= 0; i
< wls_left
; i
++)
16133 mask
= myargv
[optind
+ 1 + i
];
16135 if (stat (mask
, &file_stat
) == -1)
16137 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16143 uint is_file
= S_ISREG (file_stat
.st_mode
);
16149 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16151 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16156 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16158 while (!feof (mask_fp
))
16160 memset (line_buf
, 0, HCBUFSIZ
);
16162 int line_len
= fgetl (mask_fp
, line_buf
);
16164 if (line_len
== 0) continue;
16166 if (line_buf
[0] == '#') continue;
16168 if (masks_avail
== maskcnt
)
16170 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16172 masks_avail
+= INCR_MASKS
;
16175 masks
[maskcnt
] = mystrdup (line_buf
);
16186 log_error ("ERROR: %s: unsupported file-type", mask
);
16192 mask_from_file
= 1;
16197 custom_charset_1
= (char *) "?l?d?u";
16198 custom_charset_2
= (char *) "?l?d";
16199 custom_charset_3
= (char *) "?l?d*!$@_";
16201 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16202 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16203 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16205 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16207 wordlist_mode
= WL_MODE_MASK
;
16209 data
.wordlist_mode
= wordlist_mode
;
16219 * generate full masks and charsets
16222 masks
= (char **) mymalloc (sizeof (char *));
16226 case 1731: pw_min
= 5;
16228 mask
= mystrdup ("?b?b?b?b?b");
16230 case 12500: pw_min
= 5;
16232 mask
= mystrdup ("?b?b?b?b?b");
16234 default: pw_min
= 7;
16236 mask
= mystrdup ("?b?b?b?b?b?b?b");
16242 masks
[maskcnt
- 1] = mystrdup (mask
);
16244 wordlist_mode
= WL_MODE_MASK
;
16246 data
.wordlist_mode
= wordlist_mode
;
16251 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16255 if (increment_min
> pw_min
) pw_min
= increment_min
;
16257 if (increment_max
< pw_max
) pw_max
= increment_max
;
16260 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16262 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16266 char *mask
= myargv
[myargc
- 1];
16270 masks
= (char **) mymalloc (1 * sizeof (char *));
16274 struct stat file_stat
;
16276 if (stat (mask
, &file_stat
) == -1)
16280 masks
[maskcnt
- 1] = mystrdup (mask
);
16284 uint is_file
= S_ISREG (file_stat
.st_mode
);
16290 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16292 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16297 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16299 uint masks_avail
= 1;
16301 while (!feof (mask_fp
))
16303 memset (line_buf
, 0, HCBUFSIZ
);
16305 int line_len
= fgetl (mask_fp
, line_buf
);
16307 if (line_len
== 0) continue;
16309 if (line_buf
[0] == '#') continue;
16311 if (masks_avail
== maskcnt
)
16313 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16315 masks_avail
+= INCR_MASKS
;
16318 masks
[maskcnt
] = mystrdup (line_buf
);
16327 mask_from_file
= 1;
16333 masks
[maskcnt
- 1] = mystrdup (mask
);
16339 int wls_left
= myargc
- (optind
+ 2);
16341 for (int i
= 0; i
< wls_left
; i
++)
16343 char *filename
= myargv
[optind
+ 1 + i
];
16345 struct stat file_stat
;
16347 if (stat (filename
, &file_stat
) == -1)
16349 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16354 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16358 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16362 dictfiles
[dictcnt
- 1] = filename
;
16366 // do not allow --keyspace w/ a directory
16370 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16375 char **dictionary_files
= NULL
;
16377 dictionary_files
= scan_directory (filename
);
16379 if (dictionary_files
!= NULL
)
16381 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16383 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16385 char *l1_filename
= dictionary_files
[d
];
16387 struct stat l1_stat
;
16389 if (stat (l1_filename
, &l1_stat
) == -1)
16391 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16396 if (S_ISREG (l1_stat
.st_mode
))
16398 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16402 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16407 local_free (dictionary_files
);
16413 log_error ("ERROR: No usable dictionary file found.");
16422 uint mask_min
= increment_min
; // we can't reject smaller masks here
16423 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16425 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16427 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16429 if (cur_mask
== NULL
) break;
16431 masks
[maskcnt
] = cur_mask
;
16435 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16439 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16441 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16445 char *mask
= myargv
[optind
+ 1 + 0];
16449 masks
= (char **) mymalloc (1 * sizeof (char *));
16453 struct stat file_stat
;
16455 if (stat (mask
, &file_stat
) == -1)
16459 masks
[maskcnt
- 1] = mystrdup (mask
);
16463 uint is_file
= S_ISREG (file_stat
.st_mode
);
16469 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16471 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16476 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16478 uint masks_avail
= 1;
16480 while (!feof (mask_fp
))
16482 memset (line_buf
, 0, HCBUFSIZ
);
16484 int line_len
= fgetl (mask_fp
, line_buf
);
16486 if (line_len
== 0) continue;
16488 if (line_buf
[0] == '#') continue;
16490 if (masks_avail
== maskcnt
)
16492 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16494 masks_avail
+= INCR_MASKS
;
16497 masks
[maskcnt
] = mystrdup (line_buf
);
16506 mask_from_file
= 1;
16512 masks
[maskcnt
- 1] = mystrdup (mask
);
16518 int wls_left
= myargc
- (optind
+ 2);
16520 for (int i
= 0; i
< wls_left
; i
++)
16522 char *filename
= myargv
[optind
+ 2 + i
];
16524 struct stat file_stat
;
16526 if (stat (filename
, &file_stat
) == -1)
16528 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16533 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16537 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16541 dictfiles
[dictcnt
- 1] = filename
;
16545 // do not allow --keyspace w/ a directory
16549 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16554 char **dictionary_files
= NULL
;
16556 dictionary_files
= scan_directory (filename
);
16558 if (dictionary_files
!= NULL
)
16560 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16562 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16564 char *l1_filename
= dictionary_files
[d
];
16566 struct stat l1_stat
;
16568 if (stat (l1_filename
, &l1_stat
) == -1)
16570 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16575 if (S_ISREG (l1_stat
.st_mode
))
16577 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16581 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16586 local_free (dictionary_files
);
16592 log_error ("ERROR: No usable dictionary file found.");
16601 uint mask_min
= increment_min
; // we can't reject smaller masks here
16602 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16604 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16606 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16608 if (cur_mask
== NULL
) break;
16610 masks
[maskcnt
] = cur_mask
;
16614 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16619 data
.pw_min
= pw_min
;
16620 data
.pw_max
= pw_max
;
16626 if (weak_hash_threshold
>= salts_cnt
)
16628 hc_device_param_t
*device_param
= NULL
;
16630 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16632 device_param
= &data
.devices_param
[device_id
];
16634 if (device_param
->skipped
) continue;
16639 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16641 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16643 weak_hash_check (device_param
, salt_pos
);
16646 // Display hack, guarantee that there is at least one \r before real start
16648 //if (data.quiet == 0) log_info ("");
16652 * status and monitor threads
16655 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16657 hc_thread_t i_thread
= 0;
16659 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16661 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16664 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16666 uint ni_threads_cnt
= 0;
16668 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16670 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16680 if (outfile_check_timer
!= 0)
16682 if (data
.outfile_check_directory
!= NULL
)
16684 if ((hash_mode
!= 5200) &&
16685 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16686 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16687 (hash_mode
!= 9000))
16689 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16695 outfile_check_timer
= 0;
16700 outfile_check_timer
= 0;
16706 * Inform the user if we got some hashes remove because of the pot file remove feature
16709 if (data
.quiet
== 0)
16711 if (potfile_remove_cracks
> 0)
16713 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16714 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16718 data
.outfile_check_timer
= outfile_check_timer
;
16724 char **induction_dictionaries
= NULL
;
16726 int induction_dictionaries_cnt
= 0;
16728 hcstat_table_t
*root_table_buf
= NULL
;
16729 hcstat_table_t
*markov_table_buf
= NULL
;
16731 uint initial_restore_done
= 0;
16733 data
.maskcnt
= maskcnt
;
16735 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16737 if (data
.devices_status
== STATUS_CRACKED
) break;
16739 data
.devices_status
= STATUS_INIT
;
16741 if (maskpos
> rd
->maskpos
)
16746 rd
->maskpos
= maskpos
;
16747 data
.maskpos
= maskpos
;
16749 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16751 char *mask
= masks
[maskpos
];
16753 if (mask_from_file
== 1)
16755 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16760 uint mask_offset
= 0;
16762 uint separator_cnt
;
16764 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16766 str_ptr
= strstr (mask
+ mask_offset
, ",");
16768 if (str_ptr
== NULL
) break;
16770 str_pos
= str_ptr
- mask
;
16772 // escaped separator, i.e. "\,"
16776 if (mask
[str_pos
- 1] == '\\')
16780 mask_offset
= str_pos
+ 1;
16786 // reset the offset
16790 mask
[str_pos
] = '\0';
16792 switch (separator_cnt
)
16795 mp_reset_usr (mp_usr
, 0);
16797 custom_charset_1
= mask
;
16798 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16802 mp_reset_usr (mp_usr
, 1);
16804 custom_charset_2
= mask
;
16805 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16809 mp_reset_usr (mp_usr
, 2);
16811 custom_charset_3
= mask
;
16812 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16816 mp_reset_usr (mp_usr
, 3);
16818 custom_charset_4
= mask
;
16819 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16823 mask
= mask
+ str_pos
+ 1;
16827 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16831 local_free (css_buf
);
16832 local_free (data
.root_css_buf
);
16833 local_free (data
.markov_css_buf
);
16835 local_free (masks
[maskpos
- 1]);
16838 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16841 data
.css_cnt
= css_cnt
;
16842 data
.css_buf
= css_buf
;
16844 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16846 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16848 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16849 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16851 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16853 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16855 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16856 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16858 data
.root_css_buf
= root_css_buf
;
16859 data
.markov_css_buf
= markov_css_buf
;
16861 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16863 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16865 local_free (root_table_buf
);
16866 local_free (markov_table_buf
);
16870 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16872 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16874 if (device_param
->skipped
) continue;
16876 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16877 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16878 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16880 device_param
->kernel_params_mp_buf64
[3] = 0;
16881 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16882 device_param
->kernel_params_mp_buf32
[5] = 0;
16883 device_param
->kernel_params_mp_buf32
[6] = 0;
16884 device_param
->kernel_params_mp_buf32
[7] = 0;
16886 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16888 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16889 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16890 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16891 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16893 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16895 device_param
->kernel_params_mp_buf32
[5] = 0;
16896 device_param
->kernel_params_mp_buf32
[6] = 0;
16897 device_param
->kernel_params_mp_buf32
[7] = 0;
16900 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
]);
16901 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
]);
16902 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
]);
16904 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
);
16905 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
);
16908 else if (attack_mode
== ATTACK_MODE_BF
)
16910 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16914 for (uint i
= 0; i
< dictcnt
; i
++)
16916 local_free (dictfiles
[i
]);
16919 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16921 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16923 if (l1_filename
== NULL
) break;
16927 dictfiles
[dictcnt
- 1] = l1_filename
;
16934 dictfiles
[dictcnt
- 1] = mask
;
16939 log_error ("ERROR: Mask is too small");
16946 free (induction_dictionaries
);
16948 // induction_dictionaries_cnt = 0; // implied
16950 if (attack_mode
!= ATTACK_MODE_BF
)
16954 induction_dictionaries
= scan_directory (induction_directory
);
16956 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16960 if (induction_dictionaries_cnt
)
16962 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16966 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16970 if ((maskcnt
> 1) || (dictcnt
> 1))
16972 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16978 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
16980 char *subid
= logfile_generate_subid ();
16982 data
.subid
= subid
;
16984 logfile_sub_msg ("START");
16986 data
.devices_status
= STATUS_INIT
;
16988 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
16989 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
16990 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
16992 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
16996 data
.cpt_start
= time (NULL
);
16998 data
.cpt_total
= 0;
17000 if (data
.restore
== 0)
17002 rd
->words_cur
= skip
;
17009 data
.ms_paused
= 0;
17011 data
.words_cur
= rd
->words_cur
;
17013 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17015 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17017 if (device_param
->skipped
) continue;
17019 device_param
->speed_pos
= 0;
17021 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
17022 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
17024 device_param
->exec_pos
= 0;
17026 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
17028 device_param
->kernel_power
= device_param
->kernel_power_user
;
17030 device_param
->outerloop_pos
= 0;
17031 device_param
->outerloop_left
= 0;
17032 device_param
->innerloop_pos
= 0;
17033 device_param
->innerloop_left
= 0;
17035 // some more resets:
17037 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
17039 device_param
->pws_cnt
= 0;
17041 device_param
->words_off
= 0;
17042 device_param
->words_done
= 0;
17045 data
.kernel_power_div
= 0;
17047 // figure out some workload
17049 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17051 if (data
.wordlist_mode
== WL_MODE_FILE
)
17053 char *dictfile
= NULL
;
17055 if (induction_dictionaries_cnt
)
17057 dictfile
= induction_dictionaries
[0];
17061 dictfile
= dictfiles
[dictpos
];
17064 data
.dictfile
= dictfile
;
17066 logfile_sub_string (dictfile
);
17068 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17070 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17073 FILE *fd2
= fopen (dictfile
, "rb");
17077 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17082 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17086 if (data
.words_cnt
== 0)
17088 if (data
.devices_status
== STATUS_CRACKED
) break;
17089 if (data
.devices_status
== STATUS_ABORTED
) break;
17097 else if (attack_mode
== ATTACK_MODE_COMBI
)
17099 char *dictfile
= data
.dictfile
;
17100 char *dictfile2
= data
.dictfile2
;
17102 logfile_sub_string (dictfile
);
17103 logfile_sub_string (dictfile2
);
17105 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17107 FILE *fd2
= fopen (dictfile
, "rb");
17111 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17116 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17120 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17122 FILE *fd2
= fopen (dictfile2
, "rb");
17126 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17131 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17136 if (data
.words_cnt
== 0)
17138 if (data
.devices_status
== STATUS_CRACKED
) break;
17139 if (data
.devices_status
== STATUS_ABORTED
) break;
17146 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17148 char *dictfile
= NULL
;
17150 if (induction_dictionaries_cnt
)
17152 dictfile
= induction_dictionaries
[0];
17156 dictfile
= dictfiles
[dictpos
];
17159 data
.dictfile
= dictfile
;
17161 char *mask
= data
.mask
;
17163 logfile_sub_string (dictfile
);
17164 logfile_sub_string (mask
);
17166 FILE *fd2
= fopen (dictfile
, "rb");
17170 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17175 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17179 if (data
.words_cnt
== 0)
17181 if (data
.devices_status
== STATUS_CRACKED
) break;
17182 if (data
.devices_status
== STATUS_ABORTED
) break;
17189 else if (attack_mode
== ATTACK_MODE_BF
)
17191 local_free (css_buf
);
17192 local_free (data
.root_css_buf
);
17193 local_free (data
.markov_css_buf
);
17195 char *mask
= dictfiles
[dictpos
];
17197 logfile_sub_string (mask
);
17201 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17203 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17205 uint css_cnt_unicode
= css_cnt
* 2;
17207 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17209 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17211 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17213 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17214 css_buf_unicode
[j
+ 1].cs_len
= 1;
17219 css_buf
= css_buf_unicode
;
17220 css_cnt
= css_cnt_unicode
;
17223 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17225 uint mask_min
= pw_min
;
17226 uint mask_max
= pw_max
;
17228 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17234 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17236 if (css_cnt
< mask_min
)
17238 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17241 if (css_cnt
> mask_max
)
17243 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17246 // skip to next mask
17250 rd
->dictpos
= dictpos
;
17252 logfile_sub_msg ("STOP");
17257 uint save_css_cnt
= css_cnt
;
17259 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17261 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17263 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17264 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17266 uint css_cnt_salt
= css_cnt
+ salt_len
;
17268 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17270 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17272 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17274 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17275 css_buf_salt
[j
].cs_len
= 1;
17280 css_buf
= css_buf_salt
;
17281 css_cnt
= css_cnt_salt
;
17286 data
.css_cnt
= css_cnt
;
17287 data
.css_buf
= css_buf
;
17289 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17291 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17293 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17295 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17296 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17298 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17300 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17302 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17303 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17305 data
.root_css_buf
= root_css_buf
;
17306 data
.markov_css_buf
= markov_css_buf
;
17308 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17310 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17312 local_free (root_table_buf
);
17313 local_free (markov_table_buf
);
17317 uint css_cnt_l
= css_cnt
;
17320 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17322 if (save_css_cnt
< 6)
17326 else if (save_css_cnt
== 6)
17332 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17334 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17345 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17360 /* unfinished code?
17361 int sum = css_buf[css_cnt_r - 1].cs_len;
17363 for (uint i = 1; i < 4 && i < css_cnt; i++)
17365 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17369 sum *= css_buf[css_cnt_r - 1].cs_len;
17374 css_cnt_l
-= css_cnt_r
;
17376 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17378 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17380 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17382 if (device_param
->skipped
) continue;
17384 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17385 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17386 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17388 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17389 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17390 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17391 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17392 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17393 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17395 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17396 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17397 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17398 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17400 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17401 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17402 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17404 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17405 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17406 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17407 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17408 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17410 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
]);
17411 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
]);
17412 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
]);
17414 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
]);
17415 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
]);
17416 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
]);
17418 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
);
17419 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
);
17423 u64 words_base
= data
.words_cnt
;
17425 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17427 if (data
.kernel_rules_cnt
)
17429 words_base
/= data
.kernel_rules_cnt
;
17432 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17434 if (data
.combs_cnt
)
17436 words_base
/= data
.combs_cnt
;
17439 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17443 words_base
/= data
.bfs_cnt
;
17447 data
.words_base
= words_base
;
17451 log_info ("%llu", (unsigned long long int) words_base
);
17456 if (data
.words_cur
> data
.words_base
)
17458 log_error ("ERROR: restore value greater keyspace");
17463 if (data
.words_cur
)
17465 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17467 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17469 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17472 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17474 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17476 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17479 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17481 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17483 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17489 * Inform user about possible slow speeds
17492 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17494 if (data
.words_base
< kernel_power_all
)
17498 log_info ("ATTENTION!");
17499 log_info (" The wordlist or mask you are using is too small.");
17500 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17501 log_info (" The cracking speed will drop.");
17502 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17509 * Update loopback file
17518 uint random_num
= get_random_num (0, 9999);
17520 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17522 data
.loopback_file
= loopback_file
;
17526 * Update dictionary statistic
17531 dictstat_fp
= fopen (dictstat
, "wb");
17535 lock_file (dictstat_fp
);
17537 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17539 fclose (dictstat_fp
);
17543 data
.devices_status
= STATUS_RUNNING
;
17545 if (initial_restore_done
== 0)
17547 if (data
.restore_disable
== 0) cycle_restore ();
17549 initial_restore_done
= 1;
17552 hc_timer_set (&data
.timer_running
);
17554 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17556 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17558 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17559 if (quiet
== 0) fflush (stdout
);
17562 else if (wordlist_mode
== WL_MODE_STDIN
)
17564 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17565 if (data
.quiet
== 0) log_info ("");
17568 time_t runtime_start
;
17570 time (&runtime_start
);
17572 data
.runtime_start
= runtime_start
;
17575 * create cracker threads
17578 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17580 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17582 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17584 if (wordlist_mode
== WL_MODE_STDIN
)
17586 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17590 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17594 // wait for crack threads to exit
17596 hc_thread_wait (data
.devices_cnt
, c_threads
);
17598 local_free (c_threads
);
17604 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17606 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17608 if (data
.devices_status
== STATUS_CRACKED
) break;
17609 if (data
.devices_status
== STATUS_ABORTED
) break;
17611 if (data
.devices_status
== STATUS_BYPASS
)
17613 data
.devices_status
= STATUS_RUNNING
;
17616 if (induction_dictionaries_cnt
)
17618 unlink (induction_dictionaries
[0]);
17621 free (induction_dictionaries
);
17623 if (attack_mode
!= ATTACK_MODE_BF
)
17625 induction_dictionaries
= scan_directory (induction_directory
);
17627 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17630 if (benchmark
== 0)
17632 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17634 if (quiet
== 0) clear_prompt ();
17636 if (quiet
== 0) log_info ("");
17644 if (quiet
== 0) status_display ();
17647 if (quiet
== 0) log_info ("");
17651 if (attack_mode
== ATTACK_MODE_BF
)
17655 rd
->dictpos
= dictpos
;
17659 if (induction_dictionaries_cnt
)
17661 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17667 rd
->dictpos
= dictpos
;
17671 time_t runtime_stop
;
17673 time (&runtime_stop
);
17675 data
.runtime_stop
= runtime_stop
;
17677 logfile_sub_uint (runtime_start
);
17678 logfile_sub_uint (runtime_stop
);
17680 logfile_sub_msg ("STOP");
17682 global_free (subid
);
17685 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17687 if (data
.devices_status
== STATUS_CRACKED
) break;
17688 if (data
.devices_status
== STATUS_ABORTED
) break;
17689 if (data
.devices_status
== STATUS_QUIT
) break;
17691 if (data
.devices_status
== STATUS_BYPASS
)
17693 data
.devices_status
= STATUS_RUNNING
;
17697 // 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
17699 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17701 if (data
.wordlist_mode
== WL_MODE_FILE
)
17703 if (data
.dictfile
== NULL
)
17705 if (dictfiles
!= NULL
)
17707 data
.dictfile
= dictfiles
[0];
17709 hc_timer_set (&data
.timer_running
);
17714 // NOTE: combi is okay because it is already set beforehand
17715 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17717 if (data
.dictfile
== NULL
)
17719 if (dictfiles
!= NULL
)
17721 hc_timer_set (&data
.timer_running
);
17723 data
.dictfile
= dictfiles
[0];
17727 else if (attack_mode
== ATTACK_MODE_BF
)
17729 if (data
.mask
== NULL
)
17731 hc_timer_set (&data
.timer_running
);
17733 data
.mask
= masks
[0];
17737 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17739 data
.devices_status
= STATUS_EXHAUSTED
;
17742 // if cracked / aborted remove last induction dictionary
17744 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17746 struct stat induct_stat
;
17748 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17750 unlink (induction_dictionaries
[file_pos
]);
17754 // wait for non-interactive threads
17756 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17758 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17761 local_free (ni_threads
);
17763 // wait for interactive threads
17765 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17767 hc_thread_wait (1, &i_thread
);
17770 // we dont need restore file anymore
17771 if (data
.restore_disable
== 0)
17773 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17775 unlink (eff_restore_file
);
17776 unlink (new_restore_file
);
17784 // finally save left hashes
17786 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17795 if (benchmark
== 1)
17797 status_benchmark ();
17799 if (machine_readable
== 0)
17806 if (quiet
== 0) clear_prompt ();
17808 if (quiet
== 0) log_info ("");
17816 if (quiet
== 0) status_display ();
17819 if (quiet
== 0) log_info ("");
17822 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17824 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17826 if (device_param
->skipped
) continue;
17828 local_free (device_param
->combs_buf
);
17830 local_free (device_param
->hooks_buf
);
17832 local_free (device_param
->device_name
);
17834 local_free (device_param
->device_name_chksum
);
17836 local_free (device_param
->device_version
);
17838 local_free (device_param
->driver_version
);
17840 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17841 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17842 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17843 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17844 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17845 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17846 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17847 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17848 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17849 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17850 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17851 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17852 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17853 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17854 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17855 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17856 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17857 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17858 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17859 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17860 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17861 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17862 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17863 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17864 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17865 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17866 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17867 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17868 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17870 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17871 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17872 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17873 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17874 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17875 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17876 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17877 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17878 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17879 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17880 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17882 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17883 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17884 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17886 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17887 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17890 // reset default fan speed
17893 if (gpu_temp_disable
== 0)
17895 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17897 hc_thread_mutex_lock (mux_adl
);
17899 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17901 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17903 if (device_param
->skipped
) continue;
17905 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
17907 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17908 int fanpolicy
= temp_retain_fanpolicy_value
[device_id
];
17910 if (fanpolicy
== 1)
17914 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17916 rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
, 0);
17918 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17921 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 16);
17925 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
17930 hc_thread_mutex_unlock (mux_adl
);
17934 // reset power tuning
17936 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17938 hc_thread_mutex_lock (mux_adl
);
17940 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17942 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17944 if (device_param
->skipped
) continue;
17946 if (data
.hm_device
[device_id
].od_version
== 6)
17948 // check powertune capabilities first, if not available then skip device
17950 int powertune_supported
= 0;
17952 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17954 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17959 if (powertune_supported
!= 0)
17961 // powercontrol settings
17963 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, od_power_control_status
[device_id
])) != ADL_OK
)
17965 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17972 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17974 performance_state
->iNumberOfPerformanceLevels
= 2;
17976 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17977 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17978 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17979 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17981 if ((hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
17983 log_info ("ERROR: Failed to restore ADL performance state");
17988 local_free (performance_state
);
17993 hc_thread_mutex_unlock (mux_adl
);
17996 if (gpu_temp_disable
== 0)
18002 hm_NVML_nvmlShutdown (data
.hm_nv
);
18004 nvml_close (data
.hm_nv
);
18008 hm_NvAPI_Unload (data
.hm_nv
);
18010 nvapi_close (data
.hm_nv
);
18019 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
18021 adl_close (data
.hm_amd
);
18023 data
.hm_amd
= NULL
;
18026 #endif // HAVE_HWMON
18030 local_free (masks
);
18032 local_free (dictstat_base
);
18034 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
18036 pot_t
*pot_ptr
= &pot
[pot_pos
];
18038 hash_t
*hash
= &pot_ptr
->hash
;
18040 local_free (hash
->digest
);
18044 local_free (hash
->salt
);
18050 local_free (all_kernel_rules_cnt
);
18051 local_free (all_kernel_rules_buf
);
18053 local_free (wl_data
->buf
);
18054 local_free (wl_data
);
18056 local_free (bitmap_s1_a
);
18057 local_free (bitmap_s1_b
);
18058 local_free (bitmap_s1_c
);
18059 local_free (bitmap_s1_d
);
18060 local_free (bitmap_s2_a
);
18061 local_free (bitmap_s2_b
);
18062 local_free (bitmap_s2_c
);
18063 local_free (bitmap_s2_d
);
18066 local_free (temp_retain_fanspeed_value
);
18067 local_free (od_clock_mem_status
);
18068 local_free (od_power_control_status
);
18071 global_free (devices_param
);
18073 global_free (kernel_rules_buf
);
18075 global_free (root_css_buf
);
18076 global_free (markov_css_buf
);
18078 global_free (digests_buf
);
18079 global_free (digests_shown
);
18080 global_free (digests_shown_tmp
);
18082 global_free (salts_buf
);
18083 global_free (salts_shown
);
18085 global_free (esalts_buf
);
18087 global_free (words_progress_done
);
18088 global_free (words_progress_rejected
);
18089 global_free (words_progress_restored
);
18091 if (pot_fp
) fclose (pot_fp
);
18093 if (data
.devices_status
== STATUS_QUIT
) break;
18096 // destroy others mutex
18098 hc_thread_mutex_delete (mux_dispatcher
);
18099 hc_thread_mutex_delete (mux_counter
);
18100 hc_thread_mutex_delete (mux_display
);
18101 hc_thread_mutex_delete (mux_adl
);
18105 local_free (eff_restore_file
);
18106 local_free (new_restore_file
);
18112 tuning_db_destroy (tuning_db
);
18116 local_free (loopback_file
);
18118 if (loopback
== 1) unlink (loopback_file
);
18120 // induction directory
18122 if (induction_dir
== NULL
)
18124 if (attack_mode
!= ATTACK_MODE_BF
)
18126 if (rmdir (induction_directory
) == -1)
18128 if (errno
== ENOENT
)
18130 // good, we can ignore
18132 else if (errno
== ENOTEMPTY
)
18134 // good, we can ignore
18138 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18144 local_free (induction_directory
);
18148 // outfile-check directory
18150 if (outfile_check_dir
== NULL
)
18152 if (rmdir (outfile_check_directory
) == -1)
18154 if (errno
== ENOENT
)
18156 // good, we can ignore
18158 else if (errno
== ENOTEMPTY
)
18160 // good, we can ignore
18164 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18170 local_free (outfile_check_directory
);
18177 logfile_top_uint (proc_start
);
18178 logfile_top_uint (proc_stop
);
18180 logfile_top_msg ("STOP");
18182 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18183 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18185 if (data
.ocl
) ocl_close (data
.ocl
);
18187 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18188 if (data
.devices_status
== STATUS_QUIT
) return 2;
18189 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18190 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18191 if (data
.devices_status
== STATUS_CRACKED
) return 0;