From 0bec0cfb89c3c4e6d3afc91a5be158a88509ddcf Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 20 Jan 2019 12:04:06 +0100 Subject: [PATCH] Add -m 3000 module and unit test --- include/interface_migrate.h | 18 -- src/interface_migrate.c | 395 ----------------------------------- src/modules/module_03000.c | 246 ++++++++++++++++++++++ src/modules/module_14000.c | 4 + src/modules/module_14100.c | 4 + src/status.c | 21 +- tools/test_modules/m03000.pm | 42 ++++ 7 files changed, 310 insertions(+), 420 deletions(-) create mode 100644 src/modules/module_03000.c create mode 100644 tools/test_modules/m03000.pm diff --git a/include/interface_migrate.h b/include/interface_migrate.h index 45d0e5a50..f48b37990 100644 --- a/include/interface_migrate.h +++ b/include/interface_migrate.h @@ -424,14 +424,6 @@ typedef struct sha512crypt_tmp } sha512crypt_tmp_t; - - -typedef struct wpa_pmk_tmp -{ - u32 out[8]; - -} wpa_pmk_tmp_t; - typedef struct bitcoin_wallet_tmp { u64 dgst[8]; @@ -835,7 +827,6 @@ typedef enum hash_type HASH_TYPE_SHA384 = 7, HASH_TYPE_SHA512 = 8, HASH_TYPE_DCC2 = 9, - HASH_TYPE_LM = 11, HASH_TYPE_ORACLEH = 13, HASH_TYPE_DESRACF = 14, HASH_TYPE_BCRYPT = 15, @@ -888,8 +879,6 @@ typedef enum hash_type HASH_TYPE_CRAM_MD5_DOVECOT = 65, HASH_TYPE_JWT = 66, HASH_TYPE_ELECTRUM_WALLET = 67, - HASH_TYPE_WPA_PMKID_PBKDF2 = 68, - HASH_TYPE_WPA_PMKID_PMK = 69, HASH_TYPE_ANSIBLE_VAULT = 70, HASH_TYPE_KRB5ASREP = 71, @@ -929,7 +918,6 @@ typedef enum kern_type KERN_TYPE_MD55_PWSLT1 = 2610, KERN_TYPE_MD55_PWSLT2 = 2710, KERN_TYPE_MD55_SLTPW = 2810, - KERN_TYPE_LM = 3000, KERN_TYPE_ORACLEH = 3100, KERN_TYPE_BCRYPT = 3200, KERN_TYPE_MD5_SLT_MD5_PW = 3710, @@ -949,7 +937,6 @@ typedef enum kern_type KERN_TYPE_IKEPSK_MD5 = 5300, KERN_TYPE_IKEPSK_SHA1 = 5400, KERN_TYPE_NETNTLMv1 = 5500, - KERN_TYPE_NETNTLMv2 = 5600, KERN_TYPE_ANDROIDPIN = 5800, KERN_TYPE_RIPEMD160 = 6000, KERN_TYPE_WHIRLPOOL = 6100, @@ -1069,7 +1056,6 @@ typedef enum kern_type KERN_TYPE_JWT_HS384 = 16512, KERN_TYPE_JWT_HS512 = 16513, KERN_TYPE_ELECTRUM_WALLET13 = 16600, - KERN_TYPE_WPA_PMKID_PMK = 16801, KERN_TYPE_ANSIBLE_VAULT = 16900, KERN_TYPE_SHA3_224 = 17300, KERN_TYPE_SHA3_256 = 17400, @@ -1176,7 +1162,6 @@ int keccak_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu int keccak_384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int keccak_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lm_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int md4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int md4s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); @@ -1188,7 +1173,6 @@ int md5apr1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu int mssql2000_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int mssql2005_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int netntlmv1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netntlmv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int oracleh_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int oracles_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int oraclet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); @@ -1335,8 +1319,6 @@ int ethereum_presale_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu int jwt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int filevault2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wpa_pmkid_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wpa_pmkid_pmk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); int apfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); diff --git a/src/interface_migrate.c b/src/interface_migrate.c index 9919c995c..2f14b46c4 100644 --- a/src/interface_migrate.c +++ b/src/interface_migrate.c @@ -60,13 +60,11 @@ " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF", " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF", " 23 | Skype | Network Protocols", - " 16801 | WPA-PMKID-PMK | Network Protocols", " 4800 | iSCSI CHAP authentication, MD5(CHAP) | Network Protocols", " 5300 | IKE-PSK MD5 | Network Protocols", " 5400 | IKE-PSK SHA1 | Network Protocols", " 5500 | NetNTLMv1 | Network Protocols", " 5500 | NetNTLMv1+ESS | Network Protocols", - " 5600 | NetNTLMv2 | Network Protocols", " 7300 | IPMI2 RAKP HMAC-SHA1 | Network Protocols", " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network Protocols", " 8300 | DNSSEC (NSEC3) | Network Protocols", @@ -116,7 +114,6 @@ " 16400 | CRAM-MD5 Dovecot | HTTP, SMTP, LDAP Server", " 15000 | FileZilla Server >= 0.9.55 | FTP Server", " 11500 | CRC32 | Checksums", - " 3000 | LM | Operating Systems", " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating Systems", " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating Systems", " 15300 | DPAPI masterkey file v1 | Operating Systems", @@ -257,7 +254,6 @@ static const char *ST_PASS_HASHCAT_ONET3 = "hashcat1hashcat1hashcat1"; static const char *ST_PASS_BIN_09710 = "\x91\xb2\xe0\x62\xb9"; static const char *ST_PASS_BIN_09810 = "\xb8\xf6\x36\x19\xca"; static const char *ST_PASS_BIN_10410 = "\x6a\x8a\xed\xcc\xb7"; -static const char *ST_PASS_HEX_16801 = "5b13d4babb3714ccc62c9f71864bc984efd6a55f237c7a87fc2151e1ca658a9d"; /** @@ -322,7 +318,6 @@ static const char *ST_HASH_02611 = "28f9975808ae2bdc5847b1cda26033ea:308"; static const char *ST_HASH_02612 = "$PHPS$30353031383437363132$f02b0b2f25e5754edb04522c346ba243"; static const char *ST_HASH_02711 = "0844fbb2fdeda31884a7a45ec2010bb6:324410183853308365427804872426"; static const char *ST_HASH_02811 = "022f7e02b3314f7d0968f73c00ba759f:67588"; -static const char *ST_HASH_03000 = "299bd128c1101fd6"; static const char *ST_HASH_03100 = "792FCB0AE31D8489:7284616727"; static const char *ST_HASH_03200 = "$2a$05$MBCzKhG1KhezLh.0LRa0Kuw12nLJtpHy6DIaU.JAnqJUDYspHC.Ou"; static const char *ST_HASH_03710 = "a3aa0ae2b4a102a9974cdf40edeabee0:242812778074"; @@ -484,7 +479,6 @@ static const char *ST_HASH_16300 = "$ethereum$w*e94a8e49deac2d62206bf9bfb7d2aaea static const char *ST_HASH_16400 = "{CRAM-MD5}5389b33b9725e5657cb631dc50017ff100000000000000000000000000000000"; static const char *ST_HASH_16600 = "$electrum$1*44358283104603165383613672586868*c43a6632d9f59364f74c395a03d8c2ea"; static const char *ST_HASH_16700 = "$fvde$1$16$84286044060108438487434858307513$20000$f1620ab93192112f0a23eea89b5d4df065661f974b704191"; -static const char *ST_HASH_16801 = "2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4"; static const char *ST_HASH_16900 = "$ansible$0*0*6b761adc6faeb0cc0bf197d3d4a4a7d3f1682e4b169cae8fa6b459b3214ed41e*426d313c5809d4a80a4b9bc7d4823070*d8bad190c7fbc7c3cb1c60a27abfb0ff59d6fb73178681c7454d94a0f56a4360"; static const char *ST_HASH_17300 = "412ef78534ba6ab0e9b1607d3e9767a25c1ea9d5e83176b4c2817a6c"; static const char *ST_HASH_17400 = "d60fcf6585da4e17224f58858970f0ed5ab042c3916b76b0b828e62eaf636cbd"; @@ -529,7 +523,6 @@ static const char *HT_01800 = "sha512crypt $6$, SHA512 (Unix)"; static const char *HT_02100 = "Domain Cached Credentials 2 (DCC2), MS Cache 2"; static const char *HT_02410 = "Cisco-ASA MD5"; static const char *HT_02600 = "md5(md5($pass))"; -static const char *HT_03000 = "LM"; static const char *HT_03100 = "Oracle H: Type (Oracle 7+)"; static const char *HT_03200 = "bcrypt $2*$, Blowfish (Unix)"; static const char *HT_03710 = "md5($salt.md5($pass))"; @@ -549,7 +542,6 @@ static const char *HT_05200 = "Password Safe v3"; static const char *HT_05300 = "IKE-PSK MD5"; static const char *HT_05400 = "IKE-PSK SHA1"; static const char *HT_05500 = "NetNTLMv1 / NetNTLMv1+ESS"; -static const char *HT_05600 = "NetNTLMv2"; static const char *HT_05700 = "Cisco-IOS type 4 (SHA256)"; static const char *HT_05800 = "Samsung Android Password/PIN"; static const char *HT_06000 = "RIPEMD-160"; @@ -663,7 +655,6 @@ static const char *HT_16400 = "CRAM-MD5 Dovecot"; static const char *HT_16500 = "JWT (JSON Web Token)"; static const char *HT_16600 = "Electrum Wallet (Salt-Type 1-3)"; static const char *HT_16700 = "FileVault 2"; -static const char *HT_16801 = "WPA-PMKID-PMK"; static const char *HT_16900 = "Ansible Vault"; static const char *HT_17300 = "SHA3-224"; static const char *HT_17400 = "SHA3-256"; @@ -2894,36 +2885,6 @@ int cisco4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU return (PARSER_OK); } -int lm_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 16; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - const u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - u32 tt; - - IP (digest[0], digest[1], tt); - - return (PARSER_OK); -} - int arubaos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) { u32 *digest = (u32 *) hash_buf->digest; @@ -16684,166 +16645,6 @@ int filevault2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE return (PARSER_OK); } -int wpa_pmkid_pmk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - wpa_pmkid_t *wpa_pmkid = (wpa_pmkid_t *) hash_buf->esalt; - - token_t token; - - // real 16801 pmkid hash-lines - - token.token_cnt = 3; - - token.sep[0] = '*'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = '*'; - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 12; - token.len_max[2] = 12; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) - { - // we'll accept normal 16800 pmkid hash-lines, too - - token.token_cnt = 4; - - token.sep[0] = '*'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = '*'; - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 12; - token.len_max[2] = 12; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 0; - token.len_max[3] = 64; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer2 = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer2 != PARSER_OK) return (rc_tokenizer); - - // essid - - const u8 *essid_buf = token.buf[3]; - const int essid_len = token.len[3]; - - u8 *essid_ptr = (u8 *) wpa_pmkid->essid_buf; - - for (int i = 0, j = 0; i < essid_len; i += 2, j += 1) - { - essid_ptr[j] = hex_to_u8 (essid_buf + i); - } - - wpa_pmkid->essid_len = essid_len / 2; - } - - // pmkid - - const u8 *pmkid_buf = token.buf[0]; - - wpa_pmkid->pmkid[0] = hex_to_u32 (pmkid_buf + 0); - wpa_pmkid->pmkid[1] = hex_to_u32 (pmkid_buf + 8); - wpa_pmkid->pmkid[2] = hex_to_u32 (pmkid_buf + 16); - wpa_pmkid->pmkid[3] = hex_to_u32 (pmkid_buf + 24); - - // mac_ap - - const u8 *macap_buf = token.buf[1]; - - wpa_pmkid->orig_mac_ap[0] = hex_to_u8 (macap_buf + 0); - wpa_pmkid->orig_mac_ap[1] = hex_to_u8 (macap_buf + 2); - wpa_pmkid->orig_mac_ap[2] = hex_to_u8 (macap_buf + 4); - wpa_pmkid->orig_mac_ap[3] = hex_to_u8 (macap_buf + 6); - wpa_pmkid->orig_mac_ap[4] = hex_to_u8 (macap_buf + 8); - wpa_pmkid->orig_mac_ap[5] = hex_to_u8 (macap_buf + 10); - - // mac_sta - - const u8 *macsta_buf = token.buf[2]; - - wpa_pmkid->orig_mac_sta[0] = hex_to_u8 (macsta_buf + 0); - wpa_pmkid->orig_mac_sta[1] = hex_to_u8 (macsta_buf + 2); - wpa_pmkid->orig_mac_sta[2] = hex_to_u8 (macsta_buf + 4); - wpa_pmkid->orig_mac_sta[3] = hex_to_u8 (macsta_buf + 6); - wpa_pmkid->orig_mac_sta[4] = hex_to_u8 (macsta_buf + 8); - wpa_pmkid->orig_mac_sta[5] = hex_to_u8 (macsta_buf + 10); - - // pmkid_data - - wpa_pmkid->pmkid_data[0] = 0x204b4d50; // "PMK " - wpa_pmkid->pmkid_data[1] = 0x656d614e; // "Name" - wpa_pmkid->pmkid_data[2] = (wpa_pmkid->orig_mac_ap[0] << 0) - | (wpa_pmkid->orig_mac_ap[1] << 8) - | (wpa_pmkid->orig_mac_ap[2] << 16) - | (wpa_pmkid->orig_mac_ap[3] << 24); - wpa_pmkid->pmkid_data[3] = (wpa_pmkid->orig_mac_ap[4] << 0) - | (wpa_pmkid->orig_mac_ap[5] << 8) - | (wpa_pmkid->orig_mac_sta[0] << 16) - | (wpa_pmkid->orig_mac_sta[1] << 24); - wpa_pmkid->pmkid_data[4] = (wpa_pmkid->orig_mac_sta[2] << 0) - | (wpa_pmkid->orig_mac_sta[3] << 8) - | (wpa_pmkid->orig_mac_sta[4] << 16) - | (wpa_pmkid->orig_mac_sta[5] << 24); - - // salt - - salt->salt_buf[0] = wpa_pmkid->pmkid_data[0]; - salt->salt_buf[1] = wpa_pmkid->pmkid_data[1]; - salt->salt_buf[2] = wpa_pmkid->pmkid_data[2]; - salt->salt_buf[3] = wpa_pmkid->pmkid_data[3]; - salt->salt_buf[4] = wpa_pmkid->pmkid_data[4]; - salt->salt_buf[5] = wpa_pmkid->pmkid_data[5]; - salt->salt_buf[6] = wpa_pmkid->pmkid_data[6]; - salt->salt_buf[7] = wpa_pmkid->pmkid_data[7]; - - salt->salt_len = 32; - salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; - - // hash - - digest[0] = wpa_pmkid->pmkid[0]; - digest[1] = wpa_pmkid->pmkid[1]; - digest[2] = wpa_pmkid->pmkid[2]; - digest[3] = wpa_pmkid->pmkid[3]; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - return (PARSER_OK); -} - int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) { u32 *digest = (u32 *) hash_buf->digest; @@ -17149,11 +16950,6 @@ u32 kernel_loops_mxx (hashcat_ctx_t *hashcat_ctx) { // respect the slow_candidates, too - if (hashconfig->hash_mode == 3000 && user_options->attack_mode == ATTACK_MODE_BF) - { - kernel_loops_fixed = 1024; - } - if (hashconfig->hash_mode == 14100 && user_options->attack_mode == ATTACK_MODE_BF) { kernel_loops_fixed = 1024; @@ -17316,8 +17112,6 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo break; case 16700: salt->salt_len = 16; break; - case 16801: memcpy (salt->salt_buf, "hashcat.net", 11); - break; case 16900: salt->salt_len = 32; break; case 18300: salt->salt_len = 16; @@ -17588,8 +17382,6 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo break; case 16700: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1; break; - case 16801: salt->salt_iter = ROUNDS_WPA_PMK; - break; case 16900: salt->salt_iter = ROUNDS_ANSIBLE_VAULT - 1; break; case 18300: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1; @@ -20597,60 +20389,6 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const int out_size, byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5])); } - else if (hash_mode == 16801) - { - wpa_pmkid_t *wpa_pmkids = (wpa_pmkid_t *) esalts_buf; - - wpa_pmkid_t *wpa_pmkid = &wpa_pmkids[digest_cur]; - - if (wpa_pmkid->essid_len) - { - exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); - - int tmp_len = wpa_pmkid->essid_len * 2; - - tmp_buf[tmp_len] = 0; - - snprintf (out_buf, out_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", - byte_swap_32 (wpa_pmkid->pmkid[0]), - byte_swap_32 (wpa_pmkid->pmkid[1]), - byte_swap_32 (wpa_pmkid->pmkid[2]), - byte_swap_32 (wpa_pmkid->pmkid[3]), - wpa_pmkid->orig_mac_ap[0], - wpa_pmkid->orig_mac_ap[1], - wpa_pmkid->orig_mac_ap[2], - wpa_pmkid->orig_mac_ap[3], - wpa_pmkid->orig_mac_ap[4], - wpa_pmkid->orig_mac_ap[5], - wpa_pmkid->orig_mac_sta[0], - wpa_pmkid->orig_mac_sta[1], - wpa_pmkid->orig_mac_sta[2], - wpa_pmkid->orig_mac_sta[3], - wpa_pmkid->orig_mac_sta[4], - wpa_pmkid->orig_mac_sta[5], - tmp_buf); - } - else - { - snprintf (out_buf, out_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x", - byte_swap_32 (wpa_pmkid->pmkid[0]), - byte_swap_32 (wpa_pmkid->pmkid[1]), - byte_swap_32 (wpa_pmkid->pmkid[2]), - byte_swap_32 (wpa_pmkid->pmkid[3]), - wpa_pmkid->orig_mac_ap[0], - wpa_pmkid->orig_mac_ap[1], - wpa_pmkid->orig_mac_ap[2], - wpa_pmkid->orig_mac_ap[3], - wpa_pmkid->orig_mac_ap[4], - wpa_pmkid->orig_mac_ap[5], - wpa_pmkid->orig_mac_sta[0], - wpa_pmkid->orig_mac_sta[1], - wpa_pmkid->orig_mac_sta[2], - wpa_pmkid->orig_mac_sta[3], - wpa_pmkid->orig_mac_sta[4], - wpa_pmkid->orig_mac_sta[5]); - } - } else if (hash_mode == 16900) { ansible_vault_t *ansible_vaults = (ansible_vault_t *) esalts_buf; @@ -20879,12 +20617,6 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const int out_size, ptr[13], ptr[12], ptr[15], ptr[14]); } - else if (hash_type == HASH_TYPE_LM) - { - snprintf (out_buf, out_size, "%08x%08x", - digest_buf[0], - digest_buf[1]); - } else if (hash_type == HASH_TYPE_ORACLEH) { snprintf (out_buf, out_size, "%08X%08X", @@ -22242,28 +21974,6 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; break; - case 3000: hashconfig->hash_type = HASH_TYPE_LM; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_PT_BITSLICE - | OPTS_TYPE_PT_ALWAYS_ASCII - | OPTS_TYPE_PT_LM - | OPTS_TYPE_HASH_SPLIT; - hashconfig->kern_type = KERN_TYPE_LM; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = lm_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_03000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - case 3100: hashconfig->hash_type = HASH_TYPE_ORACLEH; hashconfig->salt_type = SALT_TYPE_GENERIC; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; @@ -25402,25 +25112,6 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; break; - case 16801: hashconfig->hash_type = HASH_TYPE_WPA_PMKID_PMK; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_AUX1 - | OPTS_TYPE_DEEP_COMP_KERNEL; - hashconfig->kern_type = KERN_TYPE_WPA_PMKID_PMK; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = wpa_pmkid_pmk_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16801; - hashconfig->st_pass = ST_PASS_HEX_16801; - break; - case 16900: hashconfig->hash_type = HASH_TYPE_ANSIBLE_VAULT; hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; @@ -25757,7 +25448,6 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) case 16500: hashconfig->esalt_size = sizeof (jwt_t); break; case 16600: hashconfig->esalt_size = sizeof (electrum_wallet_t); break; case 16700: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break; - case 16801: hashconfig->esalt_size = sizeof (wpa_pmkid_t); break; case 16900: hashconfig->esalt_size = sizeof (ansible_vault_t); break; case 18200: hashconfig->esalt_size = sizeof (krb5asrep_t); break; case 18300: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break; @@ -25863,7 +25553,6 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) case 16200: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; case 16300: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; case 16700: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; - case 16801: hashconfig->tmp_size = sizeof (wpa_pmk_tmp_t); break; case 16900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; case 18300: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; }; @@ -25891,7 +25580,6 @@ u32 default_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED co case 14100: pw_min = 24; break; // 3DES fixed case 14900: pw_min = 10; break; // Skip32 fixed case 15400: pw_min = 32; break; // ChaCha20 fixed - case 16801: pw_min = 64; break; // WPA-PMKID-PMK: fixed } return pw_min; @@ -25952,7 +25640,6 @@ u32 default_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED co { case 112: pw_max = 30; break; // https://www.toadworld.com/platforms/oracle/b/weblog/archive/2013/11/12/oracle-12c-passwords case 2100: pw_max = PW_MAX; break; - case 3000: pw_max = 7; break; // LM max case 3100: pw_max = 30; break; // http://www.red-database-security.de/whitepaper/oracle_passwords.html case 3200: pw_max = 72; break; // Underlaying Blowfish max case 5200: pw_max = PW_MAX; break; @@ -26065,7 +25752,6 @@ u32 default_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED co case 15700: pw_max = PW_MAX; break; case 15900: pw_max = PW_MAX; break; case 16000: pw_max = 8; break; // Underlaying DES max - case 16801: pw_max = 64; break; // WPA-PMKID-PMK: fixed length case 16900: pw_max = PW_MAX; break; } @@ -26127,8 +25813,6 @@ const char *default_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, break; case 14900: mask = "?b?b?b?b?bxxxxx"; break; - case 16801: mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - break; default: mask = "?b?b?b?b?b?b?b"; break; } @@ -26145,16 +25829,6 @@ bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_ } -bool default_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - - switch (hashconfig->hash_mode) - { - case 3000: return true; - } - -} - bool default_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { @@ -26411,34 +26085,6 @@ int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } } -int module_hash_decode_zero_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf) -{ - if (hashconfig->hash_mode == 3000) - { - static const char LM_ZERO_HASH[] = "aad3b435b51404ee"; - - - return module_hash_decode (hashconfig, digest, salt, esalt, LM_ZERO_HASH, 16); - -} - - -bool potfile_keep_all_hashes -{ - // keep all hashes if -m 3000 was combined with --left or --show - - if (hashconfig->hash_mode == 3000) - { - if ((user_options->show == true) || (user_options->left == true)) - { - potfile_ctx->keep_all_hashes = true; - } - } -} - - - - int build_plain_postprocess (const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { // truecrypt and veracrypt boot only: @@ -26808,7 +26454,6 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE */ if ( - || (hashconfig->hash_mode == 3000) || (hashconfig->hash_mode == 3200) || (hashconfig->hash_mode == 8900) || (hashconfig->hash_mode == 9300) @@ -26833,46 +26478,6 @@ u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED c } } -int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, MAYBE_UNUSED const int line_size) -{ - if (hashes->digests_cnt == 1) - { - else if (hashconfig->hash_mode == 5200) - { - return hashes->hashfile; - } - else if (hashconfig->hash_mode == 9000) - { - return hashes->hashfile; - } - else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) - { - return hashes->hashfile; - } - else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799)) - { - return hashes->hashfile; - } - } - else - { - if (hashconfig->hash_mode == 3000) - { - char *tmp_buf; - - char out_buf1[64] = { 0 }; - char out_buf2[64] = { 0 }; - - ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf1, sizeof (out_buf1), 0, 0); - ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf2, sizeof (out_buf2), 0, 1); - - hc_asprintf (&tmp_buf, "%s, %s", out_buf1, out_buf2); - - return tmp_buf; - } - } -} - int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes) { diff --git a/src/modules/module_03000.c b/src/modules/module_03000.c new file mode 100644 index 000000000..c180d477c --- /dev/null +++ b/src/modules/module_03000.c @@ -0,0 +1,246 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "LM"; +static const u32 HASH_TYPE = HASH_TYPE_LM; +static const u64 KERN_TYPE = 3000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_PERMUT; +static const u64 OPTS_TYPE = OPTS_TYPE_STATE_BUFFER_LE + | OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_PT_BITSLICE + | OPTS_TYPE_PT_ALWAYS_ASCII + | OPTS_TYPE_PT_LM + | OPTS_TYPE_HASH_SPLIT; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat1"; +static const char *ST_HASH = "299bd128c1101fd6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u32 module_hash_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_TYPE; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_max = KERNEL_LOOPS_MAX; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_max = 1024; + } + } + + return kernel_loops_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_min = 1024; + } + } + + return kernel_loops_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 7; // LM max + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +bool module_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return true; +} + +int module_hash_decode_zero_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED hashinfo_t *hash_info) +{ + static const char LM_ZERO_HASH[] = "aad3b435b51404ee"; + + return module_hash_decode (hashconfig, digest_buf, salt, esalt_buf, hash_info, LM_ZERO_HASH, 16); +} + +bool module_potfile_keep_all_hashes (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + if ((user_options->show == true) || (user_options->left == true)) + { + return true; + } + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + decoder_apply_optimizer (hashconfig, digest); + + decoder_apply_options (hashconfig, digest); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + encoder_apply_optimizer (hashconfig, tmp); + + encoder_apply_options (hashconfig, tmp); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = module_dictstat_disable; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_binary_verify = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = module_hash_decode_zero_hash; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hash_type = module_hash_type; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = module_potfile_keep_all_hashes; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14000.c b/src/modules/module_14000.c index 8b034065e..b4cbfdb95 100644 --- a/src/modules/module_14000.c +++ b/src/modules/module_14000.c @@ -159,6 +159,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE decoder_apply_optimizer (hashconfig, salt->salt_buf_pc); + decoder_apply_options (hashconfig, salt->salt_buf_pc); + // hash const u8 *hash_pos = token.buf[0]; @@ -170,6 +172,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE decoder_apply_optimizer (hashconfig, digest); + decoder_apply_options (hashconfig, digest); + return (PARSER_OK); } diff --git a/src/modules/module_14100.c b/src/modules/module_14100.c index f1a47ead0..a530ef9ce 100644 --- a/src/modules/module_14100.c +++ b/src/modules/module_14100.c @@ -158,6 +158,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE decoder_apply_optimizer (hashconfig, salt->salt_buf_pc); + decoder_apply_options (hashconfig, salt->salt_buf_pc); + // hash const u8 *hash_pos = token.buf[0]; @@ -169,6 +171,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE decoder_apply_optimizer (hashconfig, digest); + decoder_apply_options (hashconfig, digest); + return (PARSER_OK); } diff --git a/src/status.c b/src/status.c index bae1f9980..c2860ca1e 100644 --- a/src/status.c +++ b/src/status.c @@ -322,19 +322,26 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx) } else { - char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); + if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + { + return hashes->hashfile; + } + else + { + char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); - const int tmp_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0); + const int tmp_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0); - tmp_buf[tmp_len] = 0; + tmp_buf[tmp_len] = 0; - compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ") + compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ") - char *tmp_buf2 = strdup (tmp_buf); + char *tmp_buf2 = strdup (tmp_buf); - free (tmp_buf); + free (tmp_buf); - return tmp_buf2; + return tmp_buf2; + } } } else diff --git a/tools/test_modules/m03000.pm b/tools/test_modules/m03000.pm new file mode 100644 index 000000000..e3fa317fd --- /dev/null +++ b/tools/test_modules/m03000.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Authen::Passphrase::LANManager; + +sub module_constraints { [[0, 7], [-1, -1], [0, 7], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $ppr = Authen::Passphrase::LANManager->new ("passphrase" => $word); + + my $hash = $ppr->hash_hex; + + return sprintf ("%s", substr ($hash, 0, 16)); +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1;