Skip to content

local_site.py

Configuration objects built around the site/local.zeek file.

To import...

from dynamite_nsm.services.base.config_objects.zeek import local_site as zeek_config_local_site

Definition

__init__(self, name, value, enabled=False) special

A global variable applied at runtime.

Parameters:

Name Type Description Default
name str

The name of the definition

required
value str

The value associated with the definition

required
enabled Optional[bool]

Whether or not this definition should be enabled

False
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, name: str, value: str, enabled: Optional[bool] = False):
    """A global variable applied at runtime.
    Args:
        name: The name of the definition
        value: The value associated with the definition
        enabled: Whether or not this definition should be enabled
    """
    super().__init__(name, enabled)
    self.value = value

get_raw(self)

Get a raw representation of this Definition

Returns:

Type Description
str

A redef statement that can be inserted into Zeek's site/local.zeek

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> str:
    """Get a raw representation of this Definition
    Returns:
        A redef statement that can be inserted into Zeek's site/local.zeek
    """
    if self.enabled:
        return f'redef {self.name} = {self.value}'
    return f'#redef {self.name} = {self.value}'

Definitions

__init__(self, definitions=None) special

A collection of Definitions

Parameters:

Name Type Description Default
definitions List[dynamite_nsm.services.base.config_objects.zeek.local_site.Definition]

A collection of Definition objects

None
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, definitions: List[Definition] = None):
    """A collection of Definitions
    Args:
        definitions: A collection of Definition objects
    """
    super().__init__(definitions)
    self.definitions = self.analyzers

get_raw(self)

Get a list of all the Definitions that can be inserted directly into the site/local.zeek file

Returns:

Type Description
List[str]

A list of redef statements

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> List[str]:
    """Get a list of all the Definitions that can be inserted directly into the site/local.zeek file
    Returns:
        A list of redef statements
    """
    return [definition.get_raw() for definition in self.definitions]

Script

__init__(self, name, enabled=False) special

A script that performs some form of analysis

Parameters:

Name Type Description Default
name str

The name of the definition

required
enabled Optional[bool]

Whether or not this script should be enabled

False
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, name: str, enabled: Optional[bool] = False):
    """A script that performs some form of analysis
    Args:
        name: The name of the definition
        enabled: Whether or not this script should be enabled
    """
    self.value = None
    super().__init__(name, enabled)

get_raw(self)

Get a raw representation of this Script

Returns:

Type Description
str

A @load statement that can be inserted into Zeek's site/local.zeek

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> str:
    """Get a raw representation of this Script
    Returns:
        A @load statement that can be inserted into Zeek's site/local.zeek
    """
    if self.enabled:
        return f'@load {self.name}'
    return f'#@load {self.name}'

Scripts

__init__(self, scripts=None) special

A collection of Scripts

Parameters:

Name Type Description Default
scripts Optional[List[dynamite_nsm.services.base.config_objects.zeek.local_site.Script]]

A collection of Script objects

None
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, scripts: Optional[List[Script]] = None):
    """A collection of Scripts
    Args:
        scripts: A collection of Script objects
    """
    super().__init__(scripts)
    self.scripts = self.analyzers

get_raw(self)

Get a list of all the Scripts that can be inserted directly into the site/local.zeek file

Returns:

Type Description
List[str]

A list of @load statements

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> List[str]:
    """Get a list of all the Scripts that can be inserted directly into the site/local.zeek file
    Returns:
        A list of @load statements
    """
    return [script.get_raw() for script in self.scripts]

Signature

__init__(self, name, enabled=False) special

A signature set made available at runtime.

Parameters:

Name Type Description Default
name str

The name of the signature

required
enabled Optional[bool]

Whether or not this definition should be enabled

False
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, name: str, enabled: Optional[bool] = False):
    """A signature set made available at runtime.
    Args:
        name: The name of the signature
        enabled: Whether or not this definition should be enabled
    """
    self.value = None
    super().__init__(name, enabled)

get_raw(self)

Get a raw representation of this Signature

Returns:

Type Description
str

A @load-sig statement that can be inserted into Zeek's site/local.zeek

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> str:
    """Get a raw representation of this Signature
    Returns:
        A @load-sig statement that can be inserted into Zeek's site/local.zeek
    """
    if self.enabled:
        return f'@load-sigs {self.name}'
    return f'#@load-sigs {self.name}'

Signatures

__init__(self, signatures=None) special

A collection of Signatures

Parameters:

Name Type Description Default
signatures Optional[List[dynamite_nsm.services.base.config_objects.zeek.local_site.Signature]]

A collection of Signature objects

None
Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def __init__(self, signatures: Optional[List[Signature]] = None):
    """A collection of Signatures
    Args:
        signatures: A collection of Signature objects
    """
    super().__init__(signatures)
    self.signatures = self.analyzers

get_raw(self)

Get a list of all the Signatures that can be inserted directly into the site/local.zeek file

Returns:

Type Description
List[str]

A list of @load-sigs statements

Source code in dynamite_nsm/services/base/config_objects/zeek/local_site.py
def get_raw(self) -> List[str]:
    """Get a list of all the Signatures that can be inserted directly into the site/local.zeek file
    Returns:
        A list of @load-sigs statements
    """
    return [signature.get_raw() for signature in self.signatures]