From 9c7c4a9e22e4121daa9c981c0779ed49d828d1a0 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 9 Jan 2016 01:20:10 +0100 Subject: [PATCH 1/8] HYDRA_PROXY_CONNECT warning (unused) --- CHANGES | 1 + hydra.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 092acc0..567201c 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ Release 8.2-pre * Fixed a bug where the cisco-enable module was not working with the password-only logon mode * Fixed an out of memory bug in http-form * Fixed imap PLAIN method +* Added warning if HYDRA_PROXY_CONNECT environment is detected, that is an outdated setting * ... your patch? diff --git a/hydra.c b/hydra.c index 8ec53c0..cfb00cf 100644 --- a/hydra.c +++ b/hydra.c @@ -2552,6 +2552,9 @@ int main(int argc, char *argv[]) { hydra_options.miscptr = argv[optind + 2]; } + if (getenv("HYDRA_PROXY_CONNECT")) + fprintf(stderr, "[WARNING] The environment variable HYDRA_PROXY_CONNECT is not used! Use HYDRA_PROXY instead!\n"); + if (strcmp(hydra_options.service, "http") == 0 || strcmp(hydra_options.service, "https") == 0) { fprintf(stderr, "[ERROR] There is no service \"%s\", most likely you mean one of the many web modules, e.g. http-get or http-form-post. Read it up!\n", hydra_options.service); exit(-1); From c3218aafad9c7032beb8b9fc8ac4e58870c79f1c Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 19 Jan 2016 18:17:57 +0100 Subject: [PATCH 2/8] error output fixes --- Makefile | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- hydra.c | 24 +++++++-------- 2 files changed, 98 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 372e67e..352c85e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,90 @@ -all: - @echo Error: you must run "./configure" first +CC=gcc +STRIP=strip +XDEFINES= -DHAVE_MYSQL_MYSQL_H -DLIBNCURSES -DLIBIDN -DHAVE_PR29_H -DHAVE_PCRE -DLIBMYSQLCLIENT -DLIBSVN -DLIBSSH -DHAVE_ZLIB -DHAVE_MATH_H +XLIBS= -lz -lcurses -lidn -lpcre -lmysqlclient -lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1 -lssh +XLIBPATHS=-L/usr/lib -L/usr/local/lib -L/lib -L/lib +XIPATHS= -I/usr/include/mysql -I/usr/include/ncurses -I/usr/include -I/usr/include -I/usr/include -I/usr/include/subversion-1 -I/usr/include/apr-1 -I/usr/include/subversion-1 +PREFIX=/usr/local +XHYDRA_SUPPORT=xhydra +STRIP=strip + +HYDRA_LOGO=hydra-logo.o +PWI_LOGO=pw-inspector-logo.o +SEC=-fstack-protector-all --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 + +# +# Makefile for Hydra - (c) 2001-2014 by van Hauser / THC +# +OPTS=-I. -O3 +# -Wall -g -pedantic +LIBS=-lm +BINDIR = /bin +MANDIR ?= /man/man1 +DATADIR ?= /etc +DESTDIR ?= + +SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ + hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \ + hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \ + hydra-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \ + hydra-snmp.c hydra-cvs.c hydra-smtp.c hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c \ + hydra-sshkey.c hydra-teamspeak.c hydra-postgres.c hydra-rsh.c hydra-rlogin.c \ + hydra-oracle-listener.c hydra-svn.c hydra-pcanywhere.c hydra-sip.c \ + hydra-oracle.c hydra-vmauthd.c hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c \ + hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \ + hydra-rdp.c hydra-s7-300.c hydra-redis.c \ + crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c hydra-rtsp.c +OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \ + hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \ + hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \ + hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \ + hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o \ + hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o \ + hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o \ + hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o \ + hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o \ + hydra-rdp.o hydra-s7-300.c \ + crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-rtsp.o +BINS = hydra pw-inspector + +EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \ + hydra-mod.h hydra.h crc32.h d3des.h + +all: pw-inspector hydra $(XHYDRA_SUPPORT) + @echo + @echo Now type "make install" + +hydra: hydra.c $(OBJ) + $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) + @echo + @echo If men could get pregnant, abortion would be a sacrament + @echo + +xhydra: + -cd hydra-gtk && sh ./make_xhydra.sh + +pw-inspector: pw-inspector.c + -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c + +.c.o: + $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) + +strip: all + strip $(BINS) + -echo OK > /dev/null && test -x xhydra && strip xhydra || echo OK > /dev/null + +install: strip + -mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) + cp -f hydra-wizard.sh $(BINS) $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 hydra-wizard.sh $(BINS) + -echo OK > /dev/null && test -x xhydra && cp xhydra $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 xhydra || echo OK > /dev/null + -sed -e "s|^INSTALLDIR=.*|INSTALLDIR="$(PREFIX)"|" dpl4hydra.sh | sed -e "s|^LOCATION=.*|LOCATION="$(DATADIR)"|" > $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh + -chmod 755 $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh + -mkdir -p $(DESTDIR)$(PREFIX)$(DATADIR) + -cp -f *.csv $(DESTDIR)$(PREFIX)$(DATADIR) + -mkdir -p $(DESTDIR)$(PREFIX)$(MANDIR) + -cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR) clean: + rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile cp -f Makefile.orig Makefile + diff --git a/hydra.c b/hydra.c index cfb00cf..acfb2cd 100644 --- a/hydra.c +++ b/hydra.c @@ -2844,8 +2844,7 @@ int main(int argc, char *argv[]) { if (hydra_options.colonfile == NULL && ((hydra_options.login == NULL && hydra_options.loginfile == NULL) || (hydra_options.pass == NULL && hydra_options.passfile == NULL && hydra_options.bfg == 0))) { if (j > 3) { - fprintf(stderr, - "[ERROR] you specified SNMPv3, defined hashing/encryption but only gave one of login or password list. Either supply both logins and passwords (this is what is usually used in SNMPv3), or remove the hashing/encryption option (unusual)\n"); + fprintf(stderr, "[ERROR] you specified SNMPv3, defined hashing/encryption but only gave one of login or password list. Either supply both logins and passwords (this is what is usually used in SNMPv3), or remove the hashing/encryption option (unusual)\n"); exit(-1); } fprintf(stderr, "[WARNING] you specified SNMPv3 but gave no logins, NoAuthNoPriv is assumed. This is an unusual case, you should know what you are doing\n"); @@ -3033,7 +3032,7 @@ int main(int argc, char *argv[]) { } break; default: - fprintf(stderr, "[ERROR] Unknown optional argument: %s", optional1); + fprintf(stderr, "[ERROR] Unknown optional argument: %s\n", optional1); } } } @@ -3071,8 +3070,7 @@ int main(int argc, char *argv[]) { } if (hydra_options.ssl == 0 && hydra_options.port == 443) - fprintf(stderr, - "[WARNING] you specified port 443 for attacking a http service, however did not specify the -S ssl switch nor used https-..., therefore using plain HTTP\n"); + fprintf(stderr, "[WARNING] you specified port 443 for attacking a http service, however did not specify the -S ssl switch nor used https-..., therefore using plain HTTP\n"); if (hydra_options.loop_mode && hydra_options.colonfile != NULL) bail("The loop mode option (-u) works with all modes - except colon files (-C)\n"); @@ -3137,13 +3135,13 @@ int main(int argc, char *argv[]) { if (hydra_options.colonfile == NULL) { if (hydra_options.loginfile != NULL) { if ((lfp = fopen(hydra_options.loginfile, "r")) == NULL) { - fprintf(stderr, "[ERROR] File for logins not found: %s", hydra_options.loginfile); + fprintf(stderr, "[ERROR] File for logins not found: %s\n", hydra_options.loginfile); exit(-1); } hydra_brains.countlogin = countlines(lfp, 0); hydra_brains.sizelogin = size_of_data; if (hydra_brains.countlogin == 0) { - fprintf(stderr, "[ERROR] File for logins is empty: %s", hydra_options.loginfile); + fprintf(stderr, "[ERROR] File for logins is empty: %s\n", hydra_options.loginfile); exit(-1); } if (hydra_brains.countlogin > MAX_LINES) { @@ -3166,13 +3164,13 @@ int main(int argc, char *argv[]) { } if (hydra_options.passfile != NULL) { if ((pfp = fopen(hydra_options.passfile, "r")) == NULL) { - fprintf(stderr, "[ERROR] File for passwords not found: %s", hydra_options.passfile); + fprintf(stderr, "[ERROR] File for passwords not found: %s\n", hydra_options.passfile); exit(-1); } hydra_brains.countpass = countlines(pfp, 0); hydra_brains.sizepass = size_of_data; if (hydra_brains.countpass == 0) { - fprintf(stderr, "[ERROR] File for passwords is empty: %s", hydra_options.passfile); + fprintf(stderr, "[ERROR] File for passwords is empty: %s\n", hydra_options.passfile); exit(-1); } if (hydra_brains.countpass > MAX_LINES) { @@ -3213,13 +3211,13 @@ int main(int argc, char *argv[]) { } } else { if ((cfp = fopen(hydra_options.colonfile, "r")) == NULL) { - fprintf(stderr, "[ERROR] File for colon files (login:pass) not found: %s", hydra_options.colonfile); + fprintf(stderr, "[ERROR] File for colon files (login:pass) not found: %s\n", hydra_options.colonfile); exit(-1); } hydra_brains.countlogin = countlines(cfp, 1); hydra_brains.sizelogin = size_of_data; if (hydra_brains.countlogin == 0) { - fprintf(stderr, "[ERROR] File for colon files (login:pass) is empty: %s", hydra_options.colonfile); + fprintf(stderr, "[ERROR] File for colon files (login:pass) is empty: %s\n", hydra_options.colonfile); exit(-1); } if (hydra_brains.countlogin > MAX_LINES / 2) { @@ -3258,12 +3256,12 @@ int main(int argc, char *argv[]) { if (hydra_options.infile_ptr != NULL) { if ((ifp = fopen(hydra_options.infile_ptr, "r")) == NULL) { - fprintf(stderr, "[ERROR] File for targets not found: %s", hydra_options.infile_ptr); + fprintf(stderr, "[ERROR] File for targets not found: %s\n", hydra_options.infile_ptr); exit(-1); } hydra_brains.targets = countservers = countinfile = countlines(ifp, 0); if (countinfile == 0) { - fprintf(stderr, "[ERROR] File for targets is empty: %s", hydra_options.infile_ptr); + fprintf(stderr, "[ERROR] File for targets is empty: %s\n", hydra_options.infile_ptr); exit(-1); } // if (countinfile > 60) fprintf(stderr, "[WARNING] the -M option is not working correctly at the moment for target lists > 60!\n"); From 852aa716f5af6762a1789bfbbca537fc5a6a6342 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 19 Jan 2016 23:30:10 +0100 Subject: [PATCH 3/8] makefile fix --- Makefile | 89 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 87 deletions(-) diff --git a/Makefile b/Makefile index 352c85e..372e67e 100644 --- a/Makefile +++ b/Makefile @@ -1,90 +1,5 @@ -CC=gcc -STRIP=strip -XDEFINES= -DHAVE_MYSQL_MYSQL_H -DLIBNCURSES -DLIBIDN -DHAVE_PR29_H -DHAVE_PCRE -DLIBMYSQLCLIENT -DLIBSVN -DLIBSSH -DHAVE_ZLIB -DHAVE_MATH_H -XLIBS= -lz -lcurses -lidn -lpcre -lmysqlclient -lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1 -lssh -XLIBPATHS=-L/usr/lib -L/usr/local/lib -L/lib -L/lib -XIPATHS= -I/usr/include/mysql -I/usr/include/ncurses -I/usr/include -I/usr/include -I/usr/include -I/usr/include/subversion-1 -I/usr/include/apr-1 -I/usr/include/subversion-1 -PREFIX=/usr/local -XHYDRA_SUPPORT=xhydra -STRIP=strip - -HYDRA_LOGO=hydra-logo.o -PWI_LOGO=pw-inspector-logo.o -SEC=-fstack-protector-all --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 - -# -# Makefile for Hydra - (c) 2001-2014 by van Hauser / THC -# -OPTS=-I. -O3 -# -Wall -g -pedantic -LIBS=-lm -BINDIR = /bin -MANDIR ?= /man/man1 -DATADIR ?= /etc -DESTDIR ?= - -SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ - hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \ - hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \ - hydra-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \ - hydra-snmp.c hydra-cvs.c hydra-smtp.c hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c \ - hydra-sshkey.c hydra-teamspeak.c hydra-postgres.c hydra-rsh.c hydra-rlogin.c \ - hydra-oracle-listener.c hydra-svn.c hydra-pcanywhere.c hydra-sip.c \ - hydra-oracle.c hydra-vmauthd.c hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c \ - hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \ - hydra-rdp.c hydra-s7-300.c hydra-redis.c \ - crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c hydra-rtsp.c -OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \ - hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \ - hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \ - hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \ - hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o \ - hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o \ - hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o \ - hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o \ - hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o \ - hydra-rdp.o hydra-s7-300.c \ - crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-rtsp.o -BINS = hydra pw-inspector - -EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \ - hydra-mod.h hydra.h crc32.h d3des.h - -all: pw-inspector hydra $(XHYDRA_SUPPORT) - @echo - @echo Now type "make install" - -hydra: hydra.c $(OBJ) - $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) - @echo - @echo If men could get pregnant, abortion would be a sacrament - @echo - -xhydra: - -cd hydra-gtk && sh ./make_xhydra.sh - -pw-inspector: pw-inspector.c - -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c - -.c.o: - $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) - -strip: all - strip $(BINS) - -echo OK > /dev/null && test -x xhydra && strip xhydra || echo OK > /dev/null - -install: strip - -mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) - cp -f hydra-wizard.sh $(BINS) $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 hydra-wizard.sh $(BINS) - -echo OK > /dev/null && test -x xhydra && cp xhydra $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 xhydra || echo OK > /dev/null - -sed -e "s|^INSTALLDIR=.*|INSTALLDIR="$(PREFIX)"|" dpl4hydra.sh | sed -e "s|^LOCATION=.*|LOCATION="$(DATADIR)"|" > $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh - -chmod 755 $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh - -mkdir -p $(DESTDIR)$(PREFIX)$(DATADIR) - -cp -f *.csv $(DESTDIR)$(PREFIX)$(DATADIR) - -mkdir -p $(DESTDIR)$(PREFIX)$(MANDIR) - -cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR) +all: + @echo Error: you must run "./configure" first clean: - rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile cp -f Makefile.orig Makefile - From 725d14b9a5df1e2aedd7b336f158caac4175f9c2 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 20 Jan 2016 15:41:09 +0100 Subject: [PATCH 4/8] ssl,ssh and http-form fixes --- configure | 2 +- hydra-http-form.c | 2 +- hydra-mod.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 112756d..fc1f417 100755 --- a/configure +++ b/configure @@ -191,7 +191,7 @@ else fi SSLNEW="" -if [ "X" = "X$WSSL_PATH" ]; then +if [ "X" = "X$SSL_PATH" ]; then SSL_PATH="$i" SSLNEW=`grep SHA256_CTX $i/openssl/sha.h 2> /dev/null` else diff --git a/hydra-http-form.c b/hydra-http-form.c index 1c08148..9f0f91a 100644 --- a/hydra-http-form.c +++ b/hydra-http-form.c @@ -432,7 +432,7 @@ char *html_encode(char *string) { if (index(ret, '&') != NULL) ret = hydra_strrep(ret, "&", "%26"); if (index(ret, '#') != NULL) - ret = hydra_strrep(ret, "&", "%23"); + ret = hydra_strrep(ret, "#", "%23"); return ret; } diff --git a/hydra-mod.c b/hydra-mod.c index c79934c..77184fa 100644 --- a/hydra-mod.c +++ b/hydra-mod.c @@ -480,7 +480,7 @@ int internal__hydra_connect_to_ssl(int socket) { } else { // if ((sslContext = SSL_CTX_new(SSLv23_client_method())) == NULL) { #ifndef TLSv1_2_client_method -#define TLSv1_2_client_method TLSv1_client_method + #define TLSv1_2_client_method TLSv1_client_method #endif if ((sslContext = SSL_CTX_new(TLSv1_2_client_method())) == NULL) { if (verbose) { @@ -774,6 +774,7 @@ int hydra_connect_to_ssl(int socket) { #ifdef LIBOPENSSL return (internal__hydra_connect_to_ssl(socket)); #else + fprintf(stderr, "Error: not compiled with SSL\n"); return -1; #endif } @@ -786,7 +787,8 @@ int hydra_connect_ssl(char *host, int port) { #ifdef LIBOPENSSL return (internal__hydra_connect_ssl(host, port, SOCK_STREAM, 6)); #else - return (internal__hydra_connect(host, port, SOCK_STREAM, 6)); + fprintf(stderr, "Error: not compiled with SSL\n"); + return -1; #endif } From 8061c5fb31cabe7c293a53496478e3670ecc6be9 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 20 Jan 2016 16:21:20 +0100 Subject: [PATCH 5/8] verbose ssh connect error --- Makefile | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++-- hydra-ssh.c | 4 +-- 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 372e67e..116088c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,90 @@ -all: - @echo Error: you must run "./configure" first +CC=gcc +STRIP=strip +XDEFINES= -DHAVE_MYSQL_MYSQL_H -DLIBOPENSSL -DLIBNCURSES -DLIBFIREBIRD -DLIBIDN -DHAVE_PR29_H -DHAVE_PCRE -DLIBMYSQLCLIENT -DLIBNCP -DLIBPOSTGRES -DLIBSVN -DLIBSSH -DHAVE_ZLIB -DHAVE_MATH_H +XLIBS= -lz -lcurses -lssl -lncp -lfbclient -lidn -lpcre -lmysqlclient -lpq -lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1 -lssh -lcrypto +XLIBPATHS=-L/usr/lib -L/usr/local/lib -L/lib -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/usr/lib -L/usr/lib/i386-linux-gnu -L/usr/lib -L/usr/lib/i386-linux-gnu +XIPATHS= -I/usr/include/mysql -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/postgresql -I/usr/include -I/usr/include/subversion-1 -I/usr/include/apr-1.0 -I/usr/include/subversion-1 +PREFIX=/usr/local +XHYDRA_SUPPORT=xhydra +STRIP=strip + +HYDRA_LOGO= +PWI_LOGO= +SEC=-pie -fPIE -fstack-protector-all --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro + +# +# Makefile for Hydra - (c) 2001-2014 by van Hauser / THC +# +OPTS=-I. -O3 +# -Wall -g -pedantic +LIBS=-lm +BINDIR = /bin +MANDIR ?= /man/man1 +DATADIR ?= /etc +DESTDIR ?= + +SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ + hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \ + hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \ + hydra-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \ + hydra-snmp.c hydra-cvs.c hydra-smtp.c hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c \ + hydra-sshkey.c hydra-teamspeak.c hydra-postgres.c hydra-rsh.c hydra-rlogin.c \ + hydra-oracle-listener.c hydra-svn.c hydra-pcanywhere.c hydra-sip.c \ + hydra-oracle.c hydra-vmauthd.c hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c \ + hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \ + hydra-rdp.c hydra-s7-300.c hydra-redis.c \ + crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c hydra-rtsp.c +OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \ + hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \ + hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \ + hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \ + hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o \ + hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o \ + hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o \ + hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o \ + hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o \ + hydra-rdp.o hydra-s7-300.c \ + crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-rtsp.o +BINS = hydra pw-inspector + +EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \ + hydra-mod.h hydra.h crc32.h d3des.h + +all: pw-inspector hydra $(XHYDRA_SUPPORT) + @echo + @echo Now type "make install" + +hydra: hydra.c $(OBJ) + $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) + @echo + @echo If men could get pregnant, abortion would be a sacrament + @echo + +xhydra: + -cd hydra-gtk && sh ./make_xhydra.sh + +pw-inspector: pw-inspector.c + -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c + +.c.o: + $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) + +strip: all + strip $(BINS) + -echo OK > /dev/null && test -x xhydra && strip xhydra || echo OK > /dev/null + +install: strip + -mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) + cp -f hydra-wizard.sh $(BINS) $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 hydra-wizard.sh $(BINS) + -echo OK > /dev/null && test -x xhydra && cp xhydra $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 xhydra || echo OK > /dev/null + -sed -e "s|^INSTALLDIR=.*|INSTALLDIR="$(PREFIX)"|" dpl4hydra.sh | sed -e "s|^LOCATION=.*|LOCATION="$(DATADIR)"|" > $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh + -chmod 755 $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh + -mkdir -p $(DESTDIR)$(PREFIX)$(DATADIR) + -cp -f *.csv $(DESTDIR)$(PREFIX)$(DATADIR) + -mkdir -p $(DESTDIR)$(PREFIX)$(MANDIR) + -cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR) clean: + rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile cp -f Makefile.orig Makefile + diff --git a/hydra-ssh.c b/hydra-ssh.c index be8a59e..353193a 100644 --- a/hydra-ssh.c +++ b/hydra-ssh.c @@ -48,7 +48,7 @@ int start_ssh(int s, char *ip, int port, unsigned char options, char *miscptr, F if (ssh_connect(session) != 0) { //if the connection was drop, exit and let hydra main handle it if (verbose) - hydra_report(stderr, "[ERROR] could not connect to target port %d\n", port); + hydra_report(stderr, "[ERROR] could not connect to target port %d: %s\n", port, ssh_get_error(session)); return 3; } @@ -175,7 +175,7 @@ int service_ssh_init(char *ip, int sp, unsigned char options, char *miscptr, FIL ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "none"); ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "none"); if (ssh_connect(session) != 0) { - fprintf(stderr, "[ERROR] could not connect to ssh://%s:%d\n", hydra_address2string(ip), port); + fprintf(stderr, "[ERROR] could not connect to ssh://%s:%d - %s\n", hydra_address2string(ip), port, ssh_get_error(session)); return 2; } rc = ssh_userauth_none(session, NULL); From 6c1db2a03895bb23e6d778f5c1de3896be25ca70 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 20 Jan 2016 16:21:36 +0100 Subject: [PATCH 6/8] makefile fix --- Makefile | 89 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 87 deletions(-) diff --git a/Makefile b/Makefile index 116088c..372e67e 100644 --- a/Makefile +++ b/Makefile @@ -1,90 +1,5 @@ -CC=gcc -STRIP=strip -XDEFINES= -DHAVE_MYSQL_MYSQL_H -DLIBOPENSSL -DLIBNCURSES -DLIBFIREBIRD -DLIBIDN -DHAVE_PR29_H -DHAVE_PCRE -DLIBMYSQLCLIENT -DLIBNCP -DLIBPOSTGRES -DLIBSVN -DLIBSSH -DHAVE_ZLIB -DHAVE_MATH_H -XLIBS= -lz -lcurses -lssl -lncp -lfbclient -lidn -lpcre -lmysqlclient -lpq -lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1 -lssh -lcrypto -XLIBPATHS=-L/usr/lib -L/usr/local/lib -L/lib -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/usr/lib -L/usr/lib/i386-linux-gnu -L/usr/lib -L/usr/lib/i386-linux-gnu -XIPATHS= -I/usr/include/mysql -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/postgresql -I/usr/include -I/usr/include/subversion-1 -I/usr/include/apr-1.0 -I/usr/include/subversion-1 -PREFIX=/usr/local -XHYDRA_SUPPORT=xhydra -STRIP=strip - -HYDRA_LOGO= -PWI_LOGO= -SEC=-pie -fPIE -fstack-protector-all --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro - -# -# Makefile for Hydra - (c) 2001-2014 by van Hauser / THC -# -OPTS=-I. -O3 -# -Wall -g -pedantic -LIBS=-lm -BINDIR = /bin -MANDIR ?= /man/man1 -DATADIR ?= /etc -DESTDIR ?= - -SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ - hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \ - hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \ - hydra-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \ - hydra-snmp.c hydra-cvs.c hydra-smtp.c hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c \ - hydra-sshkey.c hydra-teamspeak.c hydra-postgres.c hydra-rsh.c hydra-rlogin.c \ - hydra-oracle-listener.c hydra-svn.c hydra-pcanywhere.c hydra-sip.c \ - hydra-oracle.c hydra-vmauthd.c hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c \ - hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \ - hydra-rdp.c hydra-s7-300.c hydra-redis.c \ - crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c hydra-rtsp.c -OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \ - hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \ - hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \ - hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \ - hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o \ - hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o \ - hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o \ - hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o \ - hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o \ - hydra-rdp.o hydra-s7-300.c \ - crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-rtsp.o -BINS = hydra pw-inspector - -EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \ - hydra-mod.h hydra.h crc32.h d3des.h - -all: pw-inspector hydra $(XHYDRA_SUPPORT) - @echo - @echo Now type "make install" - -hydra: hydra.c $(OBJ) - $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) - @echo - @echo If men could get pregnant, abortion would be a sacrament - @echo - -xhydra: - -cd hydra-gtk && sh ./make_xhydra.sh - -pw-inspector: pw-inspector.c - -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c - -.c.o: - $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) - -strip: all - strip $(BINS) - -echo OK > /dev/null && test -x xhydra && strip xhydra || echo OK > /dev/null - -install: strip - -mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) - cp -f hydra-wizard.sh $(BINS) $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 hydra-wizard.sh $(BINS) - -echo OK > /dev/null && test -x xhydra && cp xhydra $(DESTDIR)$(PREFIX)$(BINDIR) && cd $(DESTDIR)$(PREFIX)$(BINDIR) && chmod 755 xhydra || echo OK > /dev/null - -sed -e "s|^INSTALLDIR=.*|INSTALLDIR="$(PREFIX)"|" dpl4hydra.sh | sed -e "s|^LOCATION=.*|LOCATION="$(DATADIR)"|" > $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh - -chmod 755 $(DESTDIR)$(PREFIX)$(BINDIR)/dpl4hydra.sh - -mkdir -p $(DESTDIR)$(PREFIX)$(DATADIR) - -cp -f *.csv $(DESTDIR)$(PREFIX)$(DATADIR) - -mkdir -p $(DESTDIR)$(PREFIX)$(MANDIR) - -cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR) +all: + @echo Error: you must run "./configure" first clean: - rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile cp -f Makefile.orig Makefile - From e693c2fe8f3591d0a52319fc5c03c083bd6384df Mon Sep 17 00:00:00 2001 From: van Hauser Date: Thu, 4 Feb 2016 10:44:47 +0100 Subject: [PATCH 7/8] ntlm long string fix attempt --- ntlm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntlm.c b/ntlm.c index 6d5ea9b..e98b859 100644 --- a/ntlm.c +++ b/ntlm.c @@ -1172,7 +1172,7 @@ static void dumpRaw(FILE * fp, unsigned char *buf, size_t len) { static char *unicodeToString(char *p, size_t len) { int i; - static char buf[1024]; + static char buf[4096]; assert(len + 1 < sizeof buf); @@ -1186,7 +1186,7 @@ static char *unicodeToString(char *p, size_t len) { } static unsigned char *strToUnicode(char *p) { - static unsigned char buf[1024]; + static unsigned char buf[4096]; size_t l = strlen(p); int i = 0; @@ -1201,7 +1201,7 @@ static unsigned char *strToUnicode(char *p) { } static unsigned char *toString(char *p, size_t len) { - static unsigned char buf[1024]; + static unsigned char buf[4096]; assert(len + 1 < sizeof buf); From 533fb1772dc6298b6196a6be93a746d9e15a6d59 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 5 Feb 2016 10:38:46 +0100 Subject: [PATCH 8/8] ./configure --fhs support --- CHANGES | 1 + Makefile.am | 2 +- configure | 25 ++++++++++++++++++++++--- hydra.c | 4 ++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 567201c..e74e7a5 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ Release 8.2-pre * Fixed an out of memory bug in http-form * Fixed imap PLAIN method * Added warning if HYDRA_PROXY_CONNECT environment is detected, that is an outdated setting +* Added --fhs switch to configure (for Linux distribution usage) * ... your patch? diff --git a/Makefile.am b/Makefile.am index a5c00be..f340e8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # -# Makefile for Hydra - (c) 2001-2014 by van Hauser / THC +# Makefile for Hydra - (c) 2001-2016 by van Hauser / THC # OPTS=-I. -O3 # -Wall -g -pedantic diff --git a/configure b/configure index fc1f417..2b72924 100755 --- a/configure +++ b/configure @@ -6,6 +6,7 @@ if [ "$1" = "-h" -o "$1" = "--help" ]; then echo Options: echo " --prefix=path path to install hydra and its datafiles to" + echo " --fhs install according to the File System Hierarchy Standard" echo " --with-oracle=prefix prefix for oracle include dir" echo " --with-oracle-lib=prefix prefix for oracle lib dir" echo " --with-ssl=prefix prefix for SSL headers" @@ -17,6 +18,7 @@ if [ "$1" = "-h" -o "$1" = "--help" ]; then exit 0 fi +FHS="" SIXFOUR="" DEBUG="" PREFIX="" @@ -72,6 +74,12 @@ if [ '!' "X" = "X$*" ]; then NOSTRIP="yes" fi fi + if [ "X" = "X$FHS" ]; then + FHS_TMP=`echo "$1"|sed 's/.*--fhs//'` + if [ -z "$FHS_TMP" ]; then + FHS="yes" + fi + fi if [ "X" = "X$DEBUG" ]; then DEBUG_TMP=`echo "$1"|sed 's/.*--debug//'` if [ -z "$DEBUG_TMP" ]; then @@ -1191,9 +1199,16 @@ else XHYDRA_SUPPORT="xhydra" fi -echo "Hydra will be installed into .../bin of: $PREFIX" -echo " (change this by running ./configure --prefix=path)" -echo +if [ "X" != "X$FHS" ]; then + PREFIX=/usr + echo "Hydra will be installed into .../bin of: $PREFIX" + echo " (according to the File System Hierarchy Standard)" + echo +else + echo "Hydra will be installed into .../bin of: $PREFIX" + echo " (change this by running ./configure --prefix=path)" + echo +fi if [ "X" != "X$DEBUG" ]; then echo DEBUG: XDEFINES=$XDEFINES $MATH @@ -1206,6 +1221,10 @@ if [ "X" != "X$DEBUG" ]; then fi echo "Writing Makefile.in ..." +if [ "X" != "X$FHS" ]; then + echo "MANDIR = /share/man/man1" >> Makefile.in + echo "DATADIR = /share/hydra" >> Makefile.in +fi echo "XDEFINES=$XDEFINES $MATH" >> Makefile.in echo "XLIBS=$XLIBS" >> Makefile.in echo "XLIBPATHS=$XLIBPATHS" >> Makefile.in diff --git a/hydra.c b/hydra.c index acfb2cd..d39f683 100644 --- a/hydra.c +++ b/hydra.c @@ -1,5 +1,5 @@ /* - * hydra (c) 2001-2014 by van Hauser / THC + * hydra (c) 2001-2016 by van Hauser / THC * http://www.thc.org * * Parallized network login hacker. @@ -2173,7 +2173,7 @@ int main(int argc, char *argv[]) { struct sockaddr_in6 *ipv6 = NULL; struct sockaddr_in *ipv4 = NULL; - printf("%s %s (c) 2014 by %s - Please do not use in military or secret service organizations, or for illegal purposes.\n\n", PROGRAM, VERSION, AUTHOR); + printf("%s %s (c) 2016 by %s - Please do not use in military or secret service organizations, or for illegal purposes.\n\n", PROGRAM, VERSION, AUTHOR); #ifndef LIBPOSTGRES SERVICES = hydra_string_replace(SERVICES, "postgres ", ""); strcat(unsupported, "postgres ");