gvm-tools 25.1.1__tar.gz → 25.3.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 (114) hide show
  1. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/PKG-INFO +3 -3
  2. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/__version__.py +1 -1
  3. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/parser.py +1 -2
  4. gvm_tools-25.3.0/pyproject.toml +177 -0
  5. gvm_tools-25.3.0/scripts/export-certificates.gmp.py +160 -0
  6. gvm_tools-25.3.0/scripts/export-hosts-csv.gmp.py +180 -0
  7. gvm_tools-25.3.0/scripts/export-operatingsystems-csv.gmp.py +157 -0
  8. gvm_tools-25.3.0/scripts/list-hosts.gmp.py +168 -0
  9. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/ssv_csv.py +6 -6
  10. gvm_tools-25.3.0/scripts/verify-scanners.gmp.py +53 -0
  11. gvm_tools-25.1.1/pyproject.toml +0 -88
  12. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/LICENSE +0 -0
  13. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/README.md +0 -0
  14. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/__init__.py +0 -0
  15. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/cli.py +0 -0
  16. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/config.py +0 -0
  17. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/helper.py +0 -0
  18. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/pyshell.py +0 -0
  19. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/gvmtools/script.py +0 -0
  20. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/.pylintrc +0 -0
  21. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/README.md +0 -0
  22. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/application-detection.gmp.py +0 -0
  23. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/bulk-modify-schedules.gmp.py +0 -0
  24. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/certbund-report.gmp.py +0 -0
  25. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/cfg-gen-for-certs.gmp.py +0 -0
  26. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/check-gmp-gos22.04.gmp.py +0 -0
  27. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/check-gmp-gos24.10.gmp.py +0 -0
  28. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/clean-sensor.gmp.py +0 -0
  29. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/combine-reports.gmp.py +0 -0
  30. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-alerts-from-csv.gmp.py +0 -0
  31. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-consolidated-report.gmp.py +0 -0
  32. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-credentials-from-csv.gmp.py +0 -0
  33. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-cve-report-from-json.gmp.py +0 -0
  34. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-dummy-data.gmp.py +0 -0
  35. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-filters-from-csv.gmp.py +0 -0
  36. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-report-format-from-csv.gmp.py +0 -0
  37. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-schedules-from-csv.gmp.py +0 -0
  38. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-tags-from-csv.gmp.py +0 -0
  39. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-targets-from-csv.gmp.py +0 -0
  40. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-targets-from-host-list.gmp.py +0 -0
  41. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/create-tasks-from-csv.gmp.py +0 -0
  42. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/default_report_data.json +0 -0
  43. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/delete-overrides-by-filter.gmp.py +0 -0
  44. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/empty-trash.gmp.py +0 -0
  45. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/export-csv-report.gmp.py +0 -0
  46. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/export-pdf-report.gmp.py +0 -0
  47. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/export-xml-report.gmp.py +0 -0
  48. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/generate-random-reports.gmp.py +0 -0
  49. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/generate-random-targets.gmp.py +0 -0
  50. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-alerts.gmp.py +0 -0
  51. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-credentials.gmp.py +0 -0
  52. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-feeds.gmp.py +0 -0
  53. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-filters.gmp.py +0 -0
  54. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-groups.gmp.py +0 -0
  55. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-policies.gmp.py +0 -0
  56. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-portlists.gmp.py +0 -0
  57. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-report-formats.gmp.py +0 -0
  58. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-reports.gmp.py +0 -0
  59. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-roles.gmp.py +0 -0
  60. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-scan-configs.gmp.py +0 -0
  61. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-scanners.gmp.py +0 -0
  62. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-schedules.gmp.py +0 -0
  63. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-tags.gmp.py +0 -0
  64. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-targets.gmp.py +0 -0
  65. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-tasks.gmp.py +0 -0
  66. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-tickets.gmp.py +0 -0
  67. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/list-users.gmp.py +0 -0
  68. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/monthly-report-gos24.10.gmp.py +0 -0
  69. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/monthly-report-gos3.gmp.py +0 -0
  70. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/monthly-report-gos4.gmp.py +0 -0
  71. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/nvt-scan.gmp.py +0 -0
  72. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/requirements.txt +0 -0
  73. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/ruff.toml +0 -0
  74. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/scan-new-system.gmp.py +0 -0
  75. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/send-delta-emails.gmp.py +0 -0
  76. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/send-schedules.gmp.py +0 -0
  77. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/send-targets.gmp.py +0 -0
  78. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/send-tasks.gmp.py +0 -0
  79. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/start-alert-scan.gmp.py +0 -0
  80. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/start-multiple-alerts-scan.gmp.py +0 -0
  81. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/start-nvt-scan.gmp.py +0 -0
  82. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/start-scans-from-csv.py +0 -0
  83. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/stop-all-scans.gmp.py +0 -0
  84. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/stop-scans-from-csv.py +0 -0
  85. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/sync-hosts.gmp.py +0 -0
  86. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/scripts/update-task-target.gmp.py +0 -0
  87. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/__init__.py +0 -0
  88. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/root_help.3.10.snap +0 -0
  89. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/root_help.snap +0 -0
  90. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/__init__.py +0 -0
  91. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/example_schedules.xml +0 -0
  92. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/example_target.xml +0 -0
  93. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/example_task.xml +0 -0
  94. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/get_alerts.xml +0 -0
  95. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/get_scan_configs.xml +0 -0
  96. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/invalid_xml.xml +0 -0
  97. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_combine_reports.py +0 -0
  98. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_create_consolidated_report.py +0 -0
  99. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_list_tasks.py +0 -0
  100. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_send_schedules.py +0 -0
  101. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_send_targets.py +0 -0
  102. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_send_tasks.py +0 -0
  103. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/scripts/test_start_alert_scan.py +0 -0
  104. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/socket_help.3.10.snap +0 -0
  105. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/socket_help.snap +0 -0
  106. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/ssh_help.3.10.snap +0 -0
  107. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/ssh_help.snap +0 -0
  108. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/test.cfg +0 -0
  109. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/test_auth.cfg +0 -0
  110. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/test_config.py +0 -0
  111. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/test_helper.py +0 -0
  112. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/test_parser.py +0 -0
  113. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/tls_help.3.10.snap +0 -0
  114. {gvm_tools-25.1.1 → gvm_tools-25.3.0}/tests/tls_help.snap +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gvm-tools
3
- Version: 25.1.1
3
+ Version: 25.3.0
4
4
  Summary: Tools to control a GSM/GVM over GMP or OSP
5
5
  License: GPL-3.0-or-later
6
6
  Author: Greenbone AG
7
7
  Author-email: info@greenbone.net
8
- Requires-Python: >=3.9,<4.0
8
+ Requires-Python: >=3.9.2,<4.0.0
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Environment :: Console
11
11
  Classifier: Intended Audience :: Developers
@@ -14,11 +14,11 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
14
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.9
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Dist: python-gvm (>=23.4.2)
24
24
  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__ = "25.1.1"
5
+ __version__ = "25.3.0"
@@ -16,8 +16,7 @@
16
16
  # You should have received a copy of the GNU General Public License
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
- """Command Line Interface Parser
20
- """
19
+ """Command Line Interface Parser"""
21
20
 
22
21
  import argparse
23
22
  import logging
@@ -0,0 +1,177 @@
1
+ [build-system]
2
+ requires = ["poetry-core>=1.0.0"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "gvm-tools"
7
+ version = "25.3.0"
8
+ authors = ["Greenbone AG <info@greenbone.net>"]
9
+ description = "Tools to control a GSM/GVM over GMP or OSP"
10
+ license = "GPL-3.0-or-later"
11
+ readme = "README.md"
12
+ homepage = "https://github.com/greenbone/gvm-tools/"
13
+ repository = "https://github.com/greenbone/gvm-tools/"
14
+ documentation = "https://greenbone.github.io/gvm-tools/"
15
+ classifiers = [
16
+ # Full list: https://pypi.org/pypi?%3Aaction=list_classifiers
17
+ 'Development Status :: 5 - Production/Stable',
18
+ 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
19
+ 'Environment :: Console',
20
+ 'Intended Audience :: Developers',
21
+ 'Intended Audience :: System Administrators',
22
+ 'Programming Language :: Python :: 3.9',
23
+ 'Programming Language :: Python :: 3.10',
24
+ 'Programming Language :: Python :: 3.11',
25
+ 'Programming Language :: Python :: 3.12',
26
+ 'Operating System :: OS Independent',
27
+ 'Topic :: Software Development :: Libraries :: Python Modules',
28
+ ]
29
+ packages = [
30
+ { include = "gvmtools" },
31
+ { include = "tests", format = "sdist" },
32
+ { include = "scripts", format = "sdist" },
33
+ ]
34
+
35
+ [tool.poetry.scripts]
36
+ gvm-pyshell = "gvmtools.pyshell:main"
37
+ gvm-cli = "gvmtools.cli:main"
38
+ gvm-script = "gvmtools.script:main"
39
+
40
+ [tool.poetry.dependencies]
41
+ python = "^3.9.2"
42
+ python-gvm = ">=23.4.2"
43
+
44
+ [tool.poetry.group.dev.dependencies]
45
+ autohooks = ">=22.8.0"
46
+ autohooks-plugin-ruff = ">=23.6.1"
47
+ autohooks-plugin-black = ">=22.8.1"
48
+ pontos = ">=22.8.1"
49
+ sphinx = ">=5.3.0"
50
+ coverage = ">=7.2"
51
+ rope = ">=1.9.0"
52
+ furo = ">=2023.3.27"
53
+ sphinx-autobuild = ">=2021.3.14"
54
+ myst-parser = ">=2.0.0"
55
+ git-cliff = "^2.8.0"
56
+
57
+ [tool.black]
58
+ line-length = 80
59
+ target-version = ['py39', 'py310', 'py311', 'py312']
60
+ exclude = '''
61
+ /(
62
+ \.git
63
+ | \.venv
64
+ | \.github
65
+ | \.vscode
66
+ | _build
67
+ | build
68
+ | dist
69
+ | docs
70
+ )/
71
+ '''
72
+
73
+ [tool.autohooks]
74
+ mode = "poetry"
75
+ pre-commit = ['autohooks.plugins.black', 'autohooks.plugins.ruff']
76
+
77
+ [tool.ruff]
78
+ line-length = 80
79
+ target-version = "py39"
80
+
81
+ [tool.ruff.lint]
82
+ extend-select = ["I", "PLE", "PLW"]
83
+
84
+ [tool.coverage.run]
85
+ omit = ["tests/*"]
86
+ source = ["gvmtools", "scripts"]
87
+
88
+ [tool.pontos.version]
89
+ version-module-file = "gvmtools/__version__.py"
90
+
91
+ [tool.git-cliff.changelog]
92
+ # template for the changelog header
93
+ header = """
94
+ # Changelog\n
95
+ All notable changes to this project will be documented in this file.
96
+
97
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
98
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
99
+ """
100
+ # template for the changelog body
101
+ # https://keats.github.io/tera/docs/#introduction
102
+ body = """
103
+ {%- macro remote_url() -%}
104
+ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
105
+ {%- endmacro -%}
106
+
107
+ {% if version -%}
108
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
109
+ {% else -%}
110
+ ## [Unreleased]
111
+ {% endif -%}
112
+
113
+ {% for group, commits in commits | group_by(attribute="group") %}
114
+ ### {{ group | upper_first }}
115
+ {% for commit in commits %}
116
+ - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
117
+ {% if commit.remote.username %} by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}){%- endif -%}
118
+ {% if commit.remote.pr_number %} in \
119
+ [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
120
+ {% elif commit.id %} in \
121
+ [{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }})\
122
+ {%- endif -%}
123
+ {% endfor %}
124
+ {% endfor -%}
125
+ """
126
+ # template for the changelog footer
127
+ footer = """
128
+ {%- macro remote_url() -%}
129
+ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
130
+ {%- endmacro -%}
131
+
132
+ {% for release in releases %}
133
+ {% if release.version -%}
134
+ {% if release.previous.version -%}
135
+ [{{ release.version | trim_start_matches(pat="v") }}]: \
136
+ {{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }}
137
+ {% endif -%}
138
+ {% else -%}
139
+ [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD
140
+ {% endif -%}
141
+ {%- endfor -%}
142
+ """
143
+ # remove the leading and trailing whitespace from the templates
144
+ trim = true
145
+
146
+ [tool.git-cliff.git]
147
+ # parse the commits based on https://www.conventionalcommits.org
148
+ conventional_commits = true
149
+ # filter out the commits that are not following the conventional commits format
150
+ filter_unconventional = false
151
+ # process each line of a commit as an individual commit
152
+ split_commits = false
153
+ # regex for preprocessing the commit messages
154
+ commit_preprocessors = [
155
+ # remove issue numbers from commits
156
+ { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
157
+ ]
158
+ # regex for parsing and grouping commits
159
+ commit_parsers = [
160
+ { message = "^[a|A]dd", group = "<!-- 1 -->:sparkles: Added" },
161
+ { message = "^[c|C]hange", group = "<!-- 2 -->:construction_worker: Changed" },
162
+ { message = "^[f|F]ix", group = "<!-- 3 -->:bug: Bug Fixes" },
163
+ { message = "^[r|R]emove", group = "<!-- 4 -->:fire: Removed" },
164
+ { message = "^[d|D]rop", group = "<!-- 4 -->:fire: Removed" },
165
+ { message = "^[d|D]oc", group = "<!-- 5 -->:books: Documentation" },
166
+ { message = "^[t|T]est", group = "<!-- 6 -->:white_check_mark: Testing" },
167
+ { message = "^[c|C]hore", group = "<!-- 7 -->:wrench: Miscellaneous" },
168
+ { message = "^[c|C]i", group = "<!-- 7 -->️:wrench: Miscellaneous" },
169
+ { message = "^[m|M]isc", group = "<!-- 7 -->:wrench: Miscellaneous" },
170
+ { message = "^[d|D]eps", group = "<!-- 8 -->:ship: Dependencies" },
171
+ ]
172
+ # filter out the commits that are not matched by commit parsers
173
+ filter_commits = true
174
+ # sort the tags topologically
175
+ topo_order = false
176
+ # sort the commits inside sections by oldest/newest order
177
+ sort_commits = "oldest"
@@ -0,0 +1,160 @@
1
+ # SPDX-FileCopyrightText: 2025 Martin Boller
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # Loosely based on other greenbone scripts
6
+ #
7
+ # Run with: gvm-script --gmp-username admin-user --gmp-password password socket export-hosts-csv.gmp.py <csv file> days
8
+ # example: gvm-script --gmp-username admin --gmp-password top$ecret socket export-hosts-csv.gmp.py hosts.csv 2
9
+
10
+ import csv
11
+ from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
12
+ from datetime import date, datetime, time, timedelta
13
+
14
+ # GVM Specific
15
+ from gvm.protocols.gmp import Gmp
16
+ from gvmtools.helper import error_and_exit
17
+
18
+ HELP_TEXT = (
19
+ "This script generates a csv file with certificates "
20
+ "from Greenbone Vulnerability Manager.\n"
21
+ "Optional: Specify csv filename and days in the past to get data from as positional arguments\n"
22
+ "or live with the defaults\n"
23
+ "csv file will contain:\n"
24
+ "Subject, Issuer, Serial, SHA256 Fingerprint, MD5 Fingerprint, last_seen, Valid From, Valid To"
25
+ )
26
+
27
+
28
+ def parse_args(args: Namespace) -> Namespace: # pylint: disable=unused-argument
29
+ """Parsing args ..."""
30
+
31
+ parser = ArgumentParser(
32
+ prefix_chars="+",
33
+ add_help=False,
34
+ formatter_class=RawTextHelpFormatter,
35
+ description=HELP_TEXT,
36
+ )
37
+
38
+ parser.add_argument(
39
+ "+h",
40
+ "++help",
41
+ action="help",
42
+ help="Show this help message and exit.",
43
+ )
44
+
45
+ parser.add_argument(
46
+ "csv_filename",
47
+ nargs="?",
48
+ default="gvm_certificates.csv",
49
+ type=str,
50
+ help=(
51
+ "Optional: CSV File with certificate information - Default: gvm_certificates.csv"
52
+ ),
53
+ )
54
+
55
+ parser.add_argument(
56
+ "delta_days",
57
+ nargs="?",
58
+ default="1",
59
+ type=int,
60
+ help=(
61
+ "Optional: Number of days in the past to pull information - Default: 1 day"
62
+ ),
63
+ )
64
+
65
+ script_args, _ = parser.parse_known_args(args)
66
+ return script_args
67
+
68
+
69
+ def list_tls_certificates(
70
+ gmp: Gmp, from_date: date, to_date: date, csvfilename: str
71
+ ) -> None:
72
+ tls_cert_filter = (
73
+ f"rows=-1 and modified>{from_date.isoformat()} "
74
+ f"and modified<{to_date.isoformat()}"
75
+ )
76
+
77
+ cert_info = []
78
+
79
+ tls_cert_xml = gmp.get_tls_certificates(filter_string=tls_cert_filter)
80
+ # pretty_print(tls_cert_xml)
81
+
82
+ for tls_cert in tls_cert_xml.xpath("tls_certificate"):
83
+
84
+ cert_seen = tls_cert.xpath("last_seen/text()")[0]
85
+
86
+ cert_from = tls_cert.xpath("activation_time/text()")[0]
87
+
88
+ cert_to = tls_cert.xpath("expiration_time/text()")[0]
89
+
90
+ cert_subject = tls_cert.xpath("subject_dn/text()")[0]
91
+
92
+ cert_issuer = tls_cert.xpath("issuer_dn/text()")[0]
93
+
94
+ cert_serial = tls_cert.xpath("serial/text()")[0]
95
+
96
+ cert_sha256 = tls_cert.xpath("sha256_fingerprint/text()")[0]
97
+
98
+ cert_md5 = tls_cert.xpath("md5_fingerprint/text()")[0]
99
+
100
+ cert_info.append(
101
+ [
102
+ cert_subject,
103
+ cert_issuer,
104
+ cert_serial,
105
+ cert_sha256,
106
+ cert_md5,
107
+ cert_seen,
108
+ cert_from,
109
+ cert_to,
110
+ ]
111
+ )
112
+
113
+ # Write the list host_info to csv file
114
+ writecsv(csvfilename, cert_info)
115
+ print(
116
+ f"CSV file: {csvfilename}\n"
117
+ f"From: {from_date}\n"
118
+ f"To: {to_date}\n"
119
+ )
120
+
121
+
122
+ def writecsv(csv_filename: str, hostinfo: list) -> None:
123
+ field_names = [
124
+ "Subject",
125
+ "Issuer",
126
+ "Serial",
127
+ "SHA256 Fingerprint",
128
+ "MD5 Fingerprint",
129
+ "Last seen",
130
+ "Valid From",
131
+ "Valid To",
132
+ ]
133
+ try:
134
+ with open(csv_filename, "w") as csvfile:
135
+ writer = csv.writer(csvfile, delimiter=",", quoting=csv.QUOTE_ALL)
136
+ writer.writerow(field_names)
137
+ writer.writerows(hostinfo)
138
+ csvfile.close
139
+ except IOError as e:
140
+ error_and_exit(f"Failed to write csv file: {str(e)} (exit)")
141
+
142
+
143
+ def main(gmp: Gmp, args: Namespace) -> None:
144
+ # pylint: disable=undefined-variable
145
+ args = args.script[1:]
146
+ parsed_args = parse_args(args=args)
147
+ csv_filename = parsed_args.csv_filename
148
+ delta_days = parsed_args.delta_days
149
+
150
+ # simply getting yesterday from midnight to now
151
+ from_date = datetime.combine(datetime.today(), time.min) - timedelta(
152
+ days=delta_days
153
+ )
154
+ to_date = datetime.now()
155
+ # get the certs
156
+ list_tls_certificates(gmp, from_date, to_date, csv_filename)
157
+
158
+
159
+ if __name__ == "__gmp__":
160
+ main(gmp, args)
@@ -0,0 +1,180 @@
1
+ # SPDX-FileCopyrightText: 2025 Martin Boller
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # Loosely based on other greenbone scripts
6
+ #
7
+ # Run with: gvm-script --gmp-username admin-user --gmp-password password socket export-hosts-csv.gmp.py <csv file> days
8
+ # example: gvm-script --gmp-username admin --gmp-password top$ecret socket export-hosts-csv.gmp.py hosts.csv 2
9
+
10
+
11
+ import csv
12
+ import sys
13
+ from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
14
+ from datetime import date, datetime, time, timedelta
15
+
16
+ from gvm.protocols.gmp import Gmp
17
+ from gvmtools.helper import error_and_exit
18
+
19
+ HELP_TEXT = (
20
+ "This script generates a csv file with hosts (assets) "
21
+ "from Greenbone Vulnerability Manager.\n\n"
22
+ "csv file will contain:\n"
23
+ "IP Address, Hostname, MAC Address, Operating System, last seen, and severity\n"
24
+ )
25
+
26
+
27
+ def check_args(args: Namespace) -> None:
28
+ len_args = len(args.script) - 1
29
+ if len_args < 2:
30
+ message = """
31
+ This script requests all hosts <days> prior to today and exports it as a csv file.
32
+ It requires two parameter after the script name:
33
+ 1. filename -- name of the csv file of the report
34
+ 2. days -- number of days before and until today to pull hosts information from
35
+
36
+ Examples:
37
+ $ gvm-script --gmp-username username --gmp-password password socket export-hosts-csv.gmp.py <csv_file> <days>
38
+ $ gvm-script --gmp-username admin --gmp-password 0f6fa69b-32bb-453a-9aa4-b8c9e56b3d00 socket export-hosts-csv.gmp.py hosts.csv 4
39
+ """
40
+ print(message)
41
+ sys.exit()
42
+
43
+
44
+ def parse_args(args: Namespace) -> Namespace: # pylint: disable=unused-argument
45
+ """Parsing args ..."""
46
+
47
+ parser = ArgumentParser(
48
+ prefix_chars="+",
49
+ add_help=False,
50
+ formatter_class=RawTextHelpFormatter,
51
+ description=HELP_TEXT,
52
+ )
53
+
54
+ parser.add_argument(
55
+ "+h",
56
+ "++help",
57
+ action="help",
58
+ help="Show this help message and exit.",
59
+ )
60
+
61
+ parser.add_argument(
62
+ "csv_filename",
63
+ type=str,
64
+ help=("CSV File containing credentials"),
65
+ )
66
+
67
+ parser.add_argument(
68
+ "delta_days",
69
+ type=int,
70
+ help=("Number of days in the past to pull hosts information"),
71
+ )
72
+
73
+ script_args, _ = parser.parse_known_args(args)
74
+ return script_args
75
+
76
+
77
+ def list_hosts(
78
+ gmp: Gmp, from_date: date, to_date: date, csvfilename: str
79
+ ) -> None:
80
+ host_filter = (
81
+ f"rows=-1 and modified>{from_date.isoformat()} "
82
+ f"and modified<{to_date.isoformat()}"
83
+ )
84
+
85
+ # Get the XML of hosts
86
+ hosts_xml = gmp.get_hosts(filter_string=host_filter)
87
+ host_info = []
88
+
89
+ for host in hosts_xml.xpath("asset"):
90
+ # ip will always be there
91
+ ip = host.xpath("name/text()")[0]
92
+ host_seendates = host.xpath("modification_time/text()")
93
+ host_lastseen = host_seendates[0]
94
+
95
+ # hostnames and other attributes may not be there
96
+ hostnames = host.xpath(
97
+ 'identifiers/identifier/name[text()="hostname"]/../value/text()'
98
+ )
99
+ if len(hostnames) == 0:
100
+ hostname = ""
101
+ pass
102
+ else:
103
+ hostname = hostnames[0]
104
+
105
+ host_macs = host.xpath(
106
+ 'identifiers/identifier/name[text()="MAC"]/../value/text()'
107
+ )
108
+ if len(host_macs) == 0:
109
+ host_mac = ""
110
+ pass
111
+ else:
112
+ host_mac = host_macs[0]
113
+
114
+ host_severity = host.xpath("host/severity/value/text()")
115
+ if len(host_severity) == 0:
116
+ host_severity = 0
117
+ pass
118
+ else:
119
+ host_severity = host_severity[0]
120
+
121
+ host_os = host.xpath(
122
+ 'host/detail/name[text()="best_os_txt"]/../value/text()'
123
+ )
124
+ if len(host_os) == 0:
125
+ host_os = ""
126
+ pass
127
+ else:
128
+ host_os = host_os[0]
129
+
130
+ host_info.append(
131
+ [hostname, ip, host_mac, host_os, host_lastseen, host_severity]
132
+ )
133
+ # Write the list host_info to csv file
134
+ writecsv(csvfilename, host_info)
135
+ print(
136
+ f"CSV file: {csvfilename}\n"
137
+ f"From: {from_date}\n"
138
+ f"To: {to_date}\n"
139
+ )
140
+
141
+
142
+ def writecsv(csv_filename, hostinfo: list) -> None:
143
+ field_names = [
144
+ "IP Address",
145
+ "Hostname",
146
+ "MAC Address",
147
+ "Operating System",
148
+ "Last Seen",
149
+ "CVSS",
150
+ ]
151
+ try:
152
+ with open(csv_filename, "w") as csvfile:
153
+ writer = csv.writer(csvfile, delimiter=",", quoting=csv.QUOTE_ALL)
154
+ writer.writerow(field_names)
155
+ writer.writerows(hostinfo)
156
+ csvfile.close
157
+ except IOError as e:
158
+ error_and_exit(f"Failed to write csv file: {str(e)} (exit)")
159
+
160
+
161
+ def main(gmp: Gmp, args: Namespace) -> None:
162
+ # pylint: disable=undefined-variable
163
+ # argv[0] contains the csv file name
164
+ check_args(args)
165
+ if args.script:
166
+ args = args.script[1:]
167
+ parsed_args = parse_args(args=args)
168
+
169
+ delta_days = parsed_args.delta_days
170
+ # simply getting yesterday from midnight to now
171
+ from_date = datetime.combine(datetime.today(), time.min) - timedelta(
172
+ days=delta_days
173
+ )
174
+ to_date = datetime.now()
175
+ # get the hosts
176
+ list_hosts(gmp, from_date, to_date, parsed_args.csv_filename)
177
+
178
+
179
+ if __name__ == "__gmp__":
180
+ main(gmp, args)