Wireshark/Tshark json 在kafka主题中输出

Wireshark/Tshark json output in kafka topic

我正在寻找一种解决方案,可以将控制台上生成的 json 数据发送到 kafka 主题。例如。 tshark -r "filename.pcap" -T json 到我的 kafka 主题,或使用 librdkafka 在同一主题上生成它。

如果有人知道 tshark 的内部结构,我可以在其中抽动它的模块,在控制台上打印 json 以在我的 kafka 主题上生成 json。要是我能达到 json 是 packed/made 然后打印在控制台上的地步就好了。提前致谢。

If only I could get to the point where the json is packed/made and then printed on the console should work. Thanks in advance.

在屏幕上打印 JSON 的代码在 tshark.c lines 4187-4206 and lines 3834-3837

    if (print_details) {
      write_json_proto_tree(output_fields, print_dissections_none, TRUE,
                            protocolfilter, protocolfilter_flags,
                            edt, &cf->cinfo, node_children_grouper, &jdumper);
      return !ferror(stdout);
    }

write_json_proto_treeepan/print.c:712

中实现