A tool for penetrating the Intranet, allowing LAN ports to expose to the public network to penetrate the LAN, similar to FRP, ngork and other software, but more lightweight, only for TCP connections, support multi-user and multi-client.
The network IO model adopts the event driven model of reactor pattern, and the implementation method refers to redis source code
Supporting Linux only for now. WSL is recommended under Windows
- The size of executable file is very small.(100+kb)
- Easy to run, without any dependence , can run directly to the background of the daemon process.
- The configuration file is simple.
- Encryped transmission, the forwarded data will be encrypted and then transmitted, encryption algorithm defaults to aes-256-cbc.
- High performance IO, based on IO multiplexing, network event processing refers to redis Reactor event driven model.
- Compile
git clone https://github.com/DeaglePC/XTunnel.git && cd XTunnel/xtun/ && cmake -DCMAKE_BUILD_TYPE=Release . && make
- Download
XTunnel_0.2_linux_x86_64.zip
Example: ts.ini
[common]
server_port = 10087 # for client connection
password = 666 # keep it private
log_path = /home/xxx/log # log file path, make sure you have permission to write and read
Example: tc.ini
[common]
server_ip = 12.13.14.15 # server public ip address
server_port = 10087 # the server_port in ts.ini
password = 666 # server password in ts.ini
log_path = /home/xxx/log # log file path, make sure you have permission to write and read
[ssh]
local_ip = 127.0.0.1
local_port = 22 # local application's port, here is ssh
remote_port = 12300 # You want to expose the port on the public network
[vnc]
local_ip = 192.168.1.11
local_port = 5900
remote_port = 12301
[rdp]
local_ip = 192.168.1.12
local_port = 3389
remote_port = 12302
The port mapping is as follows:
LAN network | Public network |
---|---|
127.0.0.1:22 | 12.13.14.15:12300 |
192.168.1.11:5900 | 12.13.14.15:12301 |
192.168.1.12:3389 | 12.13.14.15:12302 |
According to the above configuration file, by connecting to the IP: port of the public network, you can connect to the application in the LAN. For example, the above configuration files can be connected to SSH, VNC, and Windows RDP remote desktop respectively.
- Run server(Runs on a host with a public network IP)
./xtuns -c ts.ini -d
-d
Parameter representation runs as a daemon
- Run client(Runs on a host in LAN)
./xtunc-c tc.ini -d
- Connect to LAN applications by connecting to public network IP
ssh [email protected] -p 12300
TODO:
- 1. The configuration file
- 2. Password encryption
- 3. Heartbeats
- 4. Encrypted transmission
- 5. Reconnect after disconnection
- 6. Keep log files for n days only
- 7. Add restart and stop parameters
- 8. Optimize the code
Winnerhust for inifile2
JieweiWei for MD5
ttfutt for logger