Skip to main content

traffic-forward 是一款python开发的流量转发工具,可以使用python脚本行运行,也可以封装使用命令行,同样可以使用pyinstaller等工具进行封装成Macos,Linux, Windows 下的可执行文件运行,可用于本地流量转发,与内网流量转发

1. 安装(可选)

此工具完全使用python原生的模块进行开发不需要安全任何的第三方模块,如果需要使用命令行可能需要sudo

pip(3) install traffic_forward

2. 使用

lport与lhost是需要转发的端口

rhost与rport是转发到的目标端口

2.1 转发本地流量

traffic_forward -mode trans -lhost 127.0.0.1 -lport 22 -rhost 127.0.0.1 -rport 9999

在使用完后使用control+c退出会有错误输出这是正常的

2.2 将流量转发到公网机器

在公网上的主机监听2个端口

traffic_forward -mode listen -lport 8088 -rport 8089

内网主机连接公网主机监听的任意端口(2个中任意一个),加入debug可以查看连接出现的问题,此时是讲本地的22端口转发到公网机器的8088口

traffic_forward -mode slave -lhost 127.0.0.1 -lport 22 -rhost x.x.x.x -rport 8088 -debug 1

然后

ssh name@x.x.x.x -p 8089

2.3 转发本地的UDP流量

由于UDP原因,这里只开发到了UDP的本地转发,如果可以希望可以帮组我开发远程转发

traffic_forward -mode Utrans -lhost 127.0.0.1 -lport 8090 -rhost 127.0.0.1 -rport 9999

2.4. 日志

此工具会在当前目录下生成日志,详细日志的功能等待开发可以如果不需要请直接删去

Metadata

Release files for traffic-forward 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traffic-forward 1.0.0
File Size Uploaded Provenance Actions
traffic_forward-1.0.0.tar.gz 5.4 kB Without provenance Details for traffic_forward-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for traffic-forward 1.0.0
File Interpreter ABI Platform Actions
traffic_forward-1.0.0-py3.6.egg Legacy Egg format - - Details for traffic_forward-1.0.0-py3.6.egg
traffic_forward-1.0.0-py3-none-any.whl Python 3 none any Details for traffic_forward-1.0.0-py3-none-any.whl

Total release size: 23.2 kB

Release files / traffic_forward-1.0.0.tar.gz

Download URL traffic_forward-1.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cf63be77fb3827672e538c8a798a9dfec163d8b2e2c78585aa0fdcf033e7741c
BLAKE2b-256 checksum
How to use checksums
3ec45b39b186258f5cd9f97b0351c3eb857640e68b01accb79ca5f0010bf14d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

Release files / traffic_forward-1.0.0-py3.6.egg

Download URL traffic_forward-1.0.0-py3.6.egg
Size 10.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
ae42c577e0bbcd609bae3d589041f6ad036abd3376984e322e41e39a884919f6
BLAKE2b-256 checksum
How to use checksums
2616c1eea01c70ab47502e96c7eb7b725db42f2ead1c0c92db6da474d413a738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

Release files / traffic_forward-1.0.0-py3-none-any.whl

Download URL traffic_forward-1.0.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03645851216d5ae4573fe1786b067b38328a7ca43f209f679e431f32091a113d
BLAKE2b-256 checksum
How to use checksums
23c9e1693b43f6e85937f54fe7c5be39b293b76495bac533d96553af88bd5387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

Security for traffic-forward 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page