xmap - The Fast Internet Scanner
xmap [ -4 | -6 ] [ -x <len> ] [ -p <port> ] [ -o <outfile> ] [ OPTIONS... ] [ ip|domain|range ]
XMap is a network tool for scanning any IPv6 & IPv4 address space (or large samples), reimplemented and improved thoroughly from ZMap. XMap is capable of scanning the 32-bits network space in around 45 minutes on a gigabit network connection, reaching ~98% theoretical line speed.
-6, --ipv6Scanning the IPv6 networks (default).
-4, --ipv4Scanning the IPv4 networks.
-x, --max-len=len Max IP bit length to scan (default = 32).
ip|domain|range IP addresses or DNS hostnames to scan. Accept IP ranges in CIDR block notation. Max length of domains is 256, e.g, 2001::/64, 192.168.0.1/16, and www.qq.com/32. Default to ::/0 and 0.0.0.0/0.
-p, --target-port=port|range TCP or UDP port(s) number to scan (for SYN scans and basic UDP scans). Accepts port ranges with , and -, e.g., 80,443,8080-8081. With --target-port, one target is a <ip/x, port>.
-P, --target-index=num Payload number to scan. With --target-index, one target is a <ip/x, (port), index>.
-o, --output-file=name When using an output module that uses a file, write results to this file. Use - for stdout.
-b, --blacklist-file=pathFile of subnets to exclude, accept DNS hostnames, in CIDR notation, one-per line. It is recommended you use this to exclude RFC 1918 addresses, multicast, IANA reserved space, and other IANA special-purpose addresses. An example blacklist file blacklist4.conf for this purpose.
-w, --whitelist-file=path File of subnets to include, accept DNS hostnames, in CIDR notation, one-per line. Specifying a whitelist file is equivalent to specifying to ranges directly on the command line interface, but allows specifying a large number of subnets. Note: if you are specifying a large number of individual IP addresses (more than 1 million), you should instead use --list-of-ips-file. An example whitelist file whitelist6.conf for this purpose.
-I, --list-of-ips-file=path File of individual IP addresses to scan, one-per line. This feature allows you to scan a large number of unrelated addresses. If you have a small number of IPs, it is faster to specify these on the command line or by using --whitelist-file. Note: this should only be used when scanning more than 1 million addresses. When used in with --whitelist-file, only hosts in the intersection of both sets will be scanned. Hosts specified here, but included in the --blacklist-file will be excluded.
-R, --rate=pps Set the send rate in pkts/sec. Note: when combined with --probes or --retries, this is total packets per second, not target number per second. Setting the rate to 0 will scan at full line rate (no sleep). Default to 1 pps.
-B, --bandwidth=bps Set the send rate in bits/sec (supports suffixes G/g, M/m, and K/k, e.g. -B 10M for 10 mbps). This overrides the --rate flag. Default to 0 bps.
--batch=num Number of packets to send in a burst between checks to the ratelimit. A batch size above 1 allows the sleep-based rate-limiter to be used with proportionally higher rates. This can reduce CPU usage, in exchange for a bursty send rate (default = 1).
--probes=num Number of probes to send to each target (default = 1).
--retries=num Number of times to try resending a packet if the sendto call fails (default = 1).
-n, --max-targets=num Capture number of targets to probe (default = -1).
-k, --max-packets=num Capture number of packets to send (default = -1).
-t, --max-runtime=secs Capture length of time for sending packets (default = -1).
-N, --max-results=num Exit after receiving this many results (default = -1).
-E, --est-elements=num Estimated number of results for unique (default = 5e8). Note: XMap uses the bloomfilter to check the duplicate results, which costs some of the memory. Choose the proper --est-elements to adapt to your memory capacity.
-c, --cooldown-secs=secs How long to continue receiving after sending has completed (default = 5).
-e, --seed=num Seed used to select address permutation. Use this if you want to scan addresses in the same order for multiple XMap runs (default = 0).
--shards=num Split the scan up into N shards/partitions among different instances of xmap (default = 1). When sharding, --seed is required.
--shard=num Set which shard to scan (default = 0). Shards are 0-indexed in the range [0, N), where N is the total number of shards. When sharding--seed is required.
-s, --source-port=port|range Source port(s) to send packets from. Accept port ranges with -, e.g., 12345-54321. Default to 32768-61000.
-S, --source-ip=ip|range Source address(es) to send packets from. Either single IP or range. Accept ip ranges with , and - (max=1024), e.g., 2001::1, 2001::2-2001::10.
-G, --gateway-mac=macGateway MAC address to send packets to (in case auto-detection fails).
--source-mac=macSource MAC address to send packets from (in case auto-detection fails).
-i, --interface=nameNetwork interface to use.
-X, --iplayerSend IP layer packets instead of ethernet packets (for non-Ethernet interface).
XMap allows users to specify and write their own probe modules. Probe modules are responsible for generating probe packets to send, and processing responses from hosts.
--list-probe-modulesList available probe modules (e.g., tcp_syn).
-M, --probe-module=name Select probe module (default = icmp_echo).
--probe-args=argsArguments to pass to probe module.
--probe-ttl=hops Set TTL value for probe IP packets (default = 255).
--list-output-fieldsList the fields the selected probe module can send to the output module.
XMap allows users to specify and write their own output modules for use with XMap. Output modules are responsible for processing the fieldsets returned by the probe module, and outputting them to the user. Users can specify output fields, and write filters over the output fields.
--list-output-modules-O, --output-module=namecsv).--output-args=args-f, --output-fields=fields, and *.--output-filterXMap allows users to specify and write their own iid modules for use with XMap. IID modules are responsible for filling the left bits behind the probed prefix, and creating a whole target address.
processing the fieldsets returned by the probe module, and outputting them to the user. Users can specify output fields, and write filters over the output fields.
--list-iid-modulesList available iid modules (e.g., low).
-U, --iid-module=name Select iid module (default = low).
--iid-args=argsArguments to pass to iid module.
--iid-num=numNumber of iid for one target prefix.
-q, --quietDo not print status updates once per second.
-v, --verbosity=n Level of log detail (0-5, default = 3).
-l, --log-file=filename Output file for log messages. By default, stderr.
-L, --log-directory=pathWrite log entries to a timestamped file in this directory.
-m, --metadata-file=filenameOutput file for scan metadata (JSON).
-u, --status-updates-fileWrite scan progress updates to CSV file.
--disable-syslogDisables logging messages to syslog.
--notes=notesInject user-specified notes into scan metadata.
--user-metadata=jsonInject user-specified JSON metadata into scan metadata.
-T, --sender-threads=numThreads used to send packets. XMap will attempt to detect the optimal number of send threads based on the number of processor cores.
-C, --config=filenameRead a configuration file, which can specify any other options.
-d, --dryrunPrint out each packet to stdout instead of sending it (useful for debugging).
--max-sendto-failures=numMaximum NIC sendto failures before scan is aborted.
--min-hitrate=rateMinimum hitrate that scan can hit before scan is aborted.
--coresComma-separated list of cores to pin to.
--ignore-blacklist-error Ignore invalid, malformed, or unresolvable entries in --whitelist-file and --blacklist-file.
--ignore-filelist-error Ignore invalid, malformed, or unresolvable entries in --list-of-ips-file.
-h, --helpPrint help and exit.
-V, --versionPrint version and exit.
Results generated by a probe module can be filtered before being passed to the output module. Filters are defined over the output fields of a probe module. Filters are written in a simple filtering language, similar to SQL, and are passed to XMap using the --output-filter option. Output filters are commonly used to filter out duplicate results, or to only pass only successful responses to the output module.
Filter expressions are of the form <fieldname> <operation> <value>. The type of <value> must be either a string or unsigned integer literal, and match the type of <fieldname>. The valid operations for integer comparisons are =, !=, <, >, <=, >=. The operations for string comparisons are =, !=. The--list-output-fields flag will print what fields and types are available for the selected probe module, and then exit.
Compound filter expressions may be constructed by combining filter expressions using parenthesis to specify order of operations, the && (logical AND) and || (logical OR) operators.
For example, a filter for only successful, non-duplicate responses would be written as: --output-filter="success = 1 && repeat = 0".
These arguments are all passed using the --probe-args=args option. Only one argument may be passed at a time.
file:/path/to/filePath to payload file to send to each host over UDP.
text:<text>ASCII text to send to each destination host.
hex:<hex>Hex-encoded binary to send to each destination host.
dir:/directory/to/file Directory to payload file to send to each host over UDP when probing multiple ports.
File extension priority: pkt>txt>hex. Each file is named by the port number, e.g., 53.pkt for DNS payload.
template:/path/to/templatePath to template file. For each destination host, the template file is populated, set as the UDP payload, and sent.
template-fieldsPrint information about the allowed template fields and exit.
icmp-type-code-strPrint value of the icmp related filters and exit.
You can change the rate at which XMap is scanning mid-scan by sending SIGUSR1 (increase) and SIGUSR2 (decrease) signals to XMap. These will result in the scan rate increasing or decreasing by 5%.
xmap
scan the ::/0-32 space by Echo ping and output to stdout
xmap -4
scan the 0.0.0.0/0-32 space by Echo ping and output to stdout
xmap -N 5 -B 10M
find 5 alive IPv6 hosts, scanning at 10 Mb/s
xmap 2001::/8 2002::/16
scan both subnets for 2001::/8-32 and 2002::/16-32 space
xmap -x 64 2001::/32 -U rand
scan 2001::/32-64 with random IID, e.g., 2001::1783:ab42:9247:cb38
xmap -M icmp_echo -O csv -U low -h
show help text for modules icmp_echo, csv, and low
xmap -M tcp_syn -p 80,443,8080-8081
scan the ::/0-32 space for port 80,443,8080,8081 by TCP SYN ping