【问题标题】:iptables: how to drop packets by their first bytes [closed]iptables:如何按第一个字节丢弃数据包[关闭]
【发布时间】:2022-02-08 19:25:19
【问题描述】:

我希望丢弃所有内容以"\x18\x00" 开头的数据包。 因此,我编写了以下配置:

iptables -N LIMIT
iptables -I INPUT -j LIMIT
iptables -A LIMIT -p udp -m string --string "\x18\x00" --algo kmp -j DROP

但是 iptables 把我的字节变成了一个字符串,并且没有丢包。

【问题讨论】:

    标签: bash ubuntu iptables


    【解决方案1】:

    我在我的字节字符串之前添加“$”,如下所示:

    iptables -N LIMIT
    iptables -I INPUT -j LIMIT
    iptables -A LIMIT -p udp -m string --string $"\x18\x00" --algo kmp -j DROP
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-02
      • 1970-01-01
      相关资源
      最近更新 更多