mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

While we support initializing records via coercion from an expression list, e.g., local x: X = [$x1=1, $x2=2]; this can sometimes obscure the code to readers, e.g., when assigning to value declared and typed elsewhere. The language runtime has a similar overhead since instead of just constructing a known type it needs to check at runtime that the coercion from the expression list is valid; this can be slower than just writing the readible code in the first place, see #4559. With this patch we use explicit construction, e.g., local x = X($x1=1, $x2=2);
28 lines
698 B
Text
28 lines
698 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(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, Files::AnalyzerArgs($stream_event=intel_mime_data));
|
|
}
|