Merge and conflict resolve.
This commit is contained in:
+21
-5
@@ -108,6 +108,14 @@ CC_LINUX_64 := gcc
|
||||
CC_WIN_32 := i686-w64-mingw32-gcc
|
||||
CC_WIN_64 := x86_64-w64-mingw32-gcc
|
||||
|
||||
## To compile win-iconv with mingw clone from here: https://github.com/win-iconv/win-iconv
|
||||
##
|
||||
## Then patch the makefile withe the patches from tools/win-iconv-*.diff and run make install
|
||||
##
|
||||
|
||||
WIN_ICONV_32 := /opt/win-iconv-32
|
||||
WIN_ICONV_64 := /opt/win-iconv-64
|
||||
|
||||
##
|
||||
## Misc stuff
|
||||
##
|
||||
@@ -184,7 +192,8 @@ CFLAGS_NATIVE := $(CFLAGS)
|
||||
CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_NATIVE += -DWITH_HWMON
|
||||
LFLAGS_NATIVE := $(LFLAGS)
|
||||
LFLAGS_NATIVE += -lpthread -ldl
|
||||
LFLAGS_NATIVE += -lpthread
|
||||
LFLAGS_NATIVE += -ldl
|
||||
endif # Linux
|
||||
|
||||
ifeq ($(UNAME),FreeBSD)
|
||||
@@ -202,6 +211,7 @@ CFLAGS_NATIVE := $(CFLAGS)
|
||||
LFLAGS_NATIVE := $(LFLAGS)
|
||||
LFLAGS_NATIVE += -framework OpenCL
|
||||
LFLAGS_NATIVE += -lpthread
|
||||
LFLAGS_NATIVE += -liconv
|
||||
endif # Darwin
|
||||
|
||||
ifeq ($(UNAME),CYGWIN)
|
||||
@@ -211,6 +221,7 @@ CFLAGS_NATIVE += -DWITH_HWMON
|
||||
LFLAGS_NATIVE := $(LFLAGS)
|
||||
LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat
|
||||
LFLAGS_NATIVE += -lpsapi
|
||||
LFLAGS_NATIVE += -liconv
|
||||
endif # CYGWIN
|
||||
|
||||
ifeq ($(UNAME),MSYS2)
|
||||
@@ -220,6 +231,7 @@ CFLAGS_NATIVE += -DWITH_HWMON
|
||||
LFLAGS_NATIVE := $(LFLAGS)
|
||||
LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat
|
||||
LFLAGS_NATIVE += -lpsapi
|
||||
LFLAGS_NATIVE += -liconv
|
||||
endif # MSYS2
|
||||
|
||||
##
|
||||
@@ -236,17 +248,21 @@ CFLAGS_CROSS_LINUX64 += -m64
|
||||
CFLAGS_CROSS_LINUX64 += -DWITH_HWMON
|
||||
CFLAGS_CROSS_WIN32 := $(CFLAGS)
|
||||
CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_CROSS_WIN32 += -I$(WIN_ICONV_32)/include/
|
||||
CFLAGS_CROSS_WIN32 += -m32
|
||||
CFLAGS_CROSS_WIN32 += -DWITH_HWMON
|
||||
CFLAGS_CROSS_WIN64 := $(CFLAGS)
|
||||
CFLAGS_CROSS_WIN64 += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_CROSS_WIN64 += -I$(WIN_ICONV_64)/include/
|
||||
CFLAGS_CROSS_WIN64 += -m64
|
||||
CFLAGS_CROSS_WIN64 += -DWITH_HWMON
|
||||
|
||||
LFLAGS_CROSS_LINUX32 := $(LFLAGS)
|
||||
LFLAGS_CROSS_LINUX32 += -lpthread -ldl
|
||||
LFLAGS_CROSS_LINUX32 += -lpthread
|
||||
LFLAGS_CROSS_LINUX32 += -ldl
|
||||
LFLAGS_CROSS_LINUX64 := $(LFLAGS)
|
||||
LFLAGS_CROSS_LINUX64 += -lpthread -ldl
|
||||
LFLAGS_CROSS_LINUX64 += -lpthread
|
||||
LFLAGS_CROSS_LINUX64 += -ldl
|
||||
LFLAGS_CROSS_WIN32 := $(LFLAGS)
|
||||
LFLAGS_CROSS_WIN32 += -Wl,--dynamicbase -Wl,--nxcompat
|
||||
LFLAGS_CROSS_WIN32 += -lpsapi
|
||||
@@ -403,10 +419,10 @@ hashcat32.bin: src/main.c $(LINUX_32_OBJS)
|
||||
hashcat64.bin: src/main.c $(LINUX_64_OBJS)
|
||||
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) -o $@ $^ $(LFLAGS_CROSS_LINUX64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
||||
|
||||
hashcat32.exe: src/main.c $(WIN_32_OBJS)
|
||||
hashcat32.exe: src/main.c $(WIN_32_OBJS) $(WIN_ICONV_32)/lib/libiconv.a
|
||||
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -o $@ $^ $(LFLAGS_CROSS_WIN32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
||||
|
||||
hashcat64.exe: src/main.c $(WIN_64_OBJS)
|
||||
hashcat64.exe: src/main.c $(WIN_64_OBJS) $(WIN_ICONV_64)/lib/libiconv.a
|
||||
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
||||
|
||||
hashcat32.dll: src/main.c $(WIN_32_OBJS)
|
||||
|
||||
+2
-1
@@ -6,7 +6,7 @@
|
||||
#include "common.h"
|
||||
#include "benchmark.h"
|
||||
|
||||
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 149;
|
||||
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 150;
|
||||
|
||||
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
|
||||
{
|
||||
@@ -157,6 +157,7 @@ const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
|
||||
8200,
|
||||
11300,
|
||||
12700,
|
||||
15200,
|
||||
13400,
|
||||
125
|
||||
};
|
||||
|
||||
@@ -18,6 +18,14 @@ int sort_by_dictstat (const void *s1, const void *s2)
|
||||
|
||||
d2->stat.st_atime = d1->stat.st_atime;
|
||||
|
||||
const int rc_from = strcmp (d1->encoding_from, d2->encoding_from);
|
||||
|
||||
if (rc_from != 0) return rc_from;
|
||||
|
||||
const int rc_to = strcmp (d1->encoding_to, d2->encoding_to);
|
||||
|
||||
if (rc_to != 0) return rc_to;
|
||||
|
||||
return memcmp (&d1->stat, &d2->stat, sizeof (struct stat));
|
||||
}
|
||||
|
||||
|
||||
+48
-2
@@ -123,7 +123,22 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
|
||||
|
||||
char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
const u32 attack_kern = user_options_extra->attack_kern;
|
||||
bool iconv_enabled = false;
|
||||
|
||||
iconv_t iconv_ctx;
|
||||
|
||||
char *iconv_tmp = NULL;
|
||||
|
||||
if (strcmp (user_options->encoding_from, user_options->encoding_to))
|
||||
{
|
||||
iconv_enabled = true;
|
||||
|
||||
iconv_ctx = iconv_open (user_options->encoding_to, user_options->encoding_from);
|
||||
|
||||
if (iconv_ctx == (iconv_t) -1) return -1;
|
||||
|
||||
iconv_tmp = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
}
|
||||
|
||||
while (status_ctx->run_thread_level1 == true)
|
||||
{
|
||||
@@ -144,10 +159,30 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
|
||||
|
||||
if (line_buf == NULL) break;
|
||||
|
||||
u32 line_len = (u32) in_superchop (line_buf);
|
||||
size_t line_len = in_superchop (line_buf);
|
||||
|
||||
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
|
||||
|
||||
// do the on-the-fly encoding
|
||||
|
||||
if (iconv_enabled == true)
|
||||
{
|
||||
char *iconv_ptr = iconv_tmp;
|
||||
size_t iconv_sz = HCBUFSIZ_TINY;
|
||||
|
||||
const size_t iconv_rc = iconv (iconv_ctx, &line_buf, &line_len, &iconv_ptr, &iconv_sz);
|
||||
|
||||
if (iconv_rc == (size_t) -1)
|
||||
{
|
||||
line_len = PW_MAX1;
|
||||
}
|
||||
else
|
||||
{
|
||||
line_buf = iconv_tmp;
|
||||
line_len = HCBUFSIZ_TINY - iconv_sz;
|
||||
}
|
||||
}
|
||||
|
||||
// post-process rule engine
|
||||
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
@@ -176,6 +211,8 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
|
||||
|
||||
// hmm that's always the case, or?
|
||||
|
||||
const u32 attack_kern = user_options_extra->attack_kern;
|
||||
|
||||
if (attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
{
|
||||
if ((line_len < hashconfig->pw_min) || (line_len > hashconfig->pw_max))
|
||||
@@ -241,6 +278,15 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
|
||||
device_param->kernel_accel = 0;
|
||||
device_param->kernel_loops = 0;
|
||||
|
||||
if (iconv_enabled == true)
|
||||
{
|
||||
iconv_close (iconv_ctx);
|
||||
|
||||
iconv_enabled = false;
|
||||
|
||||
hcfree (iconv_tmp);
|
||||
}
|
||||
|
||||
hcfree (buf);
|
||||
|
||||
return 0;
|
||||
|
||||
+125
-1
@@ -238,6 +238,7 @@ static const char HT_14800[] = "iTunes backup >= 10.0";
|
||||
static const char HT_14900[] = "Skip32 (PT = $salt, key = $pass)";
|
||||
static const char HT_15000[] = "FileZilla Server >= 0.9.55";
|
||||
static const char HT_15100[] = "Juniper/NetBSD sha1crypt";
|
||||
static const char HT_15200[] = "Blockchain, My Wallet, V2";
|
||||
static const char HT_99999[] = "Plaintext";
|
||||
|
||||
static const char HT_00011[] = "Joomla < 2.5.18";
|
||||
@@ -331,6 +332,7 @@ static const char SIGNATURE_MSSQL[] = "0x0100";
|
||||
static const char SIGNATURE_MSSQL2012[] = "0x0200";
|
||||
static const char SIGNATURE_MYSQL_AUTH[] = "$mysqlna$";
|
||||
static const char SIGNATURE_MYWALLET[] = "$blockchain$";
|
||||
static const char SIGNATURE_MYWALLETV2[] = "$blockchain$v2$";
|
||||
static const char SIGNATURE_NETSCALER[] = "1";
|
||||
static const char SIGNATURE_OFFICE2007[] = "$office$";
|
||||
static const char SIGNATURE_OFFICE2010[] = "$office$";
|
||||
@@ -13093,7 +13095,103 @@ int mywallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
|
||||
|
||||
salt->salt_len = 32; // note we need to fix this to 16 in kernel
|
||||
|
||||
salt->salt_iter = 10 - 1;
|
||||
salt->salt_iter = ROUNDS_MYWALLET - 1;
|
||||
|
||||
/**
|
||||
* digest buf
|
||||
*/
|
||||
|
||||
digest[0] = salt->salt_buf[4];
|
||||
digest[1] = salt->salt_buf[5];
|
||||
digest[2] = salt->salt_buf[6];
|
||||
digest[3] = salt->salt_buf[7];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int mywalletv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig)
|
||||
{
|
||||
if ((input_len < DISPLAY_LEN_MIN_15200) || (input_len > DISPLAY_LEN_MAX_15200)) return (PARSER_GLOBAL_LENGTH);
|
||||
|
||||
if (memcmp (SIGNATURE_MYWALLETV2, input_buf, 15)) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
|
||||
salt_t *salt = hash_buf->salt;
|
||||
|
||||
/**
|
||||
* parse line
|
||||
*/
|
||||
|
||||
u8 *iter_pos = input_buf + 1 + 10 + 1 + 2 + 1;
|
||||
|
||||
u8 *data_len_pos = (u8 *) strchr ((const char *) iter_pos, '$');
|
||||
|
||||
if (data_len_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 iter_pos_len = data_len_pos - iter_pos;
|
||||
|
||||
if (iter_pos_len < 1) return (PARSER_SALT_LENGTH);
|
||||
if (iter_pos_len > 8) return (PARSER_SALT_LENGTH);
|
||||
|
||||
data_len_pos++;
|
||||
|
||||
u8 *data_buf_pos = (u8 *) strchr ((const char *) data_len_pos, '$');
|
||||
|
||||
if (data_buf_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 data_len_len = data_buf_pos - data_len_pos;
|
||||
|
||||
if (data_len_len < 1) return (PARSER_SALT_LENGTH);
|
||||
if (data_len_len > 5) return (PARSER_SALT_LENGTH);
|
||||
|
||||
data_buf_pos++;
|
||||
|
||||
u32 data_buf_len = input_len - 1 - 10 - 1 - 2 - 1 - iter_pos_len - 1 - data_len_len - 1;
|
||||
|
||||
if (data_buf_len < 64) return (PARSER_HASH_LENGTH);
|
||||
|
||||
if (data_buf_len % 16) return (PARSER_HASH_LENGTH);
|
||||
|
||||
u32 data_len = atoll ((const char *) data_len_pos);
|
||||
|
||||
if ((data_len * 2) != data_buf_len) return (PARSER_HASH_LENGTH);
|
||||
|
||||
u32 iter = atoll ((const char *) iter_pos);
|
||||
|
||||
/**
|
||||
* salt
|
||||
*/
|
||||
|
||||
u8 *salt_pos = data_buf_pos;
|
||||
|
||||
if (is_valid_hex_string (salt_pos, 64) == false) return (PARSER_SALT_ENCODING);
|
||||
|
||||
salt->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]);
|
||||
salt->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]);
|
||||
salt->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]);
|
||||
salt->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_pos[24]);
|
||||
|
||||
salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]);
|
||||
salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]);
|
||||
salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]);
|
||||
salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]);
|
||||
|
||||
// this is actually the CT, which is also the hash later (if matched)
|
||||
|
||||
salt->salt_buf[4] = hex_to_u32 ((const u8 *) &salt_pos[32]);
|
||||
salt->salt_buf[5] = hex_to_u32 ((const u8 *) &salt_pos[40]);
|
||||
salt->salt_buf[6] = hex_to_u32 ((const u8 *) &salt_pos[48]);
|
||||
salt->salt_buf[7] = hex_to_u32 ((const u8 *) &salt_pos[56]);
|
||||
|
||||
salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]);
|
||||
salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]);
|
||||
salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]);
|
||||
salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]);
|
||||
|
||||
salt->salt_len = 32; // note we need to fix this to 16 in kernel
|
||||
|
||||
salt->salt_iter = iter - 1;
|
||||
|
||||
/**
|
||||
* digest buf
|
||||
@@ -15115,6 +15213,7 @@ char *strhashtype (const u32 hash_mode)
|
||||
case 14900: return ((char *) HT_14900);
|
||||
case 15000: return ((char *) HT_15000);
|
||||
case 15100: return ((char *) HT_15100);
|
||||
case 15200: return ((char *) HT_15200);
|
||||
case 99999: return ((char *) HT_99999);
|
||||
}
|
||||
|
||||
@@ -18212,6 +18311,13 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
|
||||
(char *) salt.salt_buf,
|
||||
ptr_plain);
|
||||
}
|
||||
else if (hash_mode == 15200)
|
||||
{
|
||||
hashinfo_t **hashinfo_ptr = hash_info;
|
||||
char *hash_buf = hashinfo_ptr[digest_cur]->orighash;
|
||||
|
||||
snprintf (out_buf, out_len - 1, "%s", hash_buf);
|
||||
}
|
||||
else if (hash_mode == 99999)
|
||||
{
|
||||
char *ptr = (char *) digest_buf;
|
||||
@@ -22488,6 +22594,21 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
break;
|
||||
|
||||
case 15200: hashconfig->hash_type = HASH_TYPE_AES;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_HASH_COPY;
|
||||
hashconfig->kern_type = KERN_TYPE_MYWALLET;
|
||||
hashconfig->dgst_size = DGST_SIZE_4_5; // because kernel uses _SHA1_
|
||||
hashconfig->parse_func = mywalletv2_parse_hash;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
break;
|
||||
|
||||
case 99999: hashconfig->hash_type = HASH_TYPE_PLAINTEXT;
|
||||
hashconfig->salt_type = SALT_TYPE_NONE;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
@@ -22725,6 +22846,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
case 14700: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break;
|
||||
case 14800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break;
|
||||
case 15100: hashconfig->tmp_size = sizeof (pbkdf1_sha1_tmp_t); break;
|
||||
case 15200: hashconfig->tmp_size = sizeof (mywallet_tmp_t); break;
|
||||
};
|
||||
|
||||
// hook_size
|
||||
@@ -23321,6 +23443,8 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
|
||||
break;
|
||||
case 15100: salt->salt_iter = ROUNDS_NETBSD_SHA1CRYPT - 1;
|
||||
break;
|
||||
case 15200: salt->salt_iter = ROUNDS_MYWALLETV2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ static const char *USAGE_BIG[] =
|
||||
" --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
|
||||
" --potfile-disable | | Do not write potfile |",
|
||||
" --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
|
||||
" --encoding-from | Code | Force internal wordlist encoding from X | --encoding-from=iso-8859-15",
|
||||
" --encoding-to | Code | Force internal wordlist encoding to X | --encoding-to=utf-32le",
|
||||
" --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
|
||||
" --debug-file | File | Output file for debugging rules | --debug-file=good.log",
|
||||
" --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
|
||||
@@ -344,6 +346,7 @@ static const char *USAGE_BIG[] =
|
||||
" 8200 | 1Password, cloudkeychain | Password Managers",
|
||||
" 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
|
||||
" 12700 | Blockchain, My Wallet | Password Managers",
|
||||
" 15200 | Blockchain, My Wallet, V2 | Password Managers",
|
||||
" 13400 | KeePass 1 (AES/Twofish) and KeePass 2 (AES) | Password Managers",
|
||||
" 99999 | Plaintext | Plaintext",
|
||||
"",
|
||||
|
||||
@@ -30,6 +30,8 @@ static const struct option long_options[] =
|
||||
{"custom-charset4", required_argument, 0, IDX_CUSTOM_CHARSET_4},
|
||||
{"debug-file", required_argument, 0, IDX_DEBUG_FILE},
|
||||
{"debug-mode", required_argument, 0, IDX_DEBUG_MODE},
|
||||
{"encoding-from", required_argument, 0, IDX_ENCODING_FROM},
|
||||
{"encoding-to", required_argument, 0, IDX_ENCODING_TO},
|
||||
{"force", no_argument, 0, IDX_FORCE},
|
||||
{"generate-rules-func-max", required_argument, 0, IDX_RP_GEN_FUNC_MAX},
|
||||
{"generate-rules-func-min", required_argument, 0, IDX_RP_GEN_FUNC_MIN},
|
||||
@@ -108,6 +110,9 @@ static const struct option long_options[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static char ENCODING_FROM[] = "utf-8";
|
||||
static char ENCODING_TO[] = "utf-8";
|
||||
|
||||
static char RULE_BUF_R[] = ":";
|
||||
static char RULE_BUF_L[] = ":";
|
||||
|
||||
@@ -131,6 +136,8 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->custom_charset_4 = NULL;
|
||||
user_options->debug_file = NULL;
|
||||
user_options->debug_mode = DEBUG_MODE;
|
||||
user_options->encoding_from = ENCODING_FROM;
|
||||
user_options->encoding_to = ENCODING_TO;
|
||||
user_options->force = FORCE;
|
||||
user_options->gpu_temp_abort = GPU_TEMP_ABORT;
|
||||
user_options->gpu_temp_disable = GPU_TEMP_DISABLE;
|
||||
@@ -314,6 +321,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break;
|
||||
case IDX_DEBUG_MODE: user_options->debug_mode = atoi (optarg); break;
|
||||
case IDX_DEBUG_FILE: user_options->debug_file = optarg; break;
|
||||
case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break;
|
||||
case IDX_ENCODING_TO: user_options->encoding_to = optarg; break;
|
||||
case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break;
|
||||
case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break;
|
||||
case IDX_FORCE: user_options->force = true; break;
|
||||
@@ -2072,6 +2081,8 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
logfile_top_string (user_options->custom_charset_3);
|
||||
logfile_top_string (user_options->custom_charset_4);
|
||||
logfile_top_string (user_options->debug_file);
|
||||
logfile_top_string (user_options->encoding_from);
|
||||
logfile_top_string (user_options->encoding_to);
|
||||
logfile_top_string (user_options->induction_dir);
|
||||
logfile_top_string (user_options->markov_hcstat);
|
||||
logfile_top_string (user_options->opencl_devices);
|
||||
|
||||
+78
-2
@@ -184,6 +184,28 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *o
|
||||
|
||||
wl_data->pos += off;
|
||||
|
||||
// do the on-the-fly encoding
|
||||
|
||||
if (wl_data->iconv_enabled == true)
|
||||
{
|
||||
char *iconv_ptr = wl_data->iconv_tmp;
|
||||
size_t iconv_sz = HCBUFSIZ_TINY;
|
||||
|
||||
size_t ptr_len = len;
|
||||
|
||||
const size_t iconv_rc = iconv (wl_data->iconv_ctx, &ptr, &ptr_len, &iconv_ptr, &iconv_sz);
|
||||
|
||||
if (iconv_rc == (size_t) -1)
|
||||
{
|
||||
len = PW_MAX1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = wl_data->iconv_tmp;
|
||||
len = HCBUFSIZ_TINY - iconv_sz;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
int rule_len_out = -1;
|
||||
@@ -288,6 +310,12 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
d.stat.st_blocks = 0;
|
||||
#endif
|
||||
|
||||
memset (d.encoding_from, 0, sizeof (d.encoding_from));
|
||||
memset (d.encoding_to, 0, sizeof (d.encoding_to));
|
||||
|
||||
strncpy (d.encoding_from, user_options->encoding_from, sizeof (d.encoding_from));
|
||||
strncpy (d.encoding_to, user_options->encoding_to, sizeof (d.encoding_to));
|
||||
|
||||
if (d.stat.st_size == 0)
|
||||
{
|
||||
*result = 0;
|
||||
@@ -351,7 +379,31 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
u64 len;
|
||||
u64 off;
|
||||
|
||||
wl_data->func (wl_data->buf + i, wl_data->cnt - i, &len, &off);
|
||||
char *ptr = wl_data->buf + i;
|
||||
|
||||
wl_data->func (ptr, wl_data->cnt - i, &len, &off);
|
||||
|
||||
// do the on-the-fly encoding
|
||||
|
||||
if (wl_data->iconv_enabled == true)
|
||||
{
|
||||
char *iconv_ptr = wl_data->iconv_tmp;
|
||||
size_t iconv_sz = HCBUFSIZ_TINY;
|
||||
|
||||
size_t ptr_len = len;
|
||||
|
||||
const size_t iconv_rc = iconv (wl_data->iconv_ctx, &ptr, &ptr_len, &iconv_ptr, &iconv_sz);
|
||||
|
||||
if (iconv_rc == (size_t) -1)
|
||||
{
|
||||
len = PW_MAX1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = wl_data->iconv_tmp;
|
||||
len = HCBUFSIZ_TINY - iconv_sz;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
@@ -361,7 +413,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
{
|
||||
char unused[BLOCK_SIZE] = { 0 };
|
||||
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, wl_data->buf + i, len, unused);
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, len, unused);
|
||||
}
|
||||
|
||||
if (rule_len_out < 0)
|
||||
@@ -476,6 +528,21 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx)
|
||||
wl_data->func = get_next_word_lm;
|
||||
}
|
||||
|
||||
/**
|
||||
* iconv
|
||||
*/
|
||||
|
||||
if (strcmp (user_options->encoding_from, user_options->encoding_to))
|
||||
{
|
||||
wl_data->iconv_enabled = true;
|
||||
|
||||
wl_data->iconv_ctx = iconv_open (user_options->encoding_to, user_options->encoding_from);
|
||||
|
||||
if (wl_data->iconv_ctx == (iconv_t) -1) return -1;
|
||||
|
||||
wl_data->iconv_tmp = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -487,5 +554,14 @@ void wl_data_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hcfree (wl_data->buf);
|
||||
|
||||
if (wl_data->iconv_enabled == true)
|
||||
{
|
||||
iconv_close (wl_data->iconv_ctx);
|
||||
|
||||
wl_data->iconv_enabled = false;
|
||||
|
||||
hcfree (wl_data->iconv_tmp);
|
||||
}
|
||||
|
||||
memset (wl_data, 0, sizeof (wl_data_t));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user