Skip to content

Instantly share code, notes, and snippets.

@evoxco
Last active April 25, 2017 03:48
Show Gist options
  • Save evoxco/68d6ee2b0ae2c0f67a67 to your computer and use it in GitHub Desktop.
Save evoxco/68d6ee2b0ae2c0f67a67 to your computer and use it in GitHub Desktop.
Bro Ids Extract files
Enable file extraction (Prior to 2.4.1)
---------------
sudo vi /mnt/data/bro/share/bro/site/local.bro
@load misc/extract-files
vi /mnt/data/bro/share/bro/policy/misc/extract-files.bro
global ext_map: table[string] of string = {
["application/x-dosexec"] = "exe",
["application/pdf"] = "pdf",
["application/msword"] = "doc",
["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] = "docx",
} &default ="";
event file_new(f: fa_file)
{
local ext = "";
if ( f?$mime_type )
ext = ext_map[f$mime_type];
local fname = fmt("%s-%s.%s", f$source, f$id, ext);
Files::add_analyzer(f, Files::ANALYZER_EXTRACT, [$extract_filename=fname]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment