From ac2dd7817d559b27b136223c88c320e939648752 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 2 Nov 2016 14:34:43 +0100 Subject: [PATCH] added -I option --- CHANGES | 4 +++- hydra.c | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 36529d8..d947321 100644 --- a/CHANGES +++ b/CHANGES @@ -7,7 +7,9 @@ Release 8.4-dev - HYDRA_PROXY_AUTH was deprecated, set login/password in HTTP_PROXY[_HTTP] * New protocol: adam6500 - this one is work in progress, please test and report * New protocol: rpcap! thanks to Petar Kaleychev -* New command line option -y which disables -x 1aA interpretation, thanks to crondaemon for the patch +* New command line options: + -y : disables -x 1aA interpretation, thanks to crondaemon for the patch + -I : ignore an existing hydra.restore file (dont wait for 10 seconds) * The protocols vnc, xmpp, telnet, imap, nntp and pcanywhere got accidentially long sleep commands due a patch in 8.2, fixed * Added special error message for clueless users :) diff --git a/hydra.c b/hydra.c index 37ad5eb..35cc424 100644 --- a/hydra.c +++ b/hydra.c @@ -327,12 +327,14 @@ void help(int ext) { #ifdef HAVE_MATH_H " [-x MIN:MAX:CHARSET]" #endif - " [-SOuvVd46] " + " [-ISOuvVd46] " //"[server service [OPT]]|" "[service://server[:PORT][/OPT]]\n"); printf("\nOptions:\n"); if (ext) printf(" -R restore a previous aborted/crashed session\n"); + if (ext) + printf(" -I ignore an existing restore file (dont wait 10 seconds)\n"); #ifdef LIBOPENSSL if (ext) printf(" -S perform an SSL connect\n"); @@ -2340,7 +2342,7 @@ int main(int argc, char *argv[]) { FILE *lfp = NULL, *pfp = NULL, *cfp = NULL, *ifp = NULL, *rfp = NULL, *proxyfp; size_t countinfile = 1, sizeinfile = 0; unsigned long int math2; - int i = 0, j = 0, k, error = 0, modusage = 0; + int i = 0, j = 0, k, error = 0, modusage = 0, ignore_restore = 0; int head_no = 0, target_no = 0, exit_condition = 0, readres; time_t starttime, elapsed_status, elapsed_restore, status_print = 59, tmp_time; char *tmpptr, *tmpptr2; @@ -2462,7 +2464,7 @@ int main(int argc, char *argv[]) { help(1); if (argc < 2) help(0); - while ((i = getopt(argc, argv, "hq64Rde:vVl:fFg:L:p:OP:o:M:C:t:T:m:w:W:s:SUux:y")) >= 0) { + while ((i = getopt(argc, argv, "hIq64Rde:vVl:fFg:L:p:OP:o:M:C:t:T:m:w:W:s:SUux:y")) >= 0) { switch (i) { case 'h': help(1); @@ -2485,6 +2487,9 @@ int main(int argc, char *argv[]) { case 'R': hydra_options.restore = 1; break; + case 'I': + ignore_restore = 1; // this is not to be saved in hydra_options! + break; case 'd': hydra_options.debug = ++debug; ++verbose; @@ -3457,8 +3462,9 @@ int main(int argc, char *argv[]) { } free(memcheck); if ((rfp = fopen(RESTOREFILE, "r")) != NULL) { - fprintf(stderr, "[WARNING] Restorefile (%s) from a previous session found, to prevent overwriting, you have 10 seconds to abort...\n", RESTOREFILE); - sleep(10); + fprintf(stderr, "[WARNING] Restorefile (%s) from a previous session found, to prevent overwriting, %s\n", ignore_restore == 1 ? "ignored ..." : "you have 10 seconds to abort...", RESTOREFILE); + if (ignore_restore != 1) + sleep(10); fclose(rfp); }