基本语法:tshark [ -a <capture autostop condition> ] ... [ -b <capture ring buffer option>] ... [ -B <capture buffer size (Win32 only)> ] [ -c <capture packet count> ] [ -d <layer type>==<selector>,<decode-as protocol> ] [ -D ] [ -f <capture filter> ] [ -F <file format> ] [ -h ] [ -i <capture interface>|- ] [ -l ] [ -L ] [ -n ] [ -N <name resolving flags> ] [ -o <preference setting> ] ... [ -p ] [ -q ] [ -r <infile> ] [ -R <read (display) filter> ] [ -s <capture snaplen> ] [ -S ] [ -t ad|a|r|d ] [ -T pdml|psml|ps|text ] [ -v ] [ -V ] [ -w <outfile>|- ] [ -x ] [ -X <eXtension option>] [ -y <capture link type> ] [ -z <statistics> ]
根据试验,参数的书写有讲究。模仿tcpdump,可以把抓包过滤表达式写在命令的最后。 一般将抓包表达式用引号quote起来(在windows上是双引号"),一是为了视觉方便,一是为了逃避其中字符和shell语法的冲突(如“>”,“||”等)。抓包过滤表达式也可以写在-f参数的后面,注意,此时更应该使用引号或者将-f放在最后。否则,它们会认为-f(可省)后面 的参数都是表达式的一部分,而导致命令格式混乱。
主要参数分类含义权作解说如下:
1. 抓包接口类
2. 抓包停止条件
3. 文件输出控制
4. 文件输入
5. 处理类
6. 输出类
7. 其它