From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15457 invoked from network); 23 May 2008 09:28:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 May 2008 09:28:02 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 72382 invoked from network); 23 May 2008 09:27:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 May 2008 09:27:55 -0000 Received: (qmail 29701 invoked by alias); 23 May 2008 09:27:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25082 Received: (qmail 12485 invoked from network); 22 May 2008 22:14:29 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 22 May 2008 22:14:29 -0000 Received: from pepin.polanet.pl (pepin.quarto.pl [193.34.52.2]) by bifrost.dotsrc.org (Postfix) with ESMTP id 43BC880589A4 for ; Fri, 23 May 2008 00:14:25 +0200 (CEST) Received: by pepin.polanet.pl (Postfix, from userid 1090) id E7B4A3F874; Fri, 23 May 2008 00:14:23 +0200 (CEST) Date: Fri, 23 May 2008 00:14:23 +0200 From: Tomasz Pala To: zsh-workers@sunsite.dk Subject: new completions for iftop and tcpdump Message-ID: <20080522221423.GA12985@pepin.polanet.pl> Reply-To: gotar@polanet.pl Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV 0.91.2/7218/Thu May 22 21:58:59 2008 on bifrost X-Virus-Status: Clean --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Hello, I've written some completion for iftop and tcpdump commands - see attachements. However there's still lacking one for Berkeley Packet Filter, both completions will benefit much if someone writes it. -- Tomasz Pala --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename=_iftop #compdef iftop _interfaces () { _wanted interfaces expl 'network interface' \ _net_interfaces _values "Pseudo-device that captures on all interfaces" "any" } _arguments \ '(-h -n -N -p -b -B -P -i -f -F -c)'-h'[print a summary of usage]' \ -n"[don't do hostname lookups]" \ -N"[don't resolve port number to service names]" \ -p'[run in promiscuous mode]' \ -P'[turn on port display]' \ -b"[don't display bar graphs of traffic]" \ -B'[display bandwidth rates in bytes/sec rather than bits/sec]' \ -i'[interface]:network interface:_interfaces' \ -f'[filter]:BPF filter' \ -F'[net/mask]:network/mask' \ -c'[config file]:config file:_files' --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename=_tcpdump #compdef tcpdump typeset -A opt_args _interfaces () { _wanted interfaces expl 'network interface' \ _net_interfaces _values "Pseudo-device that captures on all interfaces" "any" } _esp_secrets () { _values -S : 'ESP algorithm' \ 'des-cbc:secret' \ '3des-cbc:secret' \ 'blowfish-cbc:secret' \ 'rc3-cbc:secret' \ 'cast128-cbc:secret' \ none } _packet_types () { _values 'Packets type' \ 'aodv[Ad-hoc On-demand Distance Vector protocol]' \ 'cnfp[Cisco NetFlow protocol]' \ 'rpc[Remote Procedure Call]' \ 'rtp[Real-Time Applications protocol]' \ 'rtcp[Real-Time Applications control protocol]' \ 'snmp[Simple Network Management Protocol]' \ 'tftp[Trivial File Transfer Protocol]' \ 'vat[Visual Audio Tool]' \ 'wb[distributed White Board]' } _data_link_types () { if (( $+opt_args[-i] )); then vals=( ${${${(s: :)"$(_call_program data-link-types tcpdump -L -i $opt_args[-i] 2>&1)"}[2,-1]}/ /:} ) _describe -t data-link-types "data link types ($opt_args[-i])" vals && ret=0 else _values "Data link types (general)" \ "EN10MB" \ "LINUX_SLL" fi } _bpf_filter () { } _arguments \ '()-A[Print each packet in ASCII]' \ -c'[Exit after receiving specified number of packets]:number of packets' \ -C'[Specify output file size in MB (10e6 bytes)]:output file size' \ '(-ddd)-d[Dump the compiled packet-matching code in a human readable form]' \ '(-ddd)-dd[Dump packet-matching code as a C program fragment]' \ '(-d -dd)-ddd[Dump packet-matching code as decimal numbers (preceded with a count)]' \ '(-A -c -C -d -dd -ddd -e -E -f -F -i -l -L -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-D'[Print the list of the network interfaces available on the system]' \ -e'[Print the link-level header on each dump line]' \ -E"[Decrypting IPsec ESP packets]:spi@ipaddr::algo\:secret:_esp_secrets" \ -f"[Print 'foreign' IPv4 addresses numerically]" \ -F'[input file for the filter expression]:filter expression file:_files' \ -i'[Interface]:interface:_interfaces' \ -l'[Make stdout line buffered]' \ '(-A -c -C -d -dd -ddd -e -E -f -F -l -D -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-L'[List the known data link types for the interface]' \ '*-m[Load SMI MIB module definitions]:SMI MIB module definitions:_files' \ -M'[shared secret for validating the digests in TCP segments with the TCP-MD5 option]:secret' \ -n"[Don't convert addresses to names]" \ -N"[Don't print domain name qualification of host names]" \ -O"[Don't run the packet-matching code optimizer]" \ -p"[Don't put the interface into promiscuous mode]" \ -q'[Quick (quiet?) output]' \ -R'[Assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829)]' \ -r'[Read packets from file]:input file:_files' \ -S'[Print absolute TCP sequence numbers]' \ -s'[Specify number of bytes of data to snarf from each packet]:number of bytes to snap' \ -T'[Interpret captured packets as specified type]:packet type:_packet_types' \ "(-tttt)-t[Don't print a timestamp on each dump line]" \ '(-ttt -tttt)-tt[Print an unformatted timestamp on each dump line]' \ '(-tt -tttt)-ttt[Print a delta (in micro-seconds) between current and previous line on each dump line]' \ '(-t -tt -ttt)-tttt[Print a timestamp in default format proceeded by date on each dump line]' \ -u'[Print undecoded NFS handles]' \ -U'[Make output packet-buffered when saving to file (-w)]' \ '(-vvv)-v[slightly more verbose output]' \ '(-vvv)-vv[more verbose output]' \ '(-v -vv)-vvv[most verbose output]' \ -w'[Write the raw packets to file]:output file:_files' \ -W'[Limit the number of created files (-C)]:number of files' \ -x'[Print each packet (minus its link level header) in hex]' \ '(-x)-xx[Print each packet, including its link level header, in hex]' \ -X'[Print each packet (minus its link level header) in hex and ASCII]' \ '(-X)-XX[Print each packet, including its link level header, in hex and ASCII]' \ -y'[Set the data link type to use while capturing packets]:data link type:_data_link_types' \ -Z'[Drops privileges (if root) and changes user ID (along with primary group)]:user:_users' \ '*:BPF filter:_bpf_filter' --LZvS9be/3tNcYl/X--