Skip to main content

No project description provided

Project description

内网穿透工具

github: https://github.com/sazima/proxynt

原理

原理

特性

  1. 随时随地打开浏览器管理端口映射
  2. 公网服务器和内网客户端之间使用 WebSocket 加密传输
  3. 依赖少, 使用 pip一键安装
  4. 稳定, 自动重连, 已在生产环境中使用

常用场景

  1. 在家托管网站服务器
  2. 管理物联网设备

安装

pip install proxynt

使用

客户端

# 查看帮助
nt_client --help
# 启动客户端
nt_client -c config_c.json

服务端

# 查看帮助
nt_server --help
# 启动服务端
nt_server -c config_s.json

服务端ui

管理页面路径为websocket路径+/admin,
比如 
http://192.168.9.224:18888/websocketpath/admin

ui

示例, 通过 SSH 访问内网机器

假设公网机器的ip是 192.168.9.224

1. 在公网机器上配置config_s.json

{
  "port": 18888,
  "password": "helloworld",
  "path": "/websocket_path",
  "admin": {
    "enable": true,  
    "admin_password": "new_password"  
  }
}

说明:

  • port: 监听端口
  • password: 连接密码
  • path: websocket路径
  • admin: 管理页配置(非必须)
  • admin.enable: 是否启用管理页
  • admin.admin_password: 管理密码

然后启动: nt_server -c config_s.json

2. 在需要被访问的内网电脑上配置config_c.json

配置config_c.json

{
  "server": {
    "port": 18888,
    "host": "192.168.9.224",
    "https": false,
    "password": "helloworld",
    "path": "/websocket_path"
  },
  "client_name": "我家里的小电脑",
  "client": [
    {
      "name": "ssh1",
      "remote_port": 12222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    }
  ]
}

说明:

  • server: 要连接的服务器端口, ip, 是否是https, 密码, websocket路径
  • client_name: 客户端名称
  • client: 这里是将本机的22端口映射到服务器的12222端口上

然后启动: nt_client -c config_c.json

3. ssh 连接:

ssh -oPort=12222 test@192.168.9.224

打开管理页面:

http://192.168.9.224:18888/websocketpath/admin

完整配置说明

  • 客户端 config_c.json
{
  "server": {  // 要连接的服务端配置
    "port": 18888,  // 端口
    "host": "192.168.9.224",  // 端ip
    "https": false,  //服务端是否启动https
    "password": "helloworld",  // 密码
    "path": "/websocket_path"  // websocket 路径
  },
  "client": [  // 转发的配置列表
    {
      "name": "ssh",
      "remote_port": 1222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    },
    {
      "name": "mongo",
      "remote_port": 1223,
      "local_port": 27017,
      "local_ip": "127.0.0.1"
    }
  ],
  "client_name": "ubuntu1",  // 客户端名称, 要唯一
  "log_file": "/var/log/nt/nt.log"  // 日志路径
}
  • 服务端 config_c.json
{
    "port": 18888,  // 监听端口
    "password": "helloworld",  // 密码
    "path": "/websocket_path",  // websocket路径
    "log_file": "/var/log/nt/nt.log",  // 日志路径
    "admin": {  
        "enable": true,  // 是否启用管理页
        "admin_password": "new_password"  // 管理页密码
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxynt-1.1.3.tar.gz (338.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxynt-1.1.3-py3-none-any.whl (367.3 kB view details)

Uploaded Python 3

File details

Details for the file proxynt-1.1.3.tar.gz.

File metadata

  • Download URL: proxynt-1.1.3.tar.gz
  • Upload date:
  • Size: 338.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.12

File hashes

Hashes for proxynt-1.1.3.tar.gz
Algorithm Hash digest
SHA256 5d39b64dcd8a1d672a4be6ae82eaca6f3dc94e19bb461b51c106cfa7270d2004
MD5 166fb408c5440f18955dcabe0f1a9fd7
BLAKE2b-256 ed5e2c56cc59293a32f3abcfb4aaebc0c300acbfe6df0ee2f3367a16ad1e8c99

See more details on using hashes here.

File details

Details for the file proxynt-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: proxynt-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 367.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.12

File hashes

Hashes for proxynt-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a6b928b43cd9c51f17ba3e3bf5551c6f91de5db0e1c04a1a94960fcb53bb558f
MD5 b45803efc35891e79bf79a878a1db6c6
BLAKE2b-256 4c86be5aac078ede57bdf9e3b44ada9bcfd4e829ecc773af6ee0f896d7f1d8bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page