From 0b1f3c5037b042f19bc5a74b4d6c72df3c96b2de Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Tue, 29 Jun 2021 12:04:36 +0200 Subject: [PATCH] fix ssh for -M and ip/range --- CHANGES | 3 +++ hydra-ssh.c | 6 ++++-- hydra-sshkey.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index e895e03..b481211 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Changelog for hydra ------------------- +Release 9.3-dev +* fix for ssh to support -M or ip/range + Release 9.2 * fix for http-post-form optional parameters diff --git a/hydra-ssh.c b/hydra-ssh.c index ef4a691..eb021ce 100644 --- a/hydra-ssh.c +++ b/hydra-ssh.c @@ -34,11 +34,12 @@ int32_t start_ssh(int32_t s, char *ip, int32_t port, unsigned char options, char if (new_session) { if (session) { ssh_disconnect(session); - ssh_finalize(); + //ssh_finalize(); ssh_free(session); + } else { + ssh_init(); } - ssh_init(); session = ssh_new(); ssh_options_set(session, SSH_OPTIONS_PORT, &port); ssh_options_set(session, SSH_OPTIONS_HOST, hydra_address2string(ip)); @@ -173,6 +174,7 @@ int32_t service_ssh_init(char *ip, int32_t sp, unsigned char options, char *misc // 3 skip target because its unreachable #ifdef LIBSSH int32_t rc, method; + ssh_init(); ssh_session session = ssh_new(); if (verbose || debug) diff --git a/hydra-sshkey.c b/hydra-sshkey.c index 113d6de..092d655 100644 --- a/hydra-sshkey.c +++ b/hydra-sshkey.c @@ -33,8 +33,9 @@ int32_t start_sshkey(int32_t s, char *ip, int32_t port, unsigned char options, c if (new_session) { if (session) { ssh_disconnect(session); - ssh_finalize(); ssh_free(session); + } else { + ssh_init(); } session = ssh_new();