"""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": 455, "limit": 371, "responseCode": 200, "count": 55, "data": [{"id": "Meet week investment.", "vulnerabilityID": "According buy any.", "references": ["Catch then along."], "name": "William Marsh", "description": "Stop break actually reduce all listen.", "conclusion": "Many sure this another impact.", "solution": "Government rest piece network design music face several.", "rawOutput": "So school order and.", "cvss": 436, "createdTimestamp": 163472649, "createdByUser": {"id": 712, "customerID": 256, "userName": "harmonwilliam", "name": "Michael Mendoza"}, "lastUpdatedTimestamp": 117354730, "lastUpdatedByUser": {"id": 197, "customerID": 147, "userName": "harveykyle", "name": "Cindy Pena"}, "deletedTimestamp": 229854264, "deletedByUser": {"id": 464, "customerID": 722, "userName": "whiggins", "name": "David Best"}, "firstSeenTimestamp": 1256100572, "lastSeenTimestamp": 674874548, "resolutionTimestamp": 992538892, "resolvedByUser": {"id": 486, "customerID": 921, "userName": "erik86", "name": "Jennifer West"}, "resolutionComment": "Big different sometimes decide thank.", "resolution": "FALSE_POSITIVE", "flags": ["DETECTED_BY_CVM"], "properties": {"additionalProperties": "Shake cold top treatment near."}, "severity": "low", "socket": "Alone air finish government know respond can couple."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Something position hospital mean past.", "messageTemplate": "Often data coach cell.", "field": "Forget suggest share himself power.", "parameter": {}, "timestamp": 57228989}], "currentPage": 337, "size": 238}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.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": 959, "limit": 571, "responseCode": 200, "count": 634, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Glass majority from scientist.", "messageTemplate": "Theory affect more friend.", "field": "Top enough often but.", "parameter": {}, "timestamp": 318194912}], "currentPage": 655, "size": 791}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.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": 930, "limit": 524, "responseCode": 200, "count": 860, "data": [{"id": "Return cup scientist spring newspaper history upon protect.", "vulnerabilityID": "Face what simple boy off black.", "references": ["Most speech practice animal keep."], "name": "Alexis Arroyo", "description": "Rest stuff there specific much paper system.", "conclusion": "Station moment participant throw together me nation.", "solution": "Require trade create.", "rawOutput": "Far alone available sea team since book.", "cvss": 533, "createdTimestamp": 801926589, "createdByUser": {"id": 591, "customerID": 941, "userName": "urobertson", "name": "Mary Robinson"}, "lastUpdatedTimestamp": 1221565363, "lastUpdatedByUser": {"id": 551, "customerID": 105, "userName": "andrewwhite", "name": "Taylor Martin MD"}, "deletedTimestamp": 1465830301, "deletedByUser": {"id": 330, "customerID": 203, "userName": "masoneileen", "name": "Jeffery Rowland"}, "firstSeenTimestamp": 228986394, "lastSeenTimestamp": 525329777, "resolutionTimestamp": 1310502630, "resolvedByUser": {"id": 210, "customerID": 314, "userName": "austin40", "name": "Joseph Gilbert"}, "resolutionComment": "Six contain let company.", "resolution": "ACCEPTED", "flags": ["UPDATED_BY_CVM"], "properties": {"additionalProperties": "Available operation others."}, "severity": "critical", "socket": "Man happen institution sort add opportunity tonight."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Budget mean while approach gun.", "messageTemplate": "Account glass hour send might account box six.", "field": "Head middle close American.", "parameter": {}, "timestamp": 1178801622}], "currentPage": 430, "size": 319}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.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 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": 117, "limit": 99, "responseCode": 200, "count": 750, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Wrong rule whole.", "messageTemplate": "Another final fast kind.", "field": "Hospital put imagine provide month street.", "parameter": {}, "timestamp": 1444123727}], "currentPage": 407, "size": 175}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.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": 255, "limit": 302, "responseCode": 200, "count": 492, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Community final especially training here.", "messageTemplate": "Republican modern occur white station west less.", "field": "Site third drive.", "parameter": {}, "timestamp": 854848799}], "currentPage": 507, "size": 353}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.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": 433, "limit": 722, "responseCode": 200, "count": 66, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Around authority you few short any.", "messageTemplate": "Member mention need which medical again.", "field": "Focus life relate continue amount tax.", "parameter": {}, "timestamp": 1096012014}], "currentPage": 793, "size": 936}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.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": 568, "limit": 617, "responseCode": 200, "count": 6, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Myself war eight suddenly.", "messageTemplate": "Up teach reflect market.", "field": "Structure yet bring people miss message.", "parameter": {}, "timestamp": 414857177}], "currentPage": 874, "size": 119}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.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