diff options
-rw-r--r-- | .zsh/completion/astraceroute.zsh | 48 | ||||
-rw-r--r-- | .zsh/completion/bpfc.zsh | 22 | ||||
-rw-r--r-- | .zsh/completion/curvetun.zsh | 36 | ||||
-rw-r--r-- | .zsh/completion/flowtop.zsh | 25 | ||||
-rw-r--r-- | .zsh/completion/ifpps.zsh | 28 | ||||
-rw-r--r-- | .zsh/completion/mausezahn.zsh | 67 | ||||
-rw-r--r-- | .zsh/completion/netsniff-ng.zsh | 69 | ||||
-rw-r--r-- | .zsh/completion/trafgen.zsh | 55 | ||||
-rw-r--r-- | .zsh/zshenv/01_fpath | 5 |
9 files changed, 354 insertions, 1 deletions
diff --git a/.zsh/completion/astraceroute.zsh b/.zsh/completion/astraceroute.zsh new file mode 100644 index 0000000..c15e2c8 --- /dev/null +++ b/.zsh/completion/astraceroute.zsh @@ -0,0 +1,48 @@ +#compdef astraceroute +# +# astraceroute.zsh -- zsh completion function for astraceroute +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "(-H --host)"{-H,--host}"[Host/IPv4/IPv6 to lookup AS route to]:host:_hosts" \ + "(-p --port)"{-p,--port}"[Hosts port to lookup AS route to]:port:_gnu_generic" \ + "(-i -d --dev)"{-i,-d,--dev}"[Networking device i.e., eth0]:device:_interfaces" \ + "(-4 --ipv4)"{-4,--ipv4}"[Use IPv4 requests (default)]" \ + "(-6 --ipv6)"{-6,--ipv6}"[Use IPv6 requests]" \ + "(-n --numeric)"{-n,--nemeric}"[Do not do reverse DNS lookup for hops]" \ + "(-u --update)"{-u,--update}"[Update GeoIP databases]" \ + "(-L --latitude)"{-L,--latitude}"[Show latitude and longtitude]" \ + "(-N --dns)"{-N,--dns}"[Do a reverse DNS lookup for hops]" \ + "(-f --init-ttl)"{-f,--init-ttl}"[Set initial TTL]:ttl:_gnu_generic" \ + "(-m --max-ttl)"{-m,--max--ttl}"[Set maximum TTL]:ttl:_gnu_generic" \ + "(-q --num-probes)"{-q,--num-probes}"[Set maximum TTL (default: 30)]:ttl:_gnu_generic" \ + "(-q --num-probes)"{-q,--num-probes}"[Number of max probes for each hop (default: 3)]:num:_gnu_generic" \ + "(-x --timeout)"{-x,--timeout}"[Probe response timeout in sec (default: 3)]:timeout:_gnu_generic" \ + "(-S --syn)"{-S,--syn}"[Set TCP SYN flag in packets]" \ + "(-A --ack)"{-A,--ack}"[Set TCP ACK flag in packets]" \ + "(-F --fin)"{-F,--fin}"[Set TCP FIN flag in packets]" \ + "(-P --psh)"{-P,--psh}"[Set TCP PSH flag in packets]" \ + "(-U --urg)"{-U,--urg}"[Set TCP URG flag in packets]" \ + "(-R --rst)"{-R,--rst}"[Set TCP RST flag in packets]" \ + "(-E --ecn-syn)"{-E,--ecn-syn}"[Send ECN SYN packets (RFC3168)]" \ + "(-t --tos)"{-t,--tos}"[Set the IP TOS field]:tos:_gnu_generic" \ + "(-G --nofrag)"{-G,--nofrag}"[Set do not fragment bit]" \ + "(-X --payload)"{-X,--payload}"[Specify a payload string to test DPIs]:string:_gnu_generic" \ + "(-Z --show-packet)"{-Z,--show-packet}"[Show returned packet on each hop]" \ + "(-l --totlen)"{-l,--totlen}"[Specify total packet len]:lengths:_gnu_generic" \ + {-v,--version}"[Print version]:" \ + {-h,--help}"[Print this help]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/bpfc.zsh b/.zsh/completion/bpfc.zsh new file mode 100644 index 0000000..04f04e7 --- /dev/null +++ b/.zsh/completion/bpfc.zsh @@ -0,0 +1,22 @@ +#compdef bpfc +# +# bpfc.zsh -- zsh completion function for bpfc +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_arguments -s -S \ + "(-i --input)"{-i,--input}"[Berkeley Packet Filter file]:input:_files" \ + "(-p --cpp)"{-p,--cpp}"[Run bpf program through C preprocessor]" \ + "(-f --format)"{-f,--format}"[Output format]:output:(C netsniff-ng xt_bpf tcpdump)" \ + "(-b --bypass)"{-b,--bypass}"[Bypass filter validation (e.g. for bug testing)]" \ + "(-d --dump)"{-d,--dump}"[Dump supported instruction table]" \ + "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \ + {-v,--version}"[Print version]:" \ + {-h,--help}"[Print this help]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/curvetun.zsh b/.zsh/completion/curvetun.zsh new file mode 100644 index 0000000..16a1fd3 --- /dev/null +++ b/.zsh/completion/curvetun.zsh @@ -0,0 +1,36 @@ +#compdef curvetun +# +# curvetun.zsh -- zsh completion function for curvetun +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "(-k --keygen)"{-k,--keygen}"[Generate public/private keypair]" \ + "(-x --export)"{-x,--export}"[Export your public data for remote servers]" \ + "(-C --dumpc)"{-C,--dumpc}"[Dump parsed clients]" \ + "(-S --dumps)"{-S,--dumps}"[Dump parsed servers]" \ + "(-D --nofork)"{-D,--nofork}"[Do not daemonize]" \ + "(-d --dev)"{-d,--dev}"[Networking tunnel device, e.g. tun0]:device:_interfaces" \ + {-v,--version}"[Print version]:" \ + {-h,--help}"[Print this help]:" \ + "(-s --server -N --no-logging -p --port -t --stun -u --udp -4 --ipv4 -6 --ipv6 -c --client)"{-c,--client}"[Client mode, server alias optional]:client:_gnu_generic" \ + "(-c --client -s --server)"{-s,--server}"[Server mode]" \ + "(-c --client -N --no-logging)"{-N,--no-logging}"[Disable server logging (for better anonymity)]" \ + "(-c --client -p --port)"{-p,--port}"[Port number (mandatory)]:port:_gnu_generic" \ + "(-c --client -t --stun)"{-t,--stun}"[Show public IP/Port mapping via STUN]:stun:_gnu_generic" \ + "(-c --client -u --udp)"{-u,--udp}"[Use UDP as carrier instead of TCP]" \ + "(-c --client -4 --ipv4)"{-4,--ipv4}"[Tunnel devices are IPv4]" \ + "(-c --client -6 --ipv6)"{-6,--ipv6}"[Tunnel devices are IPv6 (default: same as carrier protocol)]" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/flowtop.zsh b/.zsh/completion/flowtop.zsh new file mode 100644 index 0000000..878931c --- /dev/null +++ b/.zsh/completion/flowtop.zsh @@ -0,0 +1,25 @@ +#compdef flowtop +# +# flowtop.zsh -- zsh completion function for flowtop +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_arguments -s -S \ + "(-4 --ipv4)"{-4,--ipv4}"[Show only IPv4 flows (default)]" \ + "(-6 --ipv6)"{-6,--ipv6}"[Show only IPv6 flows (default)]" \ + "(-T --tcp)"{-T,--tcp}"[Show only TCP flows (default)]" \ + "(-U --udp)"{-U,--udp}"[Show only UDP flows]" \ + "(-D --dccp)"{-D,--dccp}"[Show only DCCP flows]" \ + "(-I --icmp)"{-I,--icmp}"[Show only ICMP/ICMPv6 flows]" \ + "(-S --sctp)"{-S,--sctp}"[Show only SCTP flows]" \ + "(-s --show-src)"{-s,--show-src}"[Also show source, not only dest]" \ + "(-u --update)"{-u,--update}"[Update GeoIP databases]" \ + {-v,--version}"[Print version]:" \ + {-h,--help}"[Print this help]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/ifpps.zsh b/.zsh/completion/ifpps.zsh new file mode 100644 index 0000000..87ce135 --- /dev/null +++ b/.zsh/completion/ifpps.zsh @@ -0,0 +1,28 @@ +#compdef ifpps +# +# ifpps.zsh -- zsh completion function for ifpps +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "(-d --dev)"{-d,--dev}"[Device to fetch statistics for i.e., eth0]:device:_interfaces" \ + "(-p --promisc)"{-p,--promisc}"[Promiscuous mode]" \ + "(-t --interval)"{-t,--interval}"[Refresh time in sec (default 1 s)]:interval:_gnu_generic" \ + "(-n --num-cpus)"{-n,--num-cpus}"[Number of top hitter CPUs to display in ncurses mode (default 10)]" \ + "(-C --csv)"{-C,--csv}"[Output to terminal as CSV E.g. post-processing with Gnuplot et al.]" \ + "(-l --loop)"{-l,--loop}"[Loop terminal output]" \ + {-v,--version}"[Print version]:" \ + {-h,--help}"[Print this help]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/mausezahn.zsh b/.zsh/completion/mausezahn.zsh new file mode 100644 index 0000000..95a9e35 --- /dev/null +++ b/.zsh/completion/mausezahn.zsh @@ -0,0 +1,67 @@ +#compdef mausezahn +# +# mausezahn.zsh -- zsh completion function for mausezahn +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args + +_packet_type () { + _values \ + "arp" \ + "bpdu" \ + "cdp" \ + "ip" \ + "icmp" \ + "udp" \ + "tcp" \ + "dns" \ + "rtp" \ + "syslog" \ + "lldp" +} + +_interface_keywords () { + _values "interface keyword" \ + "rand[Use a random MAC address]" \ + "bc[Use a broadcast MAC address]" \ + "own[Use own interface MAC address (default for source MAC)]" \ + "stp[Use IEEE 802.1d STP multicast address]" \ + "cisco[Use Cisco multicast address as used for CDP, VTP, or PVST+]" +} + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "-x[Interactive mode with telnet CLI, default port: 25542]" \ + "(-6)-4[IPv4 mode (default)]" \ + "(-4)-6[IPv6 mode]" \ + "-c[Send packet count times, default:1, infinite:0]" \ + "-d[Apply delay between transmissions. The delay value can be specified in usec (default, no additional unit needed), or in msec (e.g. 100m or 100msec), or in seconds (e.g. 100s or 100sec)]" \ + "-r[Multiplies the specified delay with a random value]" \ + "-p[Pad the raw frame to specified length (using random bytes)]" \ + "-a[Use specified source mac address, no matter what has been specified with other arguments; keywords see below, Default is own interface]:keyword:_interface_keywords" \ + "-b[Same with destination mac address; keywords]:keywords:_interface_keywords" \ + "-A[Use specified source IP address (default is own interface IP)]" \ + "-B[Send packet to specified destination IP or domain name]" \ + "-P[Use the specified ASCII payload]" \ + "-f[Read the ASCII payload from a file]:filename:_files" \ + "-F[Read the hexadecimal payload from a file]:filename:_files" \ + "-Q[Specify 802.1Q VLAN tag and optional Class of Service, you can specify multiple 802.1Q VLAN tags (QinQ...) by separating them via a comma or a period (e.g. '5:10,20,2:30')]" \ + "-t[Specify packet type for autobuild (you don't need to care for encapsulations in lower layers, most packet types allow/require additional packet-specific arguments in an <arg-string>; Currently supported types: arp, bpdu, cdp, ip, icmp, udp, tcp, dns, rtp, syslog, lldp and more; For context-help use 'help' as <arg-string>!]:packet_type:_packet_type" \ + "-T[Specify packet type for server mode, currently only rtp is supported; Enter -T help or -T rtp help for further information]" \ + "-M[Insert a MPLS label, enter '-M help' for a syntax description]" \ + "(-V -VV -VVV)"{-V,-VV,-VVV}"[Verbose and more verbose mode]" \ + "-q[Quiet mode, even omit 'important' standard short messages]" \ + "-S[Simulation mode: DOES NOT put anything on the wire, this is typically combined with one of the verbose modes (v or V)]" \ + "-v[Show version]:" \ + "-h[Print this help]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/netsniff-ng.zsh b/.zsh/completion/netsniff-ng.zsh new file mode 100644 index 0000000..122d661 --- /dev/null +++ b/.zsh/completion/netsniff-ng.zsh @@ -0,0 +1,69 @@ +#compdef netsniff-ng +# +# netsniff-ng.zsh -- zsh completion function for netsniff-ng +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args +local context state line + +_cpu () { + _cpus=(${${(f)"$(grep processor /proc/cpuinfo | awk '{print $3}')"}}) + compadd -a _cpus +} + +_user_info () { + user_info=(${${(f)"$(awk -F':' '{print $3":"$1}' /etc/passwd)"}}) + _describe -t usr "user info" user_info && ret=0 +} + +_group_info () { + group_info=(${${(f)"$(awk -F':' '{print $4":"$1}' /etc/passwd)"}}) + _describe -t usr "group info" group_info && ret=0 +} + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "(-i -d --dev --in)"{-i,-d,--dev,--in}"[Input source as netdev, pcap or pcap stdin]:input:_interfaces" \ + "(-o --out)"{-o,--out}"[Output sink as netdev, pcap, directory, trafgen, or stdout]::_gnu_generic" \ + "(-f --filter)"{-f,--filter}"[Use BPF filter file from bpfc or tcpdump-like expression]" \ + "(-t --type)"{-t,--type}"[Filter type]:filter:(host broadcast multicast others outgoing)" \ + "(-F --interval)"{-F,--interval}"[Dump interval if -o is a dir: <num>KiB/MiB/GiB/s/sec/min/hrs]:interval:_gnu_generic" \ + "(-J --jumbo-support)"{-J,--jumbo-support}"[Support for 64KB Super Jumbo Frames (def: 2048B)]" \ + "(-R --rfraw)"{-R,--rfraw}"[Capture or inject raw 802.11 frames]" \ + "(-n --num)"{-n,--num}"[Number of packets until exit (def: 0)]" \ + "(-P --prefix)"{-P,--prefix}"[Prefix for pcaps stored in directory]" \ + "(-T --magic)"{-T,--magic}"[Pcap magic number/pcap format to store, see -D]" \ + "(-D --dump-pcap-types)"{-D,--dump-pcap-types}"[Dump pcap types and magic numbers and quit]" \ + "(-B --dump-bpf)"{-B,--dump-bpf}"[Dump generated BPF assembly]" \ + "(-r --rand)"{-r,--rand}"[Randomize packet forwarding order (dev->dev)]" \ + "(-M --no-promisc)"{-M,--no-promisc}"[No promiscuous mode for netdev]" \ + "(-A --no-sock-mem)"{-A,--no-sock-mem}"[Don\'t tune core socket memory]" \ + "(-m --mmap)"{-m,--mmap}"[Mmap(2) pcap file i.e., for replaying pcaps]" \ + "(-G --sg)"{-G,--sg}"[Scatter/gather pcap file I/O]" \ + "(-c --clrw)"{-c,--clrw}"[Use slower read(2)/write(2) I/O]" \ + "(-S --ring-size)"{-S,--ring-size}"[Specify ring size to: <num>KiB/MiB/GiB]:ringsize:" \ + "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \ + "(-b --bind-cpu)"{-b,--bind-cpu}"[Bind to specific CPU]:cpunum:_cpu" \ + "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \ + "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \ + "(-H --prio-high)"{-H,--prio-high}"[Make this high priority process]" \ + "(-Q --notouch-irq)"{-Q,--notouch-irq}"[Do not touch IRQ CPU affinity of NIC]" \ + "(-s --silent)"{-s,--silent}"[Do not print captured packets]" \ + "(-q --less)"{-q,--less}"[Print less-verbose packet information]" \ + "(-X --hex)"{-X,--hex}"[Print packet data in hex format]" \ + "(-l --ascii)"{-l,--ascii}"[Print human-readable packet data]" \ + "(-U --update)"{-U,--update}"[Update GeoIP databases]" \ + "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \ + {-v,--version}"[Show version]:" \ + {-h,--help}"[Guess what?!]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/completion/trafgen.zsh b/.zsh/completion/trafgen.zsh new file mode 100644 index 0000000..4a4fdde --- /dev/null +++ b/.zsh/completion/trafgen.zsh @@ -0,0 +1,55 @@ +#compdef trafgen +# +# trafgen.zsh -- zsh completion function for trafgen +# +# Copyright (C) 2013 Hideo Hattori <hhatto.jp@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +typeset -A opt_args +local context state line + +_cpu () { + _cpus=(${${(f)"$(grep processor /proc/cpuinfo | awk '{print $3}')"}}) + compadd -a _cpus +} + +_user_info () { + user_info=(${${(f)"$(awk -F':' '{print $3":"$1}' /etc/passwd)"}}) + _describe -t usr "user info" user_info && ret=0 +} + +_group_info () { + group_info=(${${(f)"$(awk -F':' '{print $4":"$1}' /etc/passwd)"}}) + _describe -t usr "group info" group_info && ret=0 +} + +_interfaces () { + _wanted interfaces expl 'network interface' \ + _net_interfaces + _values "Pseudo-device that captures on all interfaces" "any" +} + +_arguments -s -S \ + "(-i -c --in --conf)"{-i,-c,--in,--conf}"[Packet configuration file/stdin]:input:_files" \ + "(-o -d --out --dev)"{-o,-d,--out,--dev}"[Networking device i.e., eth0]:device:_interfaces" \ + "(-p --cpp)"{-p,--cpp}"[Run packet config through C preprocessor]" \ + "(-J --jumbo-support)"{-J,--jumbo-support}"[Support 64KB super jumbo frames (def: 2048B)]" \ + "(-R --rfraw)"{-R,--rfraw}"[Inject raw 802.11 frames]" \ + "(-s --smoke-test)"{-s,--smoke-test}"[Probe if machine survived fuzz-tested packet]" \ + "(-n --num)"{-n,--num}"[Number of packets until exit (def: 0)]" \ + "(-r --rand)"{-r,--rand}"[Randomize packet selection (def: round robin)]" \ + "(-P --cpus)"{-P,--cpus}"[Specify number of forks(<= CPUs) (def: #CPUs)]:cpunum:_cpu" \ + "(-t --gap)"{-t,--gap}"[Interpacket gap in us (approx)]" \ + "(-S --ring-size)"{-S,--ring-size}"[Manually set mmap size (KiB/MiB/GiB)]:ringsize:" \ + "(-k --kernel-pull)"{-k,--kernel-pull}"[Kernel pull from user interval in us (def: 10us)]:kernelpull:_gnu_generic" \ + "(-E --seed)"{-E,--seed}"[Manually set srand(3) seed]" \ + "(-u --user)"{-u,--user}"[Drop privileges and change to userid]:user:_user_info" \ + "(-g --group)"{-g,--group}"[Drop privileges and change to groupid]:group:_group_info" \ + "(-e --example)"{-e,--example}"[Show built-in packet config example]:" \ + "(-V --verbose)"{-V,--verbose}"[Be more verbose]" \ + {-v,--version}"[Show version]:" \ + {-h,--help}"[Guess what?!]:" \ + "*::args:_gnu_generic" diff --git a/.zsh/zshenv/01_fpath b/.zsh/zshenv/01_fpath index 6c86623..10275bc 100644 --- a/.zsh/zshenv/01_fpath +++ b/.zsh/zshenv/01_fpath @@ -2,7 +2,7 @@ # # Add local functions directory to $fpath # -# Copyright © 2010 Tobias Klauser <tklauser@distanz.ch> +# Copyright © 2010-2013 Tobias Klauser <tklauser@distanz.ch> # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net> # Released under the terms of the Artistic Licence 2.0 # @@ -10,4 +10,7 @@ fpath=($ZDOTDIR/func $fpath) +# add custom completions +fpath=($ZDOTDIR/completion $fpath) + # vim:ft=zsh |