mirror of
https://github.com/hashcat/hashcat
synced 2025-01-03 11:16:23 +01:00
fixes #2012: add Deflate support for 7-Zip using zlib
This commit is contained in:
parent
0c8768c520
commit
f45a726376
@ -6,6 +6,7 @@
|
||||
|
||||
- Fully modularized hash-mode integration via plugin interface and converted all existing hash-modes
|
||||
- Support for inline VeraCrypt PIM Brute-Force
|
||||
- Support Deflate decompression for the 7-Zip hash type using zlib
|
||||
|
||||
##
|
||||
## Algorithms
|
||||
|
@ -39,6 +39,13 @@ Other contributors to hashcat
|
||||
* A full list and their commits can be found here:
|
||||
https://github.com/hashcat/hashcat/graphs/contributors
|
||||
|
||||
# hashcat relies on some libraries, including:
|
||||
|
||||
* xxHash by Yann Collet (@Cyan4973)
|
||||
* LZMA-SDK by Igor Pavlov
|
||||
* zlib by Jean-loup Gailly and Mark Adler
|
||||
* win-iconv by Yukihiro Nakadaira
|
||||
|
||||
# Furthermore the following persons helped the project:
|
||||
|
||||
Martin "purehate" Bos <purehate@derbycon.com> (@cantcomputer)
|
||||
|
39
src/Makefile
39
src/Makefile
@ -9,6 +9,7 @@ PRODUCTION := 0
|
||||
PRODUCTION_VERSION := v5.1.0
|
||||
ENABLE_BRAIN := 1
|
||||
USE_SYSTEM_LZMA := 0
|
||||
USE_SYSTEM_ZLIB := 0
|
||||
USE_SYSTEM_OPENCL := 0
|
||||
USE_SYSTEM_XXHASH := 0
|
||||
|
||||
@ -112,6 +113,12 @@ else
|
||||
DEPS_LZMA_PATH := $(LIBRARY_DEV_ROOT_FOLDER)/
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_ZLIB),0)
|
||||
DEPS_ZLIB_PATH := deps/zlib/
|
||||
else
|
||||
DEPS_ZLIB_PATH := $(LIBRARY_DEV_ROOT_FOLDER)/
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_OPENCL),0)
|
||||
DEPS_OPENCL_PATH := deps/OpenCL-Headers
|
||||
else
|
||||
@ -168,6 +175,11 @@ ifeq ($(CC),clang)
|
||||
CFLAGS += -Wno-enum-conversion
|
||||
endif
|
||||
|
||||
## because ZLIB
|
||||
ifeq ($(USE_SYSTEM_ZLIB),0)
|
||||
CFLAGS_ZLIB += -Wno-implicit-fallthrough
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
CFLAGS += -O2
|
||||
ifneq ($(UNAME),Darwin)
|
||||
@ -200,6 +212,12 @@ ifeq ($(USE_SYSTEM_LZMA),1)
|
||||
LFLAGS += -llzmasdk
|
||||
endif
|
||||
|
||||
# ZLIB
|
||||
CFLAGS += -I$(DEPS_ZLIB_PATH)
|
||||
ifeq ($(USE_SYSTEM_ZLIB),1)
|
||||
LFLAGS += -lz
|
||||
endif
|
||||
|
||||
# OpenCL
|
||||
CFLAGS += -I$(DEPS_OPENCL_PATH)
|
||||
|
||||
@ -298,6 +316,14 @@ LINUX_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).LINUX.o)
|
||||
WIN_OBJS += $(foreach OBJ,$(OBJS_LZMA),obj/$(OBJ).WIN.o)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_ZLIB),0)
|
||||
OBJS_ZLIB := adler32 crc32 zutil inftrees inffast inflate
|
||||
|
||||
NATIVE_OBJS += $(foreach OBJ,$(OBJS_ZLIB),obj/$(OBJ).NATIVE.o)
|
||||
LINUX_OBJS += $(foreach OBJ,$(OBJS_ZLIB),obj/$(OBJ).LINUX.o)
|
||||
WIN_OBJS += $(foreach OBJ,$(OBJS_ZLIB),obj/$(OBJ).WIN.o)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_XXHASH),0)
|
||||
ifeq ($(ENABLE_BRAIN),1)
|
||||
OBJS_XXHASH := xxhash
|
||||
@ -446,6 +472,11 @@ obj/%.NATIVE.o: $(DEPS_LZMA_PATH)/%.c
|
||||
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_ZLIB),0)
|
||||
obj/%.NATIVE.o: $(DEPS_ZLIB_PATH)/%.c
|
||||
$(CC) -c $(CFLAGS_NATIVE) $(CFLAGS_ZLIB) $< -o $@ -fpic
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_XXHASH),0)
|
||||
ifeq ($(ENABLE_BRAIN),1)
|
||||
obj/%.NATIVE.o: $(DEPS_XXHASH_PATH)/%.c
|
||||
@ -590,6 +621,14 @@ obj/%.WIN.o: $(DEPS_LZMA_PATH)/%.c
|
||||
$(CC_WIN) $(CFLAGS_CROSS_WIN) -c -o $@ $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_ZLIB),0)
|
||||
obj/%.LINUX.o: $(DEPS_ZLIB_PATH)/%.c
|
||||
$(CC_LINUX) $(CFLAGS_CROSS_LINUX) $(CFLAGS_ZLIB) -c -o $@ $<
|
||||
|
||||
obj/%.WIN.o: $(DEPS_ZLIB_PATH)/%.c
|
||||
$(CC_WIN) $(CFLAGS_CROSS_WIN) $(CFLAGS_ZLIB) -c -o $@ $<
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SYSTEM_XXHASH),0)
|
||||
ifeq ($(ENABLE_BRAIN),1)
|
||||
obj/%.LINUX.o: $(DEPS_XXHASH_PATH)/%.c
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "emu_inc_cipher_aes.h"
|
||||
#include "cpu_crc32.h"
|
||||
#include "ext_lzma.h"
|
||||
#include "zlib.h"
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 0;
|
||||
@ -220,6 +221,35 @@ void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf,
|
||||
{
|
||||
ret = hc_lzma1_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes);
|
||||
}
|
||||
else if (data_type == 7) // inflate using zlib (DEFLATE compression)
|
||||
{
|
||||
ret = SZ_ERROR_DATA;
|
||||
|
||||
z_stream inf;
|
||||
|
||||
inf.zalloc = Z_NULL;
|
||||
inf.zfree = Z_NULL;
|
||||
inf.opaque = Z_NULL;
|
||||
|
||||
inf.avail_in = compressed_data_len;
|
||||
inf.next_in = compressed_data;
|
||||
|
||||
inf.avail_out = decompressed_data_len;
|
||||
inf.next_out = decompressed_data;
|
||||
|
||||
// inflate:
|
||||
|
||||
inflateInit2 (&inf, -MAX_WBITS);
|
||||
|
||||
int zlib_ret = inflate (&inf, Z_NO_FLUSH);
|
||||
|
||||
inflateEnd (&inf);
|
||||
|
||||
if ((zlib_ret == Z_OK) || (zlib_ret == Z_STREAM_END))
|
||||
{
|
||||
ret = SZ_OK;
|
||||
}
|
||||
}
|
||||
else // we only support LZMA2 in addition to LZMA1
|
||||
{
|
||||
ret = hc_lzma2_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes);
|
||||
@ -464,7 +494,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
* verify some data
|
||||
*/
|
||||
|
||||
if (data_type > 2) // this includes also 0x80 (special case that means "truncated")
|
||||
// this check also returns an error with data_type == 0x80 (special case that means "truncated")
|
||||
|
||||
if ((data_type != 0) && (data_type != 1) && (data_type != 2) && (data_type != 7))
|
||||
{
|
||||
return (PARSER_SALT_VALUE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user