#compdef nmaprs nms
# Zsh completion for nmaprs / nms (nmap-compatible CLI).
# Install: fpath+=(/path/to/nmaprs/completions); autoload -Uz compinit && compinit

local context state state_descr line
typeset -A opt_args

_arguments -s -S : \
  '(-h --help)'{-h,--help}'[print help]' \
  '(-V --version)'{-V,--version}'[print version]' \
  '--iL[input host list]:file:_files' \
  '--iR[random targets count]:count:' \
  '--exclude[exclude hosts/networks]:targets:' \
  '--excludefile[exclude list file]:file:_files' \
  '--sL[list scan]' \
  '--sn[ping scan only]' \
  '--no-ping[treat all hosts as online]' \
  '--ping-S[TCP SYN discovery]::port list:' \
  '--ping-A[TCP ACK discovery]::port list:' \
  '--ping-U[UDP discovery]::port list:' \
  '--ping-Y[SCTP discovery]::port list:' \
  '--ping-E[ICMP echo discovery]' \
  '--ping-P[ICMP timestamp discovery]' \
  '--ping-M[ICMP netmask discovery]' \
  '--ping-ip-proto[IP protocol ping]::protocols:' \
  '-n[never do DNS resolution]' \
  '-R[always resolve]' \
  '--dns-servers[custom DNS servers]:servers:' \
  '--system-dns[use OS DNS resolver]' \
  '--traceroute[trace route to each host]' \
  '--scan-type[scan type letter]:char:(T t S s U u N n F f X x A a W w M m Y y Z z)' \
  '--scanflags[TCP scan flags]:flags:' \
  '--sI[idle scan zombie]:zombie:_hosts' \
  '--sO[IP protocol scan]' \
  '-b[FTP bounce relay]:ftp spec:' \
  '--version-scan[service/version detection]' \
  '--script-default[default scripts (-sC)]' \
  '--script[script expression]:expr:' \
  '--script-args[script arguments]:args:' \
  '--script-args-file[script args file]:file:_files' \
  '--script-trace[trace script I/O]' \
  '--script-updatedb[update script database]' \
  '--script-help[script help]:expr:' \
  '--version-intensity[version probe intensity]:intensity:(0 1 2 3 4 5 6 7 8 9)' \
  '--version-light[version intensity 2]' \
  '--version-all[version intensity 9]' \
  '--version-trace[trace version scan]' \
  '-O[OS detection]' \
  '--osscan-limit[limit OS detection]' \
  '--osscan-guess[guess OS aggressively]' \
  '-p[ports]:port spec:' \
  '--exclude-ports[exclude ports]:port spec:' \
  '-F[fast scan]' \
  '-r[sequential ports]' \
  '--top-ports[scan top N ports]:N:' \
  '--port-ratio[port frequency ratio]:ratio:' \
  '--timing[timing template 0-5]:template:(0 1 2 3 4 5)' \
  '--min-hostgroup[min host batch]:N:' \
  '--max-hostgroup[max host batch]:N:' \
  '--min-parallelism[min parallelism]:N:' \
  '(-M --max-parallelism)'{-M,--max-parallelism}'[max parallelism]:N:' \
  '--min-rtt-timeout[min RTT]:time:' \
  '--max-rtt-timeout[max RTT]:time:' \
  '--initial-rtt-timeout[initial RTT]:time:' \
  '--max-retries[max probe retries]:N:' \
  '--host-timeout[per-host timeout]:time:' \
  '--scan-delay[min delay between probes]:time:' \
  '--max-scan-delay[max delay between probes]:time:' \
  '--min-rate[min probe rate]:rate:' \
  '--max-rate[max probe rate]:rate:' \
  '-f[fragment packets]' \
  '--mtu[fragment MTU]:value:' \
  '-D[decoy addresses]:decoys:' \
  '-S[spoof source address]:addr:_hosts' \
  '-e[network interface]:interface:_interfaces' \
  '(-g --source-port)'{-g,--source-port}'[source port]:port:' \
  '--proxies[HTTP/SOCKS proxies]:urls:' \
  '--proxy[alias of --proxies]:urls:' \
  '--data[append hex payload]:hex:' \
  '--data-string[append ASCII payload]:string:' \
  '--data-length[append random data length]:num:' \
  '--ip-options[IP options]:opts:' \
  '--ttl[IP TTL]:ttl:' \
  '--spoof-mac[spoof MAC]:mac:' \
  '--badsum[send bad checksum]' \
  '-oN[normal output file]:file:_files' \
  '-oX[XML output file]:file:_files' \
  '-oS[script-kiddie output file]:file:_files' \
  '-oG[grepable output file]:file:_files' \
  '-oA[output basename]:base:_files' \
  '-oM[machine-parseable output file]:file:_files' \
  '-oH[hex output file]:file:_files' \
  '-v[increase verbosity]' \
  '-d[increase debug level]' \
  '--verbosity[verbosity level]:N:' \
  '--debug[debug level]:N:' \
  '--reason[show port state reason]' \
  '--open[show open ports only]' \
  '--packet-trace[packet trace]' \
  '--iflist[list interfaces]' \
  '--append-output[append to output files]' \
  '--resume[resume file]:file:_files' \
  '--noninteractive[non-interactive]' \
  '--stylesheet[XSL stylesheet]:path:_files' \
  '--webxml[use nmap.org XSL]' \
  '--no-stylesheet[no XML stylesheet]' \
  '-6[IPv6]' \
  '-A[aggressive scan]' \
  '--datadir[data directory]:dir:_directories' \
  '--send-eth[send raw ethernet]' \
  '--send-ip[send raw IP]' \
  '--privileged[assume raw socket privileges]' \
  '--unprivileged[assume no raw sockets]' \
  '--resolve-all[scan all resolved addresses]' \
  '--max-os-tries[max OS detection tries]:N:' \
  '--defeat-rst-ratelimit[defeat RST rate limit]' \
  '--defeat-icmp-ratelimit[defeat ICMP rate limit]' \
  '--randomize-hosts[randomize host order]' \
  '--rH[alias of --randomize-hosts]' \
  '--stats-every[stats interval]:time:' \
  '--nsock-engine[nsock engine]:name:(kqueue poll select)' \
  '--discovery-ignore-rst[ignore RST in discovery]' \
  '--fuzzy[alias of --osscan-guess]' \
  '--unique[unique targets only]' \
  '--log-errors[log errors]' \
  '--deprecated-xml-osclass[deprecated XML osclass]' \
  '--adler32[Adler32 checksums]' \
  '--disable-arp-ping[disable ARP ping]' \
  '--route-dst[route debug host]:host:_hosts' \
  '--servicedb[nmap-services file]:file:_files' \
  '--versiondb[nmap-service-probes file]:file:_files' \
  '--release-memory[release memory]' \
  '--nogcc[no gcc optimizations]' \
  '--allports[ignore excluded ports]' \
  '--script-timeout[script timeout]:time:' \
  '--thc[THC mode]' \
  '--vv[extra verbosity]' \
  '--ff[extra debug]' \
  '-Pn[skip host discovery]' \
  '-PE[ICMP echo discovery]' \
  '-PP[ICMP timestamp discovery]' \
  '-PM[ICMP netmask discovery]' \
  '-PO+[IP protocol ping]:protocols:' \
  '-PS+[TCP SYN discovery]:ports:' \
  '-PA+[TCP ACK discovery]:ports:' \
  '-PU+[UDP discovery]:ports:' \
  '-PY+[SCTP discovery]:ports:' \
  '-T+[timing template]:template:(0 1 2 3 4 5)' \
  '-iL+[input host list]:file:_files' \
  '-iR+[random targets count]:count:' \
  '-sS[TCP SYN scan]' \
  '-sT[TCP connect scan]' \
  '-sU[UDP scan]' \
  '-sN[TCP Null scan]' \
  '-sF[TCP FIN scan]' \
  '-sX[TCP Xmas scan]' \
  '-sA[TCP ACK scan]' \
  '-sW[TCP Window scan]' \
  '-sM[TCP Maimon scan]' \
  '-sY[SCTP INIT scan]' \
  '-sZ[SCTP COOKIE-ECHO scan]' \
  '-sO[IP protocol scan]' \
  '-sV[version detection]' \
  '-sC[default scripts]' \
  '-sL[list scan]' \
  '-sn[ping scan]' \
  '-sI+[idle scan zombie]:zombie:_hosts' \
  '*:TARGET:_hosts'
