|
@@ 61-113 (lines=53) @@
|
| 58 |
|
""" |
| 59 |
|
return PROTOCOL_VERSION |
| 60 |
|
|
| 61 |
|
def create_audit( |
| 62 |
|
self, |
| 63 |
|
name: str, |
| 64 |
|
policy_id: str, |
| 65 |
|
target_id: str, |
| 66 |
|
scanner_id: str, |
| 67 |
|
*, |
| 68 |
|
alterable: Optional[bool] = None, |
| 69 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 70 |
|
schedule_id: Optional[str] = None, |
| 71 |
|
alert_ids: Optional[List[str]] = None, |
| 72 |
|
comment: Optional[str] = None, |
| 73 |
|
schedule_periods: Optional[int] = None, |
| 74 |
|
observers: Optional[List[str]] = None, |
| 75 |
|
preferences: Optional[dict] = None |
| 76 |
|
) -> Any: |
| 77 |
|
"""Create a new audit task |
| 78 |
|
|
| 79 |
|
Arguments: |
| 80 |
|
name: Name of the new audit |
| 81 |
|
policy_id: UUID of policy to use by the audit |
| 82 |
|
target_id: UUID of target to be scanned |
| 83 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 84 |
|
comment: Comment for the audit |
| 85 |
|
alterable: Whether the task should be alterable |
| 86 |
|
alert_ids: List of UUIDs for alerts to be applied to the audit |
| 87 |
|
hosts_ordering: The order hosts are scanned in |
| 88 |
|
schedule_id: UUID of a schedule when the audit should be run. |
| 89 |
|
schedule_periods: A limit to the number of times the audit will be |
| 90 |
|
scheduled, or 0 for no limit |
| 91 |
|
observers: List of names or ids of users which should be allowed to |
| 92 |
|
observe this audit |
| 93 |
|
preferences: Name/Value pairs of scanner preferences. |
| 94 |
|
|
| 95 |
|
Returns: |
| 96 |
|
The response. See :py:meth:`send_command` for details. |
| 97 |
|
""" |
| 98 |
|
|
| 99 |
|
return self.__create_task( |
| 100 |
|
name=name, |
| 101 |
|
config_id=policy_id, |
| 102 |
|
target_id=target_id, |
| 103 |
|
scanner_id=scanner_id, |
| 104 |
|
usage_type=UsageType.AUDIT, |
| 105 |
|
function=self.create_audit.__name__, |
| 106 |
|
alterable=alterable, |
| 107 |
|
hosts_ordering=hosts_ordering, |
| 108 |
|
schedule_id=schedule_id, |
| 109 |
|
alert_ids=alert_ids, |
| 110 |
|
comment=comment, |
| 111 |
|
schedule_periods=schedule_periods, |
| 112 |
|
observers=observers, |
| 113 |
|
preferences=preferences, |
| 114 |
|
) |
| 115 |
|
|
| 116 |
|
def create_config(self, config_id: str, name: str) -> Any: |
|
@@ 153-204 (lines=52) @@
|
| 150 |
|
function=self.create_policy.__name__, |
| 151 |
|
) |
| 152 |
|
|
| 153 |
|
def create_task( |
| 154 |
|
self, |
| 155 |
|
name: str, |
| 156 |
|
config_id: str, |
| 157 |
|
target_id: str, |
| 158 |
|
scanner_id: str, |
| 159 |
|
*, |
| 160 |
|
alterable: Optional[bool] = None, |
| 161 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 162 |
|
schedule_id: Optional[str] = None, |
| 163 |
|
alert_ids: Optional[List[str]] = None, |
| 164 |
|
comment: Optional[str] = None, |
| 165 |
|
schedule_periods: Optional[int] = None, |
| 166 |
|
observers: Optional[List[str]] = None, |
| 167 |
|
preferences: Optional[dict] = None |
| 168 |
|
) -> Any: |
| 169 |
|
"""Create a new scan task |
| 170 |
|
|
| 171 |
|
Arguments: |
| 172 |
|
name: Name of the task |
| 173 |
|
config_id: UUID of scan config to use by the task |
| 174 |
|
target_id: UUID of target to be scanned |
| 175 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 176 |
|
comment: Comment for the task |
| 177 |
|
alterable: Whether the task should be alterable |
| 178 |
|
alert_ids: List of UUIDs for alerts to be applied to the task |
| 179 |
|
hosts_ordering: The order hosts are scanned in |
| 180 |
|
schedule_id: UUID of a schedule when the task should be run. |
| 181 |
|
schedule_periods: A limit to the number of times the task will be |
| 182 |
|
scheduled, or 0 for no limit |
| 183 |
|
observers: List of names or ids of users which should be allowed to |
| 184 |
|
observe this task |
| 185 |
|
preferences: Name/Value pairs of scanner preferences. |
| 186 |
|
|
| 187 |
|
Returns: |
| 188 |
|
The response. See :py:meth:`send_command` for details. |
| 189 |
|
""" |
| 190 |
|
return self.__create_task( |
| 191 |
|
name=name, |
| 192 |
|
config_id=config_id, |
| 193 |
|
target_id=target_id, |
| 194 |
|
scanner_id=scanner_id, |
| 195 |
|
usage_type=UsageType.SCAN, |
| 196 |
|
function=self.create_task.__name__, |
| 197 |
|
alterable=alterable, |
| 198 |
|
hosts_ordering=hosts_ordering, |
| 199 |
|
schedule_id=schedule_id, |
| 200 |
|
alert_ids=alert_ids, |
| 201 |
|
comment=comment, |
| 202 |
|
schedule_periods=schedule_periods, |
| 203 |
|
observers=observers, |
| 204 |
|
preferences=preferences, |
| 205 |
|
) |
| 206 |
|
|
| 207 |
|
def create_tls_certificate( |