From a01712370b483ad7a1f4029e4f2e5b3a5d73fc65 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sat, 10 Jun 2017 23:31:45 +0300 Subject: [PATCH 1/3] Remove useless sock check in init functions 'sock' inited with -1 a few lines above, so condition is alwais false --- hydra-pop3.c | 3 --- hydra-redis.c | 2 -- hydra-rpcap.c | 2 -- 3 files changed, 7 deletions(-) diff --git a/hydra-pop3.c b/hydra-pop3.c index ac3c8a4..4481dfc 100644 --- a/hydra-pop3.c +++ b/hydra-pop3.c @@ -525,9 +525,6 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI p.disable_tls = 1; memcpy(p.ip, ip, 36); - if (sock >= 0) - sock = hydra_disconnect(sock); -// usleepn(300); if ((options & OPTION_SSL) == 0) { if (port != 0) myport = port; diff --git a/hydra-redis.c b/hydra-redis.c index d388de2..61a08ea 100644 --- a/hydra-redis.c +++ b/hydra-redis.c @@ -135,8 +135,6 @@ int service_redis_init(char *ip, int sp, unsigned char options, char *miscptr, F char buffer[] = "*1\r\n$4\r\nping\r\n"; hydra_register_socket(sp); - if (sock >= 0) - sock = hydra_disconnect(sock); if ((options & OPTION_SSL) == 0) { if (port != 0) myport = port; diff --git a/hydra-rpcap.c b/hydra-rpcap.c index fc9ce00..8272870 100644 --- a/hydra-rpcap.c +++ b/hydra-rpcap.c @@ -130,8 +130,6 @@ int service_rpcap_init(char *ip, int sp, unsigned char options, char *miscptr, F char buffer[] = "\x00\x08\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00"; hydra_register_socket(sp); - if (sock >= 0) - sock = hydra_disconnect(sock); if ((options & OPTION_SSL) == 0) { if (port != 0) myport = port; From 18ae87b39624fac492f68cc0b5f964955f9d5fa1 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sun, 11 Jun 2017 18:21:40 +0300 Subject: [PATCH 2/3] Remove useless null check 'while' has 2 pbuffer[0] checks: - pbuffer[0] not equal to 0 - pbuffer[0] more then 31 (first printable char) if pbuffer[0] more than 31 it's always not equal to 0 => first check is useless --- sasl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sasl.c b/sasl.c index d5239dc..dad73da 100644 --- a/sasl.c +++ b/sasl.c @@ -308,7 +308,7 @@ void sasl_digest_md5(char *result, char *login, char *pass, char *buffer, char * currentpos = 0; } pbuffer++; - } while ((pbuffer[0] != '\0') && (pbuffer[0] > 31) && (ind < array_size)); + } while ((pbuffer[0] > 31) && (ind < array_size)); //save the latest one if (ind < array_size) { array[ind] = malloc(currentpos + 1); From 78c88159fa4fe9a5ba664a28b15f608ea43e03f1 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sun, 11 Jun 2017 18:25:45 +0300 Subject: [PATCH 3/3] Remove reduant 'if' after 'else' if (A) { } else if (!A) { } --- hydra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra.c b/hydra.c index d9f07e9..25275e5 100644 --- a/hydra.c +++ b/hydra.c @@ -1944,7 +1944,7 @@ int hydra_send_next_pair(int target_no, int head_no) { hydra_targets[target_no]->login_no = 0; hydra_targets[target_no]->login_ptr = login_ptr; - } else if (hydra_targets[target_no]->login_no < hydra_brains.countlogin) { + } else { hydra_targets[target_no]->login_ptr++; while (*hydra_targets[target_no]->login_ptr != 0) hydra_targets[target_no]->login_ptr++;