fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
0f3274d5e
master
1# tshark - Dump and analyze network traffic 2 3__fish_complete_wireshark tshark 4 5function __fish_tshark_protocols 6set -l tok( commandline -ct| string collect) 7set -l tok_param( string replace -r --'^-O' '' $tok ) 8command tshark -G protocols2> /dev/null| while read -l -d\t name shortname identifier 9printf "%s%s\t%s\n" ( string replace -r --'(.+),[^,]*$' '$1,' $tok_param ) $tok_no_comma $identifier $name 10end 11end 12 13complete -c tshark -s2 -d'Perform a two-pass analysis' 14# This is fairly expensive, but only done upon the user pressing tab. 15complete -c tshark -s e -d'Add a field to the list of fields to display' -xa'(command tshark -G fields 2> /dev/null | awk -F\t \'{print $3"\t"$2}\')' 16complete -c tshark -s E -d'Set an option controlling the printing of fields' -xa' 17bom=y\t"Prepend output with the UTF-8 byte order mark" 18header=y\t"Print a list of the selected field names" 19separator=\t"Set the separator character to use for fields" 20occurrence=\t"Select which occurrence to use for fields that have multiple: f=first, l=last, a=all" 21aggregator=\t"Set the aggregator character to use for fields that have multiple occurrences" 22quote=\t"Set the quote character to use to surround fields d=\", s=\', n=no quotes"' 23 24complete -c tshark -s F -d'Set the output capture file format' -xa'(command tshark -F 2>| string replace -rf "\s+(\S+) - (.*)" \'$1\t$2\')' 25complete -c tshark -s G -d'Print a glossary' -xa'( 26printf "help\tList available report types\n" 27command tshark -G help 2>/dev/null | string replace -rf "\s+-G (\S+)\s+(.*)" \'$1\t$2\' 28)' 29complete -c tshark -s H -d'Read a list of entries from a "hosts" file' -r 30complete -c tshark -s j -d'Protocol match filter used for ek|json|jsonraw|pdml output file types' -x 31complete -c tshark -s J -d'Protocol match filter used, includes all child protocols' -x 32complete -c tshark -s l -d'Flush the standard output after the information for each packet is printed' 33complete -c tshark -s O -d'Show a detailed view of the comma-separated list of protocols' -xa'(__fish_tshark_protocols)' 34complete -c tshark -s P -l print -d'Decode and display packet summary or details' 35complete -c tshark -s Q -d"When capturing packets, don't display, on the standard error, the initial message" 36complete -c tshark -s S -d'Set the line separator to be printed between packets' -x 37complete -c tshark -s T -d'Set the format of the output when viewing decoded packet data' -xa' 38ek\t"Newline delimited JSON for bulk import into Elasticsearch" 39fields\t"The values of fields specified with the -e option, in a form specified by the -E option" 40json\t"JSON file format" 41jsonraw\t"JSON file format including only raw hex-encoded packet data" 42pdml\t"Packet Details Markup Language, an XML-based format for the details of a decoded packet" 43ps\t"PostScript for a human-readable summary of each of the packets" 44psml\t"Packet Summary Markup Language" 45tabs\t"Tab-separated human-readable one-line packet summaries" 46text\t"Default"' 47 48complete -c tshark -s U -d"PDUs export according to given tap name" -xa'( 49printf "%s\tTap name\n" (command tshark -U "" 2>| string replace -rf "^tshark:\s*" "")[2..-1])' 50complete -c tshark -s V -d'Causes TShark to print a view of packet details' 51complete -c tshark -s W -d'Save extra information in the capture file if the format supports it' -xa n 52complete -c tshark -s x -d'Print hex and ASCII dumps of packet data' 53complete -c tshark -s M -d'Automatically reset internal session when reaching N packets' -x 54complete -c tshark -l color -d'Enable coloring of packets according to standard Wireshark color filters' 55complete -c tshark -l no-duplicate-keys -d'Merge duplicate keys in json output' 56complete -c tshark -l elastic-mapping-filter -d'Only put specified protocols in an ElasticSearch mapping file' -x# TODO 57complete -c tshark -l export-objects -d'Export all objects within a protocol into directory given destination directory' -x# TODO