mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-18 18:42:19 +00:00
Add main_shared Makefile target, create main_shared.c out of main.c library use example
This commit is contained in:
parent
8598a79732
commit
10dfea61ad
58
src/Makefile
58
src/Makefile
@ -91,7 +91,9 @@ VERSION_TAG := $(shell test -d .git && git describe --tags --dirty=
|
|||||||
## Compiler flags
|
## Compiler flags
|
||||||
##
|
##
|
||||||
|
|
||||||
CFLAGS += -pipe -W -Wall -std=c99 -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
|
INCLUDE_PATHS := -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
|
||||||
|
|
||||||
|
CFLAGS += -pipe -W -Wall -std=c99
|
||||||
|
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
CFLAGS += -O2
|
CFLAGS += -O2
|
||||||
@ -105,12 +107,11 @@ endif
|
|||||||
##
|
##
|
||||||
## Linker flags
|
## Linker flags
|
||||||
##
|
##
|
||||||
|
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
LDFLAGS += -s
|
LDFLAGS += -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## Native compilation target
|
## Native compilation target
|
||||||
##
|
##
|
||||||
@ -128,8 +129,8 @@ endif # darwin
|
|||||||
ifeq ($(UNAME),Linux)
|
ifeq ($(UNAME),Linux)
|
||||||
CFLAGS_NATIVE :=
|
CFLAGS_NATIVE :=
|
||||||
CFLAGS_NATIVE += $(CFLAGS)
|
CFLAGS_NATIVE += $(CFLAGS)
|
||||||
LFLAGS_NATIVE := -lpthread -ldl
|
|
||||||
CFLAGS_NATIVE += -DWITH_HWMON
|
CFLAGS_NATIVE += -DWITH_HWMON
|
||||||
|
LFLAGS_NATIVE := -lpthread -ldl
|
||||||
LFLAGS_NATIVE += $(LDFLAGS)
|
LFLAGS_NATIVE += $(LDFLAGS)
|
||||||
endif # linux
|
endif # linux
|
||||||
|
|
||||||
@ -140,6 +141,14 @@ LFLAGS_NATIVE := -lpthread
|
|||||||
LFLAGS_NATIVE += $(LDFLAGS)
|
LFLAGS_NATIVE += $(LDFLAGS)
|
||||||
endif # freebsd
|
endif # freebsd
|
||||||
|
|
||||||
|
CFLAGS_NATIVE_SHARED :=
|
||||||
|
CFLAGS_NATIVE_SHARED += $(CFLAGS)
|
||||||
|
CFLAGS_NATIVE_SHARED += -DWITH_HWMON -fpic
|
||||||
|
LFLAGS_NATIVE_SHARED := -L. -lhashcat
|
||||||
|
LFLAGS_NATIVE_SHARED += -Wl,-rpath=.
|
||||||
|
LFLAGS_NATIVE_SHARED += -lpthread -ldl
|
||||||
|
LFLAGS_NATIVE_SHARED += $(LDFLAGS)
|
||||||
|
|
||||||
##
|
##
|
||||||
## Cross compilation target
|
## Cross compilation target
|
||||||
##
|
##
|
||||||
@ -148,7 +157,6 @@ CFLAGS_CROSS_LINUX :=
|
|||||||
CFLAGS_CROSS_LINUX += $(CFLAGS)
|
CFLAGS_CROSS_LINUX += $(CFLAGS)
|
||||||
CFLAGS_CROSS_LINUX += -DWITH_HWMON
|
CFLAGS_CROSS_LINUX += -DWITH_HWMON
|
||||||
|
|
||||||
#CFLAGS_CROSS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1
|
|
||||||
CFLAGS_CROSS_WIN :=
|
CFLAGS_CROSS_WIN :=
|
||||||
CFLAGS_CROSS_WIN += $(filter-out -fsanitize=address,$(CFLAGS))
|
CFLAGS_CROSS_WIN += $(filter-out -fsanitize=address,$(CFLAGS))
|
||||||
CFLAGS_CROSS_WIN += -DWITH_HWMON
|
CFLAGS_CROSS_WIN += -DWITH_HWMON
|
||||||
@ -171,6 +179,7 @@ LFLAGS_CROSS_WIN += -lpsapi
|
|||||||
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile potfile restore rp rp_cpu rp_kernel_on_cpu shared status stdout straight terminal thread timer tuningdb usage user_options weak_hash wordlist
|
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile potfile restore rp rp_cpu rp_kernel_on_cpu shared status stdout straight terminal thread timer tuningdb usage user_options weak_hash wordlist
|
||||||
|
|
||||||
NATIVE_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.o)
|
NATIVE_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.o)
|
||||||
|
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
|
||||||
|
|
||||||
LINUX_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.32.o)
|
LINUX_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.32.o)
|
||||||
LINUX_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.64.o)
|
LINUX_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.64.o)
|
||||||
@ -195,7 +204,7 @@ native: hashcat
|
|||||||
binaries: linux32 linux64 win32 win64
|
binaries: linux32 linux64 win32 win64
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -f obj/*.o *.bin *.exe *.restore *.out *.pot *.log hashcat core
|
$(RM) -f obj/*.o *.bin *.exe *.restore *.out *.pot *.log hashcat hashcat_shared libhashcat.so core
|
||||||
$(RM) -rf *.induct
|
$(RM) -rf *.induct
|
||||||
$(RM) -rf *.outfiles
|
$(RM) -rf *.outfiles
|
||||||
$(RM) -rf *.dSYM
|
$(RM) -rf *.dSYM
|
||||||
@ -259,36 +268,49 @@ uninstall:
|
|||||||
## native compiled hashcat
|
## native compiled hashcat
|
||||||
##
|
##
|
||||||
|
|
||||||
obj/%.NATIVE.o: src/%.c
|
obj/%.NATIVE.o: src/%.c
|
||||||
$(CC) $(CFLAGS_NATIVE) -c -o $@ $<
|
$(CC) -c $(CFLAGS_NATIVE) $(INCLUDE_PATHS) -o $@ $^
|
||||||
|
|
||||||
$(BINARY_NATIVE): src/main.c $(NATIVE_OBJS)
|
$(BINARY_NATIVE): $(NATIVE_OBJS) src/main.c
|
||||||
$(CC) $(CFLAGS_NATIVE) -o $(BINARY_NATIVE) $^ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
$(CC) $(CFLAGS_NATIVE) $(INCLUDE_PATHS) -o $@ $^ -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(LFLAGS_NATIVE)
|
||||||
|
|
||||||
|
##
|
||||||
|
## native compiled hashcat (shared)
|
||||||
|
##
|
||||||
|
|
||||||
|
obj/%.NATIVE.SHARED.o: src/%.c
|
||||||
|
$(CC) -c $(CFLAGS_NATIVE_SHARED) $(INCLUDE_PATHS) -o $@ $^
|
||||||
|
|
||||||
|
lib$(BINARY_NATIVE).so: $(NATIVE_SHARED_OBJS)
|
||||||
|
$(CC) -o $@ $^ -shared
|
||||||
|
|
||||||
|
$(BINARY_NATIVE)_shared: lib$(BINARY_NATIVE).so src/main_shared.c
|
||||||
|
$(CC) $(CFLAGS_NATIVE_SHARED) $(INCLUDE_PATHS) -o $@ $^ -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(LFLAGS_NATIVE_SHARED)
|
||||||
|
|
||||||
##
|
##
|
||||||
## cross compiled hashcat for binary release version
|
## cross compiled hashcat for binary release version
|
||||||
##
|
##
|
||||||
|
|
||||||
obj/%.LINUX.32.o: src/%.c
|
obj/%.LINUX.32.o: src/%.c
|
||||||
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -c -o $@ $<
|
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) $(INCLUDE_PATHS) -c -o $@ $<
|
||||||
|
|
||||||
obj/%.LINUX.64.o: src/%.c
|
obj/%.LINUX.64.o: src/%.c
|
||||||
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -c -o $@ $<
|
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) $(INCLUDE_PATHS) -c -o $@ $<
|
||||||
|
|
||||||
obj/%.WIN.32.o: src/%.c
|
obj/%.WIN.32.o: src/%.c
|
||||||
$(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -c -o $@ $<
|
$(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) $(INCLUDE_PATHS) -c -o $@ $<
|
||||||
|
|
||||||
obj/%.WIN.64.o: src/%.c
|
obj/%.WIN.64.o: src/%.c
|
||||||
$(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -c -o $@ $<
|
$(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) $(INCLUDE_PATHS) -c -o $@ $<
|
||||||
|
|
||||||
hashcat32.bin: src/main.c $(LINUX_32_OBJS)
|
hashcat32.bin: src/main.c $(LINUX_32_OBJS)
|
||||||
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) $(INCLUDE_PATHS) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
||||||
|
|
||||||
hashcat64.bin: src/main.c $(LINUX_64_OBJS)
|
hashcat64.bin: src/main.c $(LINUX_64_OBJS)
|
||||||
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) $(INCLUDE_PATHS) -o $@ $^ $(LFLAGS_CROSS_LINUX) -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)
|
||||||
$(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
$(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) $(INCLUDE_PATHS) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
||||||
|
|
||||||
hashcat64.exe: src/main.c $(WIN_64_OBJS)
|
hashcat64.exe: src/main.c $(WIN_64_OBJS)
|
||||||
$(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
$(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) $(INCLUDE_PATHS) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
||||||
|
56
src/main.c
56
src/main.c
@ -11,13 +11,8 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "user_options.h"
|
#include "user_options.h"
|
||||||
#include "usage.h"
|
#include "usage.h"
|
||||||
#include "hashcat.h"
|
|
||||||
|
|
||||||
#define RUN_AS_COMMANDLINE
|
|
||||||
|
|
||||||
#if defined (RUN_AS_COMMANDLINE)
|
|
||||||
|
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "hashcat.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
@ -472,17 +467,6 @@ void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const siz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len)
|
|
||||||
{
|
|
||||||
switch (id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
// hashcat main context
|
// hashcat main context
|
||||||
@ -493,11 +477,6 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (rc_hashcat_init == -1) return -1;
|
if (rc_hashcat_init == -1) return -1;
|
||||||
|
|
||||||
// initialize the session via getops for commandline use or
|
|
||||||
// alternatively you can set the user_options directly
|
|
||||||
|
|
||||||
#if defined (RUN_AS_COMMANDLINE)
|
|
||||||
|
|
||||||
// install and shared folder need to be set to recognize "make install" use
|
// install and shared folder need to be set to recognize "make install" use
|
||||||
|
|
||||||
char *install_folder = NULL;
|
char *install_folder = NULL;
|
||||||
@ -549,39 +528,6 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
const int rc_hashcat = hashcat (hashcat_ctx, install_folder, shared_folder, argc, argv, COMPTIME);
|
const int rc_hashcat = hashcat (hashcat_ctx, install_folder, shared_folder, argc, argv, COMPTIME);
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// this is a bit ugly, but it's the example you're looking for
|
|
||||||
|
|
||||||
char *hash = "8743b52063cd84097a65d1633f5c74f5";
|
|
||||||
char *mask = "?l?l?l?l?l?l?l";
|
|
||||||
|
|
||||||
char *hc_argv[] = { hash, mask, NULL };
|
|
||||||
|
|
||||||
// initialize the user options with some defaults (you can override them later)
|
|
||||||
|
|
||||||
const int rc_options_init = user_options_init (hashcat_ctx);
|
|
||||||
|
|
||||||
if (rc_options_init == -1) return -1;
|
|
||||||
|
|
||||||
// your own stuff
|
|
||||||
|
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
|
||||||
|
|
||||||
user_options->hc_argv = hc_argv;
|
|
||||||
user_options->hc_argc = 2;
|
|
||||||
user_options->quiet = true;
|
|
||||||
user_options->potfile_disable = true;
|
|
||||||
user_options->attack_mode = ATTACK_MODE_BF; // this is -a 3
|
|
||||||
user_options->hash_mode = 0; // MD5
|
|
||||||
user_options->workload_profile = 3;
|
|
||||||
|
|
||||||
// now run hashcat
|
|
||||||
|
|
||||||
const int rc_hashcat = hashcat (hashcat_ctx, NULL, NULL, 0, NULL, 0);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// finished with hashcat, clean up
|
// finished with hashcat, clean up
|
||||||
|
|
||||||
hashcat_ctx_destroy (hashcat_ctx);
|
hashcat_ctx_destroy (hashcat_ctx);
|
||||||
|
93
src/main_shared.c
Normal file
93
src/main_shared.c
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/**
|
||||||
|
* Author......: See docs/credits.txt
|
||||||
|
* License.....: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "user_options.h"
|
||||||
|
#include "usage.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "hashcat.h"
|
||||||
|
#include "event.h"
|
||||||
|
|
||||||
|
static void main_cracker_hash_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
||||||
|
{
|
||||||
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||||
|
|
||||||
|
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||||
|
|
||||||
|
fwrite (buf, len, 1, stdout);
|
||||||
|
fwrite (EOL, sizeof (EOL), 1, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case EVENT_CRACKER_HASH_CRACKED: main_cracker_hash_cracked (hashcat_ctx, buf, len); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
// hashcat main context
|
||||||
|
|
||||||
|
hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) malloc (sizeof (hashcat_ctx_t)); VERIFY_PTR (hashcat_ctx);
|
||||||
|
|
||||||
|
const int rc_hashcat_init = hashcat_ctx_init (hashcat_ctx, event);
|
||||||
|
|
||||||
|
if (rc_hashcat_init == -1) return -1;
|
||||||
|
|
||||||
|
// install and shared folder need to be set to recognize "make install" use
|
||||||
|
|
||||||
|
char *install_folder = NULL;
|
||||||
|
char *shared_folder = NULL;
|
||||||
|
|
||||||
|
#if defined (INSTALL_FOLDER)
|
||||||
|
install_folder = INSTALL_FOLDER;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (SHARED_FOLDER)
|
||||||
|
shared_folder = SHARED_FOLDER;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// this is a bit ugly, but it's the example you're looking for
|
||||||
|
|
||||||
|
char *hash = "8743b52063cd84097a65d1633f5c74f5";
|
||||||
|
char *mask = "?l?l?l?l?l?l?l";
|
||||||
|
|
||||||
|
char *hc_argv[] = { hash, mask, NULL };
|
||||||
|
|
||||||
|
// initialize the user options with some defaults (you can override them later)
|
||||||
|
|
||||||
|
const int rc_options_init = user_options_init (hashcat_ctx);
|
||||||
|
|
||||||
|
if (rc_options_init == -1) return -1;
|
||||||
|
|
||||||
|
// your own stuff
|
||||||
|
|
||||||
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
|
user_options->hc_argv = hc_argv;
|
||||||
|
user_options->hc_argc = 2;
|
||||||
|
user_options->quiet = true;
|
||||||
|
user_options->potfile_disable = true;
|
||||||
|
user_options->attack_mode = ATTACK_MODE_BF; // this is -a 3
|
||||||
|
user_options->hash_mode = 0; // MD5
|
||||||
|
user_options->workload_profile = 3;
|
||||||
|
|
||||||
|
// now run hashcat
|
||||||
|
|
||||||
|
const int rc_hashcat = hashcat (hashcat_ctx, install_folder, shared_folder, 0, NULL, 0);
|
||||||
|
|
||||||
|
hashcat_ctx_destroy (hashcat_ctx);
|
||||||
|
|
||||||
|
free (hashcat_ctx);
|
||||||
|
|
||||||
|
return rc_hashcat;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user