mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Wordlist encoding: Support added for internal convert from and to user-defined encoding during runtime
Wordlist encoding: Added parameters --encoding-from and --encoding-to to configure wordlist encoding handling Dictstat: Structure for dictstat file changed as it has to include --encoding-from and --encoding-to parameter now
This commit is contained in:
parent
fab4ede364
commit
7cabb848d2
2
deps/OpenCL-Headers/CL
vendored
2
deps/OpenCL-Headers/CL
vendored
@ -1 +1 @@
|
||||
Subproject commit bf0f43b76f4556c3d5717f8ba8a01216b27f4af7
|
||||
Subproject commit 42e7afe066a67107c2236b86c9864a472f8eead8
|
@ -1,5 +1,12 @@
|
||||
* changes v3.40 -> 3.5.x:
|
||||
|
||||
##
|
||||
## Features
|
||||
##
|
||||
|
||||
- Wordlist encoding: Support added for internal convert from and to user-defined encoding during runtime
|
||||
- Wordlist encoding: Added parameters --encoding-from and --encoding-to to configure wordlist encoding handling
|
||||
|
||||
##
|
||||
## Improvements
|
||||
##
|
||||
@ -10,6 +17,7 @@
|
||||
## Technical
|
||||
##
|
||||
|
||||
- Dictstat: Structure for dictstat file changed as it has to include --encoding-from and --encoding-to parameter now
|
||||
- OpenCL Runtime: Updated AMDGPU-Pro driver version check, do warn if version 17.10 is detected which is known to be broken
|
||||
- WPA cracking: Reduced --nonce-error-corrections default from 16 to 8 to compensate speed drop caused due to Big-Endian fixes
|
||||
|
||||
|
@ -189,8 +189,8 @@ _hashcat ()
|
||||
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
|
||||
|
||||
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l"
|
||||
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --markov-hcstat --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --gpu-temp-retain --powertune-enable --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections"
|
||||
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --weak-hash-threshold --markov-hcstat --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --gpu-temp-retain -disable --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --hccapx-message-pair --nonce-error-corrections"
|
||||
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --markov-hcstat --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --gpu-temp-retain --powertune-enable --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to"
|
||||
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --weak-hash-threshold --markov-hcstat --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --gpu-temp-retain -disable --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to"
|
||||
|
||||
COMPREPLY=()
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -363,7 +363,7 @@ _hashcat ()
|
||||
--status-timer|--markov-threshold|--runtime|--session|--separator|--segment-size|--rule-left|--rule-right| \
|
||||
--nvidia-spin-damp|--gpu-temp-abort|--gpu-temp-retain|--generate-rules|--generate-rules-func-min|--generate-rules-func-max| \
|
||||
--increment-min|--increment-max|--remove-timer|--bitmap-min|--bitmap-max|--skip|--limit|--generate-rules-seed| \
|
||||
--weak-hash-threshold|--outfile-check-timer|--outfile-check-dir|--induction-dir|--scrypt-tmto)
|
||||
--weak-hash-threshold|--outfile-check-timer|--outfile-check-dir|--induction-dir|--scrypt-tmto|--encoding-from|--encoding-to)
|
||||
return 0
|
||||
;;
|
||||
|
||||
|
120
include/types.h
120
include/types.h
@ -16,6 +16,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <iconv.h>
|
||||
|
||||
#if defined (_WIN)
|
||||
#include <windows.h>
|
||||
@ -573,80 +574,82 @@ typedef enum user_options_map
|
||||
IDX_CUSTOM_CHARSET_4 = '4',
|
||||
IDX_DEBUG_FILE = 0xff04,
|
||||
IDX_DEBUG_MODE = 0xff05,
|
||||
IDX_FORCE = 0xff06,
|
||||
IDX_GPU_TEMP_ABORT = 0xff07,
|
||||
IDX_GPU_TEMP_DISABLE = 0xff08,
|
||||
IDX_GPU_TEMP_RETAIN = 0xff09,
|
||||
IDX_ENCODING_FROM = 0xff06,
|
||||
IDX_ENCODING_TO = 0xff07,
|
||||
IDX_FORCE = 0xff08,
|
||||
IDX_GPU_TEMP_ABORT = 0xff09,
|
||||
IDX_GPU_TEMP_DISABLE = 0xff0a,
|
||||
IDX_GPU_TEMP_RETAIN = 0xff0b,
|
||||
IDX_HASH_MODE = 'm',
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff0a,
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff0c,
|
||||
IDX_HELP = 'h',
|
||||
IDX_HEX_CHARSET = 0xff0b,
|
||||
IDX_HEX_SALT = 0xff0c,
|
||||
IDX_HEX_WORDLIST = 0xff0d,
|
||||
IDX_HEX_CHARSET = 0xff0d,
|
||||
IDX_HEX_SALT = 0xff0e,
|
||||
IDX_HEX_WORDLIST = 0xff0f,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_MAX = 0xff0e,
|
||||
IDX_INCREMENT_MIN = 0xff0f,
|
||||
IDX_INDUCTION_DIR = 0xff10,
|
||||
IDX_KEEP_GUESSING = 0xff11,
|
||||
IDX_INCREMENT_MAX = 0xff10,
|
||||
IDX_INCREMENT_MIN = 0xff11,
|
||||
IDX_INDUCTION_DIR = 0xff12,
|
||||
IDX_KEEP_GUESSING = 0xff13,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KEYSPACE = 0xff12,
|
||||
IDX_LEFT = 0xff13,
|
||||
IDX_KEYSPACE = 0xff14,
|
||||
IDX_LEFT = 0xff15,
|
||||
IDX_LIMIT = 'l',
|
||||
IDX_LOGFILE_DISABLE = 0xff14,
|
||||
IDX_LOOPBACK = 0xff15,
|
||||
IDX_MACHINE_READABLE = 0xff16,
|
||||
IDX_MARKOV_CLASSIC = 0xff17,
|
||||
IDX_MARKOV_DISABLE = 0xff18,
|
||||
IDX_MARKOV_HCSTAT = 0xff19,
|
||||
IDX_LOGFILE_DISABLE = 0xff16,
|
||||
IDX_LOOPBACK = 0xff17,
|
||||
IDX_MACHINE_READABLE = 0xff18,
|
||||
IDX_MARKOV_CLASSIC = 0xff19,
|
||||
IDX_MARKOV_DISABLE = 0xff1a,
|
||||
IDX_MARKOV_HCSTAT = 0xff1b,
|
||||
IDX_MARKOV_THRESHOLD = 't',
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff1a,
|
||||
IDX_NVIDIA_SPIN_DAMP = 0xff1b,
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff1c,
|
||||
IDX_NVIDIA_SPIN_DAMP = 0xff1d,
|
||||
IDX_OPENCL_DEVICES = 'd',
|
||||
IDX_OPENCL_DEVICE_TYPES = 'D',
|
||||
IDX_OPENCL_INFO = 'I',
|
||||
IDX_OPENCL_PLATFORMS = 0xff1c,
|
||||
IDX_OPENCL_VECTOR_WIDTH = 0xff1d,
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff1e,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff1f,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff20,
|
||||
IDX_OUTFILE_FORMAT = 0xff21,
|
||||
IDX_OPENCL_PLATFORMS = 0xff1e,
|
||||
IDX_OPENCL_VECTOR_WIDTH = 0xff1f,
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff20,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff21,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff22,
|
||||
IDX_OUTFILE_FORMAT = 0xff23,
|
||||
IDX_OUTFILE = 'o',
|
||||
IDX_POTFILE_DISABLE = 0xff22,
|
||||
IDX_POTFILE_PATH = 0xff23,
|
||||
IDX_POWERTUNE_ENABLE = 0xff24,
|
||||
IDX_QUIET = 0xff25,
|
||||
IDX_REMOVE = 0xff26,
|
||||
IDX_REMOVE_TIMER = 0xff27,
|
||||
IDX_RESTORE = 0xff28,
|
||||
IDX_RESTORE_DISABLE = 0xff29,
|
||||
IDX_RESTORE_FILE_PATH = 0xff2a,
|
||||
IDX_POTFILE_DISABLE = 0xff24,
|
||||
IDX_POTFILE_PATH = 0xff25,
|
||||
IDX_POWERTUNE_ENABLE = 0xff26,
|
||||
IDX_QUIET = 0xff27,
|
||||
IDX_REMOVE = 0xff28,
|
||||
IDX_REMOVE_TIMER = 0xff29,
|
||||
IDX_RESTORE = 0xff2a,
|
||||
IDX_RESTORE_DISABLE = 0xff2b,
|
||||
IDX_RESTORE_FILE_PATH = 0xff2c,
|
||||
IDX_RP_FILE = 'r',
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff2b,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff2c,
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff2d,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff2e,
|
||||
IDX_RP_GEN = 'g',
|
||||
IDX_RP_GEN_SEED = 0xff2d,
|
||||
IDX_RP_GEN_SEED = 0xff2f,
|
||||
IDX_RULE_BUF_L = 'j',
|
||||
IDX_RULE_BUF_R = 'k',
|
||||
IDX_RUNTIME = 0xff2e,
|
||||
IDX_SCRYPT_TMTO = 0xff2f,
|
||||
IDX_RUNTIME = 0xff30,
|
||||
IDX_SCRYPT_TMTO = 0xff31,
|
||||
IDX_SEGMENT_SIZE = 'c',
|
||||
IDX_SEPARATOR = 'p',
|
||||
IDX_SESSION = 0xff30,
|
||||
IDX_SHOW = 0xff31,
|
||||
IDX_SESSION = 0xff32,
|
||||
IDX_SHOW = 0xff33,
|
||||
IDX_SKIP = 's',
|
||||
IDX_STATUS = 0xff32,
|
||||
IDX_STATUS_TIMER = 0xff33,
|
||||
IDX_STDOUT_FLAG = 0xff34,
|
||||
IDX_SPEED_ONLY = 0xff35,
|
||||
IDX_PROGRESS_ONLY = 0xff36,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff37,
|
||||
IDX_USERNAME = 0xff38,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff39,
|
||||
IDX_VERACRYPT_PIM = 0xff3a,
|
||||
IDX_STATUS = 0xff34,
|
||||
IDX_STATUS_TIMER = 0xff35,
|
||||
IDX_STDOUT_FLAG = 0xff36,
|
||||
IDX_SPEED_ONLY = 0xff37,
|
||||
IDX_PROGRESS_ONLY = 0xff38,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff39,
|
||||
IDX_USERNAME = 0xff3a,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff3b,
|
||||
IDX_VERACRYPT_PIM = 0xff3c,
|
||||
IDX_VERSION_LOWER = 'v',
|
||||
IDX_VERSION = 'V',
|
||||
IDX_WEAK_HASH_THRESHOLD = 0xff3b,
|
||||
IDX_WEAK_HASH_THRESHOLD = 0xff3d,
|
||||
IDX_WORKLOAD_PROFILE = 'w'
|
||||
|
||||
} user_options_map_t;
|
||||
@ -1203,6 +1206,9 @@ typedef struct dictstat
|
||||
|
||||
hc_stat_t stat;
|
||||
|
||||
char encoding_from[64];
|
||||
char encoding_to[64];
|
||||
|
||||
} dictstat_t;
|
||||
|
||||
typedef struct dictstat_ctx
|
||||
@ -1388,6 +1394,10 @@ typedef struct wl_data
|
||||
u64 cnt;
|
||||
u64 pos;
|
||||
|
||||
bool iconv_enabled;
|
||||
iconv_t iconv_ctx;
|
||||
char *iconv_tmp;
|
||||
|
||||
void (*func) (char *, u64, u64 *, u64 *);
|
||||
|
||||
} wl_data_t;
|
||||
@ -1453,6 +1463,8 @@ typedef struct user_options
|
||||
char *custom_charset_3;
|
||||
char *custom_charset_4;
|
||||
char *debug_file;
|
||||
char *encoding_from;
|
||||
char *encoding_to;
|
||||
char *induction_dir;
|
||||
char *markov_hcstat;
|
||||
char *opencl_devices;
|
||||
|
26
src/Makefile
26
src/Makefile
@ -108,6 +108,15 @@ CC_LINUX_64 := gcc
|
||||
CC_WIN_32 := i686-w64-mingw32-gcc
|
||||
CC_WIN_64 := x86_64-w64-mingw32-gcc
|
||||
|
||||
## To compile mingw iconv:
|
||||
##
|
||||
## ./configure --host=i686-w64-mingw32 --prefix=/opt/iconv-w32 && make install
|
||||
## ./configure --host=x86_64-w64-mingw32 --prefix=/opt/iconv-w64 && make install
|
||||
##
|
||||
|
||||
ICONV_WIN_32 := /opt/iconv-w32
|
||||
ICONV_WIN_64 := /opt/iconv-w64
|
||||
|
||||
##
|
||||
## Misc stuff
|
||||
##
|
||||
@ -184,7 +193,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)
|
||||
@ -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,23 +248,31 @@ CFLAGS_CROSS_LINUX64 += -m64
|
||||
CFLAGS_CROSS_LINUX64 += -DWITH_HWMON
|
||||
CFLAGS_CROSS_WIN32 := $(CFLAGS)
|
||||
CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_CROSS_WIN32 += -I$(ICONV_WIN_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$(ICONV_WIN_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 += -L$(ICONV_WIN_32)/lib/
|
||||
LFLAGS_CROSS_WIN32 += -lpsapi
|
||||
LFLAGS_CROSS_WIN32 += -liconv
|
||||
LFLAGS_CROSS_WIN64 := $(LFLAGS)
|
||||
LFLAGS_CROSS_WIN64 += -Wl,--dynamicbase -Wl,--nxcompat
|
||||
LFLAGS_CROSS_WIN64 += -L$(ICONV_WIN_64)/lib/
|
||||
LFLAGS_CROSS_WIN64 += -lpsapi
|
||||
LFLAGS_CROSS_WIN64 += -liconv
|
||||
|
||||
##
|
||||
## Objects
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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-from | 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",
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user