diff options
author | Peter Volkov <pva@gentoo.org> | 2009-12-18 10:51:30 +0000 |
---|---|---|
committer | Peter Volkov <pva@gentoo.org> | 2009-12-18 10:51:30 +0000 |
commit | 26f536cbf56f4b6e618509dd195f6406a8df47d8 (patch) | |
tree | a9c15eb397f824c4c172736ba3f36dd4a856f682 /net-analyzer/hydra | |
parent | Bug #297255 - When converting $mycmakeargs to an array inside (diff) | |
download | historical-26f536cbf56f4b6e618509dd195f6406a8df47d8.tar.gz historical-26f536cbf56f4b6e618509dd195f6406a8df47d8.tar.bz2 historical-26f536cbf56f4b6e618509dd195f6406a8df47d8.zip |
Fixed compatibility issue with libssh-0.4, bug #296816, thank Willard Dawson for report and Jonathan-Christofer Demay for ideas.
Package-Manager: portage-2.1.7.15/cvs/Linux x86_64
Diffstat (limited to 'net-analyzer/hydra')
-rw-r--r-- | net-analyzer/hydra/ChangeLog | 9 | ||||
-rw-r--r-- | net-analyzer/hydra/Manifest | 6 | ||||
-rw-r--r-- | net-analyzer/hydra/files/hydra-5.4-libssh-0.4.0.patch | 254 | ||||
-rw-r--r-- | net-analyzer/hydra/hydra-5.4-r2.ebuild | 3 | ||||
-rw-r--r-- | net-analyzer/hydra/hydra-5.4-r3.ebuild | 72 |
5 files changed, 340 insertions, 4 deletions
diff --git a/net-analyzer/hydra/ChangeLog b/net-analyzer/hydra/ChangeLog index c736e5d1d849..68bbae6556a6 100644 --- a/net-analyzer/hydra/ChangeLog +++ b/net-analyzer/hydra/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-analyzer/hydra # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/hydra/ChangeLog,v 1.33 2009/12/17 12:52:12 scarabeus Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/hydra/ChangeLog,v 1.34 2009/12/18 10:51:29 pva Exp $ + +*hydra-5.4-r3 (18 Dec 2009) + + 18 Dec 2009; Peter Volkov <pva@gentoo.org> hydra-5.4-r2.ebuild, + +hydra-5.4-r3.ebuild, +files/hydra-5.4-libssh-0.4.0.patch: + Fixed compatibility issue with libssh-0.4, bug #296816, thank Willard + Dawson for report and Jonathan-Christofer Demay for ideas. 17 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org> hydra-5.4-r2.ebuild: Stable amd64. It was not CCed on stablebug. diff --git a/net-analyzer/hydra/Manifest b/net-analyzer/hydra/Manifest index c00a162c7fac..30e10597cd60 100644 --- a/net-analyzer/hydra/Manifest +++ b/net-analyzer/hydra/Manifest @@ -1,7 +1,9 @@ AUX hydra-5.4-_FORTIFY_SOURCE.patch 562 RMD160 76ffa0d0c22c653600b6a6ec3066b0c1d85dc641 SHA1 7842f1d8c59e9eb556eaec070e1cf880cf9e2a82 SHA256 e0b45b7c69cf6d39feb98270efbba6a25c73c91036ae4f22b50566e355a7f99d AUX hydra-5.4-free-without-malloc.patch 436 RMD160 d733fd1b55395a882418aa835b67aff49d29591d SHA1 cda80e164a344bb3c0b4dc20a2bf2f4700c443db SHA256 ac64cac7e7334da4ed8ee10f88a7303460bc4c1f7cbb5b5a81f01e6c8938d0b4 AUX hydra-5.4-libssh-0.2.patch 8168 RMD160 649a2c3bb5c80a1be5e3587a994b1e10a93f4f62 SHA1 f641be2c1b13cc9a86ef5d8b34aae1ceee26e1fb SHA256 686834b8c3ee67d14de8741887c4a3fbed3fcce4499c32bd42ae721b31f24234 +AUX hydra-5.4-libssh-0.4.0.patch 8760 RMD160 20bb8dd5b584945fd0b02b01cb6c1e1c8a5828f6 SHA1 f23c93de03f6a8edd60dd7b0362747cd456e3723 SHA256 fb04b18191e3cb73f05d0af95d063cc0539b7c0642d5665bd2fc77f10b833331 DIST hydra-5.4-src.tar.gz 208272 RMD160 e3b4b98250394945dc5a8bfe234302de793db014 SHA1 2134092c7b64132c080b6b1ba155124b885767db SHA256 cd2e7e5ea479d50982b08334b1f4477a6620e6b45bc79ab55ddd07b128c64611 -EBUILD hydra-5.4-r2.ebuild 1587 RMD160 c7d7f3faddb4e506724eadccf39433703ff29a7e SHA1 d9310be1804559eec59e5fdc4c95e4a78a6bab61 SHA256 3af5a1713adb600fe202bc8e19192f09a2856f82b70d84aa433afe6306feb482 -MISC ChangeLog 4581 RMD160 548dd8c8ea81149da8632a74f1c43d0fd819531b SHA1 61876a0aa62ca16f1e0280dbef6f798428571858 SHA256 8702aa0b1afc9308aeca997e41e8ea963d142e55ed9747b37db55a97e3490f7b +EBUILD hydra-5.4-r2.ebuild 1606 RMD160 50ef3e230e9c25d61b495c3100f52f4696f0608a SHA1 1d522cb5de9f7181134a0aff6aa9aca910229e89 SHA256 0a6d100d7910b20722670707377cc1c49bade7c24d13cb695424ab8a8e61cad5 +EBUILD hydra-5.4-r3.ebuild 1591 RMD160 8b9f114a0006fafeb8d26aa735c13bf51304ebbb SHA1 72264f9de21ae8a5c64e2e336f1902cd7f7099c0 SHA256 bf8af34b4dab597a45961abaec946efa2b2103cba510562dd6a39142a6a7e3be +MISC ChangeLog 4865 RMD160 96b94100ec1e73d2573b78b46223c8729f8f02ef SHA1 bebcde26e2b691e4051ecb85800c390529f7661b SHA256 2975f6c930f3e6bfa2a1749f626112045080aa28f18d1c160b0bbcc7addf6925 MISC metadata.xml 227 RMD160 2a8754b01b0efe35e1f147451db54318da704ec1 SHA1 905f8d225c7defc78c835ebf7f44a83bed62fce3 SHA256 549534fb196ce43008704171f81429d1df086465e990f62d1685b69a7583d27c diff --git a/net-analyzer/hydra/files/hydra-5.4-libssh-0.4.0.patch b/net-analyzer/hydra/files/hydra-5.4-libssh-0.4.0.patch new file mode 100644 index 000000000000..a283fe6ee8a2 --- /dev/null +++ b/net-analyzer/hydra/files/hydra-5.4-libssh-0.4.0.patch @@ -0,0 +1,254 @@ +http://bugs.gentoo.org/show_bug.cgi?id=296816 + +Author: Peter Volkov <pva@gentoo.org> with some ideas from Jonathan-Christofer Demay. + +=== modified file 'configure' +--- configure 2009-12-15 08:46:59 +0000 ++++ configure 2009-12-17 08:26:59 +0000 +@@ -243,11 +243,11 @@ + + if [ -n "$SSH_PATH" ]; then + echo " ... found" +- echo 'NOTE: ensure that you have libssh v0.11 installed!! Get it from http://0xbadc0de.be !' ++ echo 'NOTE: ensure that you have libssh v0.4 or later installed!! Get it from http://www.libssh.org !' + fi + if [ "X" = "X$SSH_PATH" ]; then + echo " ... NOT found, module ssh2 disabled" +- echo 'Get it from http://0xbadc0de.be/ - use v0.11!' ++ echo 'Get it from http://www.libssh.org/ - use v0.4!' + fi + if [ "$SSH_IPATH" = "/usr/include" ]; then + SSH_IPATH="" + +=== modified file 'hydra-ssh2.c' +--- hydra-ssh2.c 2009-12-15 08:46:59 +0000 ++++ hydra-ssh2.c 2009-12-18 10:21:52 +0000 +@@ -7,31 +7,70 @@ + } + #else + +-#warning "If compilation of hydra-ssh2 fails, you are not using v0.11. Download from http://www.0xbadc0de.be/" +- + #include <libssh/libssh.h> + + extern char *HYDRA_EXIT; + ++/* try to authenticate with one password */ ++static int ++try_password(ssh_session ssh_session, const char *login, const char *password){ ++ int auth_state; ++ int i, j, n; ++ int methods; ++ ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] try_password(): trying login = \"%s\", pass \"%s\"\n", login, password); ++#endif ++ ++ methods = ssh_auth_list(ssh_session); ++ if (methods & SSH_AUTH_METHOD_INTERACTIVE) { ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] try_password(): trying keyboard interactive method\n"); ++#endif ++ auth_state = ssh_userauth_kbdint(ssh_session, login, NULL); ++ /* For safety we'll limit number of prompts to 33 */ ++ for(j=0; auth_state == SSH_AUTH_INFO && j<33; j++) { ++ n=ssh_userauth_kbdint_getnprompts(ssh_session); ++ for(i=0; i<n; ++i) { ++ ssh_userauth_kbdint_setanswer(ssh_session, i, password); ++ } ++ auth_state = ssh_userauth_kbdint(ssh_session, login, NULL); ++ } ++ /* Password is valid but an other authentication token is needed */ ++ if(auth_state == SSH_AUTH_PARTIAL ++ || auth_state == SSH_AUTH_SUCCESS) ++ return SSH_AUTH_SUCCESS; ++ } ++ ++ if (methods & SSH_AUTH_METHOD_PASSWORD) { ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] try_password(): trying password method\n"); ++#endif ++ auth_state = ssh_userauth_password(ssh_session, login, password); ++ if(auth_state == SSH_AUTH_PARTIAL ++ || auth_state == SSH_AUTH_SUCCESS) ++ return SSH_AUTH_SUCCESS; ++ } ++ return auth_state; ++} ++ ++ + int +-start_ssh2(int s, unsigned long int ip, int port, unsigned char options, char *miscptr, FILE * fp) ++start_ssh2(int s, unsigned long int ip, int port, unsigned char options, char *miscptr, FILE * fp, char *libssh_error) + { + char *empty = ""; +- char *login, *pass; ++ char *login, *pass, prev_login[260]; + char *buf; +- char *rc; + struct sockaddr_in targetip; +- SSH_SESSION *ssh_session; +- SSH_OPTIONS *ssh_opt; ++ ssh_session ssh_session = ssh_new(); + int auth_state; +- int i = 0; + + if (strlen(login = hydra_get_next_login()) == 0) + login = empty; ++ strcpy(prev_login, login); + if (strlen(pass = hydra_get_next_password()) == 0) + pass = empty; + +- ssh_opt=options_new(); + memset(&targetip, 0, sizeof(targetip)); + memcpy(&targetip.sin_addr.s_addr, &ip, 4); + targetip.sin_family = AF_INET; +@@ -41,62 +80,79 @@ + buf = malloc(20); + inet_ntop(AF_INET, &targetip.sin_addr, buf, 20); + #endif +- options_set_wanted_method(ssh_opt,KEX_COMP_C_S,"none"); +- options_set_wanted_method(ssh_opt,KEX_COMP_S_C,"none"); +- options_set_port(ssh_opt, port); +- options_set_host(ssh_opt, buf); +- options_set_username(ssh_opt, login); +- +- if ((ssh_session = ssh_connect(ssh_opt)) == NULL) { +- rc = ssh_get_error(ssh_session); +- if ((rc != NULL) && (rc[0] != '\0')) { +- if (strncmp("connect:", ssh_get_error(ssh_session), strlen("connect:")) == 0) +- return 3; +- else +- return 4; +- } ++ ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] ssh_options_set host=%s:%d, login=%s.\n", buf, port, login); ++#endif ++ ssh_options_set(ssh_session, SSH_OPTIONS_HOST, buf); ++ ssh_options_set(ssh_session, SSH_OPTIONS_PORT, &port); ++ ssh_options_set(ssh_session, SSH_OPTIONS_USER, login); ++ ssh_options_set(ssh_session, SSH_OPTIONS_COMPRESSION_C_S, "none"); ++ ssh_options_set(ssh_session, SSH_OPTIONS_COMPRESSION_S_C, "none"); ++ ++ if ( ssh_connect(ssh_session) != SSH_OK ) { ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] ssh_connect(ssh_session) != SSH_OK\n"); ++#endif ++ strcpy(libssh_error,ssh_get_error(ssh_session)); ++ ssh_disconnect(ssh_session); ++ return 3; + } + #ifndef CYGWIN + free(buf); + buf = NULL; + #endif + ++ /* Try 'none' method for passwordless servers */ ++ auth_state = ssh_userauth_none(ssh_session, login); ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] ssh_userauth_none (0) state = %d\n", auth_state); ++#endif + do { +- /* why this crap? */ +- auth_state = ssh_userauth_kbdint(ssh_session, login, NULL); +- while (i < 10 && auth_state == SSH_AUTH_INFO) { +- ssh_userauth_kbdint_setanswer(ssh_session, i, pass); +- auth_state = ssh_userauth_kbdint(ssh_session, login, NULL); +- i++; +- } +- +- if (auth_state == SSH_AUTH_SUCCESS || ssh_userauth_password(ssh_session, login, pass) == SSH_AUTH_SUCCESS) { +- ssh_disconnect(ssh_session); /* this automagically frees the ssh_opt buffer */ ++ if (auth_state != SSH_AUTH_SUCCESS) ++ auth_state = try_password(ssh_session, login, pass); ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] try_password returned auth_state = %d\n", auth_state); ++#endif ++ if (auth_state == SSH_AUTH_SUCCESS) { ++ ssh_disconnect(ssh_session); + hydra_report_found_host(port, ip, "ssh2", fp); + hydra_completed_pair_found(); + if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) + return 2; +- /* free(ssh_opt); */ /* DOUBLE FREE ! */ + return 1; ++ } ++ if (auth_state == SSH_AUTH_DENIED) { ++ hydra_completed_pair(); ++ if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) { ++ ssh_disconnect(ssh_session); ++ return 2; ++ } ++ if (strlen(login = hydra_get_next_login()) == 0) ++ login = empty; ++ ++ if(strcmp(login,prev_login) != 0) { ++ ssh_disconnect(ssh_session); ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] new login (%s): we have to restart ssh sessionte\n", login); ++#endif ++ return 1; ++ } ++ if (strlen(pass = hydra_get_next_password()) == 0) ++ pass = empty; + } else { +- if (ssh_error_code(ssh_session) == 1) { +- hydra_completed_pair(); +- if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) +- return 2; +- } else { +- ssh_disconnect(ssh_session); /* this automagically frees the ssh_opt buffer */ +- hydra_completed_pair(); /* really? */ +- if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) +- return 2; +- /* free(ssh_opt); */ /* DOUBLE FREE ! */ +- return 1; +- } ++#ifdef DEBUG_SSH2 ++ printf("[DEBUG] ssh session problem (%d)\n", auth_state); ++#endif ++ hydra_completed_pair(); /* really? */ ++ ssh_disconnect(ssh_session); ++ if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) ++ return 2; ++ return 1; + } + } while(1); + + /* not reached */ +- +- /* free(ssh_opt); */ /* risk of double free */ + return 1; + } + +@@ -104,6 +160,7 @@ + service_ssh2(unsigned long int ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port) + { + int run = 1, next_run = 1, sock = -1; ++ char libssh_error[1024]; /* check ERROR_BUFFERLEN in libssh */ + + hydra_register_socket(sp); + if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) +@@ -111,16 +168,15 @@ + while (1) { + switch (run) { + case 1: /* connect and service init function */ +- next_run = start_ssh2(sock, ip, port, options, miscptr, fp); ++ next_run = start_ssh2(sock, ip, port, options, miscptr, fp, libssh_error); + break; + case 2: + hydra_child_exit(0); ++ break; + case 3: /* clean exit */ +- fprintf(stderr, "Error: could not connect to target port %d\n", port); ++ fprintf(stderr, "ssh_connect failed: %s\n", libssh_error); + hydra_child_exit(1); +- case 4: +- fprintf(stderr, "Error: ssh2 protocol error\n"); +- hydra_child_exit(2); ++ break; + default: + hydra_report(stderr, "Caught unknown return code, exiting!\n"); + hydra_child_exit(-1); + diff --git a/net-analyzer/hydra/hydra-5.4-r2.ebuild b/net-analyzer/hydra/hydra-5.4-r2.ebuild index f4355101b0f6..cb673851d0bb 100644 --- a/net-analyzer/hydra/hydra-5.4-r2.ebuild +++ b/net-analyzer/hydra/hydra-5.4-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/hydra/hydra-5.4-r2.ebuild,v 1.4 2009/12/17 12:52:12 scarabeus Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/hydra/hydra-5.4-r2.ebuild,v 1.5 2009/12/18 10:51:29 pva Exp $ inherit eutils @@ -17,6 +17,7 @@ DEPEND="gtk? ( >=x11-libs/gtk+-1.2 ) ssl? ( dev-libs/openssl >=net-libs/libssh-0.2 + <net-libs/libssh-0.4.0 )" S=${WORKDIR}/${P}-src diff --git a/net-analyzer/hydra/hydra-5.4-r3.ebuild b/net-analyzer/hydra/hydra-5.4-r3.ebuild new file mode 100644 index 000000000000..81e03ec0c9e7 --- /dev/null +++ b/net-analyzer/hydra/hydra-5.4-r3.ebuild @@ -0,0 +1,72 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/hydra/hydra-5.4-r3.ebuild,v 1.1 2009/12/18 10:51:29 pva Exp $ + +EAPI="2" +inherit eutils + +DESCRIPTION="Advanced parallized login hacker" +HOMEPAGE="http://www.thc.org/thc-hydra/" +SRC_URI="http://www.thc.org/releases/${P}-src.tar.gz" + +LICENSE="HYDRA GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="gtk ssl" + +DEPEND="gtk? ( >=x11-libs/gtk+-1.2 ) + ssl? ( + dev-libs/openssl + >=net-libs/libssh-0.4.0 + )" + +S=${WORKDIR}/${P}-src + +src_prepare() { + sed -i "s:-O2:${CFLAGS}:" Makefile.am || die "sed failed" + epatch "${FILESDIR}/${P}-_FORTIFY_SOURCE.patch" + epatch "${FILESDIR}/${P}-free-without-malloc.patch" + epatch "${FILESDIR}/${P}-libssh-0.4.0.patch" +} + +src_configure() { + ./configure \ + --prefix=/usr \ + $(use gtk && echo --disable-xhydra) \ + || die "configure failed" + + sed -i \ + -e '/^XDEFINES=/s:=.*:=:' \ + -e '/^XLIBS=/s:=.*:=:' \ + -e '/^XLIBPATHS/s:=.*:=:' \ + -e '/^XIPATHS=/s:=.*:=:' \ + Makefile || die "pruning vars" + + if use ssl ; then + sed -i \ + -e '/^XDEFINES=/s:=:=-DLIBOPENSSL -DLIBSSH:' \ + -e '/^XLIBS=/s:=:=-lcrypto -lssl -lssh:' \ + Makefile || die "adding ssl" + fi + + if use gtk ; then + cd hydra-gtk && \ + econf + fi +} + +src_compile() { + emake || die "make failed" + if use gtk ; then + cd hydra-gtk && \ + emake || die "emake hydra-gtk failed" + fi +} + +src_install() { + dobin hydra pw-inspector || die "dobin failed" + if use gtk ; then + dobin hydra-gtk/src/xhydra || die "gtk" + fi + dodoc CHANGES README TODO +} |