"""Autogenerated API"""
from argus_cli.plugin import register_command
[docs]@register_command(extending=("assets","v1","application"))
def search_host_applications_simplified(
keywords: list = None,
keywordField: list = None,
name: list = None,
hostID: list = None,
serviceID: list = None,
businessProcessID: list = None,
customerID: list = None,
ip: list = None,
port: list = None,
protocol: list = None,
cpe: list = None,
includeFlag: list = None,
excludeFlag: list = None,
sortBy: list = None,
offset: int = None,
limit: int = 25,
keywordMatch: str = "all",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns a set of HostApplications defined by query parameters. (PUBLIC)
:param list keywords: Search by keywords
:param list keywordField: Set field strategy for keyword search
:param list name: Search by name
:param list hostID: Search by HostAsset ID
:param list serviceID: Search by ServiceAsset ID
:param list businessProcessID: Search by BusinessProcess ID
:param list customerID: Search by customer ID
:param list ip: Search by IP range
:param list port: Search by application port
:param list protocol: Search by application protocol
:param list cpe: Search by CPE
:param list includeFlag: Include certain HostApplications in the search result based on set flags
:param list excludeFlag: Exclude certain HostApplications from the search result based on set flags
:param list sortBy: Sort search result
:param int offset: Skip a number of results
:param int limit: Maximum number of returned results
:param str keywordMatch: Set match strategy for keyword search
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 708, 'limit': 990, 'responseCode': 200, 'count': 475, 'data': [{'id': 'Term born which reduce protect summer light.', 'name': 'Margaret Stewart', 'description': 'Just house technology fine Mrs model that.', 'createdTimestamp': 13521781, 'createdByUser': {'id': 402, 'customerID': 827, 'userName': 'drivera', 'name': 'Mr. David Hayes'}, 'lastUpdatedTimestamp': 961591499, 'lastUpdatedByUser': {'id': 798, 'customerID': 36, 'userName': 'xevans', 'name': 'Andrew Moore'}, 'deletedTimestamp': 1152336353, 'deletedByUser': {'id': 684, 'customerID': 234, 'userName': 'freemanalexandra', 'name': 'Timothy Brewer'}, 'firstSeenTimestamp': 399057352, 'lastSeenTimestamp': 1051454878, 'flags': ['MISSING_FROM_CVM'], 'properties': {'additionalProperties': 'Develop movie each police reduce.'}, 'cpe': 'Physical bag figure rest back.', 'sockets': ['She beautiful particular.']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'However show end design bill.', 'messageTemplate': 'Tough move piece perform.', 'field': 'None or cultural special they.', 'parameter': {}, 'timestamp': 717860410}], 'currentPage': 250, 'size': 975}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"offset": offset,
"limit": limit,
"keywordMatch": keywordMatch,
"keywords": keywords,
"keywordField": keywordField,
"name": name,
"hostID": hostID,
"serviceID": serviceID,
"businessProcessID": businessProcessID,
"customerID": customerID,
"ip": ip,
"port": port,
"protocol": protocol,
"cpe": cpe,
"includeFlag": includeFlag,
"excludeFlag": excludeFlag,
"sortBy": sortBy
}
response = get(url,
json=body if body else None,
verify=verify,
headers=headers
)
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=("assets","v1","application"))
def add_host_application(
hostID: str = None,
roleID: int = None,
name: str = None,
description: str = None,
properties: dict = None,
cpe: str = None,
sockets: list = None,
source: str = "USER",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Creates a new HostApplication. (PUBLIC)
:param str hostID: Specify parent host.
:param int roleID: Specify application role.
:param str name: Name of application. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str description: Description of application. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict properties: Custom user-defined properties. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str cpe: CPE of application.
:param list sockets: Specify socket strings of the application.
:param str source: Source of the request. (default USER)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 26, 'limit': 756, 'responseCode': 200, 'count': 123, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Some child religious bring.', 'messageTemplate': 'Help office relate work.', 'field': 'Top long ready.', 'parameter': {}, 'timestamp': 797908805}], 'currentPage': 635, 'size': 625}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"source": source,
"hostID": hostID,
"roleID": roleID,
"name": name,
"description": description,
"properties": properties,
"cpe": cpe,
"sockets": sockets
}
response = post(url,
json=body if body else None,
verify=verify,
headers=headers
)
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=("assets","v1","application"))
def search_host_applications(
limit: int = None,
offset: int = None,
subCriteria: list = None,
customerID: list = None,
name: list = None,
startTimestamp: int = None,
endTimestamp: int = None,
keywords: list = None,
keywordMatchStrategy: str = None,
timeMatchStrategy: str = None,
hostID: list = None,
serviceID: list = None,
businessProcessID: list = None,
ipRange: list = None,
applicationPort: list = None,
applicationProtocol: list = None,
cpe: list = None,
hostCPE: list = None,
applicationCPE: list = None,
applicationRole: list = None,
timeFieldStrategy: list = None,
keywordFieldStrategy: list = None,
sortBy: list = None,
includeFlags: list = None,
excludeFlags: list = None,
includeDeleted: bool = None,
exclude: bool = None,
required: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns a set of HostApplications defined by a HostApplicationSearchCriteria. (PUBLIC)
:param int limit: Set this value to set max number of results. By default, no restriction on result set size.
:param int offset: Set this value to skip the first (offset) objects. By default, return result from first object.
:param list subCriteria:
:param list customerID: Restrict search to data belonging to specified customers.
:param list name: Restrict search to specific asset name
:param int startTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (start timestamp).
:param int endTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (end timestamp).
:param list keywords: Search for keywords.
:param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords).
:param str timeMatchStrategy: Defines how strict to match against different timestamps (all/any) using start and end timestamp (default any)
:param list hostID: Restrict search to specific host UUIDs.
:param list serviceID: Restrict search to specific service UUIDs.
:param list businessProcessID: Restrict search to specific business process UUIDs.
:param list ipRange: Restrict search to entities related to these IP-addresses (may specify single IPs, IP networks or IP ranges.
:param list applicationPort: Restrict to applications listening on specific ports.
:param list applicationProtocol: Restrict to applications by transport protocol name.
:param list cpe: Restrict to applications or hosts by CPE.
:param list hostCPE: Restrict to hosts by CPE.
:param list applicationCPE: Restrict to applications by CPE.
:param list applicationRole: Search for applications by role (list of role IDs).
:param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp).
:param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields).
:param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
:param list includeFlags: Only include objects which have includeFlags set.
:param list excludeFlags: Exclude objects which have excludeFlags set.
:param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects.
:param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded.
:param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria).
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 185, 'limit': 567, 'responseCode': 200, 'count': 44, 'data': [{'id': 'Son none until describe executive.', 'name': 'Victor Maddox', 'description': 'Compare eye director news sport speak.', 'createdTimestamp': 1213233160, 'createdByUser': {'id': 977, 'customerID': 57, 'userName': 'stacy67', 'name': 'Andrea Gilmore'}, 'lastUpdatedTimestamp': 1251655643, 'lastUpdatedByUser': {'id': 86, 'customerID': 306, 'userName': 'murraynicholas', 'name': 'Joseph Mcfarland'}, 'deletedTimestamp': 1456665283, 'deletedByUser': {'id': 358, 'customerID': 482, 'userName': 'aprilmurphy', 'name': 'John Evans'}, 'firstSeenTimestamp': 1322274051, 'lastSeenTimestamp': 399868866, 'flags': ['DELETED'], 'properties': {'additionalProperties': 'Majority practice recently green nation kid billion surface.'}, 'cpe': 'Modern here research blue I particularly.', 'sockets': ['Compare bill believe once institution keep picture paper.']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Practice clear rate throughout up woman future.', 'messageTemplate': 'Better alone customer bed.', 'field': 'Clearly finish best front.', 'parameter': {}, 'timestamp': 646337360}], 'currentPage': 240, 'size': 483}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application/search".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"limit": limit,
"offset": offset,
"includeDeleted": includeDeleted,
"subCriteria": subCriteria,
"exclude": exclude,
"required": required,
"customerID": customerID,
"name": name,
"startTimestamp": startTimestamp,
"endTimestamp": endTimestamp,
"keywords": keywords,
"keywordMatchStrategy": keywordMatchStrategy,
"timeMatchStrategy": timeMatchStrategy,
"hostID": hostID,
"serviceID": serviceID,
"businessProcessID": businessProcessID,
"ipRange": ipRange,
"applicationPort": applicationPort,
"applicationProtocol": applicationProtocol,
"cpe": cpe,
"hostCPE": hostCPE,
"applicationCPE": applicationCPE,
"applicationRole": applicationRole,
"timeFieldStrategy": timeFieldStrategy,
"keywordFieldStrategy": keywordFieldStrategy,
"sortBy": sortBy,
"includeFlags": includeFlags,
"excludeFlags": excludeFlags
}
response = post(url,
json=body if body else None,
verify=verify,
headers=headers
)
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=("assets","v1","application"))
def get_host_application(
id: str,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns a HostApplication identified by its ID. (PUBLIC)
:param str id: HostApplication ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 213, 'limit': 259, 'responseCode': 200, 'count': 768, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Raise within late success direction above ground.', 'messageTemplate': 'Rule develop experience hundred month language process.', 'field': 'Out upon machine best avoid seek.', 'parameter': {}, 'timestamp': 1227891280}], 'currentPage': 121, 'size': 8}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
}
response = get(url,
json=body if body else None,
verify=verify,
headers=headers
)
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=("assets","v1","application"))
def update_host_application(
id: str,
roleID: int = None,
name: str = None,
description: str = None,
addProperties: dict = None,
deleteProperties: list = None,
cpe: str = None,
addSockets: list = None,
deleteSockets: list = None,
source: str = "USER",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Updates an existing HostApplication. (PUBLIC)
:param str id: HostApplication ID
:param int roleID: Change application role.
:param str name: Change application name. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str description: Change application description. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict addProperties: Add properties to application (updates a property if key already exists). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list deleteProperties: Remove properties from application by key.
:param str cpe: Change application CPE.
:param list addSockets: Add sockets to application (list of protocol/port, e.g. tcp/80).
:param list deleteSockets: Remove sockets from application (list of protocol/port, e.g. tcp/80).
:param str source: Source of the request. (default USER)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 557, 'limit': 328, 'responseCode': 200, 'count': 820, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'You during contain edge.', 'messageTemplate': 'Somebody six power difference.', 'field': 'Newspaper oil help policy certain thank.', 'parameter': {}, 'timestamp': 242948508}], 'currentPage': 164, 'size': 192}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"source": source,
"roleID": roleID,
"name": name,
"description": description,
"addProperties": addProperties,
"deleteProperties": deleteProperties,
"cpe": cpe,
"addSockets": addSockets,
"deleteSockets": deleteSockets
}
response = put(url,
json=body if body else None,
verify=verify,
headers=headers
)
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=("assets","v1","application"))
def delete_host_application(
id: str,
source: str = "USER",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Marks a HostApplication as deleted. (PUBLIC)
:param str id: HostApplication ID
:param str source: Request source (default USER)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 560, 'limit': 879, 'responseCode': 200, 'count': 939, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Day should positive down.', 'messageTemplate': 'Even world allow.', 'field': 'Approach smile growth cup including.', 'parameter': {}, 'timestamp': 1045571173}], 'currentPage': 466, 'size': 751}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/application/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"source": source
}
response = delete(url,
json=body if body else None,
verify=verify,
headers=headers
)
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