Skip to main content

No project description provided

Project description

内网穿透工具

原理

原理

特性

  1. 支持在服务端增删端口映射
  2. 公网服务器和内网客户端之间只建立一个 WebSocket 连接
  3. 跨平台. 工具用到的 Python 第三方库有: tornado, typing_extensions

常用场景

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

安装

安装

pip install https://github.com/sazima/proxynt/archive/master.zip 

使用

客户端

nt_client -c config_c.json

服务端

nt_server -c config_s.json

服务端ui

管理页面路径为websocket路径+admin,
比如 
http://192.168.9.224:18888/websocketpath1/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": "ssh1",
      "remote_port": 12222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    }
  ]
}

然后启动: nt_client -c config_c.json

3. ssh 连接:

ssh -oPort=12222 [email protected]

打开管理页面:

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-0.0.5.tar.gz (352.1 kB view details)

Uploaded Source

Built Distribution

proxynt-0.0.5-py3-none-any.whl (385.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: proxynt-0.0.5.tar.gz
  • Upload date:
  • Size: 352.1 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-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6b5d857d791346cce58a00e73bca762bcf059707229dd13541faf9636f016386
MD5 58c5bcb1012ad7e9c565bf2cbfa4992a
BLAKE2b-256 32a6c93c83b1bdcb52edfecb5f19517fcf869ba8e66f294dfc9c521146ca56c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: proxynt-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 385.9 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-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3773ae468be4eb1f2700302556870cb57a6cc7a41ea9e6925cee4d34eeffca49
MD5 ab29a8a815757dbd23ea2a5c7e95fc73
BLAKE2b-256 f5cf164c21dba22914b0e31fc9d9866791520e2d477e88436fb7cd5d1406e316

See more details on using hashes here.

Supported by

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