diff --git a/README.md b/README.md index f2edcfb..fa214d9 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ Please do not use in military or secret service organizations, or for illegal purposes. + (This is the wish of the author and non-binding. Many people working + in these organizations do not care for laws and ethics anyways. + You are not one of the "good" ones if you ignore this.) diff --git a/hydra-imap.c b/hydra-imap.c index 20d1ea1..f84e9fb 100644 --- a/hydra-imap.c +++ b/hydra-imap.c @@ -105,7 +105,8 @@ int32_t start_imap(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer2, 0, sizeof(buffer2)); result = sasl_plain(buffer2, login, pass); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%.250s\r\n", buffer2); break; @@ -163,17 +164,20 @@ int32_t start_imap(int32_t s, char *ip, int32_t port, unsigned char options, cha switch (imap_auth_mechanism) { case AUTH_CRAMMD5: { result = sasl_cram_md5(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; case AUTH_CRAMSHA1: { result = sasl_cram_sha1(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; case AUTH_CRAMSHA256: { result = sasl_cram_sha256(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; } diff --git a/hydra-nntp.c b/hydra-nntp.c index c06a7ac..8531356 100644 --- a/hydra-nntp.c +++ b/hydra-nntp.c @@ -113,7 +113,8 @@ int32_t start_nntp(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer, 0, sizeof(buffer)); result = sasl_plain(buffer, login, pass); - if (result == NULL) return 3; + if (result == NULL) + return 3; char tmp_buffer[sizeof(buffer)]; sprintf(tmp_buffer, "%.250s\r\n", buffer); @@ -149,7 +150,8 @@ int32_t start_nntp(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer2, 0, sizeof(buffer2)); result = sasl_cram_md5(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); hydra_tobase64((unsigned char *)buffer, strlen(buffer), sizeof(buffer)); diff --git a/hydra-pop3.c b/hydra-pop3.c index 2b453c1..acd6c2e 100644 --- a/hydra-pop3.c +++ b/hydra-pop3.c @@ -203,7 +203,8 @@ int32_t start_pop3(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer, 0, sizeof(buffer)); result = sasl_plain(buffer, login, pass); - if (result == NULL) return 3; + if (result == NULL) + return 3; char tmp_buffer[sizeof(buffer)]; sprintf(tmp_buffer, "%.250s\r\n", buffer); @@ -265,17 +266,20 @@ int32_t start_pop3(int32_t s, char *ip, int32_t port, unsigned char options, cha switch (p->pop3_auth_mechanism) { case AUTH_CRAMMD5: { result = sasl_cram_md5(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; case AUTH_CRAMSHA1: { result = sasl_cram_sha1(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; case AUTH_CRAMSHA256: { result = sasl_cram_sha256(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); } break; } diff --git a/hydra-sip.c b/hydra-sip.c index 954d03c..6be4d93 100644 --- a/hydra-sip.c +++ b/hydra-sip.c @@ -139,7 +139,8 @@ int32_t start_sip(int32_t s, char *ip, char *lip, int32_t port, int32_t lport, u char buffer2[512]; result = sasl_digest_md5(buffer2, login, pass, strstr(buf, "WWW-Authenticate: Digest") + strlen("WWW-Authenticate: Digest") + 1, host, "sip", NULL, 0, NULL); - if (result == NULL) return 3; + if (result == NULL) + return 3; memset(buffer, 0, SIP_MAX_BUF); snprintf(buffer, SIP_MAX_BUF, diff --git a/hydra-smtp.c b/hydra-smtp.c index f6f1ac2..dc6e54a 100644 --- a/hydra-smtp.c +++ b/hydra-smtp.c @@ -68,7 +68,8 @@ int32_t start_smtp(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer, 0, sizeof(buffer)); result = sasl_plain(buffer, login, pass); - if (result == NULL) return 3; + if (result == NULL) + return 3; char tmp_buffer[sizeof(buffer)]; sprintf(tmp_buffer, "%.250s\r\n", buffer); @@ -104,7 +105,8 @@ int32_t start_smtp(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer2, 0, sizeof(buffer2)); result = sasl_cram_md5(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s %.250s", preplogin, buffer2); hydra_tobase64((unsigned char *)buffer, strlen(buffer), sizeof(buffer)); diff --git a/hydra-xmpp.c b/hydra-xmpp.c index dd7c2f9..fe0a2f0 100644 --- a/hydra-xmpp.c +++ b/hydra-xmpp.c @@ -126,7 +126,8 @@ int32_t start_xmpp(int32_t s, char *ip, int32_t port, unsigned char options, cha case AUTH_PLAIN: { memset(buffer2, 0, sizeof(buffer)); result = sasl_plain(buffer2, login, pass); - if (result == NULL) return 3; + if (result == NULL) + return 3; sprintf(buffer, "%s%.250s%s", RESPONSE_STR, buffer2, RESPONSE_END_STR); if (debug) hydra_report(stderr, "DEBUG C: %s\n", buffer); @@ -138,7 +139,8 @@ int32_t start_xmpp(int32_t s, char *ip, int32_t port, unsigned char options, cha memset(buffer2, 0, sizeof(buffer2)); result = sasl_cram_md5(buffer2, pass, buffer); - if (result == NULL) return 3; + if (result == NULL) + return 3; rc = sasl_saslprep(login, SASL_ALLOW_UNASSIGNED, &preplogin); if (rc) { diff --git a/hydra.c b/hydra.c index 0ea27cc..6952542 100644 --- a/hydra.c +++ b/hydra.c @@ -3,8 +3,9 @@ * https://github.com/vanhauser-thc/thc-hydra * * Parallized network login hacker. - * Don't use in military or secret service organizations, or for illegal - * purposes. + * Please don't use in military or secret service organizations, or for illegal + * purposes. This is a wish and is non-binding. + * If you ignore this be sure you are not a good person though. * * License: GNU AFFERO GENERAL PUBLIC LICENSE v3.0, see LICENSE file */ @@ -551,11 +552,11 @@ void help(int32_t ext) { "module help)\n"); PRINT_NORMAL(ext, "\nSupported services: %s\n" - "\n%s is a tool to guess/crack valid login/password pairs. " - "Licensed under AGPL\n" - "v3.0. The newest version is always available at %s\n" - "Don't use in military or secret service organizations, or for " - "illegal purposes.\n", + "\n%s is a tool to guess/crack valid login/password pairs.\n" + "Licensed under AGPL v3.0. The newest version is always available at;\n%s\n" + "Please don't use in military or secret service organizations, or for illegal\n" + "purposes. (This is a wish and non-binding - most such people do not care about\n" + "laws and ethics anyway - and tell themselves they are one of the good ones.)\n", SERVICES, PROGRAM, RESOURCE); if (ext && strlen(unsupported) > 0) { @@ -2151,7 +2152,7 @@ int main(int argc, char *argv[]) { struct sockaddr_in *ipv4 = NULL; printf("%s %s (c) 2020 by %s & %s - Please do not use in military or secret " - "service organizations, or for illegal purposes.\n\n", + "service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).\n\n", PROGRAM, VERSION, AUTHOR, AUTHOR2); #ifndef LIBAFP SERVICES = hydra_string_replace(SERVICES, "afp ", ""); diff --git a/sasl.h b/sasl.h index e42299f..4e12e31 100644 --- a/sasl.h +++ b/sasl.h @@ -32,7 +32,7 @@ typedef enum { SASL_ALLOW_UNASSIGNED = 1 } sasl_saslprep_flags; int32_t print_hex(unsigned char *buf, int32_t len); -char* sasl_plain(char *result, char *login, char *pass); +char *sasl_plain(char *result, char *login, char *pass); int32_t sasl_saslprep(const char *in, sasl_saslprep_flags flags, char **out); #ifdef LIBOPENSSL @@ -40,9 +40,9 @@ int32_t sasl_saslprep(const char *in, sasl_saslprep_flags flags, char **out); #include #include -char* sasl_cram_md5(char *result, char *pass, char *challenge); -char* sasl_cram_sha1(char *result, char *pass, char *challenge); -char* sasl_cram_sha256(char *result, char *pass, char *challenge); -char* sasl_digest_md5(char *result, char *login, char *pass, char *buffer, char *miscptr, char *type, char *webtarget, int32_t webport, char *header); -char* sasl_scram_sha1(char *result, char *pass, char *clientfirstmessagebare, char *serverfirstmessage); +char *sasl_cram_md5(char *result, char *pass, char *challenge); +char *sasl_cram_sha1(char *result, char *pass, char *challenge); +char *sasl_cram_sha256(char *result, char *pass, char *challenge); +char *sasl_digest_md5(char *result, char *login, char *pass, char *buffer, char *miscptr, char *type, char *webtarget, int32_t webport, char *header); +char *sasl_scram_sha1(char *result, char *pass, char *clientfirstmessagebare, char *serverfirstmessage); #endif