Source code for api.events.v1.nids

"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command


[docs]@register_command(extending=('events','v1','nids')) def list_n_i_d_s_events(customerID: list = None, signature: list = None, ip: list = None, startTimestamp: int = None, endTimestamp: int = None, limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Simple search for NIDS events (PUBLIC) :param list customerID: Limit to customerID :param list signature: Limit to signature :param list ip: Limit to ip/network :param int startTimestamp: Limit to events after this timestamp (default is last 24 hours) :param int endTimestamp: Limit to events before this timestamp :param int limit: Limit results :param int offset: Offset results :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 1, "limit": 63, "responseCode": 200, "count": 315, "data": [{"properties": {"additionalProperties": "Focus cost indeed hold."}, "comments": [{"timestamp": 138323460, "comment": "Candidate natural Mrs reality note."}], "count": 76, "engineTimestamp": 1124174404, "protocolID": 837, "uri": "Write itself gas dark.", "timestamp": 377061185, "severity": "critical", "flags": ["DESTINATION_IS_CUSTOMERNET"], "id": "Out effect my ready outside."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Word since easy meet specific plan.", "messageTemplate": "Impact will guy worry throughout.", "field": "Best parent financial require add lot nice.", "parameter": {}, "timestamp": 172742343}], "currentPage": 111, "size": 939} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/events/v1/nids".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if limit: body.update({"limit": limit}) if offset: body.update({"offset": offset}) if customerID: body.update({"customerID": customerID}) if signature: body.update({"signature": signature}) if ip: body.update({"ip": ip}) if startTimestamp: body.update({"startTimestamp": startTimestamp}) if endTimestamp: body.update({"endTimestamp": endTimestamp}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('events','v1','nids')) def find_n_i_d_s_events(limit: int = None, offset: int = None, customerID: list = None, eventIdentifier: list = None, locationID: list = None, alarmID: list = None, attackCategoryID: list = None, sourceGeoCountry: list = None, destinationGeoCountry: list = None, geoCountry: list = None, properties: dict = None, sensorID: list = None, subCriteria: list = None, signature: list = None, sortBy: list = None, startTimestamp: int = None, endTimestamp: int = None, includeFlags: list = None, excludeFlags: list = None, lastUpdatedTimestamp: int = None, ip: list = None, destinationIP: list = None, sourceIP: list = None, destinationPort: list = None, sourcePort: list = None, port: list = None, minSeverity: str = None, maxSeverity: str = None, includeDeleted: bool = 'False', exclude: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Search for NIDS events (PUBLIC) :param int limit: Limit results :param int offset: Offset results :param list customerID: Limit result to objects belonging to these customers :param list eventIdentifier: Search for events specified by full ID (type/timestamp/customerid/eventid) :param list locationID: Search for events having these locations :param list alarmID: Search for events having an attack identifier (signature) mapped to any of these alarms :param list attackCategoryID: Search for events having an attack identifier (signature) mapped to any of these categories :param list sourceGeoCountry: Search for events where source IP is registered in any of these countries :param list destinationGeoCountry: Search for events where destination IP is registered in any of these countries :param list geoCountry: Search for events where source or destination IP is registered in any of these countries :param dict properties: Search for events having these properties (logical AND) :param list sensorID: :param list subCriteria: :param list signature: :param list sortBy: Order results by these properties (prefix with - to sort descending) :param int startTimestamp: Search objects from this timestamp :param int endTimestamp: Search objects until this timestamp :param list includeFlags: Search objects with these flags set :param list excludeFlags: Exclude objects with these flags set :param int lastUpdatedTimestamp: Search for events updated after this timestamp :param list ip: :param list destinationIP: :param list sourceIP: :param list destinationPort: :param list sourcePort: :param list port: :param str minSeverity: :param str maxSeverity: :param bool includeDeleted: Also include deleted objects (where implemented) :param bool exclude: Exclude these criteria from the parent criteria :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 592, "limit": 37, "responseCode": 200, "count": 917, "data": [{"properties": {"additionalProperties": "Behavior per born think series."}, "comments": [{"timestamp": 1312721358, "comment": "Serious home cell player standard trial rather."}], "count": 914, "engineTimestamp": 1474361984, "protocolID": 933, "uri": "Smile person course write field hold whole.", "timestamp": 816218243, "severity": "high", "flags": ["CUSTOM_DESTINATION_AGGREGATION"], "id": "Cell model main green pattern nation decision."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Agree floor certain.", "messageTemplate": "Animal market require part.", "field": "Trip western for myself show keep.", "parameter": {}, "timestamp": 824283389}], "currentPage": 895, "size": 417} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/events/v1/nids/search".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if limit: body.update({"limit": limit}) if offset: body.update({"offset": offset}) if includeDeleted: body.update({"includeDeleted": includeDeleted}) if customerID: body.update({"customerID": customerID}) if exclude: body.update({"exclude": exclude}) if eventIdentifier: body.update({"eventIdentifier": eventIdentifier}) if locationID: body.update({"locationID": locationID}) if alarmID: body.update({"alarmID": alarmID}) if attackCategoryID: body.update({"attackCategoryID": attackCategoryID}) if sourceGeoCountry: body.update({"sourceGeoCountry": sourceGeoCountry}) if destinationGeoCountry: body.update({"destinationGeoCountry": destinationGeoCountry}) if geoCountry: body.update({"geoCountry": geoCountry}) if properties: body.update({"properties": properties}) if sensorID: body.update({"sensorID": sensorID}) if subCriteria: body.update({"subCriteria": subCriteria}) if signature: body.update({"signature": signature}) if sortBy: body.update({"sortBy": sortBy}) if startTimestamp: body.update({"startTimestamp": startTimestamp}) if endTimestamp: body.update({"endTimestamp": endTimestamp}) if includeFlags: body.update({"includeFlags": includeFlags}) if excludeFlags: body.update({"excludeFlags": excludeFlags}) if lastUpdatedTimestamp: body.update({"lastUpdatedTimestamp": lastUpdatedTimestamp}) if ip: body.update({"ip": ip}) if destinationIP: body.update({"destinationIP": destinationIP}) if sourceIP: body.update({"sourceIP": sourceIP}) if destinationPort: body.update({"destinationPort": destinationPort}) if sourcePort: body.update({"sourcePort": sourcePort}) if port: body.update({"port": port}) if minSeverity: body.update({"minSeverity": minSeverity}) if maxSeverity: body.update({"maxSeverity": maxSeverity}) response = post(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response