0

我是 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)]);
        }
    }
4

1 回答 1

0

Xifeng 您的设置在这里似乎工作正常(撇开“//”注释分隔符,您需要“#”代替)。签名也应该没问题,因为 BitTorrent 协议确实以发起者的 0x13 开头。我使用的 pcap 是这个:

https://pcapr.net/view/gerald/2009/0/3/10/Comcast_Bittorrent_no_RST.pcap.html

你确定你的 pcap 没问题?确保它包含 TCP 握手,以便 Bro 可以正确引导连接状态。

于 2018-08-20T21:03:15.137 回答