统一源码风格, 去除敏感信息
This commit is contained in:
parent
1ea21b7bc6
commit
ced52a63ce
@ -8,7 +8,7 @@
|
|||||||
make clean; make
|
make clean; make
|
||||||
|
|
||||||
# test
|
# test
|
||||||
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/libssh2-tunnel# ./forward-tunnel -h
|
aixiao@NIUYULING:/mnt/c/Users/niuyuling/Desktop/libssh2-tunnel$ ./forward-tunnel -h
|
||||||
STunnel SSH forward tunnel
|
STunnel SSH forward tunnel
|
||||||
Author: AIXIAO@AIXIAO.ME
|
Author: AIXIAO@AIXIAO.ME
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
@ -25,6 +25,7 @@
|
|||||||
-? -h : help information
|
-? -h : help information
|
||||||
|
|
||||||
|
|
||||||
Mar 24 2023 17:46:41 Compile、link.
|
Jan 3 2024 09:18:55 Compile、link.
|
||||||
|
|
||||||
|
aixiao@NIUYULING:/mnt/c/Users/niuyuling/Desktop/libssh2-tunnel$
|
||||||
|
|
||||||
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/libssh2-tunnel#
|
|
BIN
forward-tunnel
BIN
forward-tunnel
Binary file not shown.
@ -3,9 +3,9 @@
|
|||||||
const char *keyfile1 = "/home/aixiao/.ssh/id_rsa.pub";
|
const char *keyfile1 = "/home/aixiao/.ssh/id_rsa.pub";
|
||||||
const char *keyfile2 = "/home/aixiao/.ssh/id_rsa";
|
const char *keyfile2 = "/home/aixiao/.ssh/id_rsa";
|
||||||
|
|
||||||
char *server_ssh_ip = "47.108.253.59";
|
char *server_ssh_ip = "127.0.0.1";
|
||||||
int server_ssh_port = 22;
|
int server_ssh_port = 22;
|
||||||
char *server_ssh_user = "root";
|
char *server_ssh_user = "aixiao";
|
||||||
char *server_ssh_passwd = "123456";
|
char *server_ssh_passwd = "123456";
|
||||||
|
|
||||||
const char *local_listenip = "0.0.0.0";
|
const char *local_listenip = "0.0.0.0";
|
||||||
@ -437,5 +437,6 @@ shutdown:
|
|||||||
free(server_ssh_user);
|
free(server_ssh_user);
|
||||||
if (server_ssh_passwd)
|
if (server_ssh_passwd)
|
||||||
free(server_ssh_passwd);
|
free(server_ssh_passwd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,11 @@
|
|||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
|
|
||||||
#define MAX_EVENTS 1024
|
#define MAX_EVENTS 1024
|
||||||
|
|
||||||
#define BUILD(fmt...) do { fprintf(stderr,"%s %s ",__DATE__,__TIME__); fprintf(stderr, ##fmt); } while(0)
|
#define BUILD(fmt...) do { fprintf(stderr,"%s %s ",__DATE__,__TIME__); fprintf(stderr, ##fmt); } while(0)
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
#ifndef INADDR_NONE
|
||||||
|
BIN
forward-tunnel.o
BIN
forward-tunnel.o
Binary file not shown.
BIN
reverse-tunnel
BIN
reverse-tunnel
Binary file not shown.
@ -26,12 +26,12 @@
|
|||||||
#define INADDR_NONE (in_addr_t)-1
|
#define INADDR_NONE (in_addr_t)-1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *keyfile1 = "/home/username/.ssh/id_rsa.pub";
|
const char *keyfile1 = "/home/aixiao/.ssh/id_rsa.pub";
|
||||||
const char *keyfile2 = "/home/username/.ssh/id_rsa";
|
const char *keyfile2 = "/home/aixiao/.ssh/id_rsa";
|
||||||
const char *username = "root";
|
const char *username = "aixiao";
|
||||||
const char *password = "12345";
|
const char *password = "12345";
|
||||||
|
|
||||||
const char *server_ip = "47.240.75.93";
|
const char *server_ip = "127.0.0.1";
|
||||||
|
|
||||||
const char *remote_listenhost = "0.0.0.0"; /* resolved by the remote server */
|
const char *remote_listenhost = "0.0.0.0"; /* resolved by the remote server */
|
||||||
int remote_wantport = 33;
|
int remote_wantport = 33;
|
||||||
@ -46,7 +46,7 @@ enum {
|
|||||||
AUTH_PUBLICKEY
|
AUTH_PUBLICKEY
|
||||||
};
|
};
|
||||||
|
|
||||||
int forward_tunnel(LIBSSH2_SESSION * session, LIBSSH2_CHANNEL * channel)
|
int forward_tunnel(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel)
|
||||||
{
|
{
|
||||||
int i, rc = 0;
|
int i, rc = 0;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
BIN
reverse-tunnel.o
BIN
reverse-tunnel.o
Binary file not shown.
Loading…
Reference in New Issue
Block a user