mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Spicy: Register well-known ports through an event handler.
This avoids the earlier problem of not tracking ports correctly in scriptland, while still supporting `port` in EVT files and `%port` in Spicy files. As it turns out we are already following the same approach for file analyzers' MIME types, so I'm applying the same pattern: it's one event per port, without further customization points. That leaves the patch pretty small after all while fixing the original issue.
This commit is contained in:
parent
547144d07e
commit
0d3296590d
13 changed files with 89 additions and 43 deletions
|
@ -47,12 +47,18 @@ export {
|
|||
|
||||
# Marked with &is_used to suppress complaints when there aren't any
|
||||
# Spicy file analyzers loaded, and hence this event can't be generated.
|
||||
# The attribute is only supported for Zeek 5.0 and higher.
|
||||
event spicy_analyzer_for_mime_type(a: Files::Tag, mt: string) &is_used
|
||||
{
|
||||
Files::register_for_mime_type(a, mt);
|
||||
}
|
||||
|
||||
# Marked with &is_used to suppress complaints when there aren't any
|
||||
# Spicy protocol analyzers loaded, and hence this event can't be generated.
|
||||
event spicy_analyzer_for_port(a: Analyzer::Tag, p: port) &is_used
|
||||
{
|
||||
Analyzer::register_for_port(a, p);
|
||||
}
|
||||
|
||||
function enable_protocol_analyzer(tag: Analyzer::Tag) : bool
|
||||
{
|
||||
return Spicy::__toggle_analyzer(tag, T);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue