From dcd04ac6d94afab7fa8e9e7b935361683f8f1c50 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 31 Jan 2018 14:07:03 +0100 Subject: [PATCH] -w support for ssh module --- CHANGES | 1 + hydra-ssh.c | 2 ++ hydra.c | 50 -------------------------------------------------- hydra.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 50 deletions(-) diff --git a/CHANGES b/CHANGES index 337590a..e49e9bf 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Changelog for hydra Release 8.7-dev +* added -w timeout support to ssh module * fixed various memory leaks in http-form module * corrected hydra return code to be 0 on success * added patch from debian maintainers which fixes spellings diff --git a/hydra-ssh.c b/hydra-ssh.c index e1497a1..3bb4e49 100644 --- a/hydra-ssh.c +++ b/hydra-ssh.c @@ -19,6 +19,7 @@ void dummy_ssh() { ssh_session session = NULL; +extern hydra_option hydra_options; extern char *HYDRA_EXIT; int32_t new_session = 1; @@ -43,6 +44,7 @@ int32_t start_ssh(int32_t s, char *ip, int32_t port, unsigned char options, char ssh_options_set(session, SSH_OPTIONS_PORT, &port); ssh_options_set(session, SSH_OPTIONS_HOST, hydra_address2string(ip)); ssh_options_set(session, SSH_OPTIONS_USER, login); + ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &hydra_options.waittime); 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) { diff --git a/hydra.c b/hydra.c index 4f12335..ae4837f 100644 --- a/hydra.c +++ b/hydra.c @@ -238,23 +238,6 @@ typedef enum { TARGET_UNRESOLVED = 3 } target_state_t; -typedef enum { - MODE_PASSWORD_LIST = 1, - MODE_LOGIN_LIST = 2, - MODE_PASSWORD_BRUTE = 4, - MODE_PASSWORD_REVERSE = 8, - MODE_PASSWORD_NULL = 16, - MODE_PASSWORD_SAME = 32, - MODE_COLON_FILE = 64 -} hydra_mode_t; - -typedef enum { - FORMAT_PLAIN_TEXT, - FORMAT_JSONV1, - FORMAT_JSONV2, - FORMAT_XMLV1 -} output_format_t; - // some structure definitions typedef struct { pid_t pid; @@ -308,39 +291,6 @@ typedef struct { FILE *ofp; } hydra_brain; -typedef struct { - hydra_mode_t mode; - int32_t loop_mode; // valid modes: 0 = password, 1 = user - int32_t ssl; - int32_t restore; - int32_t debug; // is external - for restore - int32_t verbose; // is external - for restore - int32_t showAttempt; - int32_t tasks; - int32_t try_null_password; - int32_t try_password_same_as_login; - int32_t try_password_reverse_login; - int32_t exit_found; - int32_t max_use; - int32_t cidr; - int32_t time_next_attempt; - output_format_t outfile_format; - char *login; - char *loginfile; - char *pass; - char *passfile; - char *outfile_ptr; - char *infile_ptr; - char *colonfile; - int32_t waittime; // is external - for restore - int32_t conwait; // is external - for restore - uint32_t port; // is external - for restore - char *miscptr; - char *server; - char *service; - char bfg; -} hydra_option; - typedef struct { char *name; int32_t port; diff --git a/hydra.h b/hydra.h index 74a33fa..d1fcc60 100755 --- a/hydra.h +++ b/hydra.h @@ -162,5 +162,55 @@ int32_t usleepn(uint32_t useconds); #endif +typedef enum { + MODE_PASSWORD_LIST = 1, + MODE_LOGIN_LIST = 2, + MODE_PASSWORD_BRUTE = 4, + MODE_PASSWORD_REVERSE = 8, + MODE_PASSWORD_NULL = 16, + MODE_PASSWORD_SAME = 32, + MODE_COLON_FILE = 64 +} hydra_mode_t; + +typedef enum { + FORMAT_PLAIN_TEXT, + FORMAT_JSONV1, + FORMAT_JSONV2, + FORMAT_XMLV1 +} output_format_t; + +typedef struct { + hydra_mode_t mode; + int32_t loop_mode; // valid modes: 0 = password, 1 = user + int32_t ssl; + int32_t restore; + int32_t debug; // is external - for restore + int32_t verbose; // is external - for restore + int32_t showAttempt; + int32_t tasks; + int32_t try_null_password; + int32_t try_password_same_as_login; + int32_t try_password_reverse_login; + int32_t exit_found; + int32_t max_use; + int32_t cidr; + int32_t time_next_attempt; + output_format_t outfile_format; + char *login; + char *loginfile; + char *pass; + char *passfile; + char *outfile_ptr; + char *infile_ptr; + char *colonfile; + int32_t waittime; // is external - for restore + int32_t conwait; // is external - for restore + uint32_t port; // is external - for restore + char *miscptr; + char *server; + char *service; + char bfg; +} hydra_option; + #define _HYDRA_H #endif