Source code for api.assets.v1.scan

"""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": 210, "limit": 532, "responseCode": 200, "count": 501, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Everything through guess scene picture majority beautiful face.", "messageTemplate": "Write contain floor pattern protect.", "field": "Personal social enjoy piece.", "parameter": {}, "timestamp": 1499060129}], "currentPage": 993, "size": 464} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.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": 749, "limit": 277, "responseCode": 200, "count": 422, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Wish peace reason child paper have lead.", "messageTemplate": "Thing body forget issue thank.", "field": "Already policy push several us project.", "parameter": {}, "timestamp": 414243620}], "currentPage": 385, "size": 976} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.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