zeek/scripts/policy/frameworks/intel/seen/smtp-url-extraction.zeek
Arne Welzel 4027c70e2b Merge branch 'topic/mohan/intel-event-groups' of https://github.com/Mohan-Dhawan/zeek
* 'topic/mohan/intel-event-groups' of https://github.com/Mohan-Dhawan/zeek:
  coalesce smtp handlers for ADDR
  Add fine-grained groups for Intel events

(cherry picked from commit d5e1dc27c6)
2025-05-16 11:57:00 +02:00

28 lines
635 B
Text

@load base/frameworks/intel
@load base/protocols/smtp
@load base/utils/urls
@load ./where-locations
event intel_mime_data(f: fa_file, data: string) &group="Intel::URL"
{
if ( ! f?$conns )
return;
for ( cid, c in f$conns )
{
local urls = find_all_urls_without_scheme(data);
for ( url in urls )
{
Intel::seen([$indicator=url,
$indicator_type=Intel::URL,
$conn=c,
$where=SMTP::IN_MESSAGE]);
}
}
}
event file_new(f: fa_file) &group="Intel::URL"
{
if ( f$source == "SMTP" )
Files::add_analyzer(f, Files::ANALYZER_DATA_EVENT, [$stream_event=intel_mime_data]);
}