我是第一次接触BRO,刚刚开始在BRO上测试签名。我有一个脚本main.bro和一个签名文件protosigs.sig。这个想法是比较签名,并在重写的事件函数- signature_match中做一些事情。我尝试使用以下方法来测试一个pcap文件,但测试没有生成notice.log。似乎没有调用函数- signature_match。有人能告诉我这里发生了什么事吗?非常感谢!
如何测试脚本和签名:
bro -r ./bittorrent.Transfer.pcap ./main.bro -s ./protosigs.sig我的签名:
signature torrent-request-tcp {
ip-proto == tcp
payload /^\x13/
tcp-state originator
event "torrent-request-tcp"
}我的脚本- main.bro:
@load base/frameworks/notice
@load base/frameworks/signatures/main
@load base/utils/addrs
@load base/utils/directions-and-hosts
#@load-sigs ./protosigs.sig
module bittorrent;
export {
redef enum Notice::Type += {
Torrent,
};
}
event signature_match(state: signature_state, msg: string, data: string)
&priority=-5
{print "Triggerd!"; //at least this one should be triggered, but..
if ( /torrent/ in state$sig_id )
{
print "TTTTTTTTTTTTTTTTTTT";
NOTICE([$note=bittorrent::Torrent,
$msg="Torrent whatsoever",
$sub=data,
$conn=state$conn,
$identifier=fmt("%s%s", state$conn$id$orig_h, state$conn$id$resp_h)]);
}
}发布于 2018-08-21 05:03:15
Xifeng您的设置在这里似乎工作得很好(把"//“注释分隔符放在一边,您需要的是"#”)。签名也应该没问题,因为发起者的BitTorrent协议确实是以0x13开头的。我使用的pcap是这样的:
https://pcapr.net/view/gerald/2009/0/3/10/Comcast_Bittorrent_no_RST.pcap.html
你确定你的pcap没问题吗?确保它包含TCP握手,以便Bro可以正确引导连接状态。
https://stackoverflow.com/questions/51060252
复制相似问题