Add zlib support v2

This commit is contained in:
Gabriele Gristina
2019-06-21 21:56:38 +02:00
parent f4acae6c5f
commit 6cb4abd526
80 changed files with 1122 additions and 417 deletions
+4 -2
View File
@@ -10,9 +10,11 @@
#include <string.h>
#include <errno.h>
u64 count_lines (FILE *fd);
//u64 count_lines (FILE *fd);
u64 count_lines (fp_tmp_t *fp_t);
size_t fgetl (FILE *fp, char *line_buf);
//size_t fgetl (FILE *fp, char *line_buf);
size_t fgetl (fp_tmp_t *fp_t, char *line_buf);
size_t superchop_with_length (char *buf, const size_t len);
+2 -1
View File
@@ -15,6 +15,7 @@ const char *strhlfmt (const u32 hashfile_format);
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len);
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len);
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);
//u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check);
#endif // _HLFMT_H
+18 -2
View File
@@ -14,6 +14,7 @@
#include <fcntl.h>
#include <ctype.h>
#include <math.h>
#include "zlib.h"
#if defined (_WIN)
#include <winsock2.h> // needed for select()
@@ -61,8 +62,23 @@ bool hc_string_is_digit (const char *s);
void hc_string_trim_trailing (char *s);
void hc_string_trim_leading (char *s);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
//size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
//size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
bool hc_fopen(fp_tmp_t *fp_t, const char *path, char *mode);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, fp_tmp_t *fp_t);
size_t hc_fread_direct (void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, fp_tmp_t *fp_t);
void hc_fwrite_direct (const void *ptr, size_t size, size_t nmemb, FILE *stream);
int hc_fseek (fp_tmp_t *fp_t, off_t offset, int whence);
void hc_rewind (fp_tmp_t *fp_t);
off_t hc_ftell (fp_tmp_t *fp_t);
int hc_fgetc (fp_tmp_t *fp_t);
int hc_fputc (int c, fp_tmp_t *fp_t);
char *hc_fgets (char *buf, int len, fp_tmp_t *fp_t);
int hc_fileno (fp_tmp_t *fp_t);
int hc_feof (fp_tmp_t *fp_t);
//void hc_fflush (fp_tmp_t *fp_t);
void hc_fclose (fp_tmp_t *fp_t);
bool hc_same_files (char *file1, char *file2);
+6 -3
View File
@@ -10,7 +10,8 @@ typedef struct extra_info_straight
{
u64 pos;
FILE *fp;
// FILE *fp;
fp_tmp_t *fp_t;
u64 rule_pos_prev;
u64 rule_pos;
@@ -27,8 +28,10 @@ typedef struct extra_info_combi
{
u64 pos;
FILE *base_fp;
FILE *combs_fp;
// FILE *base_fp;
// FILE *combs_fp;
fp_tmp_t *base_fp_t;
fp_tmp_t *combs_fp_t;
u64 comb_pos_prev;
u64 comb_pos;
+18 -1
View File
@@ -17,6 +17,7 @@
#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include "zlib.h"
#if defined (_WIN)
#define WINICONV_CONST
@@ -988,6 +989,21 @@ typedef struct link_speed
} link_speed_t;
// handling gzip files
typedef struct fp_tmp
{
union
{
FILE *fp;
gzFile gfp;
} f;
short is_gzip;
const char *path;
char *mode;
} fp_tmp_t;
#include "ext_nvrtc.h"
#include "ext_cuda.h"
#include "ext_OpenCL.h"
@@ -1149,7 +1165,8 @@ typedef struct hc_device_param
char *scratch_buf;
FILE *combs_fp;
// FILE *combs_fp;
fp_tmp_t *combs_fp_t;
pw_t *combs_buf;
void *hooks_buf;
+7 -3
View File
@@ -19,9 +19,13 @@ void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off);
void get_next_word_uc (char *buf, u64 sz, u64 *len, u64 *off);
void get_next_word_std (char *buf, u64 sz, u64 *len, u64 *off);
void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *out_len);
int load_segment (hashcat_ctx_t *hashcat_ctx, FILE *fd);
int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 *result);
//void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *out_len);
//int load_segment (hashcat_ctx_t *hashcat_ctx, FILE *fd);
//int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 *result);
void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf, u32 *out_len);
int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t);
int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfile, u64 *result);
int wl_data_init (hashcat_ctx_t *hashcat_ctx);
void wl_data_destroy (hashcat_ctx_t *hashcat_ctx);