Signatures
ptnad.api.signatures.SignaturesAPI
Methods:
Name | Description |
---|---|
apply_changes |
Apply changes made to Rules and commit them to sensors. |
get_classes |
Get a list of signature classes. |
get_rule |
Get information about a specific Rule. |
get_rules |
Get a list of Rules. |
get_stats |
Get statistics about Rules. |
revert_changes |
Revert changes made to Rules. |
update_rule |
Update a Rule. |
Source code in src/ptnad/api/signatures.py
apply_changes
Apply changes made to Rules and commit them to sensors.
Returns: Dict[str, str]: A dictionary with the hashsum of the package.
Raises: PTNADAPIError: If there's an error applying the changes.
Source code in src/ptnad/api/signatures.py
get_classes
get_classes(search: str | None = None, ordering: str | None = None, **filters) -> List[Dict[str, Any]]
Get a list of signature classes.
Args: search (Optional[str]): Keyword to filter the classes. ordering (Optional[str]): Field to sort the results by. **filters: Additional filters (name, title, priority).
Returns: List[Dict[str, Any]]: A list of dictionaries containing signature class information.
Raises: PTNADAPIError: If there's an error retrieving the classes.
Source code in src/ptnad/api/signatures.py
get_rule
Get information about a specific Rule.
Args: rule_id (int): sid of the Rule.
Returns: Dict[str, Any]: Information about the Rule.
Raises: PTNADAPIError: If there's an error retrieving the rule.
Source code in src/ptnad/api/signatures.py
get_rules
get_rules(search: str | None = None, ordering: str | None = None, limit: int = 100, offset: int = 0, **filters) -> List[Dict[str, Any]]
Get a list of Rules.
Args: search (Optional[str]): Keyword to filter the rules. ordering (Optional[str]): Field to sort the results by. limit (int): Maximum number of rules to return (default: 100). offset (int): Number of rules to skip (default: 0). *filters: Additional filters. Available filters: sid: Filter by sid (can be a single value or a list) sid__gte: sid greater than or equal to sid__lt: sid less than vendor: Filter by vendor name (can be a single value or a list) enabled: Filter by enabled status (true or false) has_redef: Filter by has_redef status (true or false) has_exceptions: Filter by has_exceptions status (true or false) priority: Filter by priority (if priority=4, finds all rules with priority>=4) cls: Filter by class name (can be a single value or a list) diff: Filter by rule changes, valid values (can be a list): added (+), updated (), removed (-), unchanged (=). Available in 12.2+ has_error: Filter by has_error status (true or false) client: Search for IP address in src_adr and dst_adr server: Search for IP address in src_adr and dst_adr
Returns: List[Dict[str, Any]]: A list of dictionaries containing Rule information.
Raises: PTNADAPIError: If there's an error retrieving the rules.
Source code in src/ptnad/api/signatures.py
get_stats
Get statistics about Rules.
Returns: Dict[str, Any]: Statistics about Rules.
Raises: PTNADAPIError: If there's an error retrieving the statistics.
Source code in src/ptnad/api/signatures.py
revert_changes
Revert changes made to Rules.
Raises: PTNADAPIError: If there's an error reverting the changes.
Source code in src/ptnad/api/signatures.py
update_rule
Update a Rule.
Args: rule_id (int): ID of the Rule to update. **kwargs: Fields to update (enabled, action, msg, etc.).
Returns: Dict[str, Any]: Updated information about the Rule.
Raises: PTNADAPIError: If there's an error updating the rule.