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

Adding open option to nmap (#6200)

* Adding nmap `open` option

* Removing accidental copy/paste issue

* Update changelogs/fragments/6200-adding-open-option-to-nmap.yml

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

* Update plugins/inventory/nmap.py

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

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
barloff-st 2023-03-26 03:29:55 -04:00 committed by GitHub
parent cd706454ec
commit 59e58079cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- nmap inventory plugin - add new option ``open`` for only returning open ports (https://github.com/ansible-collections/community.general/pull/6200).

View file

@ -42,7 +42,7 @@ DOCUMENTATION = '''
type: string type: string
version_added: 6.5.0 version_added: 6.5.0
ports: ports:
description: Enable/disable scanning for open ports description: Enable/disable scanning ports.
type: boolean type: boolean
default: true default: true
ipv4: ipv4:
@ -67,6 +67,11 @@ DOCUMENTATION = '''
type: boolean type: boolean
default: false default: false
version_added: 6.1.0 version_added: 6.1.0
open:
description: Only scan for open (or possibly open) ports.
type: boolean
default: false
version_added: 6.5.0
dns_resolve: dns_resolve:
description: Whether to always (C(true)) or never (C(false)) do DNS resolution. description: Whether to always (C(true)) or never (C(false)) do DNS resolution.
type: boolean type: boolean
@ -213,6 +218,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if self._options['icmp_timestamp']: if self._options['icmp_timestamp']:
cmd.append('-PP') cmd.append('-PP')
if self._options['open']:
cmd.append('--open')
cmd.append(self._options['address']) cmd.append(self._options['address'])
try: try:
# execute # execute