Python端口转发/复用服务器
我想让服务器侦听 UDP 端口 162(SNMP 陷阱),然后将此流量转发到多个客户端。同样重要的是源端口和端口号。地址保持不变(地址欺骗)。
我想最好的工具是 Twisted 或 Scapy 或者可能是普通套接字, 只是我在 Twisted 的文档中找不到任何有关源地址欺骗/伪造的内容。
有什么解决办法吗?
编辑:添加赏金,也许有 iptables 的解决方案吗?
I would like to make server that listen on UDP port 162 (SNMP trap) and then forwards this traffic to multiple clients. Also important is that the source port & address stays same (address spoofing).
I guess that best tool for this would be Twisted or Scapy or maybe vanilla sockets,
only I can't find anything in the documentation for Twisted about source address spoofing/forging.
Any solution for this?
Edit:added bounty, mybe any solution with iptables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对twisted 或scapy 不太满意,但是使用vanilla python 套接字来做到这一点非常简单。这样做的另一个优点是它更加便携。该代码在我有限的测试中有效:
I am not comfortable with twisted or scapy, but it's quite straightforward to do this with vanilla python sockets. An extra advantage of that is that it will be even more portable. This code works in my limited tests:
接受的答案对我不起作用,我最终使用 Python 中的简单 TCP 重定向器 :
The accepted answer didn't work for me and I end up using A simple TCP redirector in python :