mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Merge remote-tracking branch 'origin/topic/robin/gh1822-bittorrent-re'
* origin/topic/robin/gh1822-bittorrent-re: Switch BitTorrent analyzer to Zeek's regex engine Adding test for BitTorrent tracker.
This commit is contained in:
commit
a75b46bd12
6 changed files with 122 additions and 32 deletions
|
@ -0,0 +1,4 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
[orig_h=10.0.0.201, orig_p=49842/tcp, resp_h=91.189.95.21, resp_p=6969/tcp], /announce?info_hash=%e4%be%9eM%b8v%e3%e3%17%97x%b0%3e%90b%97%be%5c%8d%be&peer_id=-DE13F0-VnpZRF8ZP9iv&port=63448&uploaded=0&downloaded=0&left=1921843200&corrupt=0&key=764CA003&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0, {
|
||||
|
||||
}
|
BIN
testing/btest/Traces/bittorrent/tracker.pcap
Normal file
BIN
testing/btest/Traces/bittorrent/tracker.pcap
Normal file
Binary file not shown.
45
testing/btest/scripts/base/protocols/bittorrent/tracker.zeek
Normal file
45
testing/btest/scripts/base/protocols/bittorrent/tracker.zeek
Normal file
|
@ -0,0 +1,45 @@
|
|||
# @TEST-DOC: Basic functionality test for Bittorrent Tracker analyzer.
|
||||
|
||||
# @TEST-EXEC: zeek -C -b -r $TRACES/bittorrent/tracker.pcap -s bittorrent.sig %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Zeek doesn't ship with scripts or DPD sigs for Bittorrent, so we need to provide what
|
||||
# we need ourselves.
|
||||
|
||||
event bt_tracker_request(c: connection, uri: string, headers: bt_tracker_headers) {
|
||||
print c$id, uri, headers;
|
||||
}
|
||||
|
||||
@TEST-START-FILE bittorrent.sig
|
||||
|
||||
# Reusing the old Bro 1.5 signatures here.
|
||||
|
||||
signature dpd_bittorrenttracker_client {
|
||||
ip-proto == tcp
|
||||
payload /^.*\/announce\?.*info_hash/
|
||||
tcp-state originator
|
||||
}
|
||||
|
||||
signature dpd_bittorrenttracker_server {
|
||||
ip-proto == tcp
|
||||
payload /^HTTP\/[0-9]/
|
||||
tcp-state responder
|
||||
requires-reverse-signature dpd_bittorrenttracker_client
|
||||
enable "bittorrenttracker"
|
||||
}
|
||||
|
||||
signature dpd_bittorrent_peer1 {
|
||||
ip-proto == tcp
|
||||
payload /^\x13BitTorrent protocol/
|
||||
tcp-state originator
|
||||
}
|
||||
|
||||
signature dpd_bittorrent_peer2 {
|
||||
ip-proto == tcp
|
||||
payload /^\x13BitTorrent protocol/
|
||||
tcp-state responder
|
||||
requires-reverse-signature dpd_bittorrent_peer1
|
||||
enable "bittorrent"
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
Loading…
Add table
Add a link
Reference in a new issue