【问题标题】:tshark - how to avoid to select null or empty http.referer filedstshark - 如何避免选择空或空的 http.referer 字段
【发布时间】:2020-06-19 14:34:21
【问题描述】:

在 Tshark v. 3.0.5. 上,我尝试运行这些命令以选择直接从用户输入的 URL。所以我需要排除空的 http.referer 文件(为空)。

tshark -Y "http.request == 1 and **!http.referer**" -T fields -e frame.time -e http.referer -e http.host -r traffic.pcap > no_referer.txt
bash: !http.referer: event not found

tshark -Y "http.request == 1 and **http.referer == ""**" -T fields -e frame.time -e http.referer -e http.host -r traffic.pcap > no_referer.txt
Running as user "root" and group "root". This could be dangerous.
tshark: Unexpected end of filter string.

您知道如何在 tshark 上选择这些数据吗?

【问题讨论】:

    标签: tshark


    【解决方案1】:

    Bash 会将您的显示过滤器中的 ** 扩展为您可能不想要的东西,因为您是 using double quotes。您可以使用单引号来确保 bash 不会更改显示过滤器的内容。

    根据wireshark http docshttp.referer 是一个字符串,因此检查空值就是检查""。所以用http.referer and !http.referer == ""来获取有这个字段的包,还有那个字段不为空的地方。

    tshark -Y 'http.request == 1 and http.referrer and !http.referer == ""' ...
    

    注意field != value!field == value不同,首选后者。 dftest can be used 来证明这是为什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多