From 6130169d83b07a8945537a6c43cdd4a63d480958 Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Tue, 19 Nov 2019 10:16:01 +0800 Subject: [PATCH] .temp. --- server/tp_core/testssh/testssh.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/tp_core/testssh/testssh.cpp b/server/tp_core/testssh/testssh.cpp index 4d8c8a4..231bed4 100644 --- a/server/tp_core/testssh/testssh.cpp +++ b/server/tp_core/testssh/testssh.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) ssh_options_set(sess, SSH_OPTIONS_USER, username); - int _timeout = 60; // 60 sec. + int _timeout = 120; // 60 sec. ssh_options_set(sess, SSH_OPTIONS_TIMEOUT, &_timeout); // connect to real SSH host. @@ -52,7 +52,7 @@ int main(int argc, char** argv) return -1; } - _timeout = 10; // 60 sec. + _timeout = 120; // 60 sec. ssh_options_set(sess, SSH_OPTIONS_TIMEOUT, &_timeout); // get version of SSH server. @@ -70,6 +70,12 @@ int main(int argc, char** argv) int auth_methods = ssh_userauth_list(sess, username); printf("[INFO] supported auth-type: 0x%08x\n", auth_methods); + if(auth_methods == SSH_AUTH_METHOD_UNKNOWN) { +// auth_methods = SSH_AUTH_METHOD_PASSWORD|SSH_AUTH_METHOD_INTERACTIVE; +// printf("[WRN] unknown auth-type, try PASSWORD and INTERACTIVE\n"); + auth_methods = SSH_AUTH_METHOD_PASSWORD; + printf("[WRN] unknown auth-type, try PASSWORD mode.\n"); + } // get banner. const char* banner = ssh_get_issue_banner(sess); @@ -155,6 +161,9 @@ int main(int argc, char** argv) if (!ok) { printf("[ERROR] can not use password mode or interactive mode to login to SSH server.\n"); } + else { + printf("[INFO] login success.\n"); + } ssh_disconnect(sess); ssh_free(sess);