mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
analyzer/files: handle non-analyzer names in describe_file()
When a fa_file object is created through the use of Input::add_analysis(), the fa_file's source is likely not valid representation of an analyzer's tag and a Files::describe() should not error and instead return an empty description. Add a new Analyzer::is_tag() helper that can be used to pre-check `f$source`.
This commit is contained in:
parent
1e06c8bfda
commit
85ce48eb1e
7 changed files with 97 additions and 8 deletions
|
@ -88,6 +88,16 @@ export {
|
|||
## Returns: The analyzer name corresponding to the tag.
|
||||
global name: function(tag: Analyzer::Tag) : string;
|
||||
|
||||
## Check whether the given analyzer name exists.
|
||||
##
|
||||
## This can be used before calling :zeek:see:`Analyzer::get_tag` to
|
||||
## verify that the given name as string is a valid analyzer name.
|
||||
##
|
||||
## name: The analyzer name.
|
||||
##
|
||||
## Returns: True if the given name is a valid analyzer, else false.
|
||||
global has_tag: function(name: string): bool;
|
||||
|
||||
## Translates an analyzer's name to a tag enum value.
|
||||
##
|
||||
## name: The analyzer name.
|
||||
|
@ -216,6 +226,11 @@ function name(atype: AllAnalyzers::Tag) : string
|
|||
return __name(atype);
|
||||
}
|
||||
|
||||
function has_tag(name: string): bool
|
||||
{
|
||||
return __has_tag(name);
|
||||
}
|
||||
|
||||
function get_tag(name: string): AllAnalyzers::Tag
|
||||
{
|
||||
return __tag(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue