是否有用于过滤 JSON pcap 的工具或 wireshark 插件?

Is there tool or wireshark plugin for filtering JSON pcap?

我知道 JSON 消息只是键和值,但是是否有 wireshark 插件或工具可用于过滤 pcap 中的 JSON 消息?

例如:- 假设我在 pcap

中有低于 4 json 条消息
{"name":"john","salary":50000,"email":"john@whosebug.com"}
{"name":"vj","salary":55000,"email":"vj@whosebug.com"}
{"name":"rj","salary":65000,"email":"rj@whosebug.com"}
{"name":"rambo","salary":66000,"email":"rambo@whosebug.com"}

我要过滤掉所有工资低于65000的人?

代码片段

func filter_packet_based_on_rule(json_packet)
{
    // In this case if salary is < 65000, but it could be more complex
    if json_packet matches any of the rule
        return true
    else
        return false
}

main()
{
    while true
        json_packet = read_packet_from_pcap()
        if ! json_packet { break; }

        if (filter_packet_based_on_rule(json_packet))
            print json_packet 
}

我相信您正在寻找这样的东西 - https://github.com/ranjithum/Json-Analyzer/

虽然没有解析 pcap 的代码(使用 libpcap 应该不难),但您可以编写自己的过滤规则并过滤掉必要的数据包。