gvm-tools 23.10.0__tar.gz → 23.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gvm-tools might be problematic. Click here for more details.
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/PKG-INFO +2 -1
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/__version__.py +1 -1
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/pyproject.toml +1 -1
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/generate-random-reports.gmp.py +72 -32
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/LICENSE +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/README.md +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/__init__.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/cli.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/config.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/helper.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/parser.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/pyshell.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/gvmtools/script.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/.pylintrc +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/README.md +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/application-detection.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/bulk-modify-schedules.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/certbund-report.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/cfg-gen-for-certs.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/check-gmp.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/clean-sensor.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/combine-reports.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/create-consolidated-report.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/create-cve-report-from-json.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/create-dummy-data.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/create-targets-from-host-list.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/default_report_data.json +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/delete-overrides-by-filter.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/export-pdf-report.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/generate-random-targets.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/list-tasks.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/monthly-report-gos4.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/monthly-report.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/nvt-scan.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/requirements.txt +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/ruff.toml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/scan-new-system.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/send-delta-emails.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/send-schedules.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/send-targets.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/send-tasks.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/ssv_csv.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/start-alert-scan.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/start-multiple-alerts-scan.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/start-nvt-scan.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/sync-hosts.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/scripts/update-task-target.gmp.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/__init__.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/root_help.3.10.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/root_help.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/__init__.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/example_schedules.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/example_target.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/example_task.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/get_alerts.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/get_scan_configs.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/invalid_xml.xml +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_combine_reports.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_create_consolidated_report.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_send_schedules.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_send_targets.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_send_tasks.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/scripts/test_start_alert_scan.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/socket_help.3.10.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/socket_help.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/ssh_help.3.10.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/ssh_help.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/test.cfg +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/test_auth.cfg +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/test_config.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/test_helper.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/test_parser.py +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/tls_help.3.10.snap +0 -0
- {gvm_tools-23.10.0 → gvm_tools-23.11.0}/tests/tls_help.snap +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gvm-tools
|
|
3
|
-
Version: 23.
|
|
3
|
+
Version: 23.11.0
|
|
4
4
|
Summary: Tools to control a GSM/GVM over GMP or OSP
|
|
5
5
|
Home-page: https://github.com/greenbone/gvm-tools/
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
23
|
Requires-Dist: python-gvm (>=23.4.2)
|
|
23
24
|
Project-URL: Documentation, https://greenbone.github.io/gvm-tools/
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "gvm-tools"
|
|
7
|
-
version = "23.
|
|
7
|
+
version = "23.11.0"
|
|
8
8
|
authors = ["Greenbone AG <info@greenbone.net>"]
|
|
9
9
|
description = "Tools to control a GSM/GVM over GMP or OSP"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright (C) 2017-
|
|
2
|
+
# Copyright (C) 2017-2023 Greenbone AG
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
5
5
|
#
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
|
|
21
21
|
import json
|
|
22
22
|
import textwrap
|
|
23
|
-
import time
|
|
24
23
|
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
|
|
25
24
|
from pathlib import Path
|
|
26
25
|
from random import choice, gauss, randrange, seed
|
|
26
|
+
from datetime import datetime, timedelta
|
|
27
27
|
|
|
28
28
|
from gvm.protocols.gmp import Gmp
|
|
29
29
|
from lxml import etree as e
|
|
30
30
|
|
|
31
31
|
from gvmtools.helper import generate_id, generate_random_ips, generate_uuid
|
|
32
32
|
|
|
33
|
-
__version__ = "0.
|
|
33
|
+
__version__ = "0.3.1"
|
|
34
34
|
|
|
35
35
|
HELP_TEXT = f"""
|
|
36
|
-
Random Report Generation Script {__version__} (C) 2017-
|
|
36
|
+
Random Report Generation Script {__version__} (C) 2017-2023 Greenbone AG
|
|
37
37
|
|
|
38
38
|
This program is free software: you can redistribute it and/or modify
|
|
39
39
|
it under the terms of the GNU General Public License as published by
|
|
@@ -59,6 +59,17 @@ voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
|
59
59
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
|
|
60
60
|
deserunt mollit anim id est laborum."""
|
|
61
61
|
|
|
62
|
+
local_date_time = datetime.now()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def calculate_timestamp(delta: int = 0) -> str:
|
|
66
|
+
return (
|
|
67
|
+
(local_date_time + timedelta(seconds=delta))
|
|
68
|
+
.astimezone()
|
|
69
|
+
.replace(microsecond=0)
|
|
70
|
+
.isoformat()
|
|
71
|
+
)
|
|
72
|
+
|
|
62
73
|
|
|
63
74
|
def generate_ports(n_ports):
|
|
64
75
|
protocol = ["/tcp", "/udp"]
|
|
@@ -164,17 +175,9 @@ def generate_result_elem(
|
|
|
164
175
|
e.SubElement(own, "name").text = generate_id()
|
|
165
176
|
|
|
166
177
|
elem = e.Element("modification_time")
|
|
167
|
-
e.SubElement(result_elem, "modification_time").text = (
|
|
168
|
-
time.strftime("%Y-%m-%dT%H:%M:%S%z", time.localtime(time.time()))[:-2]
|
|
169
|
-
+ ":00"
|
|
170
|
-
) # Hell of a Timeformat :D
|
|
178
|
+
e.SubElement(result_elem, "modification_time").text = calculate_timestamp(0)
|
|
171
179
|
e.SubElement(result_elem, "comment").text = ""
|
|
172
|
-
e.SubElement(result_elem, "creation_time").text = (
|
|
173
|
-
time.strftime("%Y-%m-%dT%H:%M:%S%z", time.localtime(time.time() - 20))[
|
|
174
|
-
:-2
|
|
175
|
-
]
|
|
176
|
-
+ ":00"
|
|
177
|
-
)
|
|
180
|
+
e.SubElement(result_elem, "creation_time").text = calculate_timestamp(-20)
|
|
178
181
|
|
|
179
182
|
host_elem = e.Element("host")
|
|
180
183
|
host_elem.text = host_ip
|
|
@@ -260,18 +263,8 @@ def generate_host_elem(
|
|
|
260
263
|
e.SubElement(host_elem, "ip").text = host_ip
|
|
261
264
|
e.SubElement(host_elem, "asset", {"asset_id": host_asset}).text = ""
|
|
262
265
|
|
|
263
|
-
e.SubElement(host_elem, "start").text = (
|
|
264
|
-
|
|
265
|
-
"%Y-%m-%dT%H:%M:%S%z", time.localtime(time.time() - 1000)
|
|
266
|
-
)[:-2]
|
|
267
|
-
+ ":00"
|
|
268
|
-
)
|
|
269
|
-
e.SubElement(host_elem, "end").text = (
|
|
270
|
-
time.strftime("%Y-%m-%dT%H:%M:%S%z", time.localtime(time.time() - 30))[
|
|
271
|
-
:-2
|
|
272
|
-
]
|
|
273
|
-
+ ":00"
|
|
274
|
-
)
|
|
266
|
+
e.SubElement(host_elem, "start").text = calculate_timestamp(-1000)
|
|
267
|
+
e.SubElement(host_elem, "end").text = calculate_timestamp(-30)
|
|
275
268
|
|
|
276
269
|
app = choice(list(data["apps"]))
|
|
277
270
|
os = choice(list(data["oss"]))
|
|
@@ -304,7 +297,7 @@ def generate_host_elem(
|
|
|
304
297
|
host_elem.append(
|
|
305
298
|
generate_host_detail_elem(
|
|
306
299
|
"best_os_txt",
|
|
307
|
-
|
|
300
|
+
os,
|
|
308
301
|
source_name=oid,
|
|
309
302
|
source_description="Host Details",
|
|
310
303
|
source_type="nvt",
|
|
@@ -359,22 +352,58 @@ def generate_reports(task, n_reports, n_results, with_gauss, **kwargs):
|
|
|
359
352
|
return reports
|
|
360
353
|
|
|
361
354
|
|
|
362
|
-
def
|
|
355
|
+
def generate_target():
|
|
356
|
+
target_name = f"Random_Report_Generation_Target_{calculate_timestamp(0)}"
|
|
357
|
+
target_comment = (
|
|
358
|
+
f"Generated by Random Report Generation Script Version {__version__}."
|
|
359
|
+
)
|
|
360
|
+
target_hosts = ["198.18.0.0/24"]
|
|
361
|
+
target_port_list_id = "c7e03b6c-3bbe-11e1-a057-406186ea4fc5"
|
|
362
|
+
|
|
363
|
+
gmp.create_target(
|
|
364
|
+
name=target_name,
|
|
365
|
+
comment=target_comment,
|
|
366
|
+
hosts=target_hosts,
|
|
367
|
+
port_list_id=target_port_list_id,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def generate_data(gmp, n_tasks, task_type, **kwargs):
|
|
372
|
+
if task_type == "scan":
|
|
373
|
+
scanner_id = "08b69003-5fc2-4037-a479-93b440211c73"
|
|
374
|
+
config_id = "085569ce-73ed-11df-83c3-002264764cea"
|
|
375
|
+
generate_target()
|
|
376
|
+
target_id = gmp.get_targets(
|
|
377
|
+
filter_string=f'"Random_Report_Generation_Target_{calculate_timestamp(0)}"'
|
|
378
|
+
).xpath("//@id")[0]
|
|
379
|
+
|
|
363
380
|
for i in range(n_tasks):
|
|
364
381
|
index = f"{{0:0>{len(str(n_tasks))}}}"
|
|
365
|
-
task_name = f"
|
|
382
|
+
task_name = f"Random_Report_Generation_{task_type.capitalize()}_Task_{calculate_timestamp(0)}_{index.format(i + 1)}"
|
|
383
|
+
task_comment = f"Generated by Random Report Generation Script Version {__version__}."
|
|
366
384
|
|
|
367
|
-
gmp.create_container_task(task_name)
|
|
385
|
+
gmp.create_container_task(name=task_name, comment=task_comment)
|
|
368
386
|
|
|
369
387
|
task_id = gmp.get_tasks(filter_string=f"name={task_name}").xpath(
|
|
370
388
|
"//@id"
|
|
371
389
|
)[0]
|
|
372
390
|
|
|
391
|
+
if task_type == "scan":
|
|
392
|
+
gmp.modify_task(task_id=task_id, alterable=1)
|
|
393
|
+
|
|
373
394
|
reports = generate_reports(task=(task_id, task_name), **kwargs)
|
|
374
395
|
|
|
375
396
|
for report in reports[0:]:
|
|
376
397
|
gmp.import_report(report, task_id=task_id, in_assets=True)
|
|
377
398
|
|
|
399
|
+
if task_type == "scan":
|
|
400
|
+
gmp.modify_task(
|
|
401
|
+
task_id=task_id,
|
|
402
|
+
target_id=target_id,
|
|
403
|
+
scanner_id=scanner_id,
|
|
404
|
+
config_id=config_id,
|
|
405
|
+
)
|
|
406
|
+
|
|
378
407
|
|
|
379
408
|
def main(gmp: Gmp, args: Namespace) -> None:
|
|
380
409
|
# pylint: disable=undefined-variable, line-too-long
|
|
@@ -474,6 +503,16 @@ def main(gmp: Gmp, args: Namespace) -> None:
|
|
|
474
503
|
"--seed", help="RNG Seed, in case the same data should be generated."
|
|
475
504
|
)
|
|
476
505
|
|
|
506
|
+
parser.add_argument(
|
|
507
|
+
"--task-type",
|
|
508
|
+
dest="task_type",
|
|
509
|
+
type=str,
|
|
510
|
+
choices=["container", "scan"],
|
|
511
|
+
default="container",
|
|
512
|
+
help="Type of Task(s) to store the generated Reports. Can either "
|
|
513
|
+
"be 'container' or 'scan', default: 'container'.",
|
|
514
|
+
)
|
|
515
|
+
|
|
477
516
|
script_args = parser.parse_args(args.script_args)
|
|
478
517
|
|
|
479
518
|
if not script_args.seed:
|
|
@@ -484,7 +523,7 @@ def main(gmp: Gmp, args: Namespace) -> None:
|
|
|
484
523
|
with open(str(script_args.datafile), encoding="utf-8") as file:
|
|
485
524
|
data = json.load(file)
|
|
486
525
|
|
|
487
|
-
print("\n Generating randomized data
|
|
526
|
+
print("\n Generating randomized data...\n")
|
|
488
527
|
|
|
489
528
|
generate_data(
|
|
490
529
|
gmp,
|
|
@@ -497,9 +536,10 @@ def main(gmp: Gmp, args: Namespace) -> None:
|
|
|
497
536
|
data=data,
|
|
498
537
|
with_gauss=script_args.with_gauss,
|
|
499
538
|
with_descriptions=script_args.with_descriptions,
|
|
539
|
+
task_type=script_args.task_type,
|
|
500
540
|
)
|
|
501
541
|
|
|
502
|
-
print("\n Generation
|
|
542
|
+
print("\n Generation completed.\n")
|
|
503
543
|
|
|
504
544
|
|
|
505
545
|
if __name__ == "__gmp__":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|