From 49117745cf650e6960f204129a7f41e9c99c0879 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 16 Aug 2021 19:42:02 +0200 Subject: [PATCH] STDIN Interface: Disable the --stdin-timeout-abort check after 1000 successful reads from stdin --- docs/changes.txt | 1 + src/dispatch.c | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 018ce4a38..117252ae1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -40,6 +40,7 @@ - HIP Kernels: Enable vector data types for HIP kernels for functionality and performance - Kernel threads: Use warp size / wavefront size query instead of hard-coded values as the basis for kernel threads - SCRYPT Kernels: Improve Hashcat.hctune entries for many NV and AMD GPUs for hash mode 8900, 9300, 15700 and 22700 +- STDIN Interface: Disable the --stdin-timeout-abort check after 1000 successful reads from stdin - Tuning Database: Add new module function module_extra_tuningdb_block() to extend hashcat.hctune content from a module ## diff --git a/src/dispatch.c b/src/dispatch.c index 337b25fc2..78be36598 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -194,23 +194,32 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par memset (device_param->pws_comp, 0, device_param->size_pws_comp); memset (device_param->pws_idx, 0, device_param->size_pws_idx); + #define DISABLE_READ_TIMEOUT_AFTER 1000 + + int selects_returned = 0; + while (device_param->pws_cnt < device_param->kernel_power) { - const int rc_select = select_read_timeout_console (1); - - if (rc_select == -1) break; - - if (rc_select == 0) + if (selects_returned < DISABLE_READ_TIMEOUT_AFTER) { - if (status_ctx->run_thread_level1 == false) break; + const int rc_select = select_read_timeout_console (1); - status_ctx->stdin_read_timeout_cnt++; + if (rc_select == -1) break; - continue; + if (rc_select == 0) + { + if (status_ctx->run_thread_level1 == false) break; + + status_ctx->stdin_read_timeout_cnt++; + + continue; + } + + status_ctx->stdin_read_timeout_cnt = 0; + + selects_returned++; } - status_ctx->stdin_read_timeout_cnt = 0; - char *line_buf = fgets (buf, HCBUFSIZ_LARGE - 1, stdin); if (line_buf == NULL) break;