signatures: Fix ISO 9960 signature

This signature only really works when default_file_bof_buffer_size is bumped
to a sufficient value (40k).
This commit is contained in:
Arne Welzel 2024-02-21 10:28:25 +01:00
parent 036bcfe919
commit d2409dd432
4 changed files with 30 additions and 2 deletions

View file

@ -297,8 +297,17 @@ signature file-windows-minidump {
file-magic /^MDMP/ file-magic /^MDMP/
} }
# ISO 9660 disk image # ISO 9660 disk image: First 16 sectors (2k) are arbitrary data.
# The following sector is a volume descriptor with magic string "CD001"
# at offset 1: 16 * 2048 + 1 = 32769
signature file-iso9660 { signature file-iso9660 {
file-mime "application/x-iso9660-image", 99 file-mime "application/x-iso9660-image", 99
file-magic /CD001/ file-magic /^.{32769}CD001/
}
# ISO 9660 disk image, magic string match in next volume descriptor.
# 17 * 2048 + 1 = 34817
signature file-iso9660-2 {
file-mime "application/x-iso9660-image", 99
file-magic /^.{34817}CD001/
} }

View file

@ -0,0 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
fuid source mime_type filename
FbxMVx2s9vO46GnVh2 HTTP application/x-iso9660-image myiso.iso

Binary file not shown.

View file

@ -0,0 +1,16 @@
# @TEST-DOC: Test ISO 9660 mime detection works with increased default_file_bof_buffer_size.
#
# @TEST-EXEC: zcat <$TRACES/http/iso-download.pcap.gz | zeek -b -r - %INPUT
# @TEST-EXEC: zeek-cut -m fuid source mime_type filename < files.log > files.log.cut
# @TEST-EXEC: btest-diff files.log.cut
@load base/protocols/http
@load base/frameworks/files
redef default_file_bof_buffer_size = 40000;
event file_over_new_connection(f: fa_file, c: connection, is_orig: bool)
{
if ( f$source == "HTTP" )
f$info$filename = split_string(c$http$uri, /\//)[-1];
}