From 92da225dc4d7bcccb145e6d04ac9b8679f501270 Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Thu, 4 Jul 2019 16:40:31 +0800 Subject: [PATCH] add a testssh tool. --- .idea/encodings.xml | 4 ++++ CMakeLists.txt | 2 +- server/tp_core/testssh/stdafx.cpp | 9 +++++++++ server/tp_core/testssh/testssh.cpp | 19 ++++++------------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 7d25301..a363e60 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -30,8 +30,12 @@ + + + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b9daf5..47ae499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ endif() add_subdirectory(server/tp_core/core) add_subdirectory(server/tp_core/protocol/ssh) add_subdirectory(server/tp_core/protocol/telnet) -#add_subdirectory(server/testssh/testssh) +add_subdirectory(server/tp_core/testssh) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/server/tp_core/protocol/rdp") add_subdirectory(server/tp_core/protocol/rdp) diff --git a/server/tp_core/testssh/stdafx.cpp b/server/tp_core/testssh/stdafx.cpp index ed1318f..846b803 100644 --- a/server/tp_core/testssh/stdafx.cpp +++ b/server/tp_core/testssh/stdafx.cpp @@ -6,3 +6,12 @@ // TODO: reference any additional headers you need in STDAFX.H // and not in this file + +#ifdef _DEBUG +# pragma comment(lib, "debug/ssh.lib") +#else +# pragma comment(lib, "release/ssh.lib") +#endif +#pragma comment(lib, "libeay32.lib") +#pragma comment(lib, "ws2_32.lib") + diff --git a/server/tp_core/testssh/testssh.cpp b/server/tp_core/testssh/testssh.cpp index ce34131..9e2f3ec 100644 --- a/server/tp_core/testssh/testssh.cpp +++ b/server/tp_core/testssh/testssh.cpp @@ -1,18 +1,10 @@ // testssh.cpp : Defines the entry point for the console application. // -#include "stdafx.h" +//#include "stdafx.h" #include - -#ifdef _DEBUG -# pragma comment(lib, "debug/ssh.lib") -#else -# pragma comment(lib, "release/ssh.lib") -#endif -#pragma comment(lib, "libeay32.lib") -#pragma comment(lib, "ws2_32.lib") - +#include void show_usage() { printf("Usage:\n"); @@ -103,8 +95,8 @@ int main(int argc, char** argv) retry_count += 1; if (retry_count >= 5) break; - //ex_sleep_ms(500); - Sleep(500); + ex_sleep_ms(500); + // Sleep(500); rc = ssh_userauth_kbdint(sess, nullptr, nullptr); continue; } @@ -144,7 +136,8 @@ int main(int argc, char** argv) retry_count += 1; if (retry_count >= 3) break; - Sleep(100); + ex_sleep_ms(100); + // Sleep(100); rc = ssh_userauth_password(sess, nullptr, password); continue; }