Giter Site home page Giter Site logo

gankyun / natter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikewang000000/natter

0.0 0.0 0.0 1.46 MB

Expose your TCP/UDP port behind full-cone NAT to the Internet. with upnp port forward

License: GNU General Public License v3.0

Shell 3.60% Python 94.29% HTML 1.78% Dockerfile 0.32%

natter's Introduction

Natter (v2)

Expose your port behind full-cone NAT to the Internet.

中文文档

Quick start

python3 natter.py

Or, using Docker:

docker run --net=host nattertool/natter
2023-11-01 01:00:08 [I] Natter
2023-11-01 01:00:08 [I] Tips: Use `--help` to see help messages
2023-11-01 01:00:12 [I]
2023-11-01 01:00:12 [I] tcp://192.168.1.100:13483 <--Natter--> tcp://203.0.113.10:14500
2023-11-01 01:00:12 [I]
2023-11-01 01:00:12 [I] Test mode in on.
2023-11-01 01:00:12 [I] Please check [ http://203.0.113.10:14500 ]
2023-11-01 01:00:12 [I]
2023-11-01 01:00:12 [I] LAN > 192.168.1.100:13483   [ OPEN ]
2023-11-01 01:00:12 [I] LAN > 192.168.1.100:13483   [ OPEN ]
2023-11-01 01:00:12 [I] LAN > 203.0.113.10:14500    [ OPEN ]
2023-11-01 01:00:13 [I] WAN > 203.0.113.10:14500    [ OPEN ]
2023-11-01 01:00:13 [I]

In the example above, 203.0.113.10 is your public IP address outside the full-cone NAT. Natter opened TCP port 203.0.113.10:14500 for testing.

Visit http://203.0.113.10:14500 outside your LAN, you will see the web page:

It works!

--------
Natter

Usage

usage: natter.py [--version] [--help] [-v] [-q] [-u] [-k <interval>]
                 [-s <address>] [-h <address>] [-e <path>] [-i <interface>]
                 [-b <port>] [-m <method>] [-t <address>] [-p <port>] [-r]

Expose your port behind full-cone NAT to the Internet.

options:
  --version, -V   show the version of Natter and exit
  --help          show this help message and exit
  -v              verbose mode, printing debug messages
  -q              exit when mapped address is changed
  -u              UDP mode
  -f              Add port forwarding through UPNP device.
                  which maybe improve the mapping success rate under NAT Type 2/3 networks
  -k <interval>   seconds between each keep-alive
  -s <address>    hostname or address to STUN server
  -h <address>    hostname or address to keep-alive server
  -e <path>       script path for notifying mapped address

bind options:
  -i <interface>  network interface name or IP to bind
  -b <port>       port number to bind

forward options:
  -m <method>     forward method, common values are 'iptables', 'nftables',
                  'socat', 'gost' and 'socket'
  -t <address>    IP address of forward target
  -p <port>       port number of forward target
  -r              keep retrying until the port of forward target is open

Usage for Docker

Read natter-docker for details.

Use cases

Expose local port 80 to the Internet, using built-in forward method:

python3 natter.py -p 80

Expose local port 80 to the Internet, using iptables kernel forward method (requires root permission):

sudo python3 natter.py -m iptables -p 80

If you need port mapping via UPnP

python3 natter.py -p 80 -f

Dependencies

  • Python 2.7 (minimum), >= 3.6 (recommended)
  • No third-party modules are required.
  • If you need UPnP port mapping function, you need to install upnpcclient. pip install upnpclient

License

GNU General Public License v3.0

natter's People

Contributors

mikewang000000 avatar abgelehnt avatar csterkuroi avatar gankyun avatar

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.