mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Adding Files::register_for_mime_type() to associate a file analyzer
with a MIME type. Whenever that MIME is detected, Bro will now automatically activate the analyzer. The interface mimics how well-known ports are defined for protocol analyzers. This isn't actually used by any existing file analyzer (because we don't have any yet that target a specific file format), but there's a test making sure it works.
This commit is contained in:
parent
ab3d214a90
commit
c9524757d2
9 changed files with 104 additions and 675 deletions
|
@ -60,6 +60,13 @@ function Files::__analyzer_name%(tag: Files::Tag%) : string
|
|||
return new StringVal(file_mgr->GetComponentName(tag));
|
||||
%}
|
||||
|
||||
## :bro:see:`Files::register_for_mime_type`.
|
||||
function Files::__register_for_mime_type%(id: Analyzer::Tag, mt: string%) : bool
|
||||
%{
|
||||
bool result = file_mgr->RegisterAnalyzerForMIMEType(id->AsEnumVal(), mt);
|
||||
return new Val(result, TYPE_BOOL);
|
||||
%}
|
||||
|
||||
module GLOBAL;
|
||||
|
||||
## For use within a :bro:see:`get_file_handle` handler to set a unique
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue