From a69c5d87d61b9db9e90952a7cd3fc1a4899ad988 Mon Sep 17 00:00:00 2001 From: "Nicholas.Ni" Date: Fri, 2 Jul 2021 09:34:25 +0800 Subject: [PATCH] fix hydra telnet in some terminals, login failure will be accompanied by %, for example:% Authenticate failed --- hydra-http.c | 9 ++++++--- hydra-telnet.c | 14 ++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/hydra-http.c b/hydra-http.c index f2b27e6..933cb14 100644 --- a/hydra-http.c +++ b/hydra-http.c @@ -504,7 +504,10 @@ int32_t service_http_init(char *ip, int32_t sp, unsigned char options, char *mis } match_status_code = atoi(status_code); - free(status_code); + + if (debug) { + hydra_report(stdout, "Find match reply status code: %d", match_status_code); + } } } return 0; @@ -517,8 +520,8 @@ void usage_http(const char *service) { "NTLM or MD5\n" " (h|H)=My-Hdr\\: foo to send a user defined HTTP header with each " "request\n" - " (c|C)=check for status code in the HTTP reply. If the reply status " - " code matches it, it is judged as successful \n" + " (c|C)=check for status code in the HTTP reply. If the reply status code\n" + " matches it, it is judged as successful \n" " (F|S)=check for text in the HTTP reply. S= means if this text is " "found, a\n" " valid account has been found, F= means if this string is " diff --git a/hydra-telnet.c b/hydra-telnet.c index 39908f9..de6f541 100644 --- a/hydra-telnet.c +++ b/hydra-telnet.c @@ -37,12 +37,14 @@ int32_t start_telnet(int32_t s, char *ip, int32_t port, unsigned char options, c return 1; if (strchr(buf, '/') != NULL || strchr(buf, '>') != NULL || strchr(buf, '%') != NULL || strchr(buf, '$') != NULL || strchr(buf, '#') != NULL) { - hydra_report_found_host(port, ip, "telnet", fp); - hydra_completed_pair_found(); - free(buf); - if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) - return 3; - return 1; + if (strstr(buf, "ailed") == NULL) { + hydra_report_found_host(port, ip, "telnet", fp); + hydra_completed_pair_found(); + free(buf); + if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) + return 3; + return 1; + } } (void)make_to_lower(buf);