GMP v9

Module for communication with gvmd in Greenbone Management Protocol version 9

Enums

class gvm.protocols.gmpv9.AlertCondition(value)

Enum for alert condition types

ALWAYS = 'Always'
ERROR = 'Error'
FILTER_COUNT_AT_LEAST = 'Filter count at least'
FILTER_COUNT_CHANGED = 'Filter count changed'
SEVERITY_AT_LEAST = 'Severity at least'
SEVERITY_CHANGED = 'Severity changed'
class gvm.protocols.gmpv9.AlertEvent(value)

Enum for alert event types

ASSIGNED_TICKET_CHANGED = 'Assigned ticket changed'
NEW_SECINFO_ARRIVED = 'New SecInfo arrived'
OWNED_TICKET_CHANGED = 'Owned ticket changed'
TASK_RUN_STATUS_CHANGED = 'Task run status changed'
TICKET_RECEIVED = 'Ticket received'
UPDATED_SECINFO_ARRIVED = 'Updated SecInfo arrived'
class gvm.protocols.gmpv9.AlertMethod(value)

Enum for alert method type

ALEMBA_VFIRE = 'Alemba vFire'
EMAIL = 'Email'
HTTP_GET = 'HTTP Get'
SCP = 'SCP'
SEND = 'Send'
SMB = 'SMB'
SNMP = 'SNMP'
SOURCEFIRE_CONNECTOR = 'Sourcefire Connector'
START_TASK = 'Start Task'
SYSLOG = 'Syslog'
TIPPINGPOINT = 'TippingPoint SMS'
VERINICE_CONNECTOR = 'verinice Connector'
class gvm.protocols.gmpv9.AliveTest(value)

Enum for choosing an alive test

APR_PING = 'ARP Ping'
ARP_PING = 'ARP Ping'
CONSIDER_ALIVE = 'Consider Alive'
ICMP_AND_ARP_PING = 'ICMP & ARP Ping'
ICMP_AND_TCP_ACK_SERVICE_PING = 'ICMP & TCP-ACK Service Ping'
ICMP_PING = 'ICMP Ping'
ICMP_TCP_ACK_SERVICE_AND_ARP_PING = 'ICMP, TCP-ACK Service & ARP Ping'
SCAN_CONFIG_DEFAULT = 'Scan Config Default'
TCP_ACK_SERVICE_AND_ARP_PING = 'TCP-ACK Service & ARP Ping'
TCP_ACK_SERVICE_PING = 'TCP-ACK Service Ping'
TCP_SYN_SERVICE_PING = 'TCP-SYN Service Ping'
class gvm.protocols.gmpv9.AssetType(value)

“Enum for asset types

HOST = 'host'
OPERATING_SYSTEM = 'os'
class gvm.protocols.gmpv9.CredentialFormat(value)

Enum for credential format

DEB = 'deb'
EXE = 'exe'
KEY = 'key'
PEM = 'pem'
RPM = 'rpm'
class gvm.protocols.gmpv9.CredentialType(value)

Enum for credential types

CLIENT_CERTIFICATE = 'cc'
PASSWORD_ONLY = 'pw'
PGP_ENCRYPTION_KEY = 'pgp'
SMIME_CERTIFICATE = 'smime'
SNMP = 'snmp'
USERNAME_PASSWORD = 'up'
USERNAME_SSH_KEY = 'usk'
class gvm.protocols.gmpv9.EntityType(value)

Enum for entity types

AGENT = 'agent'
ALERT = 'alert'
ASSET = 'asset'
CERT_BUND_ADV = 'cert_bund_adv'
CPE = 'cpe'
CREDENTIAL = 'credential'
CVE = 'cve'
DFN_CERT_ADV = 'dfn_cert_adv'
FILTER = 'filter'
GROUP = 'group'
HOST = 'host'
INFO = 'info'
NOTE = 'note'
NVT = 'nvt'
OPERATING_SYSTEM = 'os'
OVALDEF = 'ovaldef'
OVERRIDE = 'override'
PERMISSION = 'permission'
PORT_LIST = 'port_list'
REPORT = 'report'
REPORT_FORMAT = 'report_format'
RESULT = 'result'
ROLE = 'role'
SCANNER = 'scanner'
SCAN_CONFIG = 'config'
SCHEDULE = 'schedule'
TAG = 'tag'
TARGET = 'target'
TASK = 'task'
TICKET = 'ticket'
TLS_CERTIFICATE = 'tls_certificate'
USER = 'user'
VULNERABILITY = 'vuln'
class gvm.protocols.gmpv9.FeedType(value)

Enum for feed types

CERT = 'CERT'
NVT = 'NVT'
SCAP = 'SCAP'
class gvm.protocols.gmpv9.FilterType(value)

Enum for filter types

AGENT = 'agent'
ALERT = 'alert'
ALL_SECINFO = 'secinfo'
ASSET = 'asset'
CREDENTIAL = 'credential'
FILTER = 'filter'
GROUP = 'group'
HOST = 'host'
NOTE = 'note'
OPERATING_SYSTEM = 'os'
OVERRIDE = 'override'
PERMISSION = 'permission'
PORT_LIST = 'port_list'
REPORT = 'report'
REPORT_FORMAT = 'report_format'
RESULT = 'result'
ROLE = 'role'
SCAN_CONFIG = 'config'
SCHEDULE = 'schedule'
TAG = 'tag'
TARGET = 'target'
TASK = 'task'
TICKET = 'ticket'
TLS_CERTIFICATE = 'tls_certificate'
USER = 'user'
VULNERABILITY = 'vuln'
class gvm.protocols.gmpv9.HostsOrdering(value)

Enum for host ordering during scans

RANDOM = 'random'
REVERSE = 'reverse'
SEQUENTIAL = 'sequential'
class gvm.protocols.gmpv9.InfoType(value)

Enum for info types

ALLINFO = 'ALLINFO'
CERT_BUND_ADV = 'CERT_BUND_ADV'
CPE = 'CPE'
CVE = 'CVE'
DFN_CERT_ADV = 'DFN_CERT_ADV'
NVT = 'NVT'
OVALDEF = 'OVALDEF'
class gvm.protocols.gmpv9.PermissionSubjectType(value)

Enum for permission subject type

GROUP = 'group'
ROLE = 'role'
USER = 'user'
class gvm.protocols.gmpv9.ScannerType(value)

Enum for scanner type

CVE_SCANNER_TYPE = '3'
GMP_SCANNER_TYPE = '4'
GREENBONE_SENSOR_SCANNER_TYPE = '5'
OPENVAS_SCANNER_TYPE = '2'
OSP_SCANNER_TYPE = '1'
class gvm.protocols.gmpv9.PortRangeType(value)

Enum for port range type

TCP = 'TCP'
UDP = 'UDP'
class gvm.protocols.gmpv9.SeverityLevel(value)

Enum for severity levels

ALARM = 'Alarm'
DEBUG = 'Debug'
HIGH = 'High'
LOG = 'Log'
LOW = 'Low'
MEDIUM = 'Medium'
class gvm.protocols.gmpv9.SnmpAuthAlgorithm(value)

Enum for SNMP auth algorithm

MD5 = 'md5'
SHA1 = 'sha1'
class gvm.protocols.gmpv9.SnmpPrivacyAlgorithm(value)

Enum for SNMP privacy algorithm

AES = 'aes'
DES = 'des'
class gvm.protocols.gmpv9.TicketStatus(value)

Enum for ticket status

CLOSED = 'Closed'
FIXED = 'Fixed'
OPEN = 'Open'

Protocol

class gvm.protocols.gmpv9.Gmp(connection, *, transform=None)
authenticate(username, password)

Authenticate to gvmd.

The generated authenticate command will be send to server. Afterwards the response is read, transformed and returned.

Parameters
  • username (str) – Username

  • password (str) – Password

Return type

Any

Returns

Transformed response from server.

clone_agent(agent_id)

Clone an existing agent

Parameters

agent_id (str) – UUID of an existing agent to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_alert(alert_id)

Clone an existing alert

Parameters

alert_id (str) – UUID of an existing alert to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_audit(audit_id)

Clone an existing audit

Parameters

audit_id (str) – UUID of existing audit to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_config(config_id)

Clone a scan config from an existing one

Parameters

config_id (str) – UUID of the existing scan config

Return type

Any

Returns

The response. See send_command() for details.

clone_credential(credential_id)

Clone an existing credential

Parameters

credential_id (str) – UUID of an existing credential to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_filter(filter_id)

Clone an existing filter

Parameters

filter_id (str) – UUID of an existing filter to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_group(group_id)

Clone an existing group

Parameters

group_id (str) – UUID of an existing group to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_note(note_id)

Clone an existing note

Parameters

note_id (str) – UUID of an existing note to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_override(override_id)

Clone an existing override

Parameters

override_id (str) – UUID of an existing override to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_permission(permission_id)

Clone an existing permission

Parameters

permission_id (str) – UUID of an existing permission to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_policy(policy_id)

Clone a policy from an existing one

Parameters

policy_id (str) – UUID of the existing policy

Return type

Any

Returns

The response. See send_command() for details.

clone_port_list(port_list_id)

Clone an existing port list

Parameters

port_list_id (str) – UUID of an existing port list to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_role(role_id)

Clone an existing role

Parameters

role_id (str) – UUID of an existing role to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_scanner(scanner_id)

Clone an existing scanner

Parameters

scanner_id (str) – UUID of an existing scanner to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_schedule(schedule_id)

Clone an existing schedule

Parameters

schedule_id (str) – UUID of an existing schedule to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_tag(tag_id)

Clone an existing tag

Parameters

tag_id (str) – UUID of an existing tag to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_target(target_id)

Clone an existing target

Parameters

target_id (str) – UUID of an existing target to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_task(task_id)

Clone an existing task

Parameters

task_id (str) – UUID of existing task to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_ticket(ticket_id)

Clone an existing ticket

Parameters

ticket_id (str) – UUID of an existing ticket to clone from

Return type

Any

Returns

The response. See send_command() for details.

clone_tls_certificate(tls_certificate_id)

Modifies an existing TLS certificate.

Parameters

tls_certificate_id (str) – The UUID of an existing TLS certificate

Return type

Any

Returns

The response. See send_command() for details.

clone_user(user_id)

Clone an existing user

Parameters

user_id (str) – UUID of existing user to clone from

Return type

Any

Returns

The response. See send_command() for details.

connect()

Initiates a protocol connection

Normally connect is not called directly. Either it is called automatically when sending a protocol command or when using a with statement.

create_agent(installer, signature, name, *, comment=None, howto_install=None, howto_use=None)

Create a new agent

Parameters
  • installer (str) – A base64 encoded file that installs the agent on a target machine

  • signature (str) – A detached OpenPGP signature of the installer

  • name (str) – A name for the agent

  • comment (Optional[str, None]) – A comment for the agent

  • howto_install (Optional[str, None]) – A file that describes how to install the agent

  • howto_use (Optional[str, None]) – A file that describes how to use the agent

Return type

Any

Returns

The response. See send_command() for details.

create_alert(name, condition, event, method, *, method_data=None, event_data=None, condition_data=None, filter_id=None, comment=None)

Create a new alert

Parameters
  • name (str) – Name of the new Alert

  • condition (AlertCondition) – The condition that must be satisfied for the alert to occur; if the event is either ‘Updated SecInfo arrived’ or ‘New SecInfo arrived’, condition must be ‘Always’. Otherwise, condition can also be on of ‘Severity at least’, ‘Filter count changed’ or ‘Filter count at least’.

  • event (AlertEvent) – The event that must happen for the alert to occur, one of ‘Task run status changed’, ‘Updated SecInfo arrived’ or ‘New SecInfo arrived’

  • method (AlertMethod) – The method by which the user is alerted, one of ‘SCP’, ‘Send’, ‘SMB’, ‘SNMP’, ‘Syslog’ or ‘Email’; if the event is neither ‘Updated SecInfo arrived’ nor ‘New SecInfo arrived’, method can also be one of ‘Start Task’, ‘HTTP Get’, ‘Sourcefire Connector’ or ‘verinice Connector’.

  • condition_data (Optional[dict, None]) – Data that defines the condition

  • event_data (Optional[dict, None]) – Data that defines the event

  • method_data (Optional[dict, None]) – Data that defines the method

  • filter_id (Optional[int, None]) – Filter to apply when executing alert

  • comment (Optional[str, None]) – Comment for the alert

Return type

Any

Returns

The response. See send_command() for details.

create_audit(name, policy_id, target_id, scanner_id, *, alterable=None, hosts_ordering=None, schedule_id=None, alert_ids=None, comment=None, schedule_periods=None, observers=None, preferences=None)

Create a new audit task

Parameters
  • name (str) – Name of the new audit

  • policy_id (str) – UUID of policy to use by the audit

  • target_id (str) – UUID of target to be scanned

  • scanner_id (str) – UUID of scanner to use for scanning the target

  • comment (Optional[str, None]) – Comment for the audit

  • alterable (Optional[bool, None]) – Whether the task should be alterable

  • alert_ids (Optional[List[str], None]) – List of UUIDs for alerts to be applied to the audit

  • hosts_ordering (Optional[HostsOrdering, None]) – The order hosts are scanned in

  • schedule_id (Optional[str, None]) – UUID of a schedule when the audit should be run.

  • schedule_periods (Optional[int, None]) – A limit to the number of times the audit will be scheduled, or 0 for no limit

  • observers (Optional[List[str], None]) – List of names or ids of users which should be allowed to observe this audit

  • preferences (Optional[dict, None]) – Name/Value pairs of scanner preferences.

Return type

Any

Returns

The response. See send_command() for details.

create_config(config_id, name, *, comment=None)

Create a new scan config

Parameters
  • config_id (str) – UUID of the existing scan config

  • name (str) – Name of the new scan config

  • comment (Optional[str, None]) – A comment on the config

Return type

Any

Returns

The response. See send_command() for details.

create_config_from_osp_scanner(scanner_id, name, *, comment=None)

Create a new scan config from an ospd scanner.

Create config by retrieving the expected preferences from the given scanner via OSP.

Parameters
  • scanner_id (str) – UUID of an OSP scanner to get config data from

  • name (str) – Name of the new scan config

  • comment (Optional[str, None]) – A comment on the config

Return type

Any

Returns

The response. See send_command() for details.

create_container_task(name, *, comment=None)

Create a new container task

A container task is a “meta” task to import and view reports from other systems.

Parameters
  • name (str) – Name of the task

  • comment (Optional[str, None]) – Comment for the task

Return type

Any

Returns

The response. See send_command() for details.

create_credential(name, credential_type, *, comment=None, allow_insecure=None, certificate=None, key_phrase=None, private_key=None, login=None, password=None, auth_algorithm=None, community=None, privacy_algorithm=None, privacy_password=None, public_key=None)

Create a new credential

Create a new credential e.g. to be used in the method of an alert.

Currently the following credential types are supported:

  • Username + Password

  • Username + SSH-Key

  • Client Certificates

  • SNMPv1 or SNMPv2c protocol

  • S/MIME Certificate

  • OpenPGP Key

  • Password only

Parameters
  • name (str) – Name of the new credential

  • credential_type (CredentialType) – The credential type.

  • comment (Optional[str, None]) – Comment for the credential

  • allow_insecure (Optional[bool, None]) – Whether to allow insecure use of the credential

  • certificate (Optional[str, None]) – Certificate for the credential. Required for client-certificate and smime credential types.

  • key_phrase (Optional[str, None]) – Key passphrase for the private key. Used for the username+ssh-key credential type.

  • private_key (Optional[str, None]) – Private key to use for login. Required for usk credential type. Also used for the cc credential type. The supported key types (dsa, rsa, ecdsa, …) and formats (PEM, PKC#12, OpenSSL, …) depend on your installed GnuTLS version.

  • login (Optional[str, None]) – Username for the credential. Required for username+password, username+ssh-key and snmp credential type.

  • password (Optional[str, None]) – Password for the credential. Used for username+password and snmp credential types.

  • community (Optional[str, None]) – The SNMP community

  • auth_algorithm (Optional[SnmpAuthAlgorithm, None]) – The SNMP authentication algorithm. Required for snmp credential type.

  • privacy_algorithm (Optional[SnmpPrivacyAlgorithm, None]) – The SNMP privacy algorithm

  • privacy_password (Optional[str, None]) – The SNMP privacy password

  • public_key (Optional[str, None]) – PGP public key in armor plain text format. Required for pgp credential type.

Examples

Creating a Username + Password credential

gmp.create_credential(
    name='UP Credential',
    credential_type=CredentialType.USERNAME_PASSWORD,
    login='foo',
    password='bar',
);

Creating a Username + SSH Key credential

with open('path/to/private-ssh-key') as f:
    key = f.read()

gmp.create_credential(
    name='USK Credential',
    credential_type=CredentialType.USERNAME_SSH_KEY,
    login='foo',
    key_phrase='foobar',
    private_key=key,
)

Creating a PGP credential

Note

A compatible public pgp key file can be exported with GnuPG via

$ gpg --armor --export alice@cyb.org > alice.asc
with open('path/to/pgp.key.asc') as f:
    key = f.read()

gmp.create_credential(
    name='PGP Credential',
    credential_type=CredentialType.PGP_ENCRYPTION_KEY,
    public_key=key,
)

Creating a S/MIME credential

with open('path/to/smime-cert') as f:
    cert = f.read()

gmp.create_credential(
    name='SMIME Credential',
    credential_type=CredentialType.SMIME_CERTIFICATE,
    certificate=cert,
)

Creating a Password-Only credential

gmp.create_credential(
    name='Password-Only Credential',
    credential_type=CredentialType.PASSWORD_ONLY,
    password='foo',
)
Return type

Any

Returns

The response. See send_command() for details.

create_filter(name, *, filter_type=None, comment=None, term=None)

Create a new filter

Parameters
  • name (str) – Name of the new filter

  • filter_type (Optional[FilterType, None]) – Filter for entity type

  • comment (Optional[str, None]) – Comment for the filter

  • term (Optional[str, None]) – Filter term e.g. ‘name=foo’

Return type

Any

Returns

The response. See send_command() for details.

create_group(name, *, comment=None, special=False, users=None)

Create a new group

Parameters
  • name (str) – Name of the new group

  • comment (Optional[str, None]) – Comment for the group

  • special (Optional[bool, None]) – Create permission giving members full access to each other’s entities

  • users (Optional[List[str], None]) – List of user names to be in the group

Return type

Any

Returns

The response. See send_command() for details.

create_host(name, *, comment=None)

Create a new host asset

Parameters
  • name (str) – Name for the new host asset

  • comment (Optional[str, None]) – Comment for the new host asset

Return type

Any

Returns

The response. See send_command() for details.

create_note(text, nvt_oid, *, seconds_active=None, hosts=None, port=None, result_id=None, severity=None, task_id=None, threat=None)

Create a new note

Parameters
  • text (str) – Text of the new note

  • nvt_id – OID of the nvt to which note applies

  • seconds_active (Optional[int, None]) – Seconds note will be active. -1 on always, 0 off

  • hosts (Optional[List[str], None]) – A list of hosts addresses

  • port (Optional[int, None]) – Port to which the note applies

  • result_id (Optional[str, None]) – UUID of a result to which note applies

  • severity (Optional[Real, None]) – Severity to which note applies

  • task_id (Optional[str, None]) – UUID of task to which note applies

  • threat (Optional[SeverityLevel, None]) – Severity level to which note applies. Will be converted to severity.

Return type

Any

Returns

The response. See send_command() for details.

create_override(text, nvt_oid, *, seconds_active=None, hosts=None, port=None, result_id=None, severity=None, new_severity=None, task_id=None, threat=None, new_threat=None)

Create a new override

Parameters
  • text (str) – Text of the new override

  • nvt_id – OID of the nvt to which override applies

  • seconds_active (Optional[int, None]) – Seconds override will be active. -1 on always, 0 off

  • hosts (Optional[List[str], None]) – A list of host addresses

  • port (Optional[int, None]) – Port to which the override applies

  • result_id (Optional[str, None]) – UUID of a result to which override applies

  • severity (Optional[Real, None]) – Severity to which override applies

  • new_severity (Optional[Real, None]) – New severity for result

  • task_id (Optional[str, None]) – UUID of task to which override applies

  • threat (Optional[SeverityLevel, None]) – Severity level to which override applies. Will be converted to severity.

  • new_threat (Optional[SeverityLevel, None]) – New severity level for results. Will be converted to new_severity.

Return type

Any

Returns

The response. See send_command() for details.

create_permission(name, subject_id, subject_type, *, resource_id=None, resource_type=None, comment=None)

Create a new permission

Parameters
  • name (str) – Name of the new permission

  • subject_id (str) – UUID of subject to whom the permission is granted

  • subject_type (PermissionSubjectType) – Type of the subject user, group or role

  • comment (Optional[str, None]) – Comment for the permission

  • resource_id (Optional[str, None]) – UUID of entity to which the permission applies

  • resource_type (Optional[EntityType, None]) – Type of the resource. For Super permissions user, group or role

Return type

Any

Returns

The response. See send_command() for details.

create_policy(name, *, policy_id=None, comment=None)

Create a new policy config

Parameters
  • name (str) – Name of the new policy

  • policy_id (Optional[str, None]) – UUID of an existing policy as base. By default the empty policy is used.

  • comment (Optional[str, None]) – A comment on the policy

Return type

Any

Returns

The response. See send_command() for details.

create_port_list(name, port_range, *, comment=None)

Create a new port list

Parameters
  • name (str) – Name of the new port list

  • port_range (str) – Port list ranges e.g. “T: 1-1234” for tcp port 1 - 1234

  • comment (Optional[str, None]) – Comment for the port list

Return type

Any

Returns

The response. See send_command() for details.

create_port_range(port_list_id, start, end, port_range_type, *, comment=None)

Create new port range

Parameters
  • port_list_id (str) – UUID of the port list to which to add the range

  • start (int) – The first port in the range

  • end (int) – The last port in the range

  • port_range_type (PortRangeType) – The type of the ports: TCP, UDP, …

  • comment (Optional[str, None]) – Comment for the port range

Return type

Any

Returns

The response. See send_command() for details.

create_role(name, *, comment=None, users=None)

Create a new role

Parameters
  • name (str) – Name of the role

  • comment (Optional[str, None]) – Comment for the role

  • users (Optional[List[str], None]) – List of user names to add to the role

Return type

Any

Returns

The response. See send_command() for details.

create_scanner(name, host, port, scanner_type, credential_id, *, ca_pub=None, comment=None)

Create a new scanner

Parameters
  • name (str) – Name of the scanner

  • host (str) – The host of the scanner

  • port (int) – The port of the scanner

  • scanner_type (ScannerType) – Type of the scanner.

  • credential_id (str) – UUID of client certificate credential for the scanner

  • ca_pub (Optional[str, None]) – Certificate of CA to verify scanner certificate

  • comment (Optional[str, None]) – Comment for the scanner

Return type

Any

Returns

The response. See send_command() for details.

create_schedule(name, icalendar, timezone, *, comment=None)

Create a new schedule based in iCalendar data.

Example

Requires https://pypi.org/project/icalendar/

import pytz

from datetime import datetime

from icalendar import Calendar, Event

cal = Calendar()

cal.add('prodid', '-//Foo Bar//')
cal.add('version', '2.0')

event = Event()
event.add('dtstamp', datetime.now(tz=pytz.UTC))
event.add('dtstart', datetime(2020, 1, 1, tzinfo=pytz.utc))

cal.add_component(event)

gmp.create_schedule(
    name="My Schedule",
    icalendar=cal.to_ical(),
    timezone='UTC'
)
Parameters
  • name (str) – Name of the new schedule

  • icalendar (str) – iCalendar (RFC 5545) based data.

  • timezone (str) – Timezone to use for the icalender events e.g Europe/Berlin. If the datetime values in the icalendar data are missing timezone information this timezone gets applied. Otherwise the datetime values from the icalendar data are displayed in this timezone

  • comment (Optional[str, None]) – Comment on schedule.

Return type

Any

Returns

The response. See send_command() for details.

create_tag(name, resource_type, *, resource_filter=None, resource_ids=None, value=None, comment=None, active=None)

Create a tag.

Parameters
  • name (str) – Name of the tag. A full tag name consisting of namespace and predicate e.g. foo:bar.

  • resource_type (EntityType) – Entity type the tag is to be attached to.

  • resource_filter (Optional[str, None]) – Filter term to select resources the tag is to be attached to. Only one of resource_filter or resource_ids can be provided.

  • resource_ids (Optional[List[str], None]) – IDs of the resources the tag is to be attached to. Only one of resource_filter or resource_ids can be provided.

  • value (Optional[str, None]) – Value associated with the tag.

  • comment (Optional[str, None]) – Comment for the tag.

  • active (Optional[bool, None]) – Whether the tag should be active.

Return type

Any

Returns

The response. See send_command() for details.

create_target(name, *, make_unique=None, asset_hosts_filter=None, hosts=None, comment=None, exclude_hosts=None, ssh_credential_id=None, ssh_credential_port=None, smb_credential_id=None, esxi_credential_id=None, snmp_credential_id=None, alive_test=None, reverse_lookup_only=None, reverse_lookup_unify=None, port_range=None, port_list_id=None)

Create a new target

Parameters
  • name (str) – Name of the target

  • make_unique (Optional[bool, None]) – Deprecated. Will be ignored.

  • asset_hosts_filter (Optional[str, None]) – Filter to select target host from assets hosts

  • hosts (Optional[List[str], None]) – List of hosts addresses to scan

  • exclude_hosts (Optional[List[str], None]) – List of hosts addresses to exclude from scan

  • comment (Optional[str, None]) – Comment for the target

  • ssh_credential_id (Optional[str, None]) – UUID of a ssh credential to use on target

  • ssh_credential_port (Optional[int, None]) – The port to use for ssh credential

  • smb_credential_id (Optional[str, None]) – UUID of a smb credential to use on target

  • snmp_credential_id (Optional[str, None]) – UUID of a snmp credential to use on target

  • esxi_credential_id (Optional[str, None]) – UUID of a esxi credential to use on target

  • alive_test (Optional[AliveTest, None]) – Which alive test to use

  • reverse_lookup_only (Optional[bool, None]) – Whether to scan only hosts that have names

  • reverse_lookup_unify (Optional[bool, None]) – Whether to scan only one IP when multiple IPs have the same name.

  • port_range (Optional[str, None]) – Port range for the target

  • port_list_id (Optional[str, None]) – UUID of the port list to use on target

Return type

Any

Returns

The response. See send_command() for details.

create_task(name, config_id, target_id, scanner_id, *, alterable=None, hosts_ordering=None, schedule_id=None, alert_ids=None, comment=None, schedule_periods=None, observers=None, preferences=None)

Create a new scan task

Parameters
  • name (str) – Name of the task

  • config_id (str) – UUID of scan config to use by the task

  • target_id (str) – UUID of target to be scanned

  • scanner_id (str) – UUID of scanner to use for scanning the target

  • comment (Optional[str, None]) – Comment for the task

  • alterable (Optional[bool, None]) – Whether the task should be alterable

  • alert_ids (Optional[List[str], None]) – List of UUIDs for alerts to be applied to the task

  • hosts_ordering (Optional[HostsOrdering, None]) – The order hosts are scanned in

  • schedule_id (Optional[str, None]) – UUID of a schedule when the task should be run.

  • schedule_periods (Optional[int, None]) – A limit to the number of times the task will be scheduled, or 0 for no limit

  • observers (Optional[List[str], None]) – List of names or ids of users which should be allowed to observe this task

  • preferences (Optional[dict, None]) – Name/Value pairs of scanner preferences.

Return type

Any

Returns

The response. See send_command() for details.

create_ticket(*, result_id, assigned_to_user_id, note, comment=None)

Create a new ticket

Parameters
  • result_id (str) – UUID of the result the ticket applies to

  • assigned_to_user_id (str) – UUID of a user the ticket should be assigned to

  • note (str) – A note about opening the ticket

  • comment (Optional[str, None]) – Comment for the ticket

Return type

Any

Returns

The response. See send_command() for details.

create_tls_certificate(name, certificate, *, comment=None, trust=None)

Create a new TLS certificate

Parameters
  • name (str) – Name of the TLS certificate, defaulting to the MD5 fingerprint.

  • certificate (str) – The Base64 encoded certificate data (x.509 DER or PEM).

  • comment (Optional[str, None]) – Comment for the TLS certificate.

  • trust (Optional[bool, None]) – Whether the certificate is trusted.

Return type

Any

Returns

The response. See send_command() for details.

create_user(name, *, password=None, hosts=None, hosts_allow=False, ifaces=None, ifaces_allow=False, role_ids=None)

Create a new user

Parameters
  • name (str) – Name of the user

  • password (Optional[str, None]) – Password of the user

  • hosts (Optional[List[str], None]) – A list of host addresses (IPs, DNS names)

  • hosts_allow (Optional[bool, None]) – If True allow only access to passed hosts otherwise deny access. Default is False for deny hosts.

  • ifaces (Optional[List[str], None]) – A list of interface names

  • ifaces_allow (Optional[bool, None]) – If True allow only access to passed interfaces otherwise deny access. Default is False for deny interfaces.

  • role_ids (Optional[List[str], None]) – A list of role UUIDs for the user

Return type

Any

Returns

The response. See send_command() for details.

delete_agent(agent_id, *, ultimate=False)

Deletes an existing agent

Parameters
  • agent_id (str) – UUID of the agent to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_alert(alert_id, *, ultimate=False)

Deletes an existing alert

Parameters
  • alert_id (str) – UUID of the alert to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_asset(*, asset_id=None, report_id=None)

Deletes an existing asset

Parameters
  • asset_id (Optional[str, None]) – UUID of the single asset to delete.

  • report_id (Optional[str, None]) – UUID of report from which to get all assets to delete.

Return type

Any

delete_audit(audit_id, *, ultimate=False)

Deletes an existing audit

Parameters
  • audit_id (str) – UUID of the audit to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_config(config_id, *, ultimate=False)

Deletes an existing config

Parameters
  • config_id (str) – UUID of the config to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_credential(credential_id, *, ultimate=False)

Deletes an existing credential

Parameters
  • credential_id (str) – UUID of the credential to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_filter(filter_id, *, ultimate=False)

Deletes an existing filter

Parameters
  • filter_id (str) – UUID of the filter to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_group(group_id, *, ultimate=False)

Deletes an existing group

Parameters
  • group_id (str) – UUID of the group to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_note(note_id, *, ultimate=False)

Deletes an existing note

Parameters
  • note_id (str) – UUID of the note to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely,or to the trashcan.

Return type

Any

delete_override(override_id, *, ultimate=False)

Deletes an existing override

Parameters
  • override_id (str) – UUID of the override to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_permission(permission_id, *, ultimate=False)

Deletes an existing permission

Parameters
  • permission_id (str) – UUID of the permission to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_policy(policy_id, *, ultimate=False)

Deletes an existing policy

Parameters
  • policy_id (str) – UUID of the policy to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_port_list(port_list_id, *, ultimate=False)

Deletes an existing port list

Parameters
  • port_list_id (str) – UUID of the port list to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_port_range(port_range_id)

Deletes an existing port range

Parameters

port_range_id (str) – UUID of the port range to be deleted.

Return type

Any

delete_report(report_id)

Deletes an existing report

Parameters

report_id (str) – UUID of the report to be deleted.

Return type

Any

delete_report_format(report_format_id, *, ultimate=False)

Deletes an existing report format

Parameters
  • report_format_id (str) – UUID of the report format to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_role(role_id, *, ultimate=False)

Deletes an existing role

Parameters
  • role_id (str) – UUID of the role to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_scanner(scanner_id, *, ultimate=False)

Deletes an existing scanner

Parameters
  • scanner_id (str) – UUID of the scanner to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_schedule(schedule_id, *, ultimate=False)

Deletes an existing schedule

Parameters
  • schedule_id (str) – UUID of the schedule to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_tag(tag_id, *, ultimate=False)

Deletes an existing tag

Parameters
  • tag_id (str) – UUID of the tag to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_target(target_id, *, ultimate=False)

Deletes an existing target

Parameters
  • target_id (str) – UUID of the target to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_task(task_id, *, ultimate=False)

Deletes an existing task

Parameters
  • task_id (str) – UUID of the task to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

Return type

Any

delete_ticket(ticket_id, *, ultimate=False)

Deletes an existing ticket

Parameters
  • ticket_id (str) – UUID of the ticket to be deleted.

  • ultimate (Optional[bool, None]) – Whether to remove entirely, or to the trashcan.

delete_user(user_id=None, *, name=None, inheritor_id=None, inheritor_name=None)

Deletes an existing user

Either user_id or name must be passed.

Parameters
  • user_id (Optional[str, None]) – UUID of the task to be deleted.

  • name (Optional[str, None]) – The name of the user to be deleted.

  • inheritor_id (Optional[str, None]) – The ID of the inheriting user or “self”. Overrides inheritor_name.

  • inheritor_name (Optional[str, None]) – The name of the inheriting user.

Return type

Any

describe_auth()

Describe authentication methods

Returns a list of all used authentication methods if such a list is available.

Return type

Any

Returns

The response. See send_command() for details.

disconnect()

Disconnect the connection

Ends and closes the connection.

empty_trashcan()

Empty the trashcan

Remove all entities from the trashcan. Attention: this command can not be reverted

Return type

Any

Returns

The response. See send_command() for details.

get_agent(agent_id)

Request a single agent

Parameters

agent_id (str) – UUID of an existing agent

Return type

Any

Returns

The response. See send_command() for details.

get_agents(*, filter=None, filter_id=None, trash=None, details=None, format=None)

Request a list of agents

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – True to request the agents in the trashcan

  • details (Optional[bool, None]) – Whether to include agents packageinformation when no format was provided

  • format (Optional[str, None]) – One of “installer”, “howto_install” or “howto_use”

Return type

Any

Returns

The response. See send_command() for details.

get_aggregates(resource_type, **kwargs)

Request aggregated information on a resource type

Additional arguments can be set via the kwargs parameter, but are not yet validated.

Parameters

resource_type (EntityType) – The entity type to gather data from

Return type

Any

Returns

The response. See send_command() for details.

get_alert(alert_id, *, tasks=None)

Request a single alert

Parameters

alert_id (str) – UUID of an existing alert

Return type

Any

Returns

The response. See send_command() for details.

get_alerts(*, filter=None, filter_id=None, trash=None, tasks=None)

Request a list of alerts

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – True to request the alerts in the trashcan

  • tasks (Optional[bool, None]) – Whether to include the tasks using the alerts

Return type

Any

Returns

The response. See send_command() for details.

get_asset(asset_id, asset_type)

Request a single asset

Parameters
  • asset_id (str) – UUID of an existing asset

  • asset_type (AssetType) – Either ‘os’ or ‘host’

Return type

Any

Returns

The response. See send_command() for details.

get_assets(asset_type, *, filter=None, filter_id=None)

Request a list of assets

Parameters
  • asset_type (AssetType) – Either ‘os’ or ‘host’

  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

Return type

Any

Returns

The response. See send_command() for details.

get_audit(audit_id)

Request a single audit

Parameters

audit_id (str) – UUID of an existing audit

Return type

Any

Returns

The response. See send_command() for details.

get_audits(*, filter=None, filter_id=None, trash=None, details=None, schedules_only=None)

Request a list of audits

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan audits instead

  • details (Optional[bool, None]) – Whether to include full audit details

  • schedules_only (Optional[bool, None]) – Whether to only include id, name and schedule details

Return type

Any

Returns

The response. See send_command() for details.

get_config(config_id, *, tasks=None)

Request a single scan config

Parameters
  • config_id (str) – UUID of an existing scan config

  • tasks (Optional[bool, None]) – Whether to get tasks using this config

Return type

Any

Returns

The response. See send_command() for details.

get_configs(*, filter=None, filter_id=None, trash=None, details=None, families=None, preferences=None, tasks=None)

Request a list of scan configs

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan scan configs instead

  • details (Optional[bool, None]) – Whether to get config families, preferences, nvt selectors and tasks.

  • families (Optional[bool, None]) – Whether to include the families if no details are requested

  • preferences (Optional[bool, None]) – Whether to include the preferences if no details are requested

  • tasks (Optional[bool, None]) – Whether to get tasks using this config

Return type

Any

Returns

The response. See send_command() for details.

get_credential(credential_id, *, scanners=None, targets=None, credential_format=None)

Request a single credential

Parameters
  • credential_id (str) – UUID of an existing credential

  • scanners (Optional[bool, None]) – Whether to include a list of scanners using the credentials

  • targets (Optional[bool, None]) – Whether to include a list of targets using the credentials

  • credential_format (Optional[CredentialFormat, None]) – One of “key”, “rpm”, “deb”, “exe” or “pem”

Return type

Any

Returns

The response. See send_command() for details.

get_credentials(*, filter=None, filter_id=None, scanners=None, trash=None, targets=None)

Request a list of credentials

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • scanners (Optional[bool, None]) – Whether to include a list of scanners using the credentials

  • trash (Optional[bool, None]) – Whether to get the trashcan credentials instead

  • targets (Optional[bool, None]) – Whether to include a list of targets using the credentials

Return type

Any

Returns

The response. See send_command() for details.

get_feed(feed_type)

Request a single feed

Parameters

feed_type (Optional[FeedType, None]) – Type of single feed to get: NVT, CERT or SCAP

Return type

Any

Returns

The response. See send_command() for details.

get_feeds()

Request the list of feeds

Return type

Any

Returns

The response. See send_command() for details.

get_filter(filter_id, *, alerts=None)

Request a single filter

Parameters
  • filter_id (str) – UUID of an existing filter

  • alerts (Optional[bool, None]) – Whether to include list of alerts that use the filter.

Return type

Any

Returns

The response. See send_command() for details.

get_filters(*, filter=None, filter_id=None, trash=None, alerts=None)

Request a list of filters

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan filters instead

  • alerts (Optional[bool, None]) – Whether to include list of alerts that use the filter.

Return type

Any

Returns

The response. See send_command() for details.

get_group(group_id)

Request a single group

Parameters

group_id (str) – UUID of an existing group

Return type

Any

Returns

The response. See send_command() for details.

get_groups(*, filter=None, filter_id=None, trash=None)

Request a list of groups

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan groups instead

Return type

Any

Returns

The response. See send_command() for details.

get_info(info_id, info_type)

Request a single secinfo

Parameters
  • info_id (str) – UUID of an existing secinfo

  • info_type (InfoType) – Type must be either CERT_BUND_ADV, CPE, CVE, DFN_CERT_ADV, OVALDEF, NVT or ALLINFO

Return type

Any

Returns

The response. See send_command() for details.

get_info_list(info_type, *, filter=None, filter_id=None, name=None, details=None)

Request a list of security information

Parameters
  • info_type (InfoType) – Type must be either CERT_BUND_ADV, CPE, CVE, DFN_CERT_ADV, OVALDEF, NVT or ALLINFO

  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • name (Optional[str, None]) – Name or identifier of the requested information

  • details (Optional[bool, None]) – Whether to include information about references to this information

Return type

Any

Returns

The response. See send_command() for details.

get_note(note_id)

Request a single note

Parameters

note_id (str) – UUID of an existing note

Return type

Any

Returns

The response. See send_command() for details.

get_notes(*, filter=None, filter_id=None, details=None, result=None)

Request a list of notes

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • details (Optional[bool, None]) – Add info about connected results and tasks

  • result (Optional[bool, None]) – Return the details of possible connected results.

Return type

Any

Returns

The response. See send_command() for details.

get_nvt(nvt_oid)

Request a single nvt

Parameters

nvt_oid (str) – OID of an existing nvt

Returns

The response. See send_command() for details.

get_nvt_families(*, sort_order=None)

Request a list of nvt families

Parameters

sort_order (Optional[str, None]) – Sort order

Returns

The response. See send_command() for details.

get_nvts(*, details=None, preferences=None, preference_count=None, timeout=None, config_id=None, preferences_config_id=None, family=None, sort_order=None, sort_field=None)

Request a list of nvts

Parameters
  • details (Optional[bool, None]) – Whether to include full details

  • preferences (Optional[bool, None]) – Whether to include nvt preferences

  • preference_count (Optional[bool, None]) – Whether to include preference count

  • timeout (Optional[bool, None]) – Whether to include the special timeout preference

  • config_id (Optional[str, None]) – UUID of scan config to which to limit the NVT listing

  • preferences_config_id (Optional[str, None]) – UUID of scan config to use for preference values

  • family (Optional[str, None]) – Family to which to limit NVT listing

  • sort_order (Optional[str, None]) – Sort order

  • sort_field (Optional[str, None]) – Sort field

Returns

The response. See send_command() for details.

get_override(override_id)

Request a single override

Parameters

override_id (str) – UUID of an existing override

Return type

Any

Returns

The response. See send_command() for details.

get_overrides(*, filter=None, filter_id=None, details=None, result=None)

Request a list of overrides

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • details (Optional[bool, None]) – Whether to include full details

  • result (Optional[bool, None]) – Whether to include results using the override

Return type

Any

Returns

The response. See send_command() for details.

get_permission(permission_id)

Request a single permission

Parameters

permission_id (str) – UUID of an existing permission

Return type

Any

Returns

The response. See send_command() for details.

get_permissions(*, filter=None, filter_id=None, trash=None)

Request a list of permissions

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get permissions in the trashcan instead

Return type

Any

Returns

The response. See send_command() for details.

get_policies(*, audits=None, filter=None, filter_id=None, details=None, families=None, preferences=None, trash=None)

Request a list of policies

Parameters
  • audits (Optional[bool, None]) – Whether to get audits using the policy

  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • details (Optional[bool, None]) – Whether to get families, preferences, nvt selectors and tasks.

  • families (Optional[bool, None]) – Whether to include the families if no details are requested

  • preferences (Optional[bool, None]) – Whether to include the preferences if no details are requested

  • trash (Optional[bool, None]) – Whether to get the trashcan audits instead

Return type

Any

Returns

The response. See send_command() for details.

get_policy(policy_id)

Request a single policy

Parameters

policy_id (str) – UUID of an existing policy

Return type

Any

Returns

The response. See send_command() for details.

get_port_list(port_list_id)

Request a single port list

Parameters

port_list_id (str) – UUID of an existing port list

Returns

The response. See send_command() for details.

get_port_lists(*, filter=None, filter_id=None, details=None, targets=None, trash=None)

Request a list of port lists

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • details (Optional[bool, None]) – Whether to include full port list details

  • targets (Optional[bool, None]) – Whether to include targets using this port list

  • trash (Optional[bool, None]) – Whether to get port lists in the trashcan instead

Return type

Any

Returns

The response. See send_command() for details.

get_preference(name, *, nvt_oid=None, config_id=None)

Request a nvt preference

Parameters
  • name (str) – name of a particular preference

  • nvt_oid (Optional[str, None]) – OID of nvt

  • config_id (Optional[str, None]) – UUID of scan config of which to show preference values

Return type

Any

Returns

The response. See send_command() for details.

get_preferences(*, nvt_oid=None, config_id=None)

Request a list of preferences

When the command includes a config_id attribute, the preference element includes the preference name, type and value, and the NVT to which the preference applies. Otherwise, the preference element includes just the name and value, with the NVT and type built into the name.

Parameters
  • nvt_oid (Optional[str, None]) – OID of nvt

  • config_id (Optional[str, None]) – UUID of scan config of which to show preference values

Return type

Any

Returns

The response. See send_command() for details.

static get_protocol_version()

Determine the Greenbone Management Protocol version.

Returns

Implemented version of the Greenbone Management Protocol

Return type

tuple

get_report(report_id, *, filter=None, filter_id=None, delta_report_id=None, report_format_id=None, ignore_pagination=None, details=None)

Request a single report

Parameters
  • report_id (str) – UUID of an existing report

  • filter (Optional[str, None]) – Filter term to use to filter results in the report

  • filter_id (Optional[str, None]) – UUID of filter to use to filter results in the report

  • delta_report_id (Optional[str, None]) – UUID of an existing report to compare report to.

  • report_format_id (Optional[str, None]) – UUID of report format to use

  • ignore_pagination (Optional[bool, None]) – Whether to ignore the filter terms “first” and “rows”.

  • details (Optional[bool, None]) – Request additional report information details

Return type

Any

Returns

The response. See send_command() for details.

get_report_format(report_format_id)

Request a single report format

Parameters

report_format_id (str) – UUID of an existing report format

Return type

Any

Returns

The response. See send_command() for details.

get_report_formats(*, filter=None, filter_id=None, trash=None, alerts=None, params=None, details=None)

Request a list of report formats

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan report formats instead

  • alerts (Optional[bool, None]) – Whether to include alerts that use the report format

  • params (Optional[bool, None]) – Whether to include report format parameters

  • details (Optional[bool, None]) – Include report format file, signature and parameters

Return type

Any

Returns

The response. See send_command() for details.

get_reports(*, filter=None, filter_id=None, note_details=None, override_details=None, details=None)

Request a list of reports

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • note_details (Optional[bool, None]) – If notes are included, whether to include note details

  • override_details (Optional[bool, None]) – If overrides are included, whether to include override details

  • details (Optional[bool, None]) – Whether to exclude results

Return type

Any

Returns

The response. See send_command() for details.

get_result(result_id)

Request a single result

Parameters

result_id (str) – UUID of an existing result

Return type

Any

Returns

The response. See send_command() for details.

get_results(*, filter=None, filter_id=None, task_id=None, note_details=None, override_details=None, details=None)

Request a list of results

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • task_id (Optional[str, None]) – UUID of task for note and override handling

  • note_details (Optional[bool, None]) – If notes are included, whether to include note details

  • override_details (Optional[bool, None]) – If overrides are included, whether to include override details

  • details (Optional[bool, None]) – Whether to include additional details of the results

Return type

Any

Returns

The response. See send_command() for details.

get_role(role_id)

Request a single role

Parameters

role_id (str) – UUID of an existing role

Return type

Any

Returns

The response. See send_command() for details.

get_roles(*, filter=None, filter_id=None, trash=None)

Request a list of roles

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan roles instead

Return type

Any

Returns

The response. See send_command() for details.

get_scanner(scanner_id)

Request a single scanner

Parameters

scanner_id (str) – UUID of an existing scanner

Return type

Any

Returns

The response. See send_command() for details.

get_scanners(*, filter=None, filter_id=None, trash=None, details=None)

Request a list of scanners

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan scanners instead

  • details (Optional[bool, None]) – Whether to include extra details like tasks using this scanner

Return type

Any

Returns

The response. See send_command() for details.

get_schedule(schedule_id, *, tasks=None)

Request a single schedule

Parameters
  • schedule_id (str) – UUID of an existing schedule

  • tasks (Optional[bool, None]) – Whether to include tasks using the schedules

Return type

Any

Returns

The response. See send_command() for details.

get_schedules(*, filter=None, filter_id=None, trash=None, tasks=None)

Request a list of schedules

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan schedules instead

  • tasks (Optional[bool, None]) – Whether to include tasks using the schedules

Return type

Any

Returns

The response. See send_command() for details.

get_setting(setting_id)

Request a single setting

Parameters

setting_id (str) – UUID of an existing setting

Return type

Any

Returns

The response. See send_command() for details.

get_settings(*, filter=None)

Request a list of user settings

Parameters

filter (Optional[str, None]) – Filter term to use for the query

Return type

Any

Returns

The response. See send_command() for details.

get_system_reports(*, name=None, duration=None, start_time=None, end_time=None, brief=None, slave_id=None)

Request a list of system reports

Parameters
  • name (Optional[str, None]) – A string describing the required system report

  • duration (Optional[int, None]) – The number of seconds into the past that the system report should include

  • start_time (Optional[str, None]) – The start of the time interval the system report should include in ISO time format

  • end_time (Optional[str, None]) – The end of the time interval the system report should include in ISO time format

  • brief (Optional[bool, None]) – Whether to include the actual system reports

  • slave_id (Optional[str, None]) – UUID of GMP scanner from which to get the system reports

Return type

Any

Returns

The response. See send_command() for details.

get_tag(tag_id)

Request a single tag

Parameters

tag_id (str) – UUID of an existing tag

Return type

Any

Returns

The response. See send_command() for details.

get_tags(*, filter=None, filter_id=None, trash=None, names_only=None)

Request a list of tags

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get tags from the trashcan instead

  • names_only (Optional[bool, None]) – Whether to get only distinct tag names

Return type

Any

Returns

The response. See send_command() for details.

get_target(target_id, *, tasks=None)

Request a single target

Parameters
  • target_id (str) – UUID of an existing target

  • tasks (Optional[bool, None]) – Whether to include list of tasks that use the target

Return type

Any

Returns

The response. See send_command() for details.

get_targets(*, filter=None, filter_id=None, trash=None, tasks=None)

Request a list of targets

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan targets instead

  • tasks (Optional[bool, None]) – Whether to include list of tasks that use the target

Return type

Any

Returns

The response. See send_command() for details.

get_task(task_id)

Request a single task

Parameters

task_id (str) – UUID of an existing task

Return type

Any

Returns

The response. See send_command() for details.

get_tasks(*, filter=None, filter_id=None, trash=None, details=None, schedules_only=None)

Request a list of tasks

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – Whether to get the trashcan tasks instead

  • details (Optional[bool, None]) – Whether to include full task details

  • schedules_only (Optional[bool, None]) – Whether to only include id, name and schedule details

Return type

Any

Returns

The response. See send_command() for details.

get_ticket(ticket_id)

Request a single ticket

Parameters

ticket_id (str) – UUID of an existing ticket

Return type

Any

Returns

The response. See send_command() for details.

get_tickets(*, trash=None, filter=None, filter_id=None)

Request a list of tickets

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • trash (Optional[bool, None]) – True to request the tickets in the trashcan

Return type

Any

Returns

The response. See send_command() for details.

get_tls_certificate(tls_certificate_id)

Request a single TLS certificate

Parameters

tls_certificate_id (str) – UUID of an existing TLS certificate

Return type

Any

Returns

The response. See send_command() for details.

get_tls_certificates(*, filter=None, filter_id=None, include_certificate_data=None, details=None)

Request a list of TLS certificates

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

  • include_certificate_data (Optional[bool, None]) – Whether to include the certificate data in the response

Return type

Any

Returns

The response. See send_command() for details.

get_user(user_id)

Request a single user

Parameters

user_id (str) – UUID of an existing user

Return type

Any

Returns

The response. See send_command() for details.

get_users(*, filter=None, filter_id=None)

Request a list of users

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

Return type

Any

Returns

The response. See send_command() for details.

get_version()

Get the Greenbone Manager Protocol version used by the remote gvmd

Return type

Any

Returns

The response. See send_command() for details.

get_vulnerabilities(*, filter=None, filter_id=None)

Request a list of vulnerabilities

Parameters
  • filter (Optional[str, None]) – Filter term to use for the query

  • filter_id (Optional[str, None]) – UUID of an existing filter to use for the query

Return type

Any

Returns

The response. See send_command() for details.

get_vulnerability(vulnerability_id)

Request a single vulnerability

Parameters

vulnerability_id (str) – ID of an existing vulnerability

Return type

Any

Returns

The response. See send_command() for details.

help(*, format=None, help_type='')

Get the help text

Parameters
  • format (Optional[str, None]) – One of “html”, “rnc”, “text” or “xml

  • help_type (Optional[str, None]) – One of “brief” or “”. Default “”

Return type

Any

Returns

The response. See send_command() for details.

import_config(config)

Import a scan config from XML

Parameters

config (str) – Scan Config XML as string to import. This XML must contain a <get_configs_response> root element.

Return type

Any

Returns

The response. See send_command() for details.

import_report(report, *, task_id=None, task_name=None, task_comment=None, in_assets=None)

Import a Report from XML

Parameters
  • report (str) – Report XML as string to import. This XML must contain a <report> root element.

  • task_id (Optional[str, None]) – UUID of task to import report to

  • task_name (Optional[str, None]) – Name of task to be created if task_id is not present. Either task_id or task_name must be passed

  • task_comment (Optional[str, None]) – Comment for task to be created if task_id is not present

  • in_asset – Whether to create or update assets using the report

Return type

Any

Returns

The response. See send_command() for details.

is_authenticated()

Checks if the user is authenticated

If the user is authenticated privileged GMP commands like get_tasks may be send to gvmd.

Returns

True if an authenticated connection to gvmd has been established.

Return type

bool

is_connected()

Status of the current connection

Return type

bool

Returns

True if a connection to the remote server has been established.

modify_agent(agent_id, *, name=None, comment=None)

Modifies an existing agent

Parameters
  • agent_id (str) – UUID of the agent to be modified.

  • name (Optional[str, None]) – Name of the new credential

  • comment (Optional[str, None]) – Comment for the credential

Return type

Any

Returns

The response. See send_command() for details.

modify_alert(alert_id, *, name=None, comment=None, filter_id=None, event=None, event_data=None, condition=None, condition_data=None, method=None, method_data=None)

Modifies an existing alert.

Parameters
  • alert_id (str) – UUID of the alert to be modified.

  • name (Optional[str, None]) – Name of the Alert.

  • condition (Optional[AlertCondition, None]) – The condition that must be satisfied for the alert to occur. If the event is either ‘Updated SecInfo arrived’ or ‘New SecInfo arrived’, condition must be ‘Always’. Otherwise, condition can also be on of ‘Severity at least’, ‘Filter count changed’ or ‘Filter count at least’.

  • condition_data (Optional[dict, None]) – Data that defines the condition

  • event (Optional[AlertEvent, None]) – The event that must happen for the alert to occur, one of ‘Task run status changed’, ‘Updated SecInfo arrived’ or ‘New SecInfo arrived’

  • event_data (Optional[dict, None]) – Data that defines the event

  • method (Optional[AlertMethod, None]) – The method by which the user is alerted, one of ‘SCP’, ‘Send’, ‘SMB’, ‘SNMP’, ‘Syslog’ or ‘Email’; if the event is neither ‘Updated SecInfo arrived’ nor ‘New SecInfo arrived’, method can also be one of ‘Start Task’, ‘HTTP Get’, ‘Sourcefire Connector’ or ‘verinice Connector’.

  • method_data (Optional[dict, None]) – Data that defines the method

  • filter_id (Optional[str, None]) – Filter to apply when executing alert

  • comment (Optional[str, None]) – Comment for the alert

Return type

Any

Returns

The response. See send_command() for details.

modify_asset(asset_id, comment='')

Modifies an existing asset.

Parameters
  • asset_id (str) – UUID of the asset to be modified.

  • comment (Optional[str, None]) – Comment for the asset.

Return type

Any

Returns

The response. See send_command() for details.

modify_auth(group_name, auth_conf_settings)

Modifies an existing auth.

Parameters
  • group_name (str) – Name of the group to be modified.

  • auth_conf_settings (dict) – The new auth config.

Return type

Any

Returns

The response. See send_command() for details.

modify_config(config_id, selection=None, **kwargs)

Modifies an existing scan config.

DEPRECATED. Please use modify_config_set_ methods instead.

modify_config has four modes to operate depending on the selection.

Parameters
  • config_id (str) – UUID of scan config to modify.

  • selection (Optional[str, None]) – one of ‘scan_pref’, ‘nvt_pref’, ‘nvt_selection’ or ‘family_selection’

  • name – New name for preference.

  • value – New value for preference.

  • nvt_oids – List of NVTs associated with preference to modify.

  • family – Name of family to modify.

Return type

Any

Returns

The response. See send_command() for details.

modify_config_set_comment(config_id, comment='')

Modifies the comment of an existing scan config

Parameters
  • config_id (str) – UUID of scan config to modify.

  • comment (Optional[str, None]) – Comment to set on a config. Default: ‘’

Return type

Any

modify_config_set_family_selection(config_id, families, *, auto_add_new_families=True, auto_add_new_nvts=True)

Selected the NVTs of a scan config at a family level.

Parameters
  • config_id (str) – UUID of scan config to modify.

  • families (List[str]) – List of NVT family names to select.

  • auto_add_new_families (Optional[bool, None]) – Whether new families should be added to the scan config automatically. Default: True.

  • auto_add_new_nvts (Optional[bool, None]) – Whether new NVTs in the selected families should be added to the scan config automatically. Default: True.

Return type

Any

modify_config_set_name(config_id, name)

Modifies the name of an existing scan config

Parameters
  • config_id (str) – UUID of scan config to modify.

  • name (str) – New name for the config.

Return type

Any

modify_config_set_nvt_preference(config_id, name, nvt_oid, *, value=None)

Modifies the nvt preferences of an existing scan config.

Parameters
  • config_id (str) – UUID of scan config to modify.

  • name (str) – Name for preference to change.

  • nvt_oid (str) – OID of the NVT associated with preference to modify

  • value (Optional[str, None]) – New value for the preference. None to delete the preference and to use the default instead.

Return type

Any

modify_config_set_nvt_selection(config_id, family, nvt_oids)

Modifies the selected nvts of an existing scan config

The manager updates the given family in the config to include only the given NVTs.

Parameters
  • config_id (str) – UUID of scan config to modify.

  • family (str) – Name of the NVT family to include NVTs from

  • nvt_oids (List[str]) – List of NVTs to select for the family.

Return type

Any

modify_config_set_scanner_preference(config_id, name, *, value=None)

Modifies the scanner preferences of an existing scan config

Parameters
  • config_id (str) – UUID of scan config to modify.

  • name (str) – Name of the scanner preference to change

  • value (Optional[str, None]) – New value for the preference. None to delete the preference and to use the default instead.

Return type

Any

modify_credential(credential_id, *, name=None, comment=None, allow_insecure=None, certificate=None, key_phrase=None, private_key=None, login=None, password=None, auth_algorithm=None, community=None, privacy_algorithm=None, privacy_password=None, public_key=None)

Modifies an existing credential.

Parameters
  • credential_id (str) – UUID of the credential

  • name (Optional[str, None]) – Name of the credential

  • comment (Optional[str, None]) – Comment for the credential

  • allow_insecure (Optional[bool, None]) – Whether to allow insecure use of the credential

  • certificate (Optional[str, None]) – Certificate for the credential

  • key_phrase (Optional[str, None]) – Key passphrase for the private key

  • private_key (Optional[str, None]) – Private key to use for login

  • login (Optional[str, None]) – Username for the credential

  • password (Optional[str, None]) – Password for the credential

  • auth_algorithm (Optional[SnmpAuthAlgorithm, None]) – The authentication algorithm for SNMP

  • community (Optional[str, None]) – The SNMP community

  • privacy_algorithm (Optional[SnmpPrivacyAlgorithm, None]) – The privacy algorithm for SNMP

  • privacy_password (Optional[str, None]) – The SNMP privacy password

  • public_key (Optional[str, None]) – PGP public key in armor plain text format

Return type

Any

Returns

The response. See send_command() for details.

modify_filter(filter_id, *, comment=None, name=None, term=None, filter_type=None)

Modifies an existing filter.

Parameters
  • filter_id (str) – UUID of the filter to be modified

  • comment (Optional[str, None]) – Comment on filter.

  • name (Optional[str, None]) – Name of filter.

  • term (Optional[str, None]) – Filter term.

  • filter_type (Optional[FilterType, None]) – Resource type filter applies to.

Return type

Any

Returns

The response. See send_command() for details.

modify_group(group_id, *, comment=None, name=None, users=None)

Modifies an existing group.

Parameters
  • group_id (str) – UUID of group to modify.

  • comment (Optional[str, None]) – Comment on group.

  • name (Optional[str, None]) – Name of group.

  • users (Optional[List[str], None]) – List of user names to be in the group

Return type

Any

Returns

The response. See send_command() for details.

modify_note(note_id, text, *, seconds_active=None, hosts=None, port=None, result_id=None, severity=None, task_id=None, threat=None)

Modifies an existing note.

Parameters
  • note_id (str) – UUID of note to modify.

  • text (str) – The text of the note.

  • seconds_active (Optional[int, None]) – Seconds note will be active. -1 on always, 0 off.

  • hosts (Optional[List[str], None]) – A list of hosts addresses

  • port (Optional[int, None]) – Port to which note applies.

  • result_id (Optional[str, None]) – Result to which note applies.

  • severity (Optional[Real, None]) – Severity to which note applies.

  • task_id (Optional[str, None]) – Task to which note applies.

  • threat (Optional[SeverityLevel, None]) – Threat level to which note applies. Will be converted to severity.

Return type

Any

Returns

The response. See send_command() for details.

modify_override(override_id, text, *, seconds_active=None, hosts=None, port=None, result_id=None, severity=None, new_severity=None, task_id=None, threat=None, new_threat=None)

Modifies an existing override.

Parameters
  • override_id (str) – UUID of override to modify.

  • text (str) – The text of the override.

  • seconds_active (Optional[int, None]) – Seconds override will be active. -1 on always, 0 off.

  • hosts (Optional[List[str], None]) – A list of host addresses

  • port (Optional[int, None]) – Port to which override applies.

  • result_id (Optional[str, None]) – Result to which override applies.

  • severity (Optional[Real, None]) – Severity to which override applies.

  • new_severity (Optional[Real, None]) – New severity score for result.

  • task_id (Optional[str, None]) – Task to which override applies.

  • threat (Optional[SeverityLevel, None]) – Threat level to which override applies. Will be converted to severity.

  • new_threat (Optional[SeverityLevel, None]) – New threat level for results. Will be converted to new_severity.

Return type

Any

Returns

The response. See send_command() for details.

modify_permission(permission_id, *, comment=None, name=None, resource_id=None, resource_type=None, subject_id=None, subject_type=None)

Modifies an existing permission.

Parameters
  • permission_id (str) – UUID of permission to be modified.

  • comment (Optional[str, None]) – The comment on the permission.

  • name (Optional[str, None]) – Permission name, currently the name of a command.

  • subject_id (Optional[str, None]) – UUID of subject to whom the permission is granted

  • subject_type (Optional[PermissionSubjectType, None]) – Type of the subject user, group or role

  • resource_id (Optional[str, None]) – UUID of entity to which the permission applies

  • resource_type (Optional[EntityType, None]) – Type of the resource. For Super permissions user, group or role

Return type

Any

Returns

The response. See send_command() for details.

modify_port_list(port_list_id, *, comment=None, name=None)

Modifies an existing port list.

Parameters
  • port_list_id (str) – UUID of port list to modify.

  • name (Optional[str, None]) – Name of port list.

  • comment (Optional[str, None]) – Comment on port list.

Return type

Any

Returns

The response. See send_command() for details.

modify_report_format(report_format_id, *, active=None, name=None, summary=None, param_name=None, param_value=None)

Modifies an existing report format.

Parameters
  • report_format_id (str) – UUID of report format to modify.

  • active (Optional[bool, None]) – Whether the report format is active.

  • name (Optional[str, None]) – The name of the report format.

  • summary (Optional[str, None]) – A summary of the report format.

  • param_name (Optional[str, None]) – The name of the param.

  • param_value (Optional[str, None]) – The value of the param.

Return type

Any

Returns

The response. See send_command() for details.

modify_role(role_id, *, comment=None, name=None, users=None)

Modifies an existing role.

Parameters
  • role_id (str) – UUID of role to modify.

  • comment (Optional[str, None]) – Name of role.

  • name (Optional[str, None]) – Comment on role.

  • users (Optional[List[str], None]) – List of user names.

Return type

Any

Returns

The response. See send_command() for details.

modify_scanner(scanner_id, *, scanner_type=None, host=None, port=None, comment=None, name=None, ca_pub=None, credential_id=None)

Modifies an existing scanner.

Parameters
  • scanner_id (str) – UUID of scanner to modify.

  • scanner_type (Optional[ScannerType, None]) – New type of the Scanner.

  • host (Optional[str, None]) – Host of the scanner.

  • port (Optional[int, None]) – Port of the scanner.

  • comment (Optional[str, None]) – Comment on scanner.

  • name (Optional[str, None]) – Name of scanner.

  • ca_pub (Optional[str, None]) – Certificate of CA to verify scanner’s certificate.

  • credential_id (Optional[str, None]) – UUID of the client certificate credential for the Scanner.

Return type

Any

Returns

The response. See send_command() for details.

modify_schedule(schedule_id, *, name=None, icalendar=None, timezone=None, comment=None)

Modifies an existing schedule

Parameters
  • schedule_id (str) – UUID of the schedule to be modified

  • name (Optional[str, None]) – Name of the schedule

  • icalendar (Optional[str, None]) – iCalendar (RFC 5545) based data.

  • timezone (Optional[str, None]) – Timezone to use for the icalender events e.g Europe/Berlin. If the datetime values in the icalendar data are missing timezone information this timezone gets applied. Otherwise the datetime values from the icalendar data are displayed in this timezone

  • commenhedule.

Return type

Any

Returns

The response. See send_command() for details.

modify_setting(setting_id=None, name=None, value=None)

Modifies an existing setting.

Parameters
  • setting_id (Optional[str, None]) – UUID of the setting to be changed.

  • name (Optional[str, None]) – The name of the setting. Either setting_id or name must be passed.

  • value (Optional[str, None]) – The value of the setting.

Return type

Any

Returns

The response. See send_command() for details.

modify_tag(tag_id, *, comment=None, name=None, value=None, active=None, resource_action=None, resource_type=None, resource_filter=None, resource_ids=None)

Modifies an existing tag.

Parameters
  • tag_id (str) – UUID of the tag.

  • comment (Optional[str, None]) – Comment to add to the tag.

  • name (Optional[str, None]) – Name of the tag.

  • value – Value of the tag.

  • active – Whether the tag is active.

  • resource_action (Optional[str, None]) – Whether to add or remove resources instead of overwriting. One of ‘’, ‘add’, ‘set’ or ‘remove’.

  • resource_type (Optional[EntityType, None]) – Type of the resources to which to attach the tag. Required if resource_filter is set.

  • resource_filter (Optional[str, None]) – Filter term to select resources the tag is to be attached to.

  • resource_ids (Optional[List[str], None]) – IDs of the resources to which to attach the tag.

Return type

Any

Returns

The response. See send_command() for details.

modify_target(target_id, *, name=None, comment=None, hosts=None, exclude_hosts=None, ssh_credential_id=None, ssh_credential_port=None, smb_credential_id=None, esxi_credential_id=None, snmp_credential_id=None, alive_test=None, reverse_lookup_only=None, reverse_lookup_unify=None, port_list_id=None)

Modifies an existing target.

Parameters
  • target_id (str) – ID of target to modify.

  • comment (Optional[str, None]) – Comment on target.

  • name (Optional[str, None]) – Name of target.

  • hosts (Optional[List[str], None]) – List of target hosts.

  • exclude_hosts (Optional[List[str], None]) – A list of hosts to exclude.

  • ssh_credential_id (Optional[str, None]) – UUID of SSH credential to use on target.

  • ssh_credential_port (Optional[bool, None]) – The port to use for ssh credential

  • smb_credential_id (Optional[str, None]) – UUID of SMB credential to use on target.

  • esxi_credential_id (Optional[str, None]) – UUID of ESXi credential to use on target.

  • snmp_credential_id (Optional[str, None]) – UUID of SNMP credential to use on target.

  • port_list_id (Optional[str, None]) – UUID of port list describing ports to scan.

  • alive_test (Optional[AliveTest, None]) – Which alive tests to use.

  • reverse_lookup_only (Optional[bool, None]) – Whether to scan only hosts that have names.

  • reverse_lookup_unify (Optional[bool, None]) – Whether to scan only one IP when multiple IPs have the same name.

Return type

Any

Returns

The response. See send_command() for details.

modify_task(task_id, *, name=None, config_id=None, target_id=None, scanner_id=None, alterable=None, hosts_ordering=None, schedule_id=None, schedule_periods=None, comment=None, alert_ids=None, observers=None, preferences=None)

Modifies an existing task.

Parameters
  • task_id (str) – UUID of task to modify.

  • name (Optional[str, None]) – The name of the task.

  • config_id (Optional[str, None]) – UUID of scan config to use by the task

  • target_id (Optional[str, None]) – UUID of target to be scanned

  • scanner_id (Optional[str, None]) – UUID of scanner to use for scanning the target

  • comment (Optional[str, None]) – The comment on the task.

  • alert_ids (Optional[List[str], None]) – List of UUIDs for alerts to be applied to the task

  • hosts_ordering (Optional[HostsOrdering, None]) – The order hosts are scanned in

  • schedule_id (Optional[str, None]) – UUID of a schedule when the task should be run.

  • schedule_periods (Optional[int, None]) – A limit to the number of times the task will be scheduled, or 0 for no limit.

  • observers (Optional[List[str], None]) – List of names or ids of users which should be allowed to observe this task

  • preferences (Optional[dict, None]) – Name/Value pairs of scanner preferences.

Return type

Any

Returns

The response. See send_command() for details.

modify_ticket(ticket_id, *, status=None, note=None, assigned_to_user_id=None, comment=None)

Modify a single ticket

Parameters
  • ticket_id (str) – UUID of an existing ticket

  • status (Optional[TicketStatus, None]) – New status for the ticket

  • note (Optional[str, None]) – Note for the status change. Required if status is set.

  • assigned_to_user_id (Optional[str, None]) – UUID of the user the ticket should be assigned to

  • comment (Optional[str, None]) – Comment for the ticket

Return type

Any

Returns

The response. See send_command() for details.

modify_tls_certificate(tls_certificate_id, *, name=None, comment=None, trust=None)

Modifies an existing TLS certificate.

Parameters
  • tls_certificate_id (str) – UUID of the TLS certificate to be modified.

  • name (Optional[str, None]) – Name of the TLS certificate, defaulting to the MD5 fingerprint

  • comment (Optional[str, None]) – Comment for the TLS certificate.

  • trust (Optional[bool, None]) – Whether the certificate is trusted.

Return type

Any

Returns

The response. See send_command() for details.

modify_user(user_id=None, name=None, *, new_name=None, password=None, role_ids=None, hosts=None, hosts_allow=False, ifaces=None, ifaces_allow=False)

Modifies an existing user.

Parameters
  • user_id (Optional[str, None]) – UUID of the user to be modified. Overrides name element argument.

  • name (Optional[str, None]) – The name of the user to be modified. Either user_id or name must be passed.

  • new_name (Optional[str, None]) – The new name for the user.

  • password (Optional[str, None]) – The password for the user.

  • roles_id – List of roles UUIDs for the user.

  • hosts (Optional[List[str], None]) – User access rules: List of hosts.

  • hosts_allow (Optional[bool, None]) – If True, allow only listed, otherwise forbid listed.

  • ifaces (Optional[List[str], None]) – User access rules: List of ifaces.

  • ifaces_allow (Optional[bool, None]) – If True, allow only listed, otherwise forbid listed.

Return type

Any

Returns

The response. See send_command() for details.

move_task(task_id, *, slave_id=None)

Move an existing task to another GMP slave scanner or the master

Parameters
  • task_id (str) – UUID of the task to be moved

  • slave_id (Optional[str, None]) – UUID of slave to reassign the task to, empty for master.

Return type

Any

Returns

The response. See send_command() for details.

restore(entity_id)

Restore an entity from the trashcan

Parameters

entity_id (str) – ID of the entity to be restored from the trashcan

Return type

Any

Returns

The response. See send_command() for details.

resume_task(task_id)

Resume an existing stopped task

Parameters

task_id (str) – UUID of the task to be resumed

Return type

Any

Returns

The response. See send_command() for details.

send_command(cmd)

Send a command to the remote server

If the class is not connected to the server yet the connection will be established automatically.

Parameters

cmd (str) – Command as string to be send over the connection to the server.

Returns

The actual returned type depends on the set transform.

Per default - if no transform is set explicitly - the response is returned as string.

Return type

any

start_task(task_id)

Start an existing task

Parameters

task_id (str) – UUID of the task to be started

Return type

Any

Returns

The response. See send_command() for details.

stop_task(task_id)

Stop an existing running task

Parameters

task_id (str) – UUID of the task to be stopped

Return type

Any

Returns

The response. See send_command() for details.

sync_cert()

Request a synchronization with the CERT feed service

Return type

Any

Returns

The response. See send_command() for details.

sync_config()

Request an OSP config synchronization with scanner

Return type

Any

Returns

The response. See send_command() for details.

sync_feed()

Request a synchronization with the NVT feed service

Return type

Any

Returns

The response. See send_command() for details.

sync_scap()

Request a synchronization with the SCAP feed service

Return type

Any

Returns

The response. See send_command() for details.

test_alert(alert_id)

Run an alert

Invoke a test run of an alert

Parameters

alert_id (str) – UUID of the alert to be tested

Return type

Any

Returns

The response. See send_command() for details.

trigger_alert(alert_id, report_id, *, filter=None, filter_id=None, report_format_id=None, delta_report_id=None)

Run an alert by ignoring its event and conditions

The alert is triggered to run immediately with the provided filtered report by ignoring the even and condition settings.

Parameters
  • alert_id (str) – UUID of the alert to be run

  • report_id (str) – UUID of the report to be provided to the alert

  • filter (Optional[str, None]) – Filter term to use to filter results in the report

  • filter_id (Optional[str, None]) – UUID of filter to use to filter results in the report

  • report_format_id (Optional[str, None]) – UUID of report format to use

  • delta_report_id (Optional[str, None]) – UUID of an existing report to compare report to.

Return type

Any

Returns

The response. See send_command() for details.

verify_agent(agent_id)

Verify an existing agent

Verifies the trust level of an existing agent. It will be checked whether signature of the agent currently matches the agent. This includes the agent installer file. It is not verified if the agent works as expected by the user.

Parameters

agent_id (str) – UUID of the agent to be verified

Return type

Any

Returns

The response. See send_command() for details.

verify_report_format(report_format_id)

Verify an existing report format

Verifies the trust level of an existing report format. It will be checked whether the signature of the report format currently matches the report format. This includes the script and files used to generate reports of this format. It is not verified if the report format works as expected by the user.

Parameters

report_format_id (str) – UUID of the report format to be verified

Return type

Any

Returns

The response. See send_command() for details.

verify_scanner(scanner_id)

Verify an existing scanner

Verifies if it is possible to connect to an existing scanner. It is not verified if the scanner works as expected by the user.

Parameters

scanner_id (str) – UUID of the scanner to be verified

Return type

Any

Returns

The response. See send_command() for details.