1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add additional flags to nmap.py (#5566)

* Adding extra flag options for NMAP scaning udp_scan, icmp_timestamp and dns_resolve

* Update nmap.py

* Update plugins/inventory/nmap.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Updates as per felixfontein  suggestions

* Updates as per felixfontein  suggestions

* Update plugins/inventory/nmap.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/inventory/nmap.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update nmap.py

* Update changelogs/fragments/5566-additional-flags-nmap.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/5566-additional-flags-nmap.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update 5566-additional-flags-nmap.yml

* Update nmap.py

Co-authored-by: Axis12 <3225945+axistwelve@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
David Stuart 2022-11-17 05:56:21 +00:00 committed by GitHub
parent 8ad43fd774
commit 52c28494ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,3 @@
minor_changes:
- nmap inventory plugin - add new options ``udp_scan``, ``icmp_timestamp``, and ``dns_resolve`` for different types of scans (https://github.com/ansible-collections/community.general/pull/5566).

View file

@ -46,6 +46,25 @@ DOCUMENTATION = '''
description: use IPv6 type addresses description: use IPv6 type addresses
type: boolean type: boolean
default: true default: true
udp_scan:
description:
- Scan via UDP.
- Depending on your system you might need I(sudo=true) for this to work.
type: boolean
default: false
version_added: 6.1.0
icmp_timestamp:
description:
- Scan via ICMP Timestamp (C(-PP)).
- Depending on your system you might need I(sudo=true) for this to work.
type: boolean
default: false
version_added: 6.1.0
dns_resolve:
description: Whether to always (C(true)) or never (C(false)) do DNS resolution.
type: boolean
default: false
version_added: 6.1.0
notes: notes:
- At least one of ipv4 or ipv6 is required to be True, both can be True, but they cannot both be False. - At least one of ipv4 or ipv6 is required to be True, both can be True, but they cannot both be False.
- 'TODO: add OS fingerprinting' - 'TODO: add OS fingerprinting'
@ -166,6 +185,15 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
cmd.append('--exclude') cmd.append('--exclude')
cmd.append(','.join(self._options['exclude'])) cmd.append(','.join(self._options['exclude']))
if self._options['dns_resolve']:
cmd.append('-n')
if self._options['udp_scan']:
cmd.append('-sU')
if self._options['icmp_timestamp']:
cmd.append('-PP')
cmd.append(self._options['address']) cmd.append(self._options['address'])
try: try:
# execute # execute