Total Pageviews

Friday, 20 May 2022

frsocks+protoplex+流量重定向,实现端口复用


frsocks

https://github.com/3gstudent/Homework-of-Go/blob/master/frsocks.go

监听本地的2333端口开启一个socks5代理,这里也可以用其他工具,如ew,frp等等。

./frsocks -sockstype fsocks -listen 2333

image-20200716154735565

protoplex

https://github.com/Pandentia/protoplex

这是一个协议复用的工具,比如命令可将本地9999端口的流量根据协议类型转到本地的2333和80端口。

注: 在实战环境中,先用protoplex进行分流,然后再进行重定向。

./protoplex --socks5 192.168.154.130:2333 --http 127.0.0.1:80 -b 192.168.154.130:9999

注: protoplex设置分流的http协议IP和重定向的ip不要设置为同一个ip,否则会形成闭环。

同时该工具还支持其他协议的分流,如:

  • SSH
  • HTTP
  • TLS (/ HTTPS)
  • OpenVPN
  • SOCKS4 / SOCKS5

image-20200716192504883

流量重定向

linux

将访问80的流量重定向到9999端口

sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 9999
windows

将本地80流量重定向到9999

netsh interface portproxy add v4tov4 listenport=80 listen
address=192.168.154.129 connectport=9999 connectaddress=192.168.154.129

相关操作命令:

显示系统中的转发规则列表:

netsh interface portproxy show all

删除指定的端口转发规则:

netsh interface portproxy delete v4tov4 listenport=80 listenaddress=192.168.154.129

清除所有当前的端口转发规则:

netsh interface portproxy reset

注: 必要的情况下,可以设置特定来源ip进行流量重定向。

from https://uknowsec.cn/posts/notes/frsocks+protoplex+%E6%B5%81%E9%87%8F%E9%87%8D%E5%AE%9A%E5%90%91%E5%AE%9E%E7%8E%B0%E7%AB%AF%E5%8F%A3%E5%A4%8D%E7%94%A8.html

------------------------------------

A protocol multiplexer in Go.

protoplex

An application protocol multiplexer

Build Status

What is this?

In a nutshell, this application lets you run multiple kinds of applications on a single port. This is useful for, for instance, running an OpenVPN server and a TLS/HTTPS server on port 443, which in turn is useful for evading firewalls that block all other outbound ports.

Running

Native

Assuming you have a properly configured Go setup, get and compile the multiplexer with

go get github.com/Pandentia/protoplex/cmd/protoplex

and then run it with (for example, to run SSH and HTTPS)

protoplex --ssh your_ssh_host:22 --tls your_webserver:443

Protoplex is now running on port 8443 and ready to accept connections.

For more extensive configuration, please see the output of --help.

Goals

The concepts for this multiplexer were as follows:

  • Resource usage about on par with sslh
  • Easily extensible
  • Highly dynamic

To this end, protoplex supports multiple matching methods for protocols:

  • Bytestring comparison
  • Regex matching

These can both be implemented for a protocol, with bytestrings taking priority (due to efficiency). In addition, protocols support matching limits, reducing the amount of protocols evaluated for a given handshake.

Protocol support

Currently supported protocols are:

  • SSH
  • HTTP
  • TLS (/ HTTPS)
  • OpenVPN
  • SOCKS4 / SOCKS5

Feel free to file an issue on the GitHub repository if you want a protocol to be supported. Please include steps to accurately reproduce your client setup.

Alternatively, you may submit a pull request.


from https://github.com/SapphicCode/protoplex

------


一款golang写的支持http与socks5的端口复用小工具,并且可以开启socks5代理。

multiplexing_port_socks5

一款golang写的支持http与socks5的端口复用小工具,并且可以开启socks5代理。

支持端口复用的小工具。目前仅支持socks5.与http分流。(linux版可自行添加修改。模块已经写好)

from https://github.com/TryHello/multiplexing_port_socks5


No comments:

Post a Comment