From e0759aba690ab8e495d64a34965dbe610700d1a7 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 18 Mar 2015 16:45:33 +0100 Subject: [PATCH] reverted openssl des_ => DES_ renamin patch as this does not compile and fixed the cisco-enable module --- CHANGES | 2 +- hydra-oracle-listener.c | 10 +++++----- hydra-smb.c | 10 +++++----- hydra-snmp.c | 4 ++-- hydra.c | 10 ++++------ 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index c86bf2f..29b5d7f 100644 --- a/CHANGES +++ b/CHANGES @@ -2,12 +2,12 @@ Changelog for hydra ------------------- Release 8.2-pre -* Replaced deprecated des_ and fix LibreSSL build, thanks to Bernard Spil for the patch * Added xhydra gtk patche by Petar Kaleychev to support modules that do not use usernames * Better library finding in ./configure for SVN + support for Darwin Homebrew * Fixed http-form module crash that only occurs on *BSD/OSX systems. Thanks to zdk for reporting! * Fixed for SSL connection to support TLSv1.2 etc. * Support for different RSA keylengths, thanks to fann95 for the patch +* Fixed a bug where the cisco-enable module was not working with the password-only logon mode * ... your patch? diff --git a/hydra-oracle-listener.c b/hydra-oracle-listener.c index 6636705..242bd61 100644 --- a/hydra-oracle-listener.c +++ b/hydra-oracle-listener.c @@ -106,7 +106,7 @@ int convert_byteorder(unsigned char **result, int size) { int ora_descrypt(unsigned char **rs, unsigned char *result, int siz) { int i = 0; char lastkey[8]; - DES_key_schedule ks1; + des_key_schedule ks1; unsigned char key1[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; unsigned char ivec1[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char *desresult; @@ -116,17 +116,17 @@ int ora_descrypt(unsigned char **rs, unsigned char *result, int siz) { hydra_report(stderr, "[ERROR] Can't allocate memory\n"); return 1; } - DES_key_sched((DES_cblock *) key1, ks1); - DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT); + des_key_sched((C_Block *) key1, ks1); + des_ncbc_encrypt(result, desresult, siz, ks1, &ivec1, DES_ENCRYPT); for (i = 0; i < 8; i++) { lastkey[i] = desresult[siz - 8 + i]; } - DES_key_sched((DES_cblock *) lastkey, ks1); + des_key_sched((C_Block *) lastkey, ks1); memset(desresult, 0, siz); memset(ivec1, 0, sizeof(ivec1)); - DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT); + des_ncbc_encrypt(result, desresult, siz, ks1, &ivec1, DES_ENCRYPT); if ((*rs = malloc(siz)) == NULL) { hydra_report(stderr, "[ERROR] Can't allocate memory\n"); diff --git a/hydra-smb.c b/hydra-smb.c index 2d9ee7f..0d6fb2e 100644 --- a/hydra-smb.c +++ b/hydra-smb.c @@ -176,17 +176,17 @@ static void MakeKey(unsigned char *key, unsigned char *des_key) { des_key[6] = Get7Bits(key, 42); des_key[7] = Get7Bits(key, 49); - DES_set_odd_parity((DES_cblock *) des_key); + des_set_odd_parity((des_cblock *) des_key); } /* Do the DesEncryption */ void DesEncrypt(unsigned char *clear, unsigned char *key, unsigned char *cipher) { - DES_cblock des_key; - DES_key_schedule key_schedule; + des_cblock des_key; + des_key_schedule key_schedule; MakeKey(key, des_key); - DES_set_key(&des_key, &key_schedule); - DES_ecb_encrypt((DES_cblock *) clear, (DES_cblock *) cipher, &key_schedule, 1); + des_set_key(&des_key, key_schedule); + des_ecb_encrypt((des_cblock *) clear, (des_cblock *) cipher, key_schedule, 1); } /* diff --git a/hydra-snmp.c b/hydra-snmp.c index 21ada7f..5649bb7 100644 --- a/hydra-snmp.c +++ b/hydra-snmp.c @@ -335,8 +335,8 @@ int start_snmp(int s, char *ip, int port, unsigned char options, char *miscptr, // xor initVect with salt for (i = 0; i < 8; i++) initVect[i] ^= privacy_params[i]; - DES_key_sched((DES_cblock *) key, &symcbc); - DES_ncbc_encrypt(snmpv3_get2 + 2, buf, sizeof(snmpv3_get2) - 2, &symcbc, (DES_cblock *) (initVect), DES_ENCRYPT); + des_key_sched((C_Block *) key, symcbc); + des_ncbc_encrypt(snmpv3_get2 + 2, buf, sizeof(snmpv3_get2) - 2, symcbc, (C_Block *) (initVect), DES_ENCRYPT); #endif diff --git a/hydra.c b/hydra.c index 33dfa8e..629b319 100644 --- a/hydra.c +++ b/hydra.c @@ -2799,14 +2799,12 @@ int main(int argc, char *argv[]) { i = 2; } if (strcmp(hydra_options.service, "cisco-enable") == 0) { - i = 2; - if (hydra_options.login == NULL) { - //hydra_options.login = empty_login; + if (hydra_options.login != NULL || hydra_options.loginfile != NULL) i = 1; // login will be the initial Username: login, or line Password: - } - if (hydra_options.miscptr == NULL) { + else + i = 2; + if (hydra_options.miscptr == NULL) fprintf(stderr, "[WARNING] You did not supply the initial support to the Cisco via -l, assuming direct console access\n"); - } if (hydra_options.tasks > 4) fprintf(stderr, "[WARNING] you should set the number of parallel task to 4 for cisco enable services.\n"); }