BypassNAT | System for remote access to devices.
System for remote access to devices


Purpose

Application was tested

Planned

Table of contents

BypassNAT-client

 Functions

  - 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.

 Compile from source

  - 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;

Exemples

BypassNAT-client-fv

Full version.
  *installation of additional software required

Available:

Install

 Windows:
 Ubuntu:
#sudo apt-get update && upgrade
 Raspberry Pi:
#sudo apt-get update && upgrade

BypassNAT-client-lite

With user interface.
  *reduced functionality
  *lite installation of additional software required
  *under testing - some devices (PC) do not show the video stream

Available:

Unavailable:

Install

 Windows:
 Ubuntu:
#sudo apt-get update && upgrade
 Raspberry Pi:
#sudo apt-get update && upgrade

BypassNAT-client-console-fv

Console application.
Use in your applications or as an additional support service for your device.

  *installation of additional software required

Available:

Unavailable:

Install

 Windows:
 Ubuntu:
#sudo apt-get update && upgrade
 Raspberry Pi:
#sudo apt-get update && upgrade

Properties

-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

BypassNAT-client-console-lite

Console application.
Use in your applications or as an additional support service for your device.

  *reduced functionality
  *no additional software installation required

Available:

Unavailable:

Install

 Windows:
 Ubuntu:
 Raspberry Pi:
#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

Properties

-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

Exemples

File sharing

Use Command line

Reverse SSH Tunneling

Allows you to run an ssh-client with a reverse tunnel and access the device (dev_target).

  Server requirements

 Create a reverse ssh-tunnel

 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.

Use another available server

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;

Commands for the server

Installing additional software

GStreamer for Windows

BypassNAT-server

Functions

Features

Properties

-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.

Install

Example script to check BypassNAT-server

#!/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

Video-server

  *used third-party software

Functions

Publishing and broadcasting a video stream of a desktop.

Exemple

Features

License

All code in this repository is released under the MIT license.
Application archives and compiled binaries make use of some third-party dependencies: