-w support for ssh module

This commit is contained in:
van Hauser 2018-01-31 14:07:03 +01:00
parent 9597bafb17
commit dcd04ac6d9
4 changed files with 53 additions and 50 deletions

View file

@ -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

View file

@ -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) {

50
hydra.c
View file

@ -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;

50
hydra.h
View file

@ -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