"""Autogenerated API"""
from argus_cli.plugin import register_command
[docs]@register_command(extending=("assets","v1","scan"))
def host_asset_bulk_scanned(
customerID: int = None,
scannedRequests: list = None,
scannedIpRanges: list = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Marks multiple HostAsset as scanned. (PUBLIC)
:param int customerID: Define customer which was scanned.
:param list scannedRequests: Set of host scan requests.
:param list scannedIpRanges: Set of scanned IP address ranges as list of single IPs (1.1.1.1), CIDR networks (1.1.1.0/24) or ranges (1.1.1.1-1.1.1.2)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 680, 'limit': 344, 'responseCode': 200, 'count': 413, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Bit age against.', 'messageTemplate': 'Sign low wrong college early behavior knowledge.', 'field': 'Agency think provide detail.', 'parameter': {}, 'timestamp': 194216989}], 'currentPage': 294, 'size': 419}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/scan".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"customerID": customerID,
"scannedRequests": scannedRequests,
"scannedIpRanges": scannedIpRanges
}
response = post(url,
json=body if body else None,
verify=verify,
headers=headers
)
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=("assets","v1","scan"))
def host_asset_scanned(
customerID: int,
ip: str,
detectedVulnerabilities: list = None,
detectedApplications: list = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Marks a single HostAsset as scanned. (PUBLIC)
:param int customerID: Customer ID
:param str ip: IP address of scanned HostAsset
:param list detectedVulnerabilities: Specify (vulnerabilityID, socket string) objects of detected vulnerabilities.
:param list detectedApplications: Specify sockets of detected applications (e.g. tcp/80).
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 842, 'limit': 323, 'responseCode': 200, 'count': 950, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Short claim why recent her now.', 'messageTemplate': 'College tough early bed over indeed focus.', 'field': 'Great simply design sister one.', 'parameter': {}, 'timestamp': 281303479}], 'currentPage': 505, 'size': 646}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/scan/{customerID}/{ip}".format(customerID=customerID, ip=ip)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {
"detectedVulnerabilities": detectedVulnerabilities,
"detectedApplications": detectedApplications
}
response = put(url,
json=body if body else None,
verify=verify,
headers=headers
)
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response