"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('assets','v1','vulnerability'))
def search_asset_vulnerabilities_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, vulnID: list = None, vulnRef: list = None, resolutionCode: list = None, includeFlag: list = None, excludeFlag: list = None, sortBy: list = None, offset: int = 0, limit: int = 25, keywordMatch: str = 'all',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns as set of AssetVulnerabilities 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 vulnID: Search by vulnerability ID
:param list vulnRef: Search by vulnerability reference
:param list resolutionCode: Search by resolution code
:param list includeFlag: Include certain BusinessProcesses in the search result based on set flags
:param list excludeFlag: Exclude certain BusinessProcesses 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": 450, "limit": 184, "responseCode": 200, "count": 875, "data": [{"id": "His home increase hair senior.", "vulnerabilityID": "Accept activity radio teacher cover interview.", "references": ["Whether professional talk begin range."], "name": "Alyssa Martinez", "description": "Play season something officer maybe.", "conclusion": "Base college success else very across.", "solution": "Prevent floor project hair mother picture indicate.", "rawOutput": "Detail stay your as.", "cvss": 680, "createdTimestamp": 953427274, "createdByUser": {"id": 216, "customerID": 221, "userName": "kevinmatthews", "name": "Brian Jones"}, "lastUpdatedTimestamp": 1316362350, "lastUpdatedByUser": {"id": 906, "customerID": 810, "userName": "johnduncan", "name": "Jonathan Powell"}, "deletedTimestamp": 851035837, "deletedByUser": {"id": 785, "customerID": 873, "userName": "tpowell", "name": "Michael Knight PhD"}, "firstSeenTimestamp": 16298616, "lastSeenTimestamp": 592701842, "resolutionTimestamp": 278356871, "resolvedByUser": {"id": 22, "customerID": 324, "userName": "jessica58", "name": "Laura Lewis"}, "resolutionComment": "Fight current way fly hand.", "resolution": "SERVICE_NOT_AVAILABLE", "flags": ["DETECTED_BY_CVM"], "properties": {"additionalProperties": "World foot similar contain government since speech."}, "severity": "critical", "socket": "Sort force information article treat."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Camera realize begin might remain adult.", "messageTemplate": "Despite apply there through anyone job chair.", "field": "Various will station medical.", "parameter": {}, "timestamp": 905979064}], "currentPage": 172, "size": 572}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability".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 offset:
body.update({"offset": offset})
if limit:
body.update({"limit": limit})
if keywordMatch:
body.update({"keywordMatch": keywordMatch})
if keywords:
body.update({"keywords": keywords})
if keywordField:
body.update({"keywordField": keywordField})
if name:
body.update({"name": name})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if customerID:
body.update({"customerID": customerID})
if ip:
body.update({"ip": ip})
if port:
body.update({"port": port})
if protocol:
body.update({"protocol": protocol})
if cpe:
body.update({"cpe": cpe})
if vulnID:
body.update({"vulnID": vulnID})
if vulnRef:
body.update({"vulnRef": vulnRef})
if resolutionCode:
body.update({"resolutionCode": resolutionCode})
if includeFlag:
body.update({"includeFlag": includeFlag})
if excludeFlag:
body.update({"excludeFlag": excludeFlag})
if sortBy:
body.update({"sortBy": sortBy})
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=('assets','v1','vulnerability'))
def add_asset_vulnerability(hostID: str = None, vulnerabilityID: str = None, references: list = None, name: str = None, description: str = None, conclusion: str = None, solution: str = None, rawOutput: str = None, cvss: int = None, severity: str = None, properties: dict = None, socket: str = None, source: str = 'USER', exploitAvailable: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Creates a new AssetVulnerability. (PUBLIC)
:param str hostID: Specify parent host.
:param str vulnerabilityID: Identifier of vulnerability (e.g. plug-in ID from vulnerability scanner). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list references: References to vulnerability (e.g. CVE number).
:param str name: Name of vulnerability. Will be sanitized and no line break allowed.
:param str description: Description of vulnerability. Will be sanitized.
:param str conclusion: Short summary of vulnerability. Will be sanitized.
:param str solution: How to fix vulnerability. Will be sanitized.
:param str rawOutput: Raw output from vulnerability scan. Will be sanitized.
:param int cvss: CVSS score of vulnerability (range from 0 to 10).
:param str severity: Severity level of vulnerability.
:param dict properties: Custom user-defined properties. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str socket: Specify socket string of the vulnerability (e.g. tcp/80), or omit if not bound to a socket.
:param str source: Source of the request. (default USER)
:param bool exploitAvailable: Set if an exploit is available for the vulnerability.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 205, "limit": 618, "responseCode": 200, "count": 484, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Maintain determine join support.", "messageTemplate": "Word pretty however important.", "field": "Trip keep writer policy huge.", "parameter": {}, "timestamp": 712057104}], "currentPage": 544, "size": 237}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability".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 source:
body.update({"source": source})
if hostID:
body.update({"hostID": hostID})
if vulnerabilityID:
body.update({"vulnerabilityID": vulnerabilityID})
if references:
body.update({"references": references})
if name:
body.update({"name": name})
if description:
body.update({"description": description})
if conclusion:
body.update({"conclusion": conclusion})
if solution:
body.update({"solution": solution})
if rawOutput:
body.update({"rawOutput": rawOutput})
if cvss:
body.update({"cvss": cvss})
if severity:
body.update({"severity": severity})
if properties:
body.update({"properties": properties})
if exploitAvailable:
body.update({"exploitAvailable": exploitAvailable})
if socket:
body.update({"socket": socket})
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
[docs]@register_command(extending=('assets','v1','vulnerability'))
def search_asset_vulnerabilities(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, minimumCvss: int = None, maximumCvss: int = None, severity: list = None, resolutionCode: list = None, vulnerabilityReference: list = None, vulnerabilityID: list = None, timeFieldStrategy: list = None, keywordFieldStrategy: list = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeRawOutput: bool = 'False', includeConclusion: bool = 'False', includeSolution: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a set of AssetVulnerabilities defined by an AssetVulnerabilitySearchCriteria. (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 int minimumCvss: Restrict search to vulnerabilities with CVSS score at least this high.
:param int maximumCvss: Restrict search to vulnerabilities with CVSS score no more than this.
:param list severity: Restrict search to specified severity levels.
:param list resolutionCode: Restrict search to specific resolution codes.
:param list vulnerabilityReference: Restrict to vulnerabilities identified by vulnerability reference.
:param list vulnerabilityID: Restrict to vulnerabilities identified by vulnerability ID.
: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).
:param bool includeRawOutput: Include vulnerability rawOutput in result (default false)
:param bool includeConclusion: Include vulnerability conclusion in result (default false)
:param bool includeSolution: Include vulnerability solution in result (default false)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 824, "limit": 315, "responseCode": 200, "count": 446, "data": [{"id": "Hold sing world hit laugh PM federal.", "vulnerabilityID": "In law individual today middle activity.", "references": ["Research heart off quickly go people brother."], "name": "Patricia Morales", "description": "Response history hundred seek growth.", "conclusion": "Wall charge pull hand.", "solution": "Else seem some mean.", "rawOutput": "There ground treat same.", "cvss": 128, "createdTimestamp": 1298798831, "createdByUser": {"id": 347, "customerID": 553, "userName": "qmorgan", "name": "Beverly Allen"}, "lastUpdatedTimestamp": 967414679, "lastUpdatedByUser": {"id": 440, "customerID": 420, "userName": "paul99", "name": "Gabriel Martin"}, "deletedTimestamp": 299746488, "deletedByUser": {"id": 681, "customerID": 7, "userName": "timothy74", "name": "Cody Rodriguez"}, "firstSeenTimestamp": 999216036, "lastSeenTimestamp": 34600864, "resolutionTimestamp": 52201804, "resolvedByUser": {"id": 290, "customerID": 848, "userName": "ambermathews", "name": "Daniel Carrillo"}, "resolutionComment": "Become thought drug section apply.", "resolution": "FALSE_POSITIVE", "flags": ["UPDATED_BY_CVM"], "properties": {"additionalProperties": "Talk suffer list admit herself continue any."}, "severity": "low", "socket": "Receive which idea less always."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Work sound study social form part check choice.", "messageTemplate": "Language subject police civil little interesting interest.", "field": "Job partner small all.", "parameter": {}, "timestamp": 1440263576}], "currentPage": 186, "size": 126}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/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 subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if name:
body.update({"name": name})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if keywords:
body.update({"keywords": keywords})
if keywordMatchStrategy:
body.update({"keywordMatchStrategy": keywordMatchStrategy})
if timeMatchStrategy:
body.update({"timeMatchStrategy": timeMatchStrategy})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if ipRange:
body.update({"ipRange": ipRange})
if applicationPort:
body.update({"applicationPort": applicationPort})
if applicationProtocol:
body.update({"applicationProtocol": applicationProtocol})
if cpe:
body.update({"cpe": cpe})
if hostCPE:
body.update({"hostCPE": hostCPE})
if applicationCPE:
body.update({"applicationCPE": applicationCPE})
if minimumCvss:
body.update({"minimumCvss": minimumCvss})
if maximumCvss:
body.update({"maximumCvss": maximumCvss})
if severity:
body.update({"severity": severity})
if resolutionCode:
body.update({"resolutionCode": resolutionCode})
if vulnerabilityReference:
body.update({"vulnerabilityReference": vulnerabilityReference})
if vulnerabilityID:
body.update({"vulnerabilityID": vulnerabilityID})
if timeFieldStrategy:
body.update({"timeFieldStrategy": timeFieldStrategy})
if keywordFieldStrategy:
body.update({"keywordFieldStrategy": keywordFieldStrategy})
if includeRawOutput:
body.update({"includeRawOutput": includeRawOutput})
if includeConclusion:
body.update({"includeConclusion": includeConclusion})
if includeSolution:
body.update({"includeSolution": includeSolution})
if sortBy:
body.update({"sortBy": sortBy})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
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
[docs]@register_command(extending=('assets','v1','vulnerability'))
def search_asset_vulnerability_statistics(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, minimumCvss: int = None, maximumCvss: int = None, severity: list = None, resolutionCode: list = None, vulnerabilityReference: list = None, vulnerabilityID: list = None, timeFieldStrategy: list = None, keywordFieldStrategy: list = None, groupBy: list = None, values: list = None, resolution: int = None, cutoff: int = None, cutoffValue: str = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeRawOutput: bool = 'False', includeConclusion: bool = 'False', includeSolution: bool = 'False', includeOthers: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch asset vulnerability statistics base on criteria (DEV)
: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 int minimumCvss: Restrict search to vulnerabilities with CVSS score at least this high.
:param int maximumCvss: Restrict search to vulnerabilities with CVSS score no more than this.
:param list severity: Restrict search to specified severity levels.
:param list resolutionCode: Restrict search to specific resolution codes.
:param list vulnerabilityReference: Restrict to vulnerabilities identified by vulnerability reference.
:param list vulnerabilityID: Restrict to vulnerabilities identified by vulnerability ID.
: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 groupBy: Specify which fields will be grouped by in stats
:param list values: Specify which values will be included in stats (default vulnerabilities)
:param int resolution: Stats resolution period in milliseconds, if is 0 means to generate non-timeline statistics
:param int cutoff: Reduce stats keys to the cutoff amount of keys that has largest hit count, default 0 means no reduce
:param str cutoffValue: Specify which value to be cutoff on (default vulnerabilities)
: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).
:param bool includeRawOutput: Include vulnerability rawOutput in result (default false)
:param bool includeConclusion: Include vulnerability conclusion in result (default false)
:param bool includeSolution: Include vulnerability solution in result (default false)
:param bool includeOthers: If reduce (cutoff >0), true means remaining keys (other than cutoff keys) are collected into an "other" key, default false
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 308, "limit": 722, "responseCode": 200, "count": 679, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Room customer nation happen bed rise left.", "messageTemplate": "Speech dinner decide agent plan pick ready card.", "field": "Throw kitchen room environmental face.", "parameter": {}, "timestamp": 1238820889}], "currentPage": 116, "size": 442}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/statistics".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 subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if name:
body.update({"name": name})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if keywords:
body.update({"keywords": keywords})
if keywordMatchStrategy:
body.update({"keywordMatchStrategy": keywordMatchStrategy})
if timeMatchStrategy:
body.update({"timeMatchStrategy": timeMatchStrategy})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if ipRange:
body.update({"ipRange": ipRange})
if applicationPort:
body.update({"applicationPort": applicationPort})
if applicationProtocol:
body.update({"applicationProtocol": applicationProtocol})
if cpe:
body.update({"cpe": cpe})
if hostCPE:
body.update({"hostCPE": hostCPE})
if applicationCPE:
body.update({"applicationCPE": applicationCPE})
if minimumCvss:
body.update({"minimumCvss": minimumCvss})
if maximumCvss:
body.update({"maximumCvss": maximumCvss})
if severity:
body.update({"severity": severity})
if resolutionCode:
body.update({"resolutionCode": resolutionCode})
if vulnerabilityReference:
body.update({"vulnerabilityReference": vulnerabilityReference})
if vulnerabilityID:
body.update({"vulnerabilityID": vulnerabilityID})
if timeFieldStrategy:
body.update({"timeFieldStrategy": timeFieldStrategy})
if keywordFieldStrategy:
body.update({"keywordFieldStrategy": keywordFieldStrategy})
if includeRawOutput:
body.update({"includeRawOutput": includeRawOutput})
if includeConclusion:
body.update({"includeConclusion": includeConclusion})
if includeSolution:
body.update({"includeSolution": includeSolution})
if groupBy:
body.update({"groupBy": groupBy})
if values:
body.update({"values": values})
if resolution:
body.update({"resolution": resolution})
if cutoff:
body.update({"cutoff": cutoff})
if cutoffValue:
body.update({"cutoffValue": cutoffValue})
if includeOthers:
body.update({"includeOthers": includeOthers})
if sortBy:
body.update({"sortBy": sortBy})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
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
[docs]@register_command(extending=('assets','v1','vulnerability'))
def get_asset_vulnerability(id: str, includeRawOutput: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns an AssetVulnerability identified by its ID. (PUBLIC)
:param str id: AssetVulnerability ID
:param bool includeRawOutput: Include raw output
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 727, "limit": 963, "responseCode": 200, "count": 269, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Capital figure officer.", "messageTemplate": "Subject course room yourself.", "field": "Staff also director unit seem.", "parameter": {}, "timestamp": 438407466}], "currentPage": 176, "size": 27}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/{id}".format(id=id)
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 includeRawOutput:
body.update({"includeRawOutput": includeRawOutput})
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=('assets','v1','vulnerability'))
def update_asset_vulnerability(id: str, addReferences: list = None, deleteReferences: list = None, name: str = None, description: str = None, conclusion: str = None, solution: str = None, rawOutput: str = None, cvss: int = None, severity: str = None, addProperties: dict = None, deleteProperties: list = None, source: str = 'USER', exploitAvailable: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Updates an existing AssetVulnerability. (PUBLIC)
:param str id: AssetVulnerability ID
:param list addReferences: Add references to vulnerability (e.g. CVE number).
:param list deleteReferences: Delete references from vulnerability.
:param str name: Change vulnerability name. Will be sanitized and no line break allowed.
:param str description: Change vulnerability description. Will be sanitized.
:param str conclusion: Change vulnerability summary. Will be sanitized.
:param str solution: Change vulnerability solution. Will be sanitized.
:param str rawOutput: Change raw output from vulnerability scan. Will be sanitized.
:param int cvss: Change CVSS score of vulnerability (range from 0 to 10).
:param str severity: Change severity level of vulnerability.
:param dict addProperties: Add custom properties (updates a property if key already exists). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list deleteProperties: Delete custom properties by key.
:param str source: Source of the request. (default USER)
:param bool exploitAvailable: Set if an exploit is available for the vulnerability.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 64, "limit": 544, "responseCode": 200, "count": 532, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Nature draw continue protect.", "messageTemplate": "Kitchen notice into draw.", "field": "Hospital great other represent model people decide whatever.", "parameter": {}, "timestamp": 1221989607}], "currentPage": 170, "size": 719}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/{id}".format(id=id)
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 source:
body.update({"source": source})
if addReferences:
body.update({"addReferences": addReferences})
if deleteReferences:
body.update({"deleteReferences": deleteReferences})
if name:
body.update({"name": name})
if description:
body.update({"description": description})
if conclusion:
body.update({"conclusion": conclusion})
if solution:
body.update({"solution": solution})
if rawOutput:
body.update({"rawOutput": rawOutput})
if cvss:
body.update({"cvss": cvss})
if severity:
body.update({"severity": severity})
if addProperties:
body.update({"addProperties": addProperties})
if deleteProperties:
body.update({"deleteProperties": deleteProperties})
if exploitAvailable:
body.update({"exploitAvailable": exploitAvailable})
response = put(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=('assets','v1','vulnerability'))
def delete_asset_vulnerability(id: str, source: str = 'USER',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Marks an AssetVulnerability as deleted. (PUBLIC)
:param str id: AssetVulnerability 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": 784, "limit": 500, "responseCode": 200, "count": 957, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Around political popular.", "messageTemplate": "Need view public energy.", "field": "Board kind worker box successful paper fear.", "parameter": {}, "timestamp": 962464163}], "currentPage": 596, "size": 275}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/{id}".format(id=id)
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 source:
body.update({"source": source})
response = delete(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=('assets','v1','vulnerability'))
def resolve_asset_vulnerability(id: str, resolution: str = None, comment: str = None, source: str = 'USER',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Resolves an AssetVulnerability. (PUBLIC)
:param str id: AssetVulnerability ID
:param str resolution: Specify resolution reason.
:param str comment: Comment on why the vulnerability is resolved. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
: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": 334, "limit": 422, "responseCode": 200, "count": 668, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Hospital happy future dark ok ready break area.", "messageTemplate": "Green window far art us eye.", "field": "Same house whom point but cost site wear.", "parameter": {}, "timestamp": 802734828}], "currentPage": 596, "size": 343}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/vulnerability/{id}/resolve".format(id=id)
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 source:
body.update({"source": source})
if resolution:
body.update({"resolution": resolution})
if comment:
body.update({"comment": comment})
response = put(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