Enumeration of hosts and services
Host discovery with Nmap and fping, port scans, and AS-based IP range lookups.
Nmap
Service enumeration and configuration weaknesses can be investigated with the
nmap tool.
Tip: On a large scope, prefer the
db_nmapcommand from Metasploit so that the elements reported by the scan are recorded and classified.
Passive listening
NMAP can listen to the network for information about the information system (CDP, MDNS, DHCP, and so on). This is possible in particular through protocols that communicate using broadcast frames.
nmap --script broadcast-listener
# Force listening on an interface
nmap --script broadcast-listener -e eth0
# Set the listening time (30s by default)
nmap --script broadcast-listener --script-args broadcast-listener.timeout=10Ping sweep
nmap -sn performs its own host discovery and can record the sweep:
nmap -sn 192.168.1.0/24 -oN sweep.nmapUse fping to find ICMP responders, then scan selected ports with Nmap:
fping -a -q -g 10.0.0.0/24 | xargs -r nmap -Pn -p 22,80,443-a -q: print responding hosts without ICMP error messages.-g: generate targets from the CIDR.xargs -r: skip Nmap if the list is empty (GNU xargs).-Pn: skip Nmap host discovery; scan ports22,80,443directly.
To avoid xargs splitting a large list, let Nmap read targets from stdin:
fping -a -q -g 10.0.0.0/24 | nmap -Pn -p 22,80,443 -iL -Limits: an ICMP reply does not imply an open port; silence may mean ICMP
is filtered, not that the host is absent. fping exits 1 if any target fails
to respond, so pipefail can flag the pipeline even with a valid responder list.
Timing, permissions and local discovery
-icontrols the interval between packets (default 10 ms);-rsets retries (default 3);-tsets the initial timeout (default 500 ms). Retries and timeouts extend the total sweep duration.- IPv4 CIDR generation excludes network and broadcast addresses;
-gis capped at 131072 addresses. - Raw sockets require suitable privileges, commonly
cap_net_rawon Linux. Check the installed binary withgetcap "$(command -v fping)". xargs -ris not portable across all systems; use the-iL -variant instead.- On a directly connected Ethernet network, use ARP discovery:
nmap -sn -PR 192.168.1.0/24.
Service enumeration
-A enables version detection, OS detection, default scripts and traceroute;
it is broader than a port-only scan. The UDP example scans Nmap’s default port
set, not every UDP port.
nmap -sS -A -p- 192.168.1.0/24 -oN full.tcp.nmap
nmap -sU 192.168.1.0/24 -oN quick.udp.nmapInterpret port states
States describe what Nmap observed from one source, with one scan method and at one time; they are not permanent properties of the host.
- open: a service accepts the tested traffic. Identify it before selecting a product-specific check.
- closed: the probe elicited a response indicating no listener. This is not the same as silence or an unreachable host.
- filtered: Nmap cannot determine whether a listener exists because probes or responses appear filtered. Review the path before concluding absence.
- open|filtered: the scan cannot distinguish an open silent service from filtering, often with UDP. Use a relevant protocol request to narrow it.
nmap -sT -Pn -n --reason -p 22,80,443 192.0.2.20
# Separate follow-up for a selected service
nmap -sT -Pn -n -sV --version-light -p 443 192.0.2.20--reason explains the state decision. -Pn skips discovery; it does not prove
the host is up. Without version detection, the SERVICE column may just be a
port-number lookup. -sV sends application probes and reports matches; a
banner or CPE is still not a verified package revision or patch level.
Continue with the identified protocol: SSH, HTTP, DNS, LDAP or SMB. For results through a tunnel, also check the pivot’s routing and protocol limits.
Less common states
unfiltered, typically from an ACK scan, means reachable but does not settle
open versus closed. closed|filtered is an ambiguity used by the IP ID idle
scan. Neither should be relabeled as open.Vulnerability enumeration
The vuln category is not guaranteed non-intrusive. Review the selected scripts
and their effects before running it; a scanner result still needs validation.
nmap --script vuln 10.10.10.79Retrieving a company’s IP ranges
An origin AS lookup identifies routing data, not ownership or testing permission for every returned prefix.
# Identify an AS
IP="8.8.8.8"; whois -h whois.cymru.com -- "-v ${IP}" | tail -n 1 | cut -d '|' -f1
# Find the IPs belonging to an AS
AS="AS15169"; whois -h whois.radb.net -- "-i origin ${AS}"|awk '/^route6?:/{print $2}' |sort -nt . -k1,1 -k2,2 -k3,3 -k4,4Sources and limits
Nmap port states, and version detection, reviewed 2026-11-24 for version 3.
fping(8): options and exit status (5.5-2, checked 2026-11-23).
Debian fping packaging, read 2026-11-23:
cap_net_rawviasetcap, with setuid root as a fallback.Nmap target specification, read 2026-11-23:
-iLand the-stdin convention.
Interpret each state using the actual probe and response. Discovery silence does not prove host absence, and a service match does not establish vulnerability.
Provenance and confidence
- Version
- 3
- Sources reviewed
- 2026-11-23
- Confidence
- medium — V3 on 2026-11-24 adds port-state interpretation using the Nmap reference guide. Earlier fping review retained; no remote scan performed.
Also searched as: récupération d'informations, énumération, scan nmap, découverte d'hôtes, scan réseau, fping, balayage ping, ping sweep