Purpose
- get remote access to devices located on a network where NAT is used;
- using a private (or other accessible) server for:
- device management;
- file sharing;
- capture, broadcast and watch a desktop;
- ssh-tunnel setup, device access using ssh-protocol;
Application was tested
Planned
- deployment on NVIDIA_Jetson_Nano, macOS;
- capture desktop in Linux using Wayland;
- BypassNAT-client
- Installing additional software
- BypassNAT-server
- Video-server
- License
- capture, broadcast, watch a desktop (RTSP, RTMP-protocol);
- sending, emulating mouse and keyboard signals;
- use command line on the controlled device. Use Command line;
- ability to run an ssh-client with a reverse tunnel and access the device using the ssh-protocol.
Reverse SSH Tunneling;
- file copying. Files are saved in Download folder. File sharing;
- exchange of clipboards;
- console version for use in your applications or as an additional support service for your device.
- install git and Qt (v.6.7.3 or v.5.15.2, Qt Creator v.14.0.1);
- clone the BypassNAT repository and go to the 'src' folder;
- select 'main' or 'console-lite' branch;
- open file *.pro in the Qt Creator;
- run the project;
Full version.
*installation of additional software required
- search and manage devices on the network;
- capture, broadcast, watch a desktop;
- sending mouse and keyboard signals;
- emulation of mouse and keyboard signals;
- sending, executing instructions in the command line on the controlled device and receiving the result from it;
- file sharing;
- receives/sends clipboard;
- setting the video stream quality;
- GStreamer install - GStreamer for Windows;
- download application archive and unzip it. Run BypassNatClient.ехе
#sudo apt-get update && upgrade
- for show user interface and emulate keyboard signals:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev -y
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-rtsp -y
- download application archive and unzip it. In the command line, run ./BypassNatClient.sh
#sudo apt-get update && upgrade
- for show user interface and emulate keyboard signals:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev -y
#sudo apt-get install qtdeclarative5-* qml-module-qtquick* qtquickcontrols5-* qml-module-qtquick2 -y
#sudo apt-get install libqt5multimedia5 libqt5multimedia5-plugins qml-module-qtmultimedia -y
#sudo nano /etc/xdg/qt5ct/qt5ct.conf
#change style=gtk2 to style=gtk3
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-plugins-ugly gstreamer1.0-rtsp -y
- download application archive and unzip it. In the command line: chmod +x BypassNatClient and run ./BypassNatClient
With user interface.
*reduced functionality
*lite installation of additional software required
*under testing - some devices (PC) do not show the video stream
- search and manage devices on the network;
- watch a desktop;
- sending mouse and keyboard signals;
- sending, executing instructions in the command line on the controlled device and receiving the result from it;
- file sharing;
- receives clipboard;
- setting the video stream quality;
- capture, broadcast a desktop;;
- using RTMP-protocol (use RTSP-server);
- emulation of mouse and keyboard signals;
- sends clipboard;
- codec installed for watch video;
- download application archive and unzip it. Run BypassNatClient.ехе
#sudo apt-get update && upgrade
- for show user interface:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libxkbcommon-x11-dev -y
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-libav gstreamer1.0-plugins-bad -y
- download application archive and unzip it. In the command line, run ./BypassNatClient.sh
#sudo apt-get update && upgrade
- for show user interface:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libxkbcommon-x11-dev -y
#sudo apt-get install qtdeclarative5-* qml-module-qtquick* qtquickcontrols5-* qml-module-qtquick2 -y
#sudo apt-get install libqt5multimedia5 libqt5multimedia5-plugins qml-module-qtmultimedia -y
#sudo nano /etc/xdg/qt5ct/qt5ct.conf
#change style=gtk2 to style=gtk3
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-plugins-ugly gstreamer1.0-rtsp -y
- download application archive and unzip it. In the command line: chmod +x BypassNatClient and run ./BypassNatClient
Console application.
Use in your applications or as an additional support service for your device.
*installation of additional software required
- capture, broadcast a desktop;
- emulation of mouse and keyboard signals;
- sending, executing instructions in the command line on the controlled device and receiving the result from it;
- file sharing;
- receives/sends clipboard;
- user interface;
- search and manage devices on the network;
- sending mouse and keyboard signals;
- watch stream;
- GStreamer install - GStreamer for Windows;
- download application archive and unzip it. Run BypassNatClient.ехе
#sudo apt-get update && upgrade
- for emulate keyboard signals:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev -y
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-rtsp -y
- download application archive and unzip it. In the command line, run ./BypassNatClient.sh
#sudo apt-get update && upgrade
- for emulate keyboard signals:
#sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev -y
#sudo apt-get install qtdeclarative5-* qml-module-qtquick* qtquickcontrols5-* qml-module-qtquick2 -y
#sudo nano /etc/xdg/qt5ct/qt5ct.conf
#change style=gtk2 to style=gtk3
- GStreamer plugins:
#sudo apt-get install gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-rtsp -y
- download application archive and unzip it. In the command line: chmod +x BypassNatClient and run ./BypassNatClient
-spas - set server password (default 1111); ./BypassNatClient.sh -spas 2227
-sip - set IP for connect to server; ./BypassNatClient.sh -sip 137.34.15.27
-ptcp - set port for connect to server; ./BypassNatClient.sh -ptcp 1135
-prtsp - set port for broadcast video-stream; ./BypassNatClient.sh -prtsp 8554
-prtmp - set port for broadcast video-stream; ./BypassNatClient.sh -prtmp 1927
-log - set your login; ./BypassNatClient.sh -log user1
-pas - set your password; ./BypassNatClient.sh -pas user1111
-ds - use another available server; ./BypassNatClient.sh -ds 1 Use another available server
-kds - use another available server with an access key; ./BypassNatClient.sh -ds 1 -kds ExxxRt17j Use another available server
Console application.
Use in your applications or as an additional support service for your device.
*reduced functionality
*no additional software installation required
- sending, executing instructions in the command line on the controlled device and receiving the result from it;
- file sharing;
- user interface;
- search and manage devices on the network;
- sending mouse and keyboard signals;
- emulation of mouse and keyboard signals;
- receives/sends clipboard;
- capture, broadcast a desktop;
- watch stream;
- download application archive and unzip it. Run BypassNatClient.ехе
- download application archive and unzip it. In the command line, run ./BypassNatClient.sh
#sudo apt-get update && upgrade
#sudo apt-get install qtdeclarative5-* qml-module-qtquick* qtquickcontrols5-* qml-module-qtquick2 -y
#sudo nano /etc/xdg/qt5ct/qt5ct.conf
#change style=gtk2 to style=gtk3
- download application archive and unzip it. In the command line: chmod +x BypassNatClient and run ./BypassNatClient
-spas - set server password (default 1111); ./BypassNatClient.sh -spas 2227
-sip - set IP for connect to server; ./BypassNatClient.sh -sip 137.34.15.27
-ptcp - set port for connect to server; ./BypassNatClient.sh -ptcp 1135
-log - set your login; ./BypassNatClient.sh -log user1
-pas - set your password; ./BypassNatClient.sh -pas user1111
-ds - use another available server; ./BypassNatClient.sh -ds 1 Use another available server
-kds - use another available server with an access key; ./BypassNatClient.sh -ds 1 -kds ExxxRt17j Use another available server
- use BypassNatClient - Menu - File copy;
- insert the full path to the file. Exemple: /home/user/folderKey/ssh-key-2020-11-09.key;
- click the button to copy the file;
- use sudo - 'sudo 1111 ping localhost' or 'sudo password apt-get install App'. 1111 - user password;
- use ssh with password - 'sshpass -p 1111 ssh user_server@0.0.0.0'. 1111 - user_server password;
- current directory - 'cd'. Default - "home path";
- go to directory - 'cd ..' or 'cd home/user_name/Video' or 'cd D:/';
- return to directory "home path" - 'cd ~';
- list of directories and files - 'ls'. It's custom function;
- list of directories and files including hidden ones - 'ls -a'. It's custom function;
Allows you to run an ssh-client with a reverse tunnel and access the device (dev_target).
- server user_server@0.0.0.0 must have white IP;
- port 6744 must be available on server user_server@0.0.0.0;
Use BypassNatClient - Menu - Comand line - send a command to the controlled device dev_target
# sshpass -p password_user_server ssh -o StrictHostKeyChecking=accept-new user_server@0.0.0.0 -R 6744:localhost:22
*password_user_server - it's password of user_server
... or send a command with a key
# ssh -i /home/dev_target/folderKey/ssh-key-2020-11-09.key user_server@0.0.0.0 -R 6744:localhost:22
Use server user_server@0.0.0.0 and connect to the device dev_target
# ssh dev_target@localhost -p 6744
- enter password of dev_target.
Allows you to TEMPORARILY use an already configured server 158.101.219.244
The time of using a third-party server (without an access key) 10 min. Next, the server is unavailable 30 min. Next, again, you can use the server 10 min. And so on...
The access key allows you to use a third-party server longer (until a specific date. Date is discussed additionally).
- console version of the application:
# ./BypassNatClient.sh -sip 158.101.219.244 -log user1 -pas user1111 -ds 1 -kds ExxxRt37j2
- versions of the application with user interface: select Menu -> Server -> use the developer server -> enter 158.101.219.244 -> ( optional: enter key ) -> New connect;
- set time for disconnecting clients with low activity: values from 30 to 300sec.
( 0 - disables the function on the server );
- download installation files: gstreamer-1.0-mingw-x86_64-1.20.7.msi и gstreamer-1.0-devel-mingw-x86_64-1.20.7.msi;
- run with administrator rights;
- select Custom and check all plugins;
- add 'C:\gstreamer\1.0\mingw_x86_64\bin' to PATH system;
- search for available devices and exchange data between them;
- the server must be online (statistics are kept on the number of working BypassNAT-servers);
- server usage, including in local networks, without collecting statistics is under development;
-pas - set server password (default 1111); ./BypassNatServer.sh -pas 2227
-p - set listen port; ./BypassNatServer.sh -p 1675
-la - time to disconnect clients with low activity; ./BypassNatServer.sh -la 60
*if the client is connected and not in use, it will be disconnected from the server after 60sec.
After 30sec the client will reconnect to the server to identification on the network.
- download application archive and unzip;
- start the server with parameters:
BypassNatServer.ехе -pas 2227 -p 1675 -la 60 - for Windows;
./BypassNatServer.sh -pas 2227 -p 1675 -la 60 - for Ubuntu
chmod +x BypassNatServer and run ./BypassNatServer -pas 2227 -p 1675 -la 60 - for Raspberry Pi
#!/bin/bash
sleep 10
a_pFNS_tcp=1137 #for BypassNatServer
a_pRTSP=8554 #for RTSP
a_pRTMP=1927 #for RTMP
a_pSSH=6744 #for SSH
# opening of ports
sudo systemctl start firewalld
sudo firewall-cmd --zone=public --add-port=${a_pSSH}/tcp --permanent #for SSH
sudo firewall-cmd --zone=public --add-port=${a_pRTSP}/tcp --permanent #for RTSP
sudo firewall-cmd --zone=public --add-port=${a_pRTMP}/tcp --permanent #for RTMP
sudo firewall-cmd --zone=public --add-port=${a_pFNS_tcp}/tcp --permanent #for BypassNatServer
sudo firewall-cmd --reload
while true
do
# BypassNatServer check
if pgrep "BypassNatServer" > /dev/null; then
echo "BypassNatServer STARTED!"
else
echo "BypassNatServer NOT STARTED"
cd /home/user/BypassNatServer
./BypassNatServer.sh -p ${a_pFNS_tcp} &
fi
# Mediamtx check
if pgrep "mediamtx" > /dev/null; then
echo "RTSP-server STARTED!"
else
echo "RTSP-server NOT STARTED"
cd /home/user/Mediamtx
MTX_RTSPADDRESS=":${a_pRTSP}" MTX_RTMPADDRESS=":${a_pRTMP}" MTX_PROTOCOLS="tcp,udp" ./mediamtx &
fi
sleep 2
done
*used third-party software
Publishing and broadcasting a video stream of a desktop.
- mediamtx - RTSP, RTMP and other protocols available;
- Nginx-RTMP - RTMP protocol available;
- or other RTSP, RTMP server;
- if you are not using desktop capture/broadcast, then installing a Video-server is not required.
All code in this repository is released under the MIT license.
Application archives and compiled binaries make use of some third-party dependencies:
- Qt - the primary open-source license is the GNU Lesser General Public License v.3 “LGPL v3”;
- GStreamer - licensed under the LGPL v2.1;