"""Autogenerated API"""
import requests
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 = "", 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": 60, "limit": 377, "responseCode": 200, "count": 688, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Condition describe enter point.", "messageTemplate": "Purpose start southern own.", "field": "Return fine little compare offer federal.", "parameter": {}, "timestamp": 1056255413}], "currentPage": 912, "size": 527}
"""
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/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 customerID:
body.update({"customerID": customerID})
if scannedRequests:
body.update({"scannedRequests": scannedRequests})
if scannedIpRanges:
body.update({"scannedIpRanges": scannedIpRanges})
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','scan'))
def host_asset_scanned(customerID: int, ip: str, detectedVulnerabilities: list = None, detectedApplications: list = None,json: bool = True, verify: bool = True, apiKey: str = "", 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": 227, "limit": 702, "responseCode": 200, "count": 497, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Us necessary himself without.", "messageTemplate": "Wait environmental expert education build attention too.", "field": "Plant least nothing eat role hair professor worry.", "parameter": {}, "timestamp": 1474863920}], "currentPage": 782, "size": 140}
"""
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/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 detectedVulnerabilities:
body.update({"detectedVulnerabilities": detectedVulnerabilities})
if detectedApplications:
body.update({"detectedApplications": detectedApplications})
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