mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
FileAnalysis: finish switching hooks to events.
This commit is contained in:
parent
641154f8e8
commit
a2d9b47bcd
39 changed files with 219 additions and 305 deletions
|
@ -18,18 +18,15 @@ export {
|
|||
extraction_file: string &log &optional;
|
||||
|
||||
## Indicates if the response body is to be extracted or not. Must be
|
||||
## set before or by the first :bro:enum:`FileAnalysis::TRIGGER_NEW`
|
||||
## for the file content.
|
||||
## set before or by the first :bro:see:`file_new` for the file content.
|
||||
extract_file: bool &default=F;
|
||||
};
|
||||
}
|
||||
|
||||
global extract_count: count = 0;
|
||||
|
||||
hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
||||
&priority=5
|
||||
event file_type(f: fa_file) &priority=5
|
||||
{
|
||||
if ( trig != FileAnalysis::TRIGGER_TYPE ) return;
|
||||
if ( ! f?$mime_type ) return;
|
||||
if ( ! f?$source ) return;
|
||||
if ( f$source != "HTTP" ) return;
|
||||
|
@ -56,10 +53,8 @@ hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
|||
}
|
||||
}
|
||||
|
||||
hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
||||
&priority=5
|
||||
event file_new(f: fa_file) &priority=5
|
||||
{
|
||||
if ( trig != FileAnalysis::TRIGGER_NEW ) return;
|
||||
if ( ! f?$source ) return;
|
||||
if ( f$source != "HTTP" ) return;
|
||||
if ( ! f?$conns ) return;
|
||||
|
|
|
@ -23,10 +23,8 @@ export {
|
|||
&redef;
|
||||
}
|
||||
|
||||
hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
||||
&priority=5
|
||||
event file_type(f: fa_file) &priority=5
|
||||
{
|
||||
if ( trig != FileAnalysis::TRIGGER_TYPE ) return;
|
||||
if ( ! f?$mime_type ) return;
|
||||
if ( ! f?$source ) return;
|
||||
if ( f$source != "HTTP" ) return;
|
||||
|
|
|
@ -34,10 +34,8 @@ export {
|
|||
const ignored_incorrect_file_type_urls = /^$/ &redef;
|
||||
}
|
||||
|
||||
hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
||||
&priority=5
|
||||
event file_type(f: fa_file) &priority=5
|
||||
{
|
||||
if ( trig != FileAnalysis::TRIGGER_TYPE ) return;
|
||||
if ( ! f?$mime_type ) return;
|
||||
if ( ! f?$source ) return;
|
||||
if ( f$source != "HTTP" ) return;
|
||||
|
@ -68,16 +66,14 @@ hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
|||
}
|
||||
}
|
||||
|
||||
hook FileAnalysis::policy(trig: FileAnalysis::Trigger, f: fa_file)
|
||||
&priority=5
|
||||
event file_over_new_connection(f: fa_file) &priority=5
|
||||
{
|
||||
if ( trig != FileAnalysis::TRIGGER_NEW_CONN ) return;
|
||||
if ( ! f?$mime_type ) return;
|
||||
if ( ! f?$source ) return;
|
||||
if ( f$source != "HTTP" ) return;
|
||||
if ( ! f?$conns ) return;
|
||||
|
||||
# Spread the mime around (e.g. for partial content, TRIGGER_TYPE only
|
||||
# Spread the mime around (e.g. for partial content, file_type event only
|
||||
# happens once for the first connection, but if there's subsequent
|
||||
# connections to transfer the same file, they'll be lacking the mime_type
|
||||
# field if we don't do this).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue