mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-04 05:42:35 +00:00
Bypass an attack after a user-specified time and cracks/time threshold
This commit is contained in:
parent
d10f3979fc
commit
cc0e8a3864
@ -842,6 +842,8 @@ typedef enum user_options_map
|
|||||||
IDX_VERSION = 'V',
|
IDX_VERSION = 'V',
|
||||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff53,
|
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff53,
|
||||||
IDX_WORKLOAD_PROFILE = 'w',
|
IDX_WORKLOAD_PROFILE = 'w',
|
||||||
|
IDX_BYPASS_THRESHOLD = 0xff54,
|
||||||
|
IDX_BYPASS_DELAY = 0xff55,
|
||||||
|
|
||||||
} user_options_map_t;
|
} user_options_map_t;
|
||||||
|
|
||||||
@ -2294,6 +2296,8 @@ typedef struct user_options
|
|||||||
bool brain_password_chgd;
|
bool brain_password_chgd;
|
||||||
bool brain_server_timer_chgd;
|
bool brain_server_timer_chgd;
|
||||||
#endif
|
#endif
|
||||||
|
bool bypass_delay_chgd;
|
||||||
|
bool bypass_threshold_chgd;
|
||||||
bool hash_mode_chgd;
|
bool hash_mode_chgd;
|
||||||
bool hccapx_message_pair_chgd;
|
bool hccapx_message_pair_chgd;
|
||||||
bool identify;
|
bool identify;
|
||||||
@ -2412,6 +2416,8 @@ typedef struct user_options
|
|||||||
u32 brain_session;
|
u32 brain_session;
|
||||||
u32 brain_attack;
|
u32 brain_attack;
|
||||||
#endif
|
#endif
|
||||||
|
u32 bypass_delay;
|
||||||
|
u32 bypass_threshold;
|
||||||
u32 debug_mode;
|
u32 debug_mode;
|
||||||
u32 hwmon_temp_abort;
|
u32 hwmon_temp_abort;
|
||||||
int hash_mode;
|
int hash_mode;
|
||||||
@ -2776,11 +2782,20 @@ typedef struct status_ctx
|
|||||||
time_t runtime_start;
|
time_t runtime_start;
|
||||||
time_t runtime_stop;
|
time_t runtime_stop;
|
||||||
|
|
||||||
|
time_t timer_bypass_start;
|
||||||
|
time_t timer_bypass_cur;
|
||||||
|
|
||||||
hc_timer_t timer_running; // timer on current dict
|
hc_timer_t timer_running; // timer on current dict
|
||||||
hc_timer_t timer_paused; // timer on current dict
|
hc_timer_t timer_paused; // timer on current dict
|
||||||
|
|
||||||
double msec_paused; // timer on current dict
|
double msec_paused; // timer on current dict
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --bypass-threshold cracked counter
|
||||||
|
*/
|
||||||
|
|
||||||
|
int bypass_digests_done;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read timeouts
|
* read timeouts
|
||||||
*/
|
*/
|
||||||
|
@ -294,6 +294,15 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
loopback_write_open (hashcat_ctx);
|
loopback_write_open (hashcat_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set time for --bypass-delay
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (user_options->bypass_delay_chgd == true)
|
||||||
|
{
|
||||||
|
time (&status_ctx->timer_bypass_start);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare cracking stats
|
* Prepare cracking stats
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "restore.h"
|
#include "restore.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx)
|
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
@ -327,6 +328,35 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(user_options->bypass_delay_chgd == true)
|
||||||
|
{
|
||||||
|
time (&status_ctx->timer_bypass_cur);
|
||||||
|
|
||||||
|
// --bypass-delay check
|
||||||
|
if((status_ctx->timer_bypass_cur - status_ctx->timer_bypass_start) >= user_options->bypass_delay)
|
||||||
|
{
|
||||||
|
time (&status_ctx->timer_bypass_start);
|
||||||
|
|
||||||
|
// --bypass-threshold check
|
||||||
|
if((u32)(hashcat_ctx->hashes->digests_done - status_ctx->bypass_digests_done) < user_options->bypass_threshold)
|
||||||
|
{
|
||||||
|
event_log_info (hashcat_ctx, NULL);
|
||||||
|
event_log_info (hashcat_ctx, NULL);
|
||||||
|
|
||||||
|
bypass (hashcat_ctx);
|
||||||
|
|
||||||
|
event_log_info (hashcat_ctx, "Bypass threshold reached! Next dictionary / mask in queue selected. Bypassing current one.");
|
||||||
|
|
||||||
|
event_log_info (hashcat_ctx, NULL);
|
||||||
|
status_ctx->bypass_digests_done = 0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// enough recovered to continue the session
|
||||||
|
status_ctx->bypass_digests_done = hashcat_ctx->hashes->digests_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// final round of save_hash
|
// final round of save_hash
|
||||||
|
@ -133,6 +133,8 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
|
|||||||
" --increment-min | Num | Start mask incrementing at X | --increment-min=4",
|
" --increment-min | Num | Start mask incrementing at X | --increment-min=4",
|
||||||
" --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
|
" --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
|
||||||
" -S, --slow-candidates | | Enable slower (but advanced) candidate generators |",
|
" -S, --slow-candidates | | Enable slower (but advanced) candidate generators |",
|
||||||
|
" --bypass-delay | Num | Seconds delay between checking bypass threshold | --bypass-delay=5",
|
||||||
|
" --bypass-threshold | Num | Minimum amount of founds to avoid being bypassed | --bypass-threshold=5",
|
||||||
#ifdef WITH_BRAIN
|
#ifdef WITH_BRAIN
|
||||||
" --brain-server | | Enable brain server |",
|
" --brain-server | | Enable brain server |",
|
||||||
" --brain-server-timer | Num | Update the brain server dump each X seconds (min:60) | --brain-server-timer=300",
|
" --brain-server-timer | Num | Update the brain server dump each X seconds (min:60) | --brain-server-timer=300",
|
||||||
|
@ -42,6 +42,8 @@ static const struct option long_options[] =
|
|||||||
{"backend-ignore-opencl", no_argument, NULL, IDX_BACKEND_IGNORE_OPENCL},
|
{"backend-ignore-opencl", no_argument, NULL, IDX_BACKEND_IGNORE_OPENCL},
|
||||||
{"backend-info", no_argument, NULL, IDX_BACKEND_INFO},
|
{"backend-info", no_argument, NULL, IDX_BACKEND_INFO},
|
||||||
{"backend-vector-width", required_argument, NULL, IDX_BACKEND_VECTOR_WIDTH},
|
{"backend-vector-width", required_argument, NULL, IDX_BACKEND_VECTOR_WIDTH},
|
||||||
|
{"bypass-delay", required_argument, NULL, IDX_BYPASS_DELAY},
|
||||||
|
{"bypass-threshold", required_argument, NULL, IDX_BYPASS_THRESHOLD},
|
||||||
{"benchmark-all", no_argument, NULL, IDX_BENCHMARK_ALL},
|
{"benchmark-all", no_argument, NULL, IDX_BENCHMARK_ALL},
|
||||||
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
|
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
|
||||||
{"bitmap-max", required_argument, NULL, IDX_BITMAP_MAX},
|
{"bitmap-max", required_argument, NULL, IDX_BITMAP_MAX},
|
||||||
@ -341,6 +343,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
case IDX_MARKOV_THRESHOLD:
|
case IDX_MARKOV_THRESHOLD:
|
||||||
case IDX_OUTFILE_CHECK_TIMER:
|
case IDX_OUTFILE_CHECK_TIMER:
|
||||||
case IDX_BACKEND_VECTOR_WIDTH:
|
case IDX_BACKEND_VECTOR_WIDTH:
|
||||||
|
case IDX_BYPASS_DELAY:
|
||||||
|
case IDX_BYPASS_THRESHOLD:
|
||||||
case IDX_WORKLOAD_PROFILE:
|
case IDX_WORKLOAD_PROFILE:
|
||||||
case IDX_KERNEL_ACCEL:
|
case IDX_KERNEL_ACCEL:
|
||||||
case IDX_KERNEL_LOOPS:
|
case IDX_KERNEL_LOOPS:
|
||||||
@ -481,6 +485,10 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
case IDX_BACKEND_DEVICES_VIRTUAL: user_options->backend_devices_virtual = hc_strtoul (optarg, NULL, 10); break;
|
case IDX_BACKEND_DEVICES_VIRTUAL: user_options->backend_devices_virtual = hc_strtoul (optarg, NULL, 10); break;
|
||||||
case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10);
|
case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10);
|
||||||
user_options->backend_vector_width_chgd = true; break;
|
user_options->backend_vector_width_chgd = true; break;
|
||||||
|
case IDX_BYPASS_DELAY: user_options->bypass_delay = hc_strtoul (optarg, NULL, 10);
|
||||||
|
user_options->bypass_delay_chgd = true; break;
|
||||||
|
case IDX_BYPASS_THRESHOLD: user_options->bypass_threshold = hc_strtoul (optarg, NULL, 10);
|
||||||
|
user_options->bypass_threshold_chgd = true; break;
|
||||||
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
|
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
|
||||||
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
|
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
|
||||||
case IDX_MULTIPLY_ACCEL_DISABLE: user_options->multiply_accel_disable = true; break;
|
case IDX_MULTIPLY_ACCEL_DISABLE: user_options->multiply_accel_disable = true; break;
|
||||||
@ -1532,6 +1540,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((user_options->bypass_delay_chgd && !user_options->bypass_threshold_chgd) || (!user_options->bypass_delay_chgd && user_options->bypass_threshold_chgd))
|
||||||
|
{
|
||||||
|
event_log_error (hashcat_ctx, "You must specify --bypass-delay and --bypass-threshold together.");
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// argc / argv checks
|
// argc / argv checks
|
||||||
|
|
||||||
bool show_error = true;
|
bool show_error = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user