我正在尝试使用libnetfilter_conntrack来监控网络活动。
我能找到的只有this的例子。
我希望能够从nf_conntrack结构中提取数据,唯一能找到的方法就是使用nfct_snprintf,然后解析缓冲区。
我想将数据存储在这样的结构中:
struct connection_details {
std::string src_ip;
int src_port;
std::string dst_ip;
int dst_port;
std::string type;
std::string state;
};有没有其他方法可以做到这一点?
发布于 2016-06-15 08:44:02
对于在这里结束的其他人来说,由于库实现的抽象,您不能真正直接解析结构nf_conntrack对象。
但是,您可以包含来自库源代码libnetfilter_conntrack/include/internal/object.h的头文件来直接访问nf_conntrack对象,但是要小心,存在抽象是有原因的。
https://stackoverflow.com/questions/37241744
复制相似问题