通过Scapy向特定端口转发数据包

发布于 2025-02-02 19:46:11 字数 413 浏览 3 评论 0原文

是否可以抓住一个本身到另一个端口的数据包并将其发送到另一个端口?这个想法是使端口看起来很开或关闭。

if pckt.haslayer(TCP):
    if str(pckt[TCP].dport) == "500":
        pckt[TCP].dport = 6698
        del pckt[IP].chksum
        del pckt[TCP].chksum
        sendp(pckt, verbose=False)

这是我尝试做的,但它行不通。我的猜测是计算机的回答速度比SCAPY快。我环顾四周,有些人似乎指向了iptables,但我挣扎着使用它。我也尝试过Netfilterqueue,但似乎已经被放弃了,拒绝在Python3.10上工作。

谁能建议?

非常感谢!

Is it possible to grab a packet destined to a different port and send it to another port? The idea is to make a port seem open or closed.

if pckt.haslayer(TCP):
    if str(pckt[TCP].dport) == "500":
        pckt[TCP].dport = 6698
        del pckt[IP].chksum
        del pckt[TCP].chksum
        sendp(pckt, verbose=False)

This is what I tried to do, but it does not work. My guess is that the computer is answering faster than scapy. I look around and some people seem to point to iptables, but I struggled using it. I've also tried NetfilterQueue but it seems it was abandoned and refuses to work on python3.10.

Can anyone advise?

Many thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文