mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Fix some EOL handling
This commit is contained in:
parent
97a33dc4ef
commit
97b58b16af
@ -24,38 +24,13 @@
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
// don't try to simply change this, it will not work
|
||||
#define PW_MIN 0
|
||||
#define PW_MAX 54
|
||||
#define PW_MAX1 (PW_MAX + 1)
|
||||
|
||||
#define PW_DICTMAX 31
|
||||
#define PW_DICTMAX1 (PW_DICTMAX + 1)
|
||||
|
||||
#define EXEC_CACHE 128
|
||||
|
||||
#define SPEED_CACHE 128
|
||||
#define SPEED_MAXAGE 4096
|
||||
|
||||
// general buffer size in case the size is unknown at compile-time
|
||||
#define HCBUFSIZ_TINY 0x100
|
||||
#define HCBUFSIZ_LARGE 0x50000
|
||||
|
||||
#define BLOCK_SIZE 64
|
||||
|
||||
#define EXPECTED_ITERATIONS 10000
|
||||
#define NOMINMAX 1
|
||||
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define DEVICES_MAX 128
|
||||
|
||||
#define MAX_CUT_TRIES 4
|
||||
|
||||
#define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a)
|
||||
|
||||
#define NOMINMAX 1
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#define __stdcall
|
||||
#endif
|
||||
@ -81,12 +56,34 @@ but this is nededed for VS compiler which doesn't have inline keyword but has __
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MAYBE_UNUSED __attribute__((unused))
|
||||
|
||||
// config section
|
||||
// do not try to simply change this, it will not work
|
||||
|
||||
#define PW_MIN 0
|
||||
#define PW_MAX 54
|
||||
#define PW_MAX1 (PW_MAX + 1)
|
||||
#define PW_DICTMAX 31
|
||||
#define PW_DICTMAX1 (PW_DICTMAX + 1)
|
||||
|
||||
#define HCBUFSIZ_TINY 0x100
|
||||
#define HCBUFSIZ_LARGE 0x50000
|
||||
|
||||
#define CPT_CACHE 0x20000
|
||||
#define PARAMCNT 64
|
||||
#define DEVICES_MAX 128
|
||||
#define EXEC_CACHE 128
|
||||
#define SPEED_CACHE 128
|
||||
#define SPEED_MAXAGE 4096
|
||||
#define BLOCK_SIZE 64
|
||||
#define EXPECTED_ITERATIONS 10000
|
||||
#define MAX_CUT_TRIES 4
|
||||
|
||||
#if defined (_WIN)
|
||||
#define EOL "\r\n"
|
||||
#else
|
||||
#define EOL "\n"
|
||||
#endif
|
||||
|
||||
#define MAYBE_UNUSED __attribute__((unused))
|
||||
|
||||
#endif // _COMMON_H
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef _TYPES_H
|
||||
#define _TYPES_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@ -14,9 +16,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define CPT_BUF 0x20000
|
||||
#define PARAMCNT 64
|
||||
|
||||
#if defined (_WIN)
|
||||
#include <windows.h>
|
||||
#if defined (_BASETSD_H)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define _USAGE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void usage_mini_print (const char *progname);
|
||||
void usage_big_print (const char *progname);
|
||||
|
@ -25,7 +25,7 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
cpt_ctx->enabled = true;
|
||||
|
||||
cpt_ctx->cpt_buf = (cpt_t *) hccalloc (hashcat_ctx, CPT_BUF, sizeof (cpt_t)); VERIFY_PTR (cpt_ctx->cpt_buf);
|
||||
cpt_ctx->cpt_buf = (cpt_t *) hccalloc (hashcat_ctx, CPT_CACHE, sizeof (cpt_t)); VERIFY_PTR (cpt_ctx->cpt_buf);
|
||||
|
||||
cpt_ctx->cpt_total = 0;
|
||||
cpt_ctx->cpt_pos = 0;
|
||||
@ -51,7 +51,7 @@ void cpt_ctx_reset (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (cpt_ctx->enabled == false) return;
|
||||
|
||||
memset (cpt_ctx->cpt_buf, 0, CPT_BUF * sizeof (cpt_t));
|
||||
memset (cpt_ctx->cpt_buf, 0, CPT_CACHE * sizeof (cpt_t));
|
||||
|
||||
cpt_ctx->cpt_total = 0;
|
||||
cpt_ctx->cpt_pos = 0;
|
||||
|
@ -380,7 +380,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
cpt_ctx->cpt_total += cpt_cracked;
|
||||
|
||||
if (cpt_ctx->cpt_pos == CPT_BUF) cpt_ctx->cpt_pos = 0;
|
||||
if (cpt_ctx->cpt_pos == CPT_CACHE) cpt_ctx->cpt_pos = 0;
|
||||
|
||||
hc_thread_mutex_unlock (status_ctx->mux_display);
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
|
||||
|
||||
if (outfile_ctx->fp)
|
||||
{
|
||||
fprintf (outfile_ctx->fp, "%s" EOL, tmp_buf);
|
||||
fwrite (EOL, strlen (EOL), 1, outfile_ctx->fp);
|
||||
}
|
||||
|
||||
return tmp_len;
|
||||
|
@ -1253,7 +1253,7 @@ int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
int cpt_cur_min = 0;
|
||||
|
||||
for (int i = 0; i < CPT_BUF; i++)
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
@ -1278,7 +1278,7 @@ int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
int cpt_cur_hour = 0;
|
||||
|
||||
for (int i = 0; i < CPT_BUF; i++)
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
@ -1303,7 +1303,7 @@ int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
int cpt_cur_day = 0;
|
||||
|
||||
for (int i = 0; i < CPT_BUF; i++)
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
|
@ -523,7 +523,7 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
printf (EOL);
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
|
@ -414,7 +414,8 @@ void usage_mini_print (const char *progname)
|
||||
for (int i = 0; USAGE_MINI[i] != NULL; i++)
|
||||
{
|
||||
printf (USAGE_MINI[i], progname);
|
||||
printf (EOL);
|
||||
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,6 +424,7 @@ void usage_big_print (const char *progname)
|
||||
for (int i = 0; USAGE_BIG[i] != NULL; i++)
|
||||
{
|
||||
printf (USAGE_BIG[i], progname);
|
||||
printf (EOL);
|
||||
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user