gvm-tools 24.7.0__tar.gz → 24.12.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.

Files changed (107) hide show
  1. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/PKG-INFO +2 -1
  2. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/__version__.py +1 -1
  3. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/pyproject.toml +1 -1
  4. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-consolidated-report.gmp.py +1 -4
  5. gvm_tools-24.12.0/scripts/list-tasks.gmp.py +90 -0
  6. gvm_tools-24.12.0/tests/scripts/test_list_tasks.py +119 -0
  7. gvm_tools-24.7.0/scripts/list-tasks.gmp.py +0 -44
  8. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/LICENSE +0 -0
  9. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/README.md +0 -0
  10. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/__init__.py +0 -0
  11. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/cli.py +0 -0
  12. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/config.py +0 -0
  13. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/helper.py +0 -0
  14. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/parser.py +0 -0
  15. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/pyshell.py +0 -0
  16. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/gvmtools/script.py +0 -0
  17. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/.pylintrc +0 -0
  18. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/README.md +0 -0
  19. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/application-detection.gmp.py +0 -0
  20. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/bulk-modify-schedules.gmp.py +0 -0
  21. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/certbund-report.gmp.py +0 -0
  22. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/cfg-gen-for-certs.gmp.py +0 -0
  23. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/check-gmp.gmp.py +0 -0
  24. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/clean-sensor.gmp.py +0 -0
  25. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/combine-reports.gmp.py +0 -0
  26. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-alerts-from-csv.gmp.py +0 -0
  27. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-credentials-from-csv.gmp.py +0 -0
  28. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-cve-report-from-json.gmp.py +0 -0
  29. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-dummy-data.gmp.py +0 -0
  30. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-filters-from-csv.gmp.py +0 -0
  31. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-report-format-from-csv.gmp.py +0 -0
  32. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-schedules-from-csv.gmp.py +0 -0
  33. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-tags-from-csv.gmp.py +0 -0
  34. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-targets-from-csv.gmp.py +0 -0
  35. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-targets-from-host-list.gmp.py +0 -0
  36. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/create-tasks-from-csv.gmp.py +0 -0
  37. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/default_report_data.json +0 -0
  38. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/delete-overrides-by-filter.gmp.py +0 -0
  39. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/empty-trash.gmp.py +0 -0
  40. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/export-csv-report.gmp.py +0 -0
  41. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/export-pdf-report.gmp.py +0 -0
  42. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/export-xml-report.gmp.py +0 -0
  43. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/generate-random-reports.gmp.py +0 -0
  44. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/generate-random-targets.gmp.py +0 -0
  45. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-alerts.gmp.py +0 -0
  46. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-credentials.gmp.py +0 -0
  47. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-feeds.gmp.py +0 -0
  48. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-filters.gmp.py +0 -0
  49. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-groups.gmp.py +0 -0
  50. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-policies.gmp.py +0 -0
  51. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-portlists.gmp.py +0 -0
  52. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-report-formats.gmp.py +0 -0
  53. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-reports.gmp.py +0 -0
  54. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-roles.gmp.py +0 -0
  55. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-scan-configs.gmp.py +0 -0
  56. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-scanners.gmp.py +0 -0
  57. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-schedules.gmp.py +0 -0
  58. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-tags.gmp.py +0 -0
  59. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-targets.gmp.py +0 -0
  60. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-tickets.gmp.py +0 -0
  61. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/list-users.gmp.py +0 -0
  62. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/monthly-report-gos4.gmp.py +0 -0
  63. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/monthly-report.gmp.py +0 -0
  64. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/nvt-scan.gmp.py +0 -0
  65. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/requirements.txt +0 -0
  66. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/ruff.toml +0 -0
  67. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/scan-new-system.gmp.py +0 -0
  68. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/send-delta-emails.gmp.py +0 -0
  69. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/send-schedules.gmp.py +0 -0
  70. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/send-targets.gmp.py +0 -0
  71. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/send-tasks.gmp.py +0 -0
  72. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/ssv_csv.py +0 -0
  73. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/start-alert-scan.gmp.py +0 -0
  74. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/start-multiple-alerts-scan.gmp.py +0 -0
  75. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/start-nvt-scan.gmp.py +0 -0
  76. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/start-scans-from-csv.py +0 -0
  77. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/stop-all-scans.gmp.py +0 -0
  78. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/stop-scans-from-csv.py +0 -0
  79. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/sync-hosts.gmp.py +0 -0
  80. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/scripts/update-task-target.gmp.py +0 -0
  81. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/__init__.py +0 -0
  82. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/root_help.3.10.snap +0 -0
  83. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/root_help.snap +0 -0
  84. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/__init__.py +0 -0
  85. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/example_schedules.xml +0 -0
  86. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/example_target.xml +0 -0
  87. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/example_task.xml +0 -0
  88. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/get_alerts.xml +0 -0
  89. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/get_scan_configs.xml +0 -0
  90. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/invalid_xml.xml +0 -0
  91. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_combine_reports.py +0 -0
  92. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_create_consolidated_report.py +0 -0
  93. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_send_schedules.py +0 -0
  94. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_send_targets.py +0 -0
  95. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_send_tasks.py +0 -0
  96. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/scripts/test_start_alert_scan.py +0 -0
  97. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/socket_help.3.10.snap +0 -0
  98. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/socket_help.snap +0 -0
  99. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/ssh_help.3.10.snap +0 -0
  100. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/ssh_help.snap +0 -0
  101. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/test.cfg +0 -0
  102. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/test_auth.cfg +0 -0
  103. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/test_config.py +0 -0
  104. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/test_helper.py +0 -0
  105. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/test_parser.py +0 -0
  106. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/tls_help.3.10.snap +0 -0
  107. {gvm_tools-24.7.0 → gvm_tools-24.12.0}/tests/tls_help.snap +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gvm-tools
3
- Version: 24.7.0
3
+ Version: 24.12.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
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.9
19
19
  Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
22
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
24
  Requires-Dist: python-gvm (>=23.4.2)
24
25
  Project-URL: Documentation, https://greenbone.github.io/gvm-tools/
@@ -2,4 +2,4 @@
2
2
 
3
3
  # THIS IS AN AUTOGENERATED FILE. DO NOT TOUCH!
4
4
 
5
- __version__ = "24.7.0"
5
+ __version__ = "24.12.0"
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "gvm-tools"
7
- version = "24.7.0"
7
+ version = "24.12.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"
@@ -2,7 +2,6 @@
2
2
  #
3
3
  # SPDX-License-Identifier: GPL-3.0-or-later
4
4
 
5
- import sys
6
5
  from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
7
6
  from datetime import date
8
7
  from typing import List, Tuple
@@ -239,9 +238,7 @@ def get_last_report_in_time_period(
239
238
  reports_id = reports_xml.xpath("report/@id")
240
239
  if reports_id:
241
240
  reports.append(reports_id[0])
242
- else:
243
- print(f"Failed to get report for task {task_id}", file=sys.stderr)
244
- sys.exit(1)
241
+
245
242
  return reports
246
243
 
247
244
 
@@ -0,0 +1,90 @@
1
+ # SPDX-FileCopyrightText: 2024 Martin Boller
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+
5
+ from argparse import Namespace
6
+
7
+ from gvm.protocols.gmp import Gmp
8
+ from gvmtools.helper import Table
9
+ from datetime import datetime
10
+
11
+
12
+ def list_tasks(gmp: Gmp, args: Namespace) -> None:
13
+ # pylint: disable=unused-argument
14
+
15
+ response_xml = gmp.get_tasks(details=True, filter_string="rows=-1")
16
+ tasks_xml = response_xml.xpath("task")
17
+
18
+ heading = [
19
+ "#",
20
+ "Name",
21
+ "Id",
22
+ "Target",
23
+ "Scanner",
24
+ "Scan Order",
25
+ "Severity",
26
+ "Average Duration",
27
+ "Last Scan Duration (hours)",
28
+ ]
29
+
30
+ rows = []
31
+ numberRows = 0
32
+
33
+ for task in tasks_xml:
34
+ # Count number of reports
35
+ numberRows = numberRows + 1
36
+ # Cast/convert to text to show in list
37
+ rowNumber = str(numberRows)
38
+
39
+ name = "".join(task.xpath("name/text()"))
40
+ task_id = task.get("id")
41
+ targetname = "".join(task.xpath("target/name/text()"))
42
+ scanner = "".join(task.xpath("scanner/name/text()"))
43
+ severity = "".join(task.xpath("last_report/report/severity/text()"))
44
+ order = "".join(task.xpath("hosts_ordering/text()"))
45
+ average_duration = "".join(task.xpath("average_duration/text()"))
46
+ average_duration_int = (
47
+ 0 if not average_duration else int(average_duration)
48
+ )
49
+ average_duration_hours = f"{average_duration_int / 3600:.2f}"
50
+ scan_start_iso = "".join(
51
+ task.xpath("last_report/report/scan_start/text()")
52
+ )
53
+ scan_end_iso = "".join(task.xpath("last_report/report/scan_end/text()"))
54
+ if not scan_start_iso or not scan_end_iso:
55
+ duration_hours = ""
56
+ else:
57
+ scan_start_time = datetime.fromisoformat(
58
+ scan_start_iso.replace("Z", "+00:00")
59
+ )
60
+ scan_end_time = datetime.fromisoformat(
61
+ scan_end_iso.replace("Z", "+00:00")
62
+ )
63
+ duration = scan_end_time - scan_start_time
64
+ duration_hours = f"{duration.total_seconds() / 3600:.2f}"
65
+ rows.append(
66
+ [
67
+ rowNumber,
68
+ name,
69
+ task_id,
70
+ targetname,
71
+ scanner,
72
+ order,
73
+ severity,
74
+ average_duration_hours,
75
+ duration_hours,
76
+ ]
77
+ )
78
+
79
+ print(Table(heading=heading, rows=rows))
80
+
81
+
82
+ def main(gmp: Gmp, args: Namespace) -> None:
83
+
84
+ print("Listing tasks.\n")
85
+
86
+ list_tasks(gmp, args)
87
+
88
+
89
+ if __name__ == "__gmp__":
90
+ main(gmp, args)
@@ -0,0 +1,119 @@
1
+ # -*- coding: utf-8 -*-
2
+ # SPDX-FileCopyrightText: 2020-2024 Greenbone AG
3
+ #
4
+ # SPDX-License-Identifier: GPL-3.0-or-later
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see<http://www.gnu.org/licenses/>
18
+
19
+
20
+ import unittest
21
+ from argparse import Namespace
22
+ from pathlib import Path
23
+ from unittest.mock import patch
24
+
25
+ from gvmtools.helper import Table
26
+
27
+ from . import GmpMockFactory, load_script
28
+
29
+ CWD = Path(__file__).absolute().parent
30
+
31
+
32
+ class ListTasksTestCase(unittest.TestCase):
33
+ def setUp(self):
34
+ self.list_tasks = load_script(
35
+ (CWD.parent.parent / "scripts"), "list-tasks"
36
+ )
37
+
38
+ @patch("gvm.protocols.latest.Gmp", new_callable=GmpMockFactory)
39
+ @patch("builtins.print")
40
+ def test_duration_with_timezone_offset(
41
+ self, mock_print, mock_gmp: GmpMockFactory
42
+ ):
43
+ args = Namespace(script=["foo"])
44
+
45
+ mock_gmp.mock_response(
46
+ "get_tasks",
47
+ '<get_tasks_response status="200" status_text="OK">'
48
+ '<task id="7f32c1f4-c5c8-4035-b4fb-5b1e220bc052">'
49
+ "<name>Test</name>"
50
+ "<average_duration>4115</average_duration>"
51
+ "<last_report>"
52
+ '<report id="cbf8c159-d3f8-4adf-b17d-fd53abf20e52">'
53
+ "<scan_start>2024-03-12T16:35:01-07:00</scan_start>"
54
+ "<scan_end>2024-03-12T17:43:36-07:00</scan_end>"
55
+ "</report>"
56
+ "</last_report>"
57
+ "</task>"
58
+ "</get_tasks_response>",
59
+ )
60
+ self.list_tasks.list_tasks(mock_gmp.gmp_protocol, args)
61
+
62
+ table = mock_print.call_args[0][0]
63
+ self.assertIsInstance(table, Table)
64
+ self.assertEqual(len(table.rows), 1)
65
+ self.assertEqual(table.rows[0][1], "Test")
66
+ self.assertEqual(table.rows[0][7], "1.14")
67
+ self.assertEqual(table.rows[0][8], "1.14")
68
+
69
+ @patch("gvm.protocols.latest.Gmp", new_callable=GmpMockFactory)
70
+ @patch("builtins.print")
71
+ def test_duration_in_UTC(self, mock_print, mock_gmp: GmpMockFactory):
72
+ args = Namespace(script=["foo"])
73
+
74
+ mock_gmp.mock_response(
75
+ "get_tasks",
76
+ '<get_tasks_response status="200" status_text="OK">'
77
+ '<task id="7f32c1f4-c5c8-4035-b4fb-5b1e220bc052">'
78
+ "<name>Test</name>"
79
+ "<average_duration>14444</average_duration>"
80
+ "<last_report>"
81
+ '<report id="cbf8c159-d3f8-4adf-b17d-fd53abf20e52">'
82
+ "<scan_start>2024-09-27T14:30:01Z</scan_start>"
83
+ "<scan_end>2024-09-27T18:30:45Z</scan_end>"
84
+ "</report>"
85
+ "</last_report>"
86
+ "</task>"
87
+ "</get_tasks_response>",
88
+ )
89
+ self.list_tasks.list_tasks(mock_gmp.gmp_protocol, args)
90
+
91
+ table = mock_print.call_args[0][0]
92
+ self.assertIsInstance(table, Table)
93
+ self.assertEqual(len(table.rows), 1)
94
+ self.assertEqual(table.rows[0][1], "Test")
95
+ self.assertEqual(table.rows[0][7], "4.01")
96
+ self.assertEqual(table.rows[0][8], "4.01")
97
+
98
+ @patch("gvm.protocols.latest.Gmp", new_callable=GmpMockFactory)
99
+ @patch("builtins.print")
100
+ def test_missing_last_report(self, mock_print, mock_gmp: GmpMockFactory):
101
+ args = Namespace(script=["foo"])
102
+
103
+ mock_gmp.mock_response(
104
+ "get_tasks",
105
+ '<get_tasks_response status="200" status_text="OK">'
106
+ '<task id="7f32c1f4-c5c8-4035-b4fb-5b1e220bc052">'
107
+ "<name>Test</name>"
108
+ "<average_duration>0</average_duration>"
109
+ "</task>"
110
+ "</get_tasks_response>",
111
+ )
112
+ self.list_tasks.list_tasks(mock_gmp.gmp_protocol, args)
113
+
114
+ table = mock_print.call_args[0][0]
115
+ self.assertIsInstance(table, Table)
116
+ self.assertEqual(len(table.rows), 1)
117
+ self.assertEqual(table.rows[0][1], "Test")
118
+ self.assertEqual(table.rows[0][7], "0.00")
119
+ self.assertEqual(table.rows[0][8], "")
@@ -1,44 +0,0 @@
1
- # SPDX-FileCopyrightText: 2024 Martin Boller
2
- #
3
- # SPDX-License-Identifier: GPL-3.0-or-later
4
-
5
- from argparse import Namespace
6
-
7
- from gvm.protocols.gmp import Gmp
8
- from gvmtools.helper import Table
9
-
10
-
11
- def main(gmp: Gmp, args: Namespace) -> None:
12
- # pylint: disable=unused-argument
13
-
14
- response_xml = gmp.get_tasks(details=True, filter_string="rows=-1")
15
- tasks_xml = response_xml.xpath("task")
16
-
17
- heading = ["#", "Name", "Id", "Target", "Scanner", "Scan Order", "Severity"]
18
-
19
- rows = []
20
- numberRows = 0
21
-
22
- print("Listing tasks.\n")
23
-
24
- for task in tasks_xml:
25
- # Count number of reports
26
- numberRows = numberRows + 1
27
- # Cast/convert to text to show in list
28
- rowNumber = str(numberRows)
29
-
30
- name = "".join(task.xpath("name/text()"))
31
- task_id = task.get("id")
32
- targetname = "".join(task.xpath("target/name/text()"))
33
- scanner = "".join(task.xpath("scanner/name/text()"))
34
- severity = "".join(task.xpath("last_report/report/severity/text()"))
35
- order = "".join(task.xpath("hosts_ordering/text()"))
36
- rows.append(
37
- [rowNumber, name, task_id, targetname, scanner, order, severity]
38
- )
39
-
40
- print(Table(heading=heading, rows=rows))
41
-
42
-
43
- if __name__ == "__gmp__":
44
- main(gmp, args)
File without changes
File without changes
File without changes
File without changes