Skip to content

Instantly share code, notes, and snippets.

@sethhall
Last active February 17, 2020 03:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethhall/8221401 to your computer and use it in GitHub Desktop.
Save sethhall/8221401 to your computer and use it in GitHub Desktop.
File extraction special naming example.
redef record fa_file += {
is_my_extractor_going: bool &default=F;
};
event file_over_new_connection(f: fa_file, c: connection, is_orig: bool)
{
if ( !f$is_my_extractor_going )
{
f$is_my_extractor_going=T;
if ( f$source == "HTTP" && is_orig == F )
{
local filename = cat(f$source, "_", c$id$orig_h, ":", port_to_count(c$id$orig_p), "-", c$id$resp_h, ":", port_to_count(c$id$resp_p), "_", f$id, ".dat");
Files::add_analyzer(f, Files::ANALYZER_EXTRACT, [$extract_filename=filename]);
}
else
{
Files::add_analyzer(f, Files::ANALYZER_EXTRACT);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment