8 Usage: $prog -n -oG - -PS 127.0.0.1 -p <port>[,<port> ...]
10 A fake nmap stub that prints items depending on the variable
11 FAKE_TCP_LISTEN and the ports specified.
13 Note that all options apart from -p are ignored.
23 _temp=$(getopt -n "$prog" -a -o "np:" -l help -l PS: -l oG: -- "$@")
33 -p) ports="${ports}${ports:+ }${2//,/ }" ; shift 2 ;;
35 -h|--help|*) usage ;; # * shouldn't happen, so this is reasonable.
41 [ -n "$ports" ] || usage
52 pn=$(getent services "$p" | sed -e 's@[[:space:]].*@@')
53 for i in $FAKE_TCP_LISTEN ; do
55 if [ "$p" = "$lp" ] ; then
56 port_states="${port_states}${port_states:+, }${p}/open/tcp//${pn}///"
60 port_states="${port_states}${port_states:+, }${p}/closed/tcp//${pn}///"
64 # Nmap 5.21 scan initiated $(date) as: nmap $args
65 Host: 127.0.0.1 () Status: Up
66 Host: 127.0.0.1 () Ports: $port_states
67 # Nmap done at $(date) -- 1 IP address (1 host up) scanned in 0.04 seconds