1 /** 2 * Author......: See docs/credits.txt 3 * License.....: MIT 4 */ 5 6 #ifndef _LOGFILE_H 7 #define _LOGFILE_H 8 9 #include <stdio.h> 10 #include <stdlib.h> 11 #include <stdarg.h> 12 #include <time.h> 13 #include <errno.h> 14 15 // logfile_append() checks for logfile_disable internally to make it easier from here 16 17 #define logfile_top_msg(msg) logfile_append (hashcat_ctx, "%s\t%s", logfile_ctx->topid, (msg)) 18 #define logfile_sub_msg(msg) logfile_append (hashcat_ctx, "%s\t%s\t%s", logfile_ctx->topid, logfile_ctx->subid, (msg)) 19 #define logfile_top_var_uint64(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%" PRIu64 "", logfile_ctx->topid, (var), (u64) (val)) 20 #define logfile_sub_var_uint64(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%s\t%" PRIu64 "", logfile_ctx->topid, logfile_ctx->subid, (var), (u64) (val)) 21 #define logfile_top_var_uint(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%u", logfile_ctx->topid, (var), (u32) (val)) 22 #define logfile_sub_var_uint(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%s\t%u", logfile_ctx->topid, logfile_ctx->subid, (var), (u32) (val)) 23 #define logfile_top_var_char(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%c", logfile_ctx->topid, (var), (char) (val)) 24 #define logfile_sub_var_char(var,val) logfile_append (hashcat_ctx, "%s\t%s\t%s\t%c", logfile_ctx->topid, logfile_ctx->subid, (var), (char) (val)) 25 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append (hashcat_ctx, "%s\t%s\t%s", logfile_ctx->topid, (var), (val)) 26 #define logfile_sub_var_string(var,val) if ((val) != NULL) logfile_append (hashcat_ctx, "%s\t%s\t%s\t%s", logfile_ctx->topid, logfile_ctx->subid, (var), (val)) 27 28 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var)) 29 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var)) 30 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var)) 31 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var)) 32 #define logfile_top_char(var) logfile_top_var_char (#var, (var)) 33 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var)) 34 #define logfile_top_string(var) logfile_top_var_string (#var, (var)) 35 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var)) 36 37 void logfile_generate_topid (hashcat_ctx_t *hashcat_ctx); 38 void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx); 39 void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); 40 int logfile_init (hashcat_ctx_t *hashcat_ctx); 41 void logfile_destroy (hashcat_ctx_t *hashcat_ctx); 42 43 #endif // _LOGFILE_H 44