managed eof with stdin

This commit is contained in:
pirate sans barbe 2021-03-03 05:45:20 -10:00 committed by yvain douard
commit 7de88f2353

17
hydra.c
View file

@ -1774,10 +1774,10 @@ int32_t hydra_send_next_pair(int32_t target_no, int32_t head_no) {
if (snpdont) { if (snpdont) {
hydra_targets[target_no]->pass_ptr = pass_ptr; hydra_targets[target_no]->pass_ptr = pass_ptr;
} else { } else {
if (check_flag(hydra_options.mode, MODE_PASSWORD_BRUTE)) { if (check_flag(hydra_options.mode, MODE_PASSWORD_BRUTE)) {
#ifndef HAVE_MATH_H #ifndef HAVE_MATH_H
sleep(1); sleep(1);
#else #else
hydra_targets[target_no]->pass_ptr = bf_next(); hydra_targets[target_no]->pass_ptr = bf_next();
if (debug) if (debug)
printf("[DEBUG] bfg new password for next child: %s\n", hydra_targets[target_no]->pass_ptr); printf("[DEBUG] bfg new password for next child: %s\n", hydra_targets[target_no]->pass_ptr);
@ -2280,6 +2280,7 @@ int main(int argc, char *argv[]) {
hydra_options.waittime = waittime = WAITTIME; hydra_options.waittime = waittime = WAITTIME;
bf_options.disable_symbols = 0; bf_options.disable_symbols = 0;
// command line processing // command line processing
if (argc > 1 && strncmp(argv[1], "-h", 2) == 0) if (argc > 1 && strncmp(argv[1], "-h", 2) == 0)
help(1); help(1);
@ -2447,13 +2448,14 @@ int main(int argc, char *argv[]) {
break; break;
case 'x': case 'x':
#ifndef HAVE_MATH_H #ifndef HAVE_MATH_H
fprintf(stderr, "[ERROR] -x option is not available as math.h was not " fprintf(stderr, "[ERROR] -x option is not available as math.h was not "
"found at compile time\n"); "found at compile time\n");
exit(-1); exit(-1);
#else #else
if (strcmp(optarg, "-h") == 0) if (strcmp(optarg, "-h") == 0)
help_bfg(); help_bfg();
bf_options.arg = optarg; bf_options.arg = optarg;
}
hydra_options.bfg = 1; hydra_options.bfg = 1;
hydra_options.mode = hydra_options.mode | MODE_PASSWORD_BRUTE; hydra_options.mode = hydra_options.mode | MODE_PASSWORD_BRUTE;
hydra_options.loop_mode = 1; hydra_options.loop_mode = 1;
@ -3442,6 +3444,7 @@ int main(int argc, char *argv[]) {
#else #else
sleep(1); sleep(1);
#endif #endif
}
} else { } else {
pass_ptr = hydra_options.pass = empty_login; pass_ptr = hydra_options.pass = empty_login;
hydra_brains.countpass = 0; hydra_brains.countpass = 0;