"""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": 902, "limit": 5, "responseCode": 200, "count": 851, "data": [{"id": "Why so I already property particularly building.", "vulnerabilityID": "Call letter deep.", "references": ["Federal whole floor yourself happy wish."], "name": "Heather Keller", "description": "Industry anyone check this.", "conclusion": "Beyond mother wear.", "solution": "Thus human chair song side.", "rawOutput": "Tend Democrat capital box.", "cvss": 776, "createdTimestamp": 311738026, "createdByUser": {"id": 943, "customerID": 54, "userName": "awilliams", "name": "Briana Cowan"}, "lastUpdatedTimestamp": 1004649568, "lastUpdatedByUser": {"id": 147, "customerID": 442, "userName": "paula52", "name": "Christopher Nelson"}, "deletedTimestamp": 459528365, "deletedByUser": {"id": 609, "customerID": 582, "userName": "ndorsey", "name": "Taylor Kaufman"}, "firstSeenTimestamp": 387528530, "lastSeenTimestamp": 713223532, "resolutionTimestamp": 1072410376, "resolvedByUser": {"id": 16, "customerID": 545, "userName": "saralong", "name": "Brian Stokes"}, "resolutionComment": "Popular safe leg moment range rate.", "resolution": "ACCEPTED", "flags": ["EXPLOIT_AVAILABLE"], "properties": {"additionalProperties": "Through factor side lead."}, "severity": "critical", "socket": "Bit call bag very."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Central southern well build which letter forget.", "messageTemplate": "Church than follow meet second none conference.", "field": "Together environment need cut.", "parameter": {}, "timestamp": 1441467868}], "currentPage": 686, "size": 5}
"""
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": 392, "limit": 353, "responseCode": 200, "count": 145, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Take several owner take bank social.", "messageTemplate": "Trip whether cut point sound study.", "field": "Staff field quickly.", "parameter": {}, "timestamp": 510677213}], "currentPage": 157, "size": 22}
"""
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": 225, "limit": 171, "responseCode": 200, "count": 983, "data": [{"id": "Cell dinner student responsibility feel may.", "vulnerabilityID": "Son city player listen manage.", "references": ["Away effort machine."], "name": "Angela Leon", "description": "Cup dinner who young cover break tell.", "conclusion": "Open issue responsibility.", "solution": "Industry science clearly left usually market.", "rawOutput": "Expect minute bank always more future.", "cvss": 404, "createdTimestamp": 1199943350, "createdByUser": {"id": 48, "customerID": 904, "userName": "gonzalezbrian", "name": "Robert Perez"}, "lastUpdatedTimestamp": 634471907, "lastUpdatedByUser": {"id": 774, "customerID": 582, "userName": "abigail85", "name": "Adam Adams"}, "deletedTimestamp": 495336356, "deletedByUser": {"id": 58, "customerID": 270, "userName": "ricejacob", "name": "Sean Chang"}, "firstSeenTimestamp": 1002308667, "lastSeenTimestamp": 262746297, "resolutionTimestamp": 399046603, "resolvedByUser": {"id": 71, "customerID": 882, "userName": "harrisonchelsea", "name": "Jacob Crawford"}, "resolutionComment": "Recognize paper standard young.", "resolution": "UNRESOLVED", "flags": ["DELETED_FROM_CVM"], "properties": {"additionalProperties": "Environment southern beautiful science almost control provide."}, "severity": "low", "socket": "Show practice century receive give heavy agree."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Bar able note couple bar training small.", "messageTemplate": "Whose change huge small also that.", "field": "Tonight team beyond particular trade.", "parameter": {}, "timestamp": 588716206}], "currentPage": 452, "size": 986}
"""
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 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": 55, "limit": 12, "responseCode": 200, "count": 218, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Man technology professional certainly.", "messageTemplate": "Lawyer white stand data.", "field": "Well soon I college.", "parameter": {}, "timestamp": 1452925468}], "currentPage": 56, "size": 47}
"""
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": 545, "limit": 830, "responseCode": 200, "count": 740, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Forward traditional from two.", "messageTemplate": "Race page discuss you.", "field": "Television information teacher whole push else arm.", "parameter": {}, "timestamp": 104706335}], "currentPage": 55, "size": 6}
"""
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": 744, "limit": 64, "responseCode": 200, "count": 270, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Recognize series even.", "messageTemplate": "Item specific herself base number different cup.", "field": "Cut must play with take cup sure law.", "parameter": {}, "timestamp": 954690956}], "currentPage": 889, "size": 132}
"""
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": 12, "limit": 604, "responseCode": 200, "count": 351, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Country for eight add set fill.", "messageTemplate": "Manager one others dark.", "field": "Operation your poor.", "parameter": {}, "timestamp": 908394046}], "currentPage": 422, "size": 756}
"""
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