Git Product home page Git Product logo

nat-tunnel's Introduction

NAT Tunnel v0.01

If you have access to a server with public IP and unfiltered ports you can run NAT Tunnel (NT) server on the server, and NT client on your box behind NAT. the server requires 2 open ports: one for communication with the NT client (--admin), the other for regular clients to connect to (--public: this is the port you want your users to use).

The NT client opens a connection to the server's admin ip/port. As soon as the server receives a new connection, it signals the NT client, which then creates a new tunnel connection to the server, which is then connected to the desired service on the NT client's side (--local)

The connection between NT Client and NT Server on the admin interface is protected by a shared secret against unauthorized use. An adversary who can intercept packets could crack the secret if it's of insufficient complexity. At least 10 random characters and numbers are recommended.

Example: You have a HTTP server listening on your local machine on port 80. You want to make it available on your cloud server/VPS/etc's public IP on port 7000. We use port 8000 on the cloud server for the control channel.

Server:

natsrv.py --mode server --secret s3cretP4ss --public 0.0.0.0:7000 --admin 0.0.0.0:8000

Client:

natsrv.py --mode client --secret s3cretP4ss --local localhost:80 --admin example.com:8000

nat-tunnel's People

Contributors

rofl0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nat-tunnel's Issues

Client idles and stops serving requests

(Thanks for making this awesome piece of software!)

I have a little problem: I run my media server on Windows, but I'm behind NAT. I also have a Linux VPS, which I use to expose my local machine thanks to your script.

Linux runs in server mode, Windows runs in client mode.

The way I run the client is simply opening a cmd.exe tab, and run the script as in the example in the docs

Python27\python.exe natsrv.py --mode client --secret pass123 --local 192.168.1.117:8096 --admin example.com:80

However, if I leave cmd.exe open for a while, example.com:80 eventually stops serving requests. There are no error messages or anything.

I know the error is on the client because if I simply close cmd.exe, reopen it and rereun the client it starts working again.

This happens even after just a few minutes of inactivity (less than 20mins).

Have any idea what might be causing this?

Many thanks again!

NOT an issue but question|

how to access all open port services from local to client, because there are many port such as rdp, flask, some services at different ports etc. how to use ip virtualisation such as use domain instead of ip and local server can be accessed anywhere

Python 3 compatibility

OS: Windows 10
Python 3.7.2

C:\Users\Me\AppData\Local\Programs\Python\Python37\python.exe "C:\Program Files (x86)\nat-tunnel-master\natsrv.py" --mode client --secret hunter1 --local 192.168.1.117:123 --admin xxx.xxx.xxx.xxx:321

Traceback (most recent call last):
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 258, in <module>
    cl.setup()
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 75, in setup
    self.controlsock = self._setup_sock('adm')
  File "C:\Program Files (x86)\nat-tunnel-master\natsrv.py", line 69, in _setup_sock
    sock.connect()
  File "C:\Program Files (x86)\nat-tunnel-master\rocksock.py", line 242, in connect
    for pnum in xrange(1, len(self.proxychain)):
NameError: name 'xrange' is not defined

Possible reason: https://stackoverflow.com/a/17192181/1307020

Syntax error with python3

Hi,

Upon trying to run the script, I got the error:

python3 natsrv.py
  File "natsrv.py", line 89
    print _timestamp() + l.rstrip('\n')
                   ^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.