mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
[PR #6200/59e58079 backport][stable-6] Adding open option to nmap (#6246)
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>
(cherry picked from commit 59e58079cb)
Co-authored-by: barloff-st <42866449+barloff-st@users.noreply.github.com>
This commit is contained in:
2
changelogs/fragments/6200-adding-open-option-to-nmap.yml
Normal file
2
changelogs/fragments/6200-adding-open-option-to-nmap.yml
Normal 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).
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user