Ethereal 使用手册

Ethereal 用户手册

18094 for Ethereal 0.10.14

Ulf Lamping

 

Richard Sharpe

NS Computer Software and Services P/L

Ed Warnicke

 

版权所有 © 2004-2005 Ulf Lamping , Richard Sharpe , Ed Warnicke

允许基于GNU的标准对该文档进行复制、分发、或修改。包括版本2及由Free Software Foundation(免费软件基金会)发布的任何后续版本。

在该文档中的所有徽标及商标的所有权属于各自的所有者。

翻译者列表(说明:任何人可对该文档进行再翻译及修订,请按顺序留下姓名)

胡彼德   peterhu318@hotmail.com     2006.6.6 完整除附录以后的所有章节翻译,历时约一个月

 


目录

前言

1. 序

2. 谁适合看这篇文档?

3. 感谢

4. 关于这篇文档

5. 何处可以得到该文档的最新版本?

6. 提供关于该文档的反馈

1. 介绍

1.1. Ethereal是什么?

1.1.1. 该软件的特定功能

1.1.2. 软件特色

1.1.3. 从许多不同网络介质实时捕获a

1.1.4. 导入其它程序的捕获文件

1.1.5. 导出捕获的文件,以便其它捕获程序读取

1.1.6. 协议解码器

1.1.7. 开放源代码软件

1.1.8. Ethereal不能做什么

1.2. Ethereal的运行平台

1.2.1. Unix

1.2.2. Linux

1.2.3. Microsoft Windows

1.3. 从可处获得Ethereal?

1.4. A rose by any other name

1.5. Ethereal的开发历史

1.6. Ethereal的开发及维护

1.7. 报告问题及帮助

1.7.1. 网站

1.7.2. Wiki

1.7.3. 常见问题FAQ

1.7.4. 邮件讨论组

1.7.5. 报告问题

1.7.6. 报告UNIX/LINUX平台下的Crash情况(Crash:系统异常退出)

1.7.7. 报告WIN平台的Crash情况

2. 编译及安装

2.1. 介绍

2.2. 获得源代码及可执行代码

2.3. 在UNIX平台下编译之前需要做的工作

2.4. 在UNIX下编译

2.5. 在UNIX平台下安装已编译的

2.5.1. 在RedHat平台安装基于rpm的包

2.5.2. 在Debian下安装deb包

2.6. UNIX平台下安装常见问题及解决办法

2.7. 在Windows平台下进行编译

2.8. 在Windows下安装

2.8.1. 安装Ethereal

2.8.2. 安装WinPcap

2.8.3. 更新Ethereal

2.8.4. 更新WinPcap

2.8.5. 卸载Ethereal

2.8.6. 卸载WinPcap

3. 用户界面

3.1. 介绍

3.2. 启动Ethereal

3.3. 主窗口

3.4. 菜单

3.5. “File”(文件)菜单

3.6. “Edit”(编辑)菜单

3.7. “View”(查看)菜单

3.8. “Go”菜单

3.9. “Capture”(捕获)菜单

3.10. “Analyze”(分析)菜单

3.11. “Statistics”(统计)菜单

3.12. “Help”(帮助)菜单

3.13. “Main”(主)工具条

3.14. “Filter”(过滤)工具条

3.15. “Packet List”(包列表)面板

3.16. “Packet Details”(包的详细信息)面板

3.17. “Packet Bytes”(包的字节)面板

3.18. 状态栏

4. 捕获动态的网络数据包

4.1. 介绍

4.2. 首要条件

4.3. 开始捕获

4.4. “Capture Interfaces”(捕获界面)对话窗

4.5. “Capture Options”(选项)对话窗

4.5.1. “Capture”(捕获)子窗口

4.5.2. “Capture Files(s)”(捕获到文件)子窗口

4.5.3. “Stop capture...”(停止捕获)子窗口

4.5.4. “Display Options”(显示选项)子窗口

4.5.5. “Name Resolution”(名称解析)子窗口

4.5.6. 按钮

4.6. 捕获到文件及文件保存的模式

4.7. 链路层头的类型

4.8. 捕获时进行过滤

4.9. 当进行捕获时… ...

4.9.1. 停止捕获

4.9.2. 重新开始捕获

5. 文件输入/输出及打印

5.1. 介绍

5.2. 打开捕获的文件

5.2.1. “Open Capture File”(打开捕获文件)对话框

5.2.2. 输入文件格式

5.3. 保存捕获的包

5.3.1. “Save Capture File As”(保存到…)对话框

5.3.2. 输出文件格式

5.4. 合并捕获文件

5.4.1. “Merge with Capture File”(合并捕获文件)对话框

5.5. 文件设置

5.5.1. “List Files”(列出文件)对话框

5.6. 导出数据

5.6.1. “Export as Plain Text File”(以纯文本方式导出)对话框

5.6.2. “Export as PostScript File”(以PostScript格式导出)对话框

5.6.3. “Export as CSV file”(以CSV格式导出)对话框

5.6.4. “Export as PSML file”(以PSML格式导出)对话框

5.6.5. “Export as PDML file”(以PDML格式导出)对话框

5.6.6. “Export selected packet bytes”(导出选择的包字节)对话框

5.7. 打印包

5.7.1. “Print”(打印)对话框

5.8. “Packet Range”子窗口

5.9. “Packet Format”子窗口

6. 使用捕获的包

6.1. 查看捕获的包

6.2. 过滤后查看

6.3. 建立显示过滤表达式

6.3.1. 显示过滤字段

6.3.2. 比较

6.3.3. 表达式组合

6.3.4. 一个常犯的错误

6.4. “Filter Expression”(过滤表达式)对话框

6.5. 定义&保存过滤表达式

6.6. 查找包

6.6.1. “Find Packet”(查找包)对话框

6.6.2. “Find Next”(查找下一个)命令

6.6.3. “Find Previous”(查找前一个)命令

6.7. 转到一个特定的包

6.7.1. “Go Back”(回跳)命令

6.7.2. “Go Forward”(前跳)命令

6.7.3. “Go to Packet”(转到包)对话框

6.7.4. “Go to Corresponding Packet”(转到相应的包)命令

6.7.5. “Go to First Packet”(转到第一个包)命令

6.7.6. “Go to Last Packet”(转到最后一个包)命令

6.8. 对包进行标记

6.9. 时间显示格式及参考时间

6.9.1. 包的参考时间

7. 进阶

7.1. 介绍

7.2. 跟随TCP数据流

7.2.1. “Follow TCP Stream”(跟随TCP数据流)对话框

7.3. 时间戳

7.3.1. Ethereal内部时间格式

7.3.2. 捕获文件的格式

7.3.3. 精度

7.4. 时区

7.4.1. 正确设置计算机的时间!

7.4.2. Ethereal与时区

7.5. 包的重新封装

7.5.1. 什么是封装?

7.5.2. Ethereal如何处理

7.6. 名称解析

7.6.1. 名称解析的缺点

7.6.2. 以太网名称解析(MAC层)

7.6.3. IP 名称解析(网络层)

7.6.4. IPX 名称解析(网络层)

7.6.5. TCP/UDP 端口名解析(传输层)

7.7. 校验和

7.7.1. Ethereal校验和确认

7.7.2. 校验和卸载

8. 统计

8.1. 介绍

8.2. 汇总窗口

8.3. 协议分层窗口

8.4. 端点

8.4.1. 什么是端点?

8.4.2. 端点窗口

8.4.3. 特定协议的端点列表窗口

8.5. 会话

8.5.1. 什么是会话?

8.5.2. 会话窗口

8.5.3. 特定协议的会话列表窗口

8.6. "IO图形"窗口

8.7. 服务响应时间

8.7.1. DCE-RPC服务响应时间窗口

8.8. 特定协议统计窗口

9. 定制Ethereal

9.1. 介绍

9.2. 从命令行启动Ethereal

9.3. 包的着色

9.4. 控制协议解码

9.4.1. "Enabled协议"对话框

9.4.2. 用户指定的解码器

9.4.3. 显示用户指定的解码器

9.5. 参数设置

A. Configuration (and other) Files and Folders

A.1. Windows folders

A.1.1. Windows profiles

A.1.2. Windows NT/2000/XP roaming profiles

A.1.3. Windows temporary folder

B. Protocols and Protocol Fields

C. Ethereal Messages

C.1. Packet List Messages

C.1.1. [Malformed Packet]

C.1.2. [Packet size limited during capture]

C.2. Packet Details Messages

C.2.1. [Response in frame: 123]

C.2.2. [Request in frame: 123]

C.2.3. [Time from request: 0.123 seconds]

D. Related command line tools

D.1. Introduction

D.2. tcpdump: Capturing with tcpdump for viewing with Ethereal

D.3. tethereal: Terminal-based Ethereal

D.4. capinfos: Print information about capture files

D.5. editcap: Edit capture files

D.6. mergecap: Merging multiple capture files into one

D.7. text2pcap: Converting ASCII hexdumps to network captures

D.8. idl2eth: Creating dissectors from Corba IDL files

D.8.1. What is it?

D.8.2. Why do this?

D.8.3. How to use idl2eth

D.8.4. TODO

D.8.5. Limitations

D.8.6. Notes

E. This Document's License (GPL)

前言Preface

1. 序

Ethereal是一个许多网络管理员喜欢使用的软件,但是由于Ethereal的文档不是很丰富,网络管理员有时不能通过Ethereal得到他们想要的东西

这篇文档就是Ethereal小组为改进Ethereal的可用性所做的一点努力。

希望它对你有所帮助,并且期望能得到你的建议

2. 哪些人应该看该文档

任何使用Ethereal的人都可以是这本书的读者。

这本书介绍 了Ehereal的所有基本内容及一些Ethereal提供的特别功能。由于Ethereal已经是一个非常复杂的综合的程序,因此并不是每一个优点都做了说明。.

这本书的目的不是解释网络嗅探,应此并不讲解协议的具体内容。与这些内容相关的信息可以通过下面的Ethereal Wiki这个网站获得,网址是:http://wiki.ethereal.com

通过读这本书,你将学到怎样安装Ethereal,怎么使用基本的图形元素以及一些高级特性。这本书对于Ethereal初学者解决常见的一些问题是非常有用的。

3. 感谢

作者感谢Ethereal小组的协助。另外,作者还要对下面的人说一声谢谢,他们是:

·         Gerald Combs, Ethereal项目的发起者,并且对该文档的制作进行了资助

·         Guy Harris, 提出了很多有用的建议,并且耐心的对该文档进行了大量的复核

·         Gilbert Ramirez, 给了我们很多鼓励和有用的建议

也将感谢下面这些人为篇文档给出的反馈

·         Pat Eyler, 对改进建立反向跟踪的例子提供了很有用的建议

·         Martin Regner, 提供了他的一些建议并进行了一些修正

·         Graeme Hewson, 做了一些文法方面的修改

也将感谢那些man页及readme文档的作者们,该文档加入了他们写的一些内容

·         Scott Renfro from whose mergecap man page Section D.6, “mergecap: Merging multiple capture files into one ” is derived.

·         Ashok Narayanan from whose text2pcap man page Section D.7, “text2pcap: Converting ASCII hexdumps to network captures ” is derived.

·         Frank Singleton from whose README.idl2eth Section D.8, “idl2eth: Creating dissectors from Corba IDL files ” is derived.

4. 关于该文档

这本书的发起者是Richard Sharpe [Peter:with funds provided from the Ethereal Fund.]  Ed Warnicke 进行了更新,最近进行的重新设计及更新是由Ulf Lamping完成的。

该文档是用DocBook/XML写的。

该书使用的一些特殊标记

这是一个警告!

你应该注意这个警告,否则可能会丢失数据

这是一个注解!

注解将指出常见的错误及不是很明显的一些东西

这是一个提示!

它对你每天使用Ethereal进行工作是非常有帮助的.

5. 获取该方档的最新版本

可以从下面的地址获得该文档的最新版 本: http://www.ethereal.com/docs/#usersguide.

6. 提供对这篇文档的反馈

对该文档的任何反馈,请发E-mail给作者,邮箱是: ethereal-dev[AT]ethereal.com.

Chapter 1. 介绍

 

1.1. 什么是Ethereal?

Ethereal是一个网络包的分析仪。网络分析仪通常试着去捕获网络包,然后尽可能详细的显示出那个包所包含的数据。

你或许觉得网络分析仪就象是一个测量仪,能够测量网络线缆里经过的数据。就象是电工使用的伏特计,可以测试电缆里的电压。(当然,Ethereal在一个更高的层次上).

在过去,这样的工具即昂贵,又很少见到。但是随着Ethereal的出现,这一切被改变了

或许Ethereal是今天最好的基于开放源代码的网络包分析仪之一。

1.1.1. 几个常用功能

下面是使用Ethereal可以完成的几个工作:

·         网络管理员使用它去帮助解决网络问题

·         网络安全工程师用它去测试安全问题

·         开发人员用它是调试协议的实现过程

·         用它还可以帮助人员深入的学习网络协议

当然Ethereal在其它的一些方面也是非常有用的。

1.1.2. 特性

下面是Ethereal提供的一些特性:

·         支持UNIX 平台和 Windows平台。

·         从网络接口上捕获实时数据包

·         以非常详细的协议方式显示数据包

·         可以打开或者存贮捕获的数据包

·         导入/导出数据包,从/到其它的捕获程序

·         按多种方式过滤数据包

·         按多种方式查找数据包

·         根据过滤条件,以不同的颜色显示数据包

·         可以建立多种统计数据

·         ... 还有很多其它特性

但是,要想真正体验到Ethereal的强大功能,你必须亲自使用它。

图 1.1, “ Ethereal捕获数据包并允许检查包的内容” 显示了Ethereal已经捕获的数据包,并等待你去检查这些包的内容

图 1.1.  Ethereal捕获数据包并允许检查包的内容

1.1.3. 在各种网络介质上进行实时捕获

Ethereal并不象他的名字一样,只能对以太网数据进行捕获,他可以捕获许多非以太网数据。Ethereal支持的网络介质取决于许多因素,比如你的操作系统等。Ethereal支持的网络介质类型可以从以下网址得到: http://www.ethereal.com/media.html.

1.1.4. 导入其它程序的捕获文件

Ethereal能够打开许多程序捕获文件,支持的文件格式参见5.2.2,  输入文件格式.

1.1.5. 导出文件

Ethereal可以将捕获的数据包按照多种格式保存,以便其它厂家的捕获程序读取。Ethereal可支持的输出格式参见 5.3.2,  输出文件格式

1.1.6. 多种协议解码器

Ethereal可以对很多很多协议进行解码,具体列表可参见附录 B, 协议和协议字段.

1.1.7. 开放源代码软件

Ethereal是一个开放源代码软件工程,基于GPL发布。你可以在任何数量的计算机上免费使用,无须担心授权码及费用问题。另外,所有源代码也是免费的(遵守GPL),因此任何人可以追加新的协议到Ethereal里,可能通过插件形式,也可以通过源代码的方式,人们通常使用后者。

1.1.8. Ethereal不具备的功能

下面是Ethereal不具备的功能

·         Ethereal不是一个IDS(入侵检测系统),如果某些人在你的网络上做一些不允许的事情,Ethereal并不发出警告。但是,如果出现异常情况,Ethereal可以帮你查找出正在发生的问题

·         Ethereal不能改变网络上的任何事情,它只能监测。Ethereal不会向网络上发送任何包或者其它的活动(名字解析除外,但是这个功能是可以disable的)

1.2. 运行平台

Ethereal目前可以运行很多的UNIX平台及Windows平台。不过需要GTK+, GLib, libpcap及其它一些库文件的支持。

如果对于某个特定平台没有相应的可执行包,可以下载源码进行编译,你的经验可以发到下面的邮箱: ethereal-dev[AT]ethereal.com.

下面的平台已经有了相应的可执行包(Binary packages)

1.2.1. Unix

·         Apple Mac OS X

·         BeOS

·         FreeBSD

·         HP-UX

·         IBM AIX

·         NetBSD

·         OpenBSD

·         SCO UnixWare/OpenUnix

·         SGI Irix

·         Sun Solaris/Intel

·         Sun Solaris/Sparc

·         Tru64 UNIX (formerly Digital UNIX)

1.2.2. Linux

·         Debian GNU/Linux

·         Gentoo Linux

·         IBM S/390 Linux (Red Hat)

·         Mandrake Linux

·         PLD Linux

·         Red Hat Linux

·         Rock Linux

·         Slackware Linux

·         Suse Linux

1.2.3. Microsoft Windows

支持的::

·         Windows Server 2003 / XP / 2000 / NT 4.0

·         Windows Me / 98

不支持的: (因为缺少相应的库文件):

·         Windows CE

·         Windows NT / XP Embedded

·         Windows 95 :WinPcap不再支持及维护WIN95,但是可以工作

未知(新版本):

·         Windows XP 64-bit Edition

·         Windows Vista (aka Longhorn)

请提供关于新版本下运行Ethereal的经验至: ethereal-dev[AT]ethereal.com.

1.3. 获取Ethereal软件

Ethereal website: http://www.ethereal.com/download.html,可以从这儿获得Ethereal的最新版本。也可以从这个网站的镜象站点下载。

通常每4-8周,将会有一个新版本出现。

如果当有新版本出现时得到一个通知,你可以订阅Ethereal-annouce邮件列表。具体请参见1.7.4, “邮件列表”.

1.4. A rose by any other name(不知怎么翻译)

William Shakespeare wrote: "A rose by any other name would smell as sweet." And so it is with Ethereal, as there appears to be two different ways that people pronounce the name.

有些人读作ether-real, 而有些人读作it e-the-real, [peter:因为它如此的可怕 原文:as in ghostly, insubstantial, etc. ]

你可以任何称呼它,FAQ给出的发音是"e-the-real".

1.5.  Ethereal的历史

1997年末, Gerald Combs需要一个工具来跟踪网络崩溃问题,并且想学习更多的网络知识,因此他开始写Ethereal软件。.

经过几次停滞,Ethereal在1998年7月首次发布了,当时的版本是0.2.0. 几天内,补丁、bug报告,还有一些对这个软件表示赞赏的言论都开始出现了,Ethereal走上了成功之路。

不久之后,Gilbert Ramirez 看到了它存在的潜能,于是贡献了一个底层的解码器给Ethereal。

1998年10月Network Appliance公司的Guy Harris要找一个比tcpview好一点的工具,于是他开始对Ethereal提供patch及一些解码器。

1998年末, Richard Sharpe要教TCP/IP课程, 看到了Ethereal对其课程的帮助力,于是开始关注这个软件是否支持他需要的协议。当有不支持的协议时,他就将这些新的解码器加进去,还包括一些补丁。

给Ethereal做出贡献的人的名单已经很长了,他们中几乎所有人都是因为他们需要一个协议而Ethereal当时无法持的情况下与Ethereal开始的,因此他们通常拷贝一个解码器,再把源码发回给Ethereal小组。

1.6.  开发&维护

Ethereal最初是由Gerald Combs开发的。现在Ethereal小组负继续的开发及维护工作。Ethereal小组是一个松散的小组,由于许多修复BUG及提供新功能的个人组成。

也有非常非常多的人提供协议解码器,希望这种情况能保持下去。通过点击“About Ethereal”对话框,你可以看到这些人的名单,或者在网站上的authors页面

Ethereal是一个开放源代码工程,它的发布是基于GNU General Public Licence (GPL). 在GPL下,所有源代码都是免费使用的。你可以修改Ethereal以适应自己的需求,同样欢迎你将自己的改进反馈给Ethereal 小组。

如果将你的改进反馈给小组,你能获得下面三点好处:

·         那些发现你的贡献对他们很有用的人会非常感激你,并且你会知你帮助了他们,就象Ethereal的开发者帮助大家一样。

·         因为开发者一直进行软件的改进工作,或许他们能更好更多的改进你的建议。或者他们能在你的代码的出础上再加一些好的东西,这对你自己也是有帮助的

·         维护及开发人员会很好的维护你的代码,当有API改变(或其它改变)时,他们会帮你修正,并保持最优化。因此,如果Ethereal更新了,你能在网站得到一个新版本,并且你的改进已经包含在新版本中了。

源代码及可执行套件在网站的下载页面: http://www.ethereal.com/download.html.

1.7. 报告问题及获得帮助

如果你有问题或需要帮助,下面这几个地方或许对你有用(当然也包括这本手册)

1.7.1. 网站

在网站会有很多有用的信息http://www.ethereal.com.

1.7.2. Wiki

The Ethereal Wiki at http://wiki.ethereal.com 提供了一个与Ethereal相关的更广泛的信息,包括包捕获内容。它提供了许多这本手册没有提供的内容,例如:怎样在一个交换的网络里进行捕获、正在进行的建立一个协议参考书的努力及其它等等

最好的是,如果你想分享你在某一方面的知识时(你最擅长的网络协议),你可以用浏览器很容易的去编辑wiki的页面

1.7.3. FAQ常见问题及回答

The "常见问题及回答 " 将列出常见的问题及对这些问题的正确回答

读FAQ!

在发送mail到下面的邮件列表之前,首先确认你已经看了FAQ,这将节省你和其它人的时间。(要知道很多人都订阅了邮件列表).

在Ethereal里,通过点击Help/contents,然后选择FAQ,就能看到常见问题及回答

在Ethereal的网站上,有一个在线版本: http://www.ethereal.com/faq.html. 这是一个HTML格式的,容易使用,而且是最新的。

1.7.4. 邮件列表

根据不同的题目,有下面几个邮件列表

ethereal-announce(译:ethereal发布)

这个列表列完成新版本的通知功能,通常 4-8周出现一次。

ethereal-users(译:用户)

这是针对Ethereal用户的邮件列表,人们可将在使用和编译Ethereal中遇到的问题发出来,其它人将会回答你的问题

ethereal-dev(译:开发)

这是开发者的一个邮件列表,如果你想开发一个协议解码器,你可以加入这个列表

可以通过网站订阅这些邮件列表http://www.ethereal.com,简单的选择页面左边的mailing lists 链接就可以。 The lists are archived at the Ethereal web site as well.

提示!

你可以通过搜索列表文档看是否有人问过相同的问题,或许已经有人回答,这样能节省时间

1.7.5. 报告问题

注意!

在报告任何问题时,请首先确认你已经安装了最新版的Ethereal

在报告问题时,请提供下面的信息:

1.      Ethereal的版本号及与其关联的库,如GTK+等等。可以通过ethereal –v命令获得这些信息

2.      Ethereal运行的平台的信息

3.      详细描述你遇到的问题

4.      如果出现了错误或告警信息,记下这些信息(包括前面和后面的部分信息,如果有的话),这样就能发现在什么地方出问题了。不要告诉说“当我做X时,得到一个告警信息”

不要发送大文件!

不要发送大文件到邮件列表(>100KB), 只需要说明你有可能需要的数据就行。大文件会让那些对你的问题不感 兴趣的人烦的。 如果可能,真能帮助你的人会向你要需要的数据的

不要送需要保密的信息!

在送捕获数据到邮件列时,请确认不要包含敏感或者保密的信息,比如密码。

1.7.6. 报告程序崩溃( Crashe),UNIX/Linux平台

当报告一个Crash错误时,最好提供一些可回溯信息(traceback) (在“报告问题”之外的信息).

你可以通过下面的命令获得这些可回溯(traceback)信息:

 
$ gdb `whereis ethereal | cut -f2 -d: | cut -d' ' -f2` core >& bt.txt
backtrace
^D
$
 
               

注意

逐字的打入第一行! Those are back-tics there!

注意

backtrace 是一个gdb 命令。当第一行显示后,逐字的输入它,但是这个命令不回显任何信息,通过按^D (Control-D)可以退出gdb 。. 这样,会在当前目录下产生一个bt.txt文件。将这个文件包含在你的bug报告中。

注意

如果你没有gdb 可用,你不得不是检查你的系统调试器

Traceback可以mail到ethereal-dev[AT]ethereal.com 邮件列表。

1.7.7. 报告Windows平台下的Crash问题

Windows版不包含符号文件 (.pdb),因为他们非常大。由于这个原因是不可能建立backtrace文件的。你只能象报告其它问题一样报告crash情了。

Chapter 2. 创建和安装Ethereal

 

2.1. 介绍

就象任何事情都有开始一样,开始使用Ethereal之前,需要完成:

·         获取与您使用的操作系统相匹配的二进制包,或者

·         获得源代码自己创建Ethereal

目前,只有两三个Linux 发布版包括了Ethereal,而且通常都是较老的版本,其它UNIX版本都不带Ethereal。微软的Windows的任何版本也没有附带Ethereal,因此,你需要知道从何处去得到最新版本及如何安装

这一章将讲述如何获是源代码和二制制包,怎样从源代码去创建Ethereal。[peter:怎么译?should you choose to do so. ]

下面是通常的几个步取骤:

1.      下载相应的包,比如源代码或发布的二进制包

2.      通过源文件创建二进制包

这步可能会调用创建或安装其它的一些必须的包

3.      安装二进制文件到最终目录。

2.2. 获取源代码和二进制发布包

源代码及二进制发布包可以从Ethereal网站获得http://www.ethereal.com.。选择download(下载)链接,然后选择源代码或二进制包,可以从离你最近的镜象站点下载。

下载所有需要的文件!

如果准备从源代码创建Ethereal,你很可能需要下载几个源代码包,下面会有详细的说明.

一旦下载完了相关的文件,就可以进入下一步了

注意!

While you will find a number of binary packages available on the Ethereal web site, you might not find one for your platform, and they often tend to be several versions behind the current released version, as they are contributed by people who have the platforms they are built for.

For this reason, you might want to pull down the source distribution and build it, as the process is relatively simple.

2.3. 在UNIX下创建Ethereal需要准备的工作

在创建、安装Ethereal之间,需要确认已经安装了下面的包:

·         GTK+, GIMP工具包

也需要Glib。它们都可以从www.gtk.org 获得。

·         libpcap, Ethereal使用的包捕获软件

可以从 www.tcpdump.org 获得

至于是通过RPM方式还是通过源代码创建这些包,这取决于你自己的系统。

如果已经下载了GTK+的源代码, 例子 2.1, 通过源代码创建GTK+ 或许对你创建包有所帮助

例子 2.1. 通过源代码创建GTK+

 
gzip -dc gtk+-1.2.10.tar.gz | tar xvf -
<much output removed>
cd gtk+-1.2.10
./configure
<输出省略>
make
<输出省略>
make install
<输出省略>
          

注意!

 例子 2.1, 通过源代码创建 中gtk+的版本号需要和你下载的GTK+包一致。tar xvf – 将显示需要改变成的目录的名字

注意!

如果使用LINUX或GNU tar 包,可以使用tar zxvf gtk+-1.2.10.tar.gz命令,用gunzip -c or gzcat 代替gzip -dc 在许多UNIX系统是可行的

注意!

如果你在Windows下下载了gtk+ 或其它tar文件,可能会发现文件名为gtk+-1_2_8_tar.gz.

如果按照 例子 2.1, 通过源代码创建GTK+ 的步骤做时出现问题,请参考GTK+网站。

如果你下载了libpcap源代码, 例子 2.2, 创建和安装libpcap” 的步骤将协助你创建它。另外,如果你的操作系统不支持tcpdump,你或许也想下载并安装它(从tcpdump 网站)[peter:搞不明白什么意思]

例子 2.2. 创建、安装 libpcap

 
gzip -dc libpcap-0.8.3.tar.Z | tar xvf -
<输出省略>
cd libpcap_0_8_3
./configure
<输出省略>
make
<输出省略>
make install
<输出省略>
make install-incl
<输出省略>
            

注意!

你要改变的目录取决于你的版本,所有情况下 tar xvf – 将会显示被解包的目录

当安装include文件时 ,可能会得到一些错误提示, 例子 2.3, 安装bpcap include文件时遇到的一些错误

例子 2.3. 安装libpcap include文件时遇到的错误

 
/usr/local/include/pcap.h
/usr/bin/install -c -m 444 -o bin -g bin ./pcap-namedb.h \
/usr/local/include/pcap-namedb.h
/usr/bin/install -c -m 444 -o bin -g bin ./net/bpf.h \
/usr/local/include/net/bpf.h
/usr/bin/install: cannot create regular file \
`/usr/local/include/net/bpf.h': No such file or directory
make: *** [install-incl] Error 1
          

如果你遇到了上面的错误,只要简单的用下面的命令创建丢失的目录就可以了

 
mkdir /usr/local/include/net
        

然后返回到命令行重新make install-incl.

在RedHat 6.x 或更新的版本下 (或者基于它发布的,比如Mandrake) ,可以容易的安装每一个你需要的rpm包。大多数Linux系统将安装GTK+和Glib。但是你或许需要安装,however, you will probably need to install the devel versions of each of these packages. 在例子 2.4, 在RedHat Linux 6.2及更新版本下安装所需的RPMs 给出全部需要的命令

例子 2.4.  在RedHat Linux 6.2及更新版本下安装所需的RPMs

 
cd /mnt/cdrom/RedHat/RPMS
rpm -ivh glib-1.2.6-3.i386.rpm
rpm -ivh glib-devel-1.2.6-3.i386.rpm
rpm -ivh gtk+-1.2.6-7.i386.rpm
rpm -ivh gtk+-devel-1.2.6-7.i386.rpm
rpm -ivh libpcap-0.4-19.i386.rpm
          

注意

如果RedHat版本低于6.2, RPMs包的名字可能与上面的不一致,需要使用你的发布包里的正确的RPM

Debian下安装时可以使用apt-get。 apt-get能够帮助用户处理包之间的相关性问题。 例子 2.5, 在Debian下安装debs 给出了安装方法

例子 2.5. 在Debian下安装debs

 
apt-get install ethereal
          

2.4. 在UNIX下通过源代码创建Ethereal

在UNIX操作系统下,通过源代码创建Ethereal,可以按以下步骤:Use the following general steps if you are building Ethereal from source under a UNIX operating system:

1.      解包。如果使用Linux或者GNU tar,可以使用下面的命令

tar zxvf ethereal-0.10.14-tar.gz
      

对于其它版本的UNIX,可以使用下面的命令

 
gzip -d ethereal-0.10.14-tar.gz
tar xvf ethereal-0.10.14-tar
      

注意!

通常 gzip -dc ethereal-0.10.14-tar.gz | tar xvf – 这个命令组合可能更好用一些.

注意!

如果在Windows下下载了Ethereal的tar包,文件名中的点可能会变成下划线.

2.      改变到Ethereal源文件目录

3.      配置源码,以便为你的UNIX版本正确创建。使用下面的命令完成配置源码的工作

 
./configure
      

如果这一步失败,需要查出问题,然后再重新configure。解决问题的一些提示列在Section 2.6, 解决在UNIX下安装时的问题

4.      创建二进制文件,使用make 命令

 
make
      

5.      使用下面的命令进行软件的最终安装

 
make install
      

使用上面的make install 安装完成后,通过在命令行输入ethereal,就可以试着运行了。

2.5. 在UNIX下安装二进制文件包

通常,在UNIX下安装二进制包,每一个版本的UNIX是各不相同的。例如:在AIX下,使用smit 来安装Ethereal二进制包,而在Tru64 UNIX (formerly Digital UNIX)通常使用setld.

2.5.1. 在RedHat(或相似版本)安装:通过rpm包安装

从Ethereal站点下载相应的rpm包,然后使用下面的命令进行安装:

 
rpm -ivh ethereal-0.10.5-0.2.2.i386.rpm
      

如果因为丢失相关包而造成安装失败,那么需要首先安装Ethereal依赖的包,然后再重新试一下上面的步骤。例子 2.4, 在ReaHat 6.2及更新版本下安装所需的RPMs 中列出了需要安装的rpm包。

2.5.2. 在Debian下安装deb包

在Debian下使用下面的命令安装Ethereal:

 
apt-get install ethereal
      

apt-get 会自行解决包的依存关系问题

2.6. 解决在UNIX下安装时遇到的问题

在安装过程中会有一些错误出现,这里提供一此解决这些问题办法

如果configure 命令失败,需要找出原因,可以检查config.log 文件来查找为什么的败(该文件在源文件目录下),这个文件的后面几行可以帮助你定位问题。

一个常见的问题是没有GTK+或者GTK+的版本太老。如果没有libpcap也会造成configure 失败

另外一个常见问题发生在最后编译和链接(link)语句,通常会给出一个Output too long(输出太长)的提示信息。这种情况很可是由于sed的版本太旧造成的(比如Solaris自带的一个)。 因为libtool 脚本使用 sed h去组织最后的链接命令,这就产生了这个怪问题。解决办法是去下载一个新版的 sed (从 http://directory.fsf.org/GNU/sed.html).

如果无法确定问题到底出在哪儿,就将遇到的问题发到ethereal-dev 邮件列表,并附上config.log的输出及你认为任何有关的内容

2.7. 在Windows下通过源代码创建Ethereal

除非想在Windows平台进行开发工作,否则建议安装二进制型的安装包。

在Windows平台下怎么通过源代码创建Ethereal的补充资料,请参见http://wiki.ethereal.com/Development ,里面包含着最新的开发文档。

2.8. 在Windows下安装Ethereal

在这一部分对Windows下安装可执行包做出说明。

2.8.1. 安装 Ethereal

下载的Ethereal的文件名通常是这样的格式:ethereal-setup-x.y.z.exe.

可以从这个站点下载然后执行安装: http://www.ethereal.com/download.html#releases

注意!

从0.10.12以后,Ethereal都内置了WinPcap,因此不需要再单独去下载安装WinPcap了!

2.8.1.1. 命令行选项

安装时,可以不加任何选项直接点击进行安装,这种情况下将以交互方式进行安装。

下面是一些可用的命令行参数:

·         /NCRC 放弃CRC 检查

·         /S 以安静方式安装或卸载,采用默认值。注意:这种方式将不安装WinPCap!

·         /desktopicon 桌面图标, =yes – 强制安装一个桌面图标, =no – 不安装桌面图标, 其它情况下采用默认的用户设置[peter:默认是什么呀?] 这个选项从0.10.13以后可以在安静(silent)方式下使用

·         /quicklaunchicon 快速启动栏图标安装, =yes – 强制安装 =no – 不安装, otherwise use defaults / user settings. 该选项从0.10.13 版开始可以在安静(silent)安装模式下使用

·         /D 设置默认的安装目录 ($INSTDIR), 覆盖InstallDir和InstallDirRegKey。该参数必须放到命令的最后,且不能包含引号,即使是路径中有空格

例:

 
ethereal-setup-0.10.13.exe /NCRC /S /desktopicon=yes /quicklaunchicon=no /D=C:\Program Files\Foo
        
2.8.1.2. 安装内容

Beside the usual installer options like where to install the program, 有几个可选的安装内容:

提示!

如果不能确定选择哪些设置,就保留默认值

安装内容(Ethereal GTK1和2 不能被同时安装)

·         Etheral GTK1 - Ethereal 是一个GUI的网络协议分析仪

·         Etheral GTK2 - Ethereal 是一个GUI的网络协议分析仪(使用流行的GTK2 GUI 工具包,建议选该项)

·         GTK-Wimp - GTKWimp 是GTK2 的windows下的模拟器(native Win32 look and feel, recommended).

·         Tethereal - Tethereal 是一个基于命令行的网络协议分析仪

Ethereal和Tethereal用的扩展解码器

·         Dissector Plugins – 带有扩展解码器的插件

·         Tree Statistics Plugins – 带有扩展的统计能力的插件

·         Mate - Meta 分析和跟踪引擎- 用户可配置的显示过滤引擎,详细内容见http://wiki.ethereal.com/Mate

·         SNMP MIBs – 解码器的MIB库

工具:

·         Editcap – Editcap程序可以读取捕获的文件中的全部或部分包,然后写到另一个捕获文件

·         Text2Pcap - 可以将一个十六进制的ASCII的DUMP文件转换成libpcap型的捕获文件

·         Mergecap – 将多个捕获文件进行合并

·         Capinfos – 显示捕获文件的信息

附加任务:

·         Start Menu Shortcuts – 增加启动菜单快捷方式

·         Desktop Icon – 在桌面上增加一个Ethereal图标

·         Quick Launch Icon – 在快速启动栏增加一个图标

·         Associate file extensions to Ethereal – 将标准的网络trace 文件关系到Ethereal.

2.8.2. 安装WinPcap

注意!

正如上面提到的,Ethereal从0.10.12版本开始内置了WinPcap,因此不必再担心 WinPcap的问题了!

如果WinPcap没有安装,仍可以打开原来保存过的捕获文件,但是不能进行实时的捕获

安装时,Ethereal安装软件会检查当前安装的WinPcap版本,如果没有安装或者版本太老,将会安装WinPcap。

有关WinPcap的一些信息:

·         Ethereal相关的信息: http://wiki.ethereal.com/WinPcap

·         一般的WinPcap信息 : http://www.winpcap.org

2.8.2.1. 手工安装WinPcap

下面的步骤只有在用户想使用一个与Ethereal内置的WinPcap不同版本时才是必须的,比如WinPcap发布了一个测试版本,而用户想采用。

其它 一些WinPcap版本(包括新的alpha 或者beta版) 可以从以下站点下载:

·         WinPcap 主站点: http://www.winpcap.org

·         ethereal.com 镜象站点: http://winpcap.mirror.ethereal.com

·         Wiretapped.net镜象站点: http://www.mirrors.wiretapped.net/security/packet-capture/winpcap

在下载页面有一个单独的安装文件auto-installer.exe,这个文件可在大部分Windows平台安装,包括9x/Me/NT4.0/2000/XP.

2.8.3. 更新Ethereal

有时我们想将安装的Ethereal更新到最新版本。如果加入了Ethereal的announce邮件列表,有新版本时将有得到通知, Section 1.7.4,  邮件列表 部分对怎样加入列表有详细的说明

通常每4-8周就会有一个新的版本。更新版本时,只要下载新版本的包,然后进行安装就可以了。一般情况下不需要重新启动,且会保留你原来的设置。

2.8.4. 更新WinPcap

WinPcap更新频率不是很高,有时仅仅一年更新一次。通常在下载的地方都有相应的更新方法的说明。新版本WinPcap安装后通常需要重新启动机器。

警告!

在安装新版WinPcap时,需要卸载旧版的WinPcap,不过新版的安装软件将会自动识别的

2.8.5. 卸载Ethereal

可以通过控制面板里的“追加删除程序”选项来卸载Ethereal。

卸载时有几个选项需要考虑,默认情况下将卸装核心内容,但保留个人设置。WinPcap也是这样。

WinPcap默认不被卸载,因为其它程序可能还在需要WinPcap。

2.8.6. 卸载WinPcap

WinPcap的卸装需要单独进行,同样可以通过控制面板里的“追加删除程序”项来完成,里面会有一项WinPcap。

注意!

WinPcap卸载后Ethereal不能捕获到任何东西!

卸装后最好重新启动Windows。

Chapter 3. 用户接口

3.1. 介绍

到目前为止,我们已经完成了Ethereal的安装,现在最渴望的事情或许就是开始进行捕获你的第一包,在接下来的这章,我们将对以下内容进行学习

·         Ethereal用户接口怎样工作

·         怎么去捕获包

·         怎样去查看包

·         怎样去过滤包

·         ... 还有其它的很多东西

3.2. 启动Ethereal

可通过命令行或Windows管理器来启动Ethereal。

提示!

当启动Ethereal时,可能需要通过命令行指定选项,具体内容参见Section 9.2, 从命令行启动Ethereal

注意!

在下面章节中,会有一些Ethereal的屏幕抓图,由于存在多种平台及不同GUI工具包(GTK 1.x / 2.x)的使用,可能与你使用的Ethereal不一致。但功能方面来讲是一样的。

3.3.  主窗口

让我们来看一下Ethereal的用户界面,图 3.1,  主窗口 就是当Ethereal捕获到一些包或都打开一个捕获文件后通常显示的画面。 (后面将讲述怎么做这些工作).

图 3.1. 主窗口

Ethereal的主窗口通常由下面几部分组成(其它GUI程序通常也是这样)

1.      菜单 (参见 Section 3.4, 菜单) :用于启动一个活动

2.      主工具条(参见 Section 3.13, 主工具条):提供快速访问菜单中常用项目的功能

3.      过滤工具条(参见 Section 3.14, 过滤工具条) :可以直接编辑当前使用的显示过滤条件 (参见).

4.      列表面板 (参见 Section 3.15, 包列表面板) 显示每一个包的摘要信息。通过在该面板单击相应的包,来控制其它两个面板显示的内容

5.      详细信息面板(参见 Section 3.16, 详细信息面板) 显示在列表面板中选 中的包的详细信息(解码过的)

6.      字节信息面板 (参见 Section 3.17, 字节信息面板) 显示包的完整数据,且会高亮度显示在详细信息面板中的选中的部分

7.      状态条 (参见 Section 3.18, 状态条) 显示当前程序和捕获的数据的一些详细的内容

提示!

主窗口的布局可以由用户自己更改,具体做法参见Section 9.5, “参数选择”

3.4. 菜单

菜单位置于Ethereal主窗口的最上端,如 图igure 3.2, “菜单” 

注意!

如果菜单中的某一项不可用时,它会以灰色显示。例如:如果即没有进行数据包捕获也没有打开任何捕获文件,那么save(保存)菜单项是不可用的(即无法进行选择)。

Figure 3.2. 菜单

菜单包含如下内容:

File(文件)

这个菜单包含:打开文件、合并文件、保存/打印/导出整个或部分捕获文件、退出。参见Section 3.5, "File"(文件)菜单.

Edit(编辑)

这个菜单包括:查找包、时间参照、标记一个或多个包、设置参数、(剪切、复制、粘贴目前不可用),参见 Section 3.6, "Edit"(编辑)菜单 .

View(查看)

这个菜单控制捕获数据的显示,包括:给定特定的一类包标以不同的颜色、字体缩放、在一个新窗口中显示一个包、展开&折叠详细信息面板的树状结构,.... 参见 Section 3.7, "View"(查看)菜单.

Go

这个菜单实现转到一个特定包(注意:不是查找),参见 Section 3.8, "Go"菜单.

Capture(捕获)

这个菜单实现开始、停止捕获,编辑捕获过滤条件的功能。参见 Section 3.9, "Capture"(捕获)菜单.

Analyze(分析)

这个菜单包含编辑显示过滤、enable(开)或 disable(关)协议解码器、配置用户指定的解码方法、追踪一个TCP流。参见Section 3.10, "Analyze"(分析)菜单.

Statistics(统计)

该菜单完成统计功能。包括捕获的包的一个摘要、基于协议的包的数量等树状统计图等许多功能。参见 Section 3.11, "Statistics"(统计)菜单.

Help(帮助)

这个菜单包含了一些对用户有用的信息。比如基本帮助、支持的协议列表、手册页、在线访问到网站等等。参见 Section 3.12,  "Help"(帮助)菜单.

每一个菜单的具体描述见下面相应的部分。

提示!

可以通过快捷键去快速访问相应的菜单项。例如:可以通过Contrl-K打开一个捕获对话框

3.5.  "File"(文件)菜单

菜单包括的项目见表 3.1, 文件菜单项.

图 3.3. "File"(文件)菜单

表 3.1. 文件菜单

菜单项

快捷键

功能描述

Open...(打开)

Ctrl+O

打开一个“打开”对话框,以便装入一个捕获文件进行查看。更详细的内容见Section 5.2.1, 打开捕获文件对话框.

Open Recent(打开最近打开的)

 

这个菜单显示一个子菜单,包括最近打开的几个捕获文件。可以直接点击相应的文件名来打开。

Merge...(合并)

 

该菜单打一个合并文件对话框,允许将一个文件合并到当前装入的文件中。详见Section 5.4, 合并文件.

Close(关闭)

Ctrl+W

关闭当前的捕获内容。如果还未保存,系统会给出一 个提示(可以通过参数设置放弃这一提示功能)

------

 

 

Save(保存)

Ctrl+S

保存当前的捕获数据。如果未设置默认的捕获文件名(或未使用 –w 选项),系统会显示一个保存对话框 ,在Section 5.3.1,“保存捕获文件到…”对话框 有详细描述

注意!

如果已经保存了当前的捕获数据,这个菜单项将为灰色的,不能够点击。

注意!

当捕获正在进行中时,不能进行保存工作,必须停止捕获过程后才能执行保存工作

Save As...(另存为…)

Shift+Ctrl+S

允许将当前捕获的数据或文件另存为其它文件名,参见 Section 5.3.1, 捕获文件另存为…对话框.

------

 

 

File Set > List Files(文件设置>列出文件)

 

这个菜单项显示一个文件组的一组文件。会显示一个对话框,参见Section 5.5, “文件组.

File Set > Next File(下一个文件)

 

如果当前装入的是一个文件组,跳到文件组中的下一个文件。如果是单个文件,或者是文件组中最后一个文件,该项将变成灰色,即不可用状态

File Set > Previous File(上一个文件)

 

如果当前装入的是一个文件组,跳到文件组中的前一个文件。如果是单个文件,或者是文件组中第一个文件,该项将变成灰色,即不可用状态。

------

 

 

Export > as "Plain Text" file...(以纯文格式导出)

 

将全部或部分包导出到一个纯ASCII文本文件中。该项菜单将弹出一个Ethereal导出对话框 (详见Section 5.6.1, “导出成纯文本文件”对话框).

Export > as "PostScript" file...(以PostScript格式导出)

 

该项菜单实现导出全部或部分包至一个PostScript文件。详见Section 5.6.2, “导出为PostScript文件"对话框).

Export > as "CSV" (Comma Separated Values packet summary) file...(以CSV格式导出)

 

实现导出全部或部分包的摘要内容至一个.csv文件(This menu item allows you to export the (or some) of the packet summaries in the capture file to a .csv file (例如:电子数据表程序常使用这种格式)。详见Section 5.6.3, “导出至CSV文件(逗号分隔)"对话框 ).

Export > as "PSML" file...(以PSML格式导出)

 

导出全部或部分包至一个PSML(包摘要标记语言)XML文件,详见Section 5.6.4, “The "导出至PSML文件"对话框 ).

Export > as "PDML" file...(以PDML格式导出)

 

导出全部或部分包至一个PDML(包细节标记语言)XML文件,详见Section 5.6.5,  导出至PDML文件对话框).

Export > Selected Packet Bytes...(导出>选中包的字节)

Ctrl+H

导出在包字节面板中选择的包的字节,保存成二进制方式。详见 Section 5.6.6, “导出选择的包字节”)

------

 

 

Print...(打印…)

Ctrl+P

打印所有或部分包,详见Section 5.7, “打印包”).

------

 

 

Quit(退出)

Ctrl+Q

退出。如果还未对捕获数据进行保存,Ethereal会提示是否保存(可以通过参数设置是否进行提示)

3.6.  "Edit"(编辑)菜单

Ethereal “EDIT”(编辑菜单) 如图Table 3.2, “Edit(编辑)菜单项”,包括如下几项

图 3.4.  "Edit"(编辑)菜单

Table 3.2. Edit menu items

Menu Item

Accelerator

Description

Find Packet...(查找包)

Ctrl+F

按照多种条件组合查找包,详见Section 6.6, “查找包”.

Find Next(查找下一个)

Ctrl+N

查找下一个符合条件的包

Find Previous(查找前一个)

Ctrl+B

查找前一个符合条件的包

------

 

 

Time Reference > Set Time Reference (toggle) 时间能考>设置或者取消时间参考

Ctrl+T

在当前选择的包上设置一个时间参考(译:即以0为基准)。详见 Section 6.9.1, “时间参考”.

Time Reference > Find Next

 

查找下一个时间参考点

Time Reference > Find Previous

 

查找上一个时间参考点

Mark Packet (toggle)

Ctrl+M

标记(取消)当前选择的包,详见 Section 6.8, “对包进行标记”

Mark All Packets

 

标记所有的包

Unmark All Packets

 

取消所有标记

------

 

 

Preferences...(参数设置)

Shift+Ctrl+P

对Ethereal的许多参数进行设置并保存。详见 Section 9.5, “Preferences”.

3.7. "View"(查看)菜单

Ethereal查看菜单如图表 3.3, “View (查看)菜单项”.,包括如上几项:

图 3.5.  "View"(查看)菜单

表 3.3. 查看菜单包括的项

Menu Item

Accelerator

Description

Main Toolbar

 

显示/隐藏主工具条,见Section 3.13, “主工具条”.

Filter Toolbar

 

显示/隐藏过滤工具条,见Section 3.14, “过滤工具条”.

Statusbar

 

显示/隐藏状态条,见 Section 3.18, “状态条”.

------

 

 

Packet List

 

显示/隐藏包列表面板,见Section 3.15, “包列表" 面板”.

Packet Details

 

显示/隐藏包详细信息面板,见Section 3.16, “包详细信息" 面板.

Packet Bytes

 

显示/隐藏包字节面板,见 Section 3.17, “包字节"面板”.

------

 

 

Time Display Format > Date and Time of Day: 1970-01-01 01:02:03.123456 (时间显示格式)

 

设置时间显示格式为日期+时间,见Section 6.9, “时间显示格式和时间参考”.

注意!

 "Time of Day", "Date and Time of Day", "Seconds Since Beginning of Capture" and "Seconds Since Previous Packet" 这几个选择是多选一的。

Time Display Format > Time of Day: 01:02:03.123456

 

设置时间显示格式为时间,见 Section 6.9, “时间显示格式和时间参考”.

Time Display Format > Seconds Since Beginning of Capture: 123.123456

 

设置时间显示格式为:距离开始捕获的时间,见 Section 6.9, “时间显示格式和时间参考”.

Time Display Format > Seconds Since Previous Packet: 1.123456

 

设置时间显示格式为:距离上一个包的时间,见Section 6.9, “时间显示格式和时间参考”.

Time Display Format > ------

 

 

Time Display Format > Automatic (File Format Precision)

 

按照捕获文件中的时间精度显示,见Section 6.9, “时间显示格式和时间参考”.

注意!

"Automatic", "Seconds" and "...seconds" 是多选一。

Time Display Format > Seconds: 0

 

以秒的精度显示,见Section 6.9, “时间显示格式和时间参考”.

Time Display Format > ...seconds: 0....

 

以0.1/0.01/0.001秒的精度显示,见 Section 6.9, “时间显示格式和时间参考”.

Name Resolution > Resolve Name

 

仅对当前包进行名称解析,参见Section 7.6, “名称解析”. [译:实验结果是只对捕获数据进行解析,已捕获的数据无法解析]

Name Resolution > Enable for MAC Layer

 

将MAC地址翻译成名字,参见Section 7.6, “名称解析”.

Name Resolution > Enable for Network Layer

 

将网络层地址翻译成名字(即域名),参见Section 7.6, “名称解析”.

Name Resolution > Enable for Transport Layer

 

将传输层地翻译成名字,参见Section 7.6, “名称解析”.

Colorize Packet List(对包列表标记颜色)

 

控制是否对包进行颜色标记

注意!

在捕获/装入捕获文件时,打开颜色标记功能将减慢新包的显示速度

Auto Scroll in Live Capture(在实时捕获时自动滚动)

 

当有新包进来时,会实时的在包面板显示,因此,我们总能看到最新的包。如果不指定这个选项,Ethereal简单的追加新进来的包到末尾,但并不滚动包面板

------

 

 

Zoom In(放大)

Ctrl++

放大显示(增加字体大小).

Zoom Out(缩小)

Ctrl+-

缩小显示 (减小字体大小).

Normal Size(正常尺寸)

Ctrl+=

正常显示(以正常字体显示)

Resize All Columns(调整所有列宽)

 

调整所有列宽以适应显示.

注意!

重新调整列宽会花费大量时间,特别是装入了一个大的捕获文件时

------

 

 

Expand Subtrees(展开子树)

 

在包细节面板中,展开选择的子树

Expand All(展开所有子树)

 

Ethereal 保持一个所有被展开的协议的列表,以便正确的显示。该项展开所有子树

Collapse All(折叠所有子树)

 

这个菜单项折叠所有树.

------

 

 

Coloring Rules...(颜色标记规则)

 

按照过滤表达式对包进行颜色标记,这对定位某一个特定类型的包是非常有用的。Section 9.3, “对包进行颜色标记”.

------

 

 

Show Packet in New Window在新的窗口中显示当前选 中的包

 

在一个新窗口显示当前选 中的包,仅包含包细节和包字节两个面板

Reload重新装入

Ctrl-R

重新装入当前的捕获文件

3.8. "Go" (转到…)菜单

Ethereal 这个菜单包含的字段如图表 3.4, “转到….菜单”.

图 3.6. "Go" 菜单

表 3.4. “转到…”菜单项

菜单项

快捷键

描述

Back 回退

Alt+Left

跳转到刚才查看的包,就象在Web浏览器中的回退一样。

Forward 前进

Alt+Right

跳转到下一个要查看的包,类似Web浏览器中的前进功能。

Go to Packet...(转到包…

Ctrl-G

将出现一个对话框,要求输入一个包编号值,然后跳转到那个包,参见 Section 6.7, “转到一个指定的包

Go to Corresponding Packet(转到相应的包)

 

Go to the corresponding packet of the currently selected protocol field. If the selected field doesn't correspond to a packet, this item is greyed out.

------

 

 

First Packet( 第一个包)

 

跳到第一个包

Last Packet (最后一个包)

 

跳到最后一个包

3.9. "Capture"(捕获)菜单

Ethereal捕获菜单包含的内容见表 3.5, “捕获菜单”.

图 3.7. "Capture"(捕获)菜单

表 3.5. 捕获菜单项

菜单项

快捷键

描述

Interfaces...

 

Ethereal识别的网卡,见 Section 4.4, “捕获接口"对话框) .

Options...

Ctrl+K

显示捕获选项对话框, (在 Section 4.5, “"捕获选项"对话框”讨论) 并可以启动捕获.

Start

 

用上一次的设置立即开始捕获

Stop

Ctrl+E

停止当前运行的捕获,参见 Section 4.9.1, “停止捕获”) .

Restart

 

停止当前运行的捕获,并且立即使用同样的设置再次开始捕获,该项仅仅是为了方便

Capture Filters...

 

该菜单弹出一个对话框,允许新建、编辑一个捕获过滤。可以重新命名一个过滤并存贮。具体参见Section 6.5, “定义和存贮过滤”

3.10. "Analyze"(分析)菜单

Ethereal分析菜单包括内容见表 3.6, “分析菜单项”.

图 3.8. "Analyze" (分析)菜单

表 3.6. 分析菜单项

菜单项

快捷键

描述

Display Filters...

 

允许新建和编辑显示过滤、重命名、保存。详见Section 6.5, “定义和保存过滤”

Apply as Filter > ...

 

改变当前的过滤并且立即应用。首先要选中包详细信息面板中的某一个字段(即要过滤的字段),然后按照接下来的选择来决定是替换还是追加到当前的过滤中。

Prepare a Filter > ...

 

这个菜单项允许改当前的显示过滤但不立即应用。是替换还是追加到当前的过滤条件表达式中取决于接下来的选择

------

 

 

Enabled Protocols...

Shift+Ctrl+R

该项允许enable/disable(打开/关闭)协议解码器,参见Section 9.4.1,  "使能某些协议"对话框”

Decode As...

 

强制Ethereal用一个特定的协议对特定的包进行解码,参见 Section 9.4.2, “用户指定的解码器”

User Specified Decodes...

 

这个菜单显示一个列表,列出了目前用户自己指定的所有解码器。参见 Section 9.4.3, “显示用户指定的解码器”

------

 

 

Follow TCP Stream

 

在一个新窗口中显示同一个TCP连接中所有的TCP报文,参见 Section 7.2, “跟随 TCP流”

3.11.  "Statistics"(统计)菜单

统计菜单包括的内容如表 表 3.7, “统计菜单项目”.

图 3.9. Statistics(统计)菜单

所有菜单项都将在一个新的窗口中显示指定的统计信息。

表 3.7. Statistics(统计)菜单项

Menu Item

Accelerator

Description

Summary(摘要)

 

显示捕获数据的信息,见 Section 8.2, “摘要窗口”.

Protocol Hierarchy

 

以树形的分级方式显示基于协议的统计信息,参见 Section 8.3, “The "Protocol Hierarchy" window”.

Conversations

 

显示会话列表(两个端点之间的流量), 见 Section 8.5.2, “会话" 窗口”.

Endpoints

 

显示所有端点的列表(某个端点的出/入的流量), 见 Section 8.4.2, “端点"窗口”.

IO Graphs

 

显示用户指定的图形(举例:一定时间内的包的数量), 见 Section 8.6, “"IO 图形"窗口”.

------

 

 

Conversation List

 

显示一个统计的列表,obsoleted by the combined window of Conversations above, see Section 8.5.3, “The protocol specific "Conversation List" windows”.

Endpoint List

 

Display a list of endpoints, obsoleted by the combined window of Endpoints above, see Section 8.4.3, “The protocol specific "Endpoint List" windows”.

Service Response Time(服务响应时间)

 

显示“请求响应”的时间,见 Section 8.7, “服务响应时间”.

------

 

 

ANSI

 

见 Section 8.8, “指定协议的统计窗口”

GSM

 

见 Section 8.8, “指定协议的统计窗口”

H.225...

 

见 Section 8.8, “指定协议的统计窗口”

ISUP Message Types

 

见 Section 8.8, “指定协议的统计窗口”

MTP3

 

见 Section 8.8, “指定协议的统计窗口”

RTP

 

见 Section 8.8, “指定协议的统计窗口”

SCTP

 

见 Section 8.8, “指定协议的统计窗口”

SIP

 

见 Section 8.8, “指定协议的统计窗口”

VoIP Calls...

 

见 Section 8.8, “指定协议的统计窗口”

WAP-WSP...

 

见 Section 8.8, “指定协议的统计窗口”

------

 

 

BOOTP-DHCP

 

见 Section 8.8, “指定协议的统计窗口”

HTTP

 

http reqest/respone(请求响应)统计,见 Section 8.8, “指定协议的统计窗口”

ISUP Messages

 

见 Section 8.8, “指定协议的统计窗口”

ONC-RPC Programs

 

见 Section 8.8, “指定协议的统计窗口”

TCP Stream Graph

 

见 Section 8.8, “指定协议的统计窗口”

3.12.  "Help"(帮助)菜单

Ethereal帮助菜单包含内容如表 3.8, “帮助菜单项目”.

图 3.10. 帮助菜单

表 3.8. 帮助菜单项目

Menu Item

Accelerator

Description

Contents

F1

弹出一个基本帮助系统

Supported Protocols(支持的协议)

 

显示支持的协议及协议字段(过滤时使用的那些字段)

Manual Pages > ...

 

使用浏览器显示一个本地的html手册

Ethereal Online > ...

 

在线显示网站的内容, http://www.ethereal.com.

------

 

 

About Ethereal

 

显示关于、插件、使用的文件夹等信息

注意!

在你的Ethereal版本,可能不支持直接调用WEB浏览器,如果是这样,相应的菜单项将会被隐藏

Note!

如果调用一个WEB浏览器失败,或许没有任何事情发生,或仅仅启动了WEB浏览器但没有任何页面显示,查看一下浏览器的配置

3.13. 主工具条

主工具条提供了一个快速访问常用菜单项的功能。工具条不能用户化修改,但通过VIEW菜单可以隐藏,这样就可以显示更多的内容

就象菜单里一样,仅仅可用的项才能使用,其它的将被显示为灰色(举例来说:如果你没有load一个捕获文件,就不能保存)

图 3.11. 主工具条

表 3.9. 主工具条项目

工具条图标

工具条项

对应的菜单项

描  述

Interfaces...

Capture/Interfaces...

显示捕获接口列表对话框(将在Section 4.3, “开始捕获” 讨论).

Options...

Capture/Options...

显示捕获选项对话框(将在Section 4.3, “开始捕获”讨论) ,并且允许起动捕获

Start

Capture/Start

采用上次的选项立即开始捕获包。

Stop

Capture/Stop

停止正在进行的捕获

Restart

Capture/Restart

先停止,然后再重新开始捕获。主要是为了方便

------

 

 

 

Open...

File/Open...

显示文件打开对话框,允许你装入一个捕获文件进行查看。更细节的内容在 Section 5.2.1, “打开捕获文件"对话框”.

Save As...

File/Save As...

保存当前的捕获文件至另外一个位置或文件名。它将弹出一个Save Capture File As 对话框 (将在Section 5.3.1, “The "Save Capture File As" dialog box”讨论).

注意!

如果当前有一个临时捕获文件,那么保存图标将会代替显示

Close

File/Close

关闭当前的捕获,如果还有保存,系统将会提示

Reload

View/Reload

重新装入当前的捕获文件

Print...

File/Print...

打印捕获文件中所有或部分数据包。它将弹出一个打印对话框(将在Section 5.7, “Printing packets”讨论).

------

 

 

 

Find Packet...

Edit/Find Packet...

将弹出一个对话框,允许去查找一个包。具体将在Section 6.6, “Finding packets”部分讨论

Go Back

Go/Go Back

回跳

Go Forward

Go/Go Forward

前跳

Go to Packet...

Go/Go to Packet...

跳到一个指定编号的包

Go To First Packet

Go/First Packet

跳转到第一个包

Go To Last Packet

Go/Last Packet

跳转到最后一个包

------

 

 

 

Colorize

View/Colorize

对包列表进行着色/取消着色

Auto Scroll in Live Capture

View/Auto Scroll in Live Capture

在实时捕获时,自动滚动包列表(或者取消该功能)

------

 

 

 

Zoom In

View/Zoom In

放大包数据(增大字体)

Zoom Out

View/Zoom Out

缩小包数据(减小字体)

Normal Size

View/Normal Size

设置缩放为 100%.

Resize Columns

View/Resize Columns

重新调整列宽,以适应内容的显示

------

 

 

 

Capture Filters...

Capture/Capture Filters...

建立/编辑捕获过滤表达式。可以命名并保存以便将来再次使用。关于这个话题更详细的讨论见Section 6.5, “定义&保存过滤”.

Display Filters...

Analyze/Display Filters...

建立/编辑显示过滤表达式。可以命名并保存以便将来再次使用。关于这个话题更详细的讨论见Section 6.5, “定义&保存过滤”.

Coloring Rules...

View/Coloring Rules...

允许按照过滤表达式对包进行着色。这对定位特定类型的包非常有用。关于这个话题更详细的讨论见Section 9.3, “包的着色”.

Preferences...

Edit/Preferences

参数设置。可以保存这些设置以供下次使用。更详细的信息见Section 9.5, “参数设置”

------

 

 

 

Help

Help/Contents

显示帮助对话框.

3.14. "Filter"(过滤)工具条

过滤工具条能够让你快速 的编辑和应用显示过滤。关于显示过滤的更多的信息见Section 6.2, “在查看时进行包过滤”.

图 3.12. 过滤工具条

·         点击最左边标记为"Filter:"的按钮可以调用过滤构建对话框(如 图 6.8, “捕获过滤和显示过滤对话框.

·         左边中间的文本框提供了一个输入和编辑显示过滤串的区域。参见Section 6.3, “建立显示过滤表达式” . 键入后,会有一个语法检查。如果输入的表达式非法或不完整,那么背景将变成红色。还可以点击下拉键头来选择一个原来输入的表达式。在下拉菜单项中的项即使程序重新启动了,也是可用的。

注意!

当在这个域中做了某些改动后,不要忘记按一下Apply按钮或者回车键以便使能这个过滤串。

注意!

这个区域也是当前起作用的表达式的显示的地方。

·         点击中间标记为"Add Expression..."的按钮会打一个对话框,从一组协议表中编辑显示过滤表达式。详细描述见 Section 6.4, “过滤表达式对话框”

·         右面中间的按钮"Clear" 会复位当前显示过滤,并清除编辑区域

·         最右面的按钮"Apply"将应用在编辑区中的新值做为当前的过滤表达式

注意!

在一个大文件中应用一个显示过滤可能需要花费很多时间

3.15. "Packet List"(包列表)面板

包列表面板显示当前捕获文件中的所有包。

图 3.13. 包列表面板

包列表中的每一行对应一个包。如果在这个面板中选择一行,那么更详细的信息将被显示在"Packet Details"(包细节)和  "Packet Bytes"(包字节)面板中。

当解码一个包时,Ethereal将在列中显示协议信息。更高级别的协议将覆盖低级别的信息。因此,你通常看到的都是尽可能高的级别的信息。

例如:让我们看一个以太网帧中包括IP包,内部又包括TCP的情况。以太网解码器将写自己的数据,而IP解码器将覆盖它以写自己的信息,同样TCP将覆盖IP的信息以写入自己的信息。

有许多不同的列可以显示。可通通过参数设置来控制显示哪些列,具体参见Section 9.5, “参数设置”.

默认列将显示:

·         No. 包的编号。这个编号即使在使用显示过滤时也不会改变

·         Time 时间:包的时间戳。它的显示格式可以改变。见Section 6.9, “时间显示格式和时间参考”.

·         Source 源:包的源地址

·         Destination 目的:包的目的地址

·         Protocol 协议:简写的协议名称

·         Info :关于包的内容的附加信息

这里有一个上下文可用(点击鼠标右键),具体见图 6.3, “包列表面板的弹出菜单”.

3.16. "Packet Details"(包细节)面板

包细节面板将显示当前包(在包列表面板中选中的)的更细节的信息。

图 3.14. 包细节面板

这个面板显示协议和协议字段。协议和字段的显示采用了树状结构,可以被展开及折叠。

这儿也有一个上下文菜单(单击鼠标右键),参见 图 6.4, “包细节面板的弹出菜单”.

一些协议字段被特别的显示Some protocol fields are specially displayed.

·         Generated fields Ethereal自己将建立追加的字段(用方括号括着) 。在这些字段的信息来源于其它相关联的包。例如:Ethereal 对每一个TCP流会做一个序号/应答的分析,并在[SEQ/ACK analysis] 字段显示出来

·         Links 如果Ethereal检测到一包与另一个包存在关联,它将建立一个到那个包的链接。链接通常有一个下划线并被显示成兰色。如果双击,Ethereal就会跳转到相应的包。

3.17. "Packet Bytes"包字节面板

包字节面板将以十六进制格式显示当前包的数据

图 3.15. 包字节面板

就象通常的十六进制显示一样,左边显示偏移量,中间显示十六进制数值,右边显示相应的ASCII字符(或者如果无法显示就显示一个点)

这个有一个上下文菜单(单击鼠标右键),参见 图 6.5, “包字节面板的弹出菜单”.

有时侯,当包的数据量大时,会超过一页。举例来说,当Ethereal重新封装了一些包,变成一个大包,见 Section 7.5, “包的封装”.  在这种情况下,在面板的底部有一些追加的标签让用户选择想要看的页。

图 3.16. 带标签的包字节面板

注意!

增加的页可能包含从其它多个包中汲取的数据

标签的上下文菜单将显示一个可用页的列表。如果面板很小的时侯,这非常有用。

3.18. 状态条

状态条显示信息的情况

通常,左边将显示上下文相关的信息,右边将显示包的数量。

图 3.17. 初始状态的状态条

这代表没有任何捕获文件装入,举例来说:当Ethereal刚启动的时侯。

图 3.18. 装入捕获文件之后的状态条

左边显示捕获文件的信息:名字,大小及及共用了多长时间。

右边显示包的数量。下面的值将被显示

·         P: 捕获的包的数量

·         D: 当前显示的包的数量

·         M: 标记的包的数量

Figure 3.19. 带有协议字段的状态条

如果从包细节面板选择了一个协议字段,将如图显示

提示!

在括号中的值(这个例中是arp.opcode) 可被用做显示过滤串。, representing the selected protocol field.

Chapter 4. 捕获实时的网络数据

4.1. 介绍

实时捕获网络数据是Ethereal的主要功能之一。

Ethereal捕获引擎提供下面的一些特点:

·         从不同的网络硬 件进行捕获(以太网, 令牌环, ATM, ...).

·         按照不同的条件停止捕获,如:数据量,捕获时间,捕获的包的数量

·         在捕获的同时显示解码过的数据包

·         过滤数据包,减小捕获的数据量,参见Section 4.8, “捕获时的过滤”.

·         当时行一个长的捕获时,可以将数据存入到多个 文件中,另外,可选的,可以将这些文件做成一个循环队列,仅仅保持最新的n个文件,这对一个长时间的捕获是非常有用的。参见Section 4.6, “捕获文件和文件模式”.

捕获引擎缺少下面的特点:

·         同时从多个接口卡进行捕获(但是,可以启动多个Ethereal实例,然后合并捕获文件).

·         按照捕获的数据停止捕获或做一些其它的动作

4.2. 前提条件

Setting up Ethereal to capture packets for the first time can be tricky.

提示!

一个全面的手册"怎么设置一个捕获" 可以从下面的地址获得: http://wiki.ethereal.com/CaptureSetup.

存在的一些普通的问题:

·         需要root / Administrator 权限去启动捕获

·         需要选择正确网络接卡

·         需要在网络中的合适位置对你想要的数据进行捕获

·         ... 还有更多

如果在设置捕获环境方面仍有问题,请再查看一下手册的上面提到的相关部分

4.3. 启动捕获

可以通过下面的任何一种方法启动捕获:

·         使用" Capture Interfaces" 对话框可以得到一个目前可用的接口表。参见 图 4.1, “捕获接口对话框”. 点击这个对话框中的"Capture"(捕获)按纽可以启动捕获

·         使用" Capture Options"(捕获选项)对话框可以启动捕获,参见 图 4.2, “"捕获选项"对话框”.

·         如果之前选择了正确的捕获选项,可以通过" Capture Start"(捕获开始)菜单/工具棒立即启动捕获。 捕获进程将立即启动

·         如果知道捕获接口的名称,可以在命令行使用下面的命令启动捕获:

·                 
·                ethereal -i eth0 -k
      

上面的命令将在eth0接口上启动捕获,更细节的内容见: Section 9.2, “从命令行启动Ethereal”.

4.4. "Capture Interfaces"(捕获接口)对话框

当从Capture(捕获)菜单选择"Interfaces..."(接口)时,会弹出一个"Capture Interfaces"(捕获接口)对话框,如 图 4.1, “捕获接口对话框.

警告!

因为"Capture Interfaces"对话框将显示实时的捕获数据,这将消耗一些系统资源。尽可能早的关闭这个对话框以避免系统过载

注意!

这个对话框将仅仅显示Ethereal可以识别的本地接口。由于Ethereal不可能检测出所有本地接口以及它不能检测远程接口,因此可用的捕获接 口可能比列表中的多

图 4.1. "Capture Interfaces"(捕获接口)对话框

描述

由操作系统提供的接口描述

IP

Ethereal能解析的该接口的第一个IP地址。如果解析不出IP地址 (举例来说:DHCP服务器不可用), 将显示"unknown"(未知的)。如果解析出超过一个IP地址,仅仅第一个IP被显示 (具体显示哪一个不可预知).

Packets(包)

打开这个对话框以后,从这个接口捕获的包的数量。如果一秒钟内没有再捕获到包,该字段将显示成灰色

Packets/s

最后一秒钟捕获的包的数量,如果最后一秒钟没有捕获到数据包,该字段将显示成灰色

Stop(停止)

停止当前的捕获

Capture(捕获)

使用上次的参数,在该接口上立即启动捕获

Prepare(准备)

基于这个接口打开“Capture Options”(捕获选项)对话框,参见 Section 4.5, “The "捕获选项"对话框”.

Close(关闭)

关闭这个对话框

4.5. "Capture Options"(捕获选项)对话框

当从Capture菜单选择start时 (或在主工具棒中使用相应的项), Ethereal 将弹出"Capture Options"捕获选项对话框,如图 4.2, “"捕获选项"对话框.

图 4.2. "Capture Options"捕获选项对话框

 

提示!

如果不能确认到底选择哪个选项,就保持默认状态,一般情况下会工作的很好

在这个对话框中可以设置下列字段:

4.5.1. Capture(捕获)子框架

Interface(接口)

这个字段指定在哪个接口进行捕获。这是一个下拉字段,只能从中选择Ethereal识别出来的接口,默认是第一块支持捕获的非loopback接口卡。如果没有接口卡,那么第一个默认就是第一块loopback接口卡。在某些系统中,loopback接口卡不能用来捕获(loopback接口卡在Windows平台是不可用的)

这个字段的功能与命令行选项-i <interface> 是一样的。

IP address(IP地址)

所选接口卡的IP地址。如果不能解析出IP地址,则显示"unknown"

Link-layer header type(链路层头类型)

除非你在极个别的情况下可能用到这个字段,大多数情况下保持默认值。具体的描述,见 

Buffer size: n megabyte(s) (缓冲区大小:n 兆)

输入捕获时使用的buffer的大小。这是核心buffer的大小,捕获的数据首先保存在这里,直到写入磁盘。如果遇到包丢失的情况,增加这个值可能解决问题。

注意

这个选项仅仅在Windows平台有效.

Capture packets in promiscuous mode (在混杂模式捕获包)

这个选项允许设置是否将网卡设置在混杂模式。如果不指定,Ethereal仅仅捕获那些进入你的计算机的或送出你的计算机的包。 (而不是LAN网段上的所有包).

注意

如果某些程序将网卡已经设置到了混杂模式,那么即使没有选择该项,捕获也将工作在混杂模式

注意

即使设置了混杂模式,也可能看不到LAN网段的包,参见http://www.ethereal.com/faq#promiscsniff ,这里给出了一解释

Limit each packet to n bytes (限制每一个包为n 字节)

这个字段设置每一个数据包的最大捕获的数据量。有时称作snaplen 。如果disable这个选项,默认是65535, 对于大多数协议来讲中够了。Some rules of thumb:

·   如果不能确认某些东西,就保持默认值

·   如果不需要一个包的所有数据,可以选择一个小的快照长度。例如:当仅仅需要链路层,IP头,TCP头的时侯。这将减轻CPU的负担,减小buffer的消耗,因此即使流量很大,也不会出现丢包的情况

·   If you don't capture all of the data in a packet, you might find that the packet data you want is in the part that's dropped, or that reassembly isn't possible as the data required for reassembly is missing.

Capture Filter(捕获过滤)

这个字段指定一个捕获过滤。具体关于捕获过滤的内容将在Section 4.8, “在捕获时进行过滤”部分进行讨论。默认是空的,即没过过滤。

也可以点击标为Capture Filter的按钮, Ethereal将弹出Capture Filters(捕获过滤)对话框,来建立或者选择一个过滤。参见Section 6.5, “定义和保存过滤”

4.5.2. Capture File(s) (捕获文件)子框架

关于捕获文件用法的一个解释可参见Section 4.6, “捕获文件和文件模式”.

File(文件)

该字段指定文件名,被用来保存捕获文件。该字段默认为空白,这代表捕获数据将被存贮在一个临时文件中。详见 Section 4.6, “捕获文件和文件模式”

也可以点击右边的按钮通过文件系统进行浏览

Use multiple files(使用多个文件)

代替使用一个单一的文件,如果指定的条件出现,Ethereal将自动切换到一个新的文件。

Next file every n megabyte(s)(每达到n 兆,切换到下一个文件)

仅在多文件时可用:当达到指定的容量后切换到下一个文件

Next file every n minute(s)(每达到n 分钟后,切换到下一个文件)

仅在多文件时可用:当过了指定的时间后,切换到下一个文件

Ring buffer with n files(以n 个文件做为一个循环)

仅在多文件时可用:用给定数量的文件,形成一个捕获文件的循环。

Stop capture after n file(s)

仅在多文件时可用:当文件数达到设定的值时,停止捕获

4.5.3. Stop Capture... frame(停止捕获…)子框架

... after n packet(s) (n 个包后)

当捕获的包达到指定的数值时,停止捕获

... after n megabytes(s)(n兆字节后)

当捕获的数据量达到指定的字节/兆/吉时,停止捕获。如果选择了"Use multiple files"(使用多个文件)时,该项变为灰色,不可用。

... after n minute(s) (n 分钟后)

当捕获时间达到指定的时间后,停止捕获

4.5.4. Display Options (显示选项)子框架

Update list of packets in real time (实时更新包列表)

该选项允许指定Ethereal在包列表面板实时显示捕获的包。如果不指定该选项,Ethereal不会显示任何包,直到停止捕获后,才显示。当选择该项时,Ethereal在一个单独的进程进行捕获,并将捕获的内容传递到显示进程

Automatic scrolling in live capture (捕获时实时滚动)

该选项允许设定当有新的包捕获时,是否滚动包列表面板。如果滚动,则使终可以看到最新捕获的包。如果不选该项,Ethereal只是简单的在列表的末尾增加新捕获的包,但不滚动包列表面板。如果"Update list of packets in real time" (实时更新包列表)项未被选择,那么该项将为灰色不可用状态

Hide capture info dialog (隐藏捕获信息对话框)

如果选择了这项,则接下来的捕获信息对话框将会被隐藏

4.5.5. Name Resolution (名称解析)子框架

Enable MAC name resolution(使能MAC地址名称解析)

该项控制Ethereal是否将MAC地址翻译成名字,见Section 7.6, “名称解析”.

Enable network name resolution(使能网络名称解析)

该项控制Ethereal是否将网络地址翻译成名字,见 Section 7.6, “名称解析”.

Enable transport name resolution(使能传输层名称解析)

该项控制Ethereal是否将传输层地址翻译成协议,见 Section 7.6, “名称解析”.

4.5.6. 按纽

一旦设置完了期望的值,选择了需要的选项,简单的点Start 开始捕获,或者Cancel 去中止捕获

如果开始捕获,Ethereal允许在捕获到足够的包后停止。详见Section 4.9, “当捕获运行时...”.

4.6. 捕获文件和文件模式

当捕获时,下层的libpcap捕获引擎从网络卡获取数据包,然后保存在一个小的内核buffer中,Ethereal读取这个buffer,然后存入用户指定的捕获文件

当将buffer中的数据存入捕获文件时,有几种不同的模式

提示!

用大文件工作会非常慢(几个100 MB的) 。 如果计划在一个高流量的网络上,做一个长时间的捕获,最好考虑使用多文件选项 。这将会将捕获的数据包分隔在几个小的文件中保存,这样是非常利于工作的。

注意!

使用多文件可能切断了上下文的关联信息。Ethereal能够保持装入的包数据的上下文信息,因此它可以报告上下文相关的问题(例如一个流错误)且能保持相关协议的上下文的信息(e.g. where data is exchanged at the establishing phase and only referred to in later packets). 因为仅仅保持装入文件的这个信息,因此使用多文件模式会切掉这些上下文。如果建立阶段在一个文件中,你关心的东西在另一个文件中,就不会看到有价值的上下文相关的信息

提示!

Information about the folders used for the capture file(s), can be found in Appendix A, Configuration (and other) Files and Folders.

表 4.1. 捕获选择的捕获文件模式

"File" option

"Use multiple files" option

"Ring buffer with n files" option

Mode

Resulting filename(s) used

-

-

-

Single temporary file

etherXXXXXX (where XXXXXX is a unique number)

foo.cap

-

-

Single named file

foo.cap

foo.cap

x

-

Multiple files, continuous

foo_00001_20040205110102.cap, foo_00002_20040205110102.cap, ...

foo.cap

X

x

Multiple files, ring buffer

foo_00001_20040205110102.cap, foo_00002_20040205110102.cap, ...

单一临时文件

默认情况下,一个临时文件将被建立并使用。当捕获停止后,这个文件可以被用户保存到一个指定名字的文件中

单一的命名文件

一个单一的捕获文件将被使用。如果用户想将捕获文件放到一个新的位置,就选择这个模式

多个文件,连续的

就象单一命名文件模式,但当到达一定的条件后,一个新文件会被建立和使用 (one of the "Next file every ..." values).

多个文件,循环的

与“多个文件,连续的”模式很相似,当到达设定的条件后,将切换到下一个文件。如果没有到达"Ring buffer with n files"设定的值,新文件将被建立并使用。如果达到了,就会置换原来使用的文件 (因此形成了一个环).

这种模式将限制磁盘的使用量,甚至对于无限量的输入数据,也只保存最新的捕获数据

4.7. Link-layer header type

在通常情况下,无需选择链路层头类型。下面将描述一些特例,即需要选择这个类型,这样就会知道应该怎么做:

如果在一个802.11设备上进行捕获,且使用BSD的某些版本,这将提供一个在"Ethernet"和"802.11"之间的选择。 "Ethernet" 将引起捕获的包有一个伪造的以太头; "802.11"将引起他们有一个IEEE 802.11 头。除非要读取捕获数据的那个应用程序不支持802.11,否则,你需要选择"802.11".

如果在一个连接到 同步串行线路的Endace DAG 卡上进行捕获,这将提供一个选择:"PPP over serial" 或者 "Cisco HDLC"; 如果协议是PPP, 选择"PPP over serial", 如果是Cisco HDLC, 那就选择"Cisco HDLC".

如果在一个连接到ATM网络的Endace DAG 卡上进行捕获,这将提供一个选择: "RFC 1483 IP-over-ATM" 或者"Sun raw ATM". 如果捕获的流量仅仅是RFC 1483 LLC-封装的IP,或者捕获的数据需要另一个程序去读,但它又不支持SunATM头部,就选择"RFC 1483 IP-over-ATM", 其它情况下选择"Sun raw ATM".

如果在一个以太网设备上进行捕获,这将提供一个选择: "Ethernet" 或者 "DOCSIS"。如果从一个Cisco Cable Modem终端系统(DOCSIS overEthernet)选择"DOCSIS", 其它情况选"Ethernet".

4.8. 当捕获的时侯进行过滤

Ethereal使用libpcap过滤语言进行捕获过滤,在tcpdump的man 页里对它进行了解释,但是很难理解,因此在这里做一些进一步的解释。

提示!

可以从下列地址获得一些捕获过滤的例子http://wiki.ethereal.com/CaptureFilters.

在Capture Option对话框中,将捕获过滤表达式输入到过滤字段,如图 4.2, “"捕获选项"对话框”. 下面是一个tcpdump 捕获过滤语言的语法的大致说明。 具体参见tcpdump手册的表达式选项部分: http://www.tcpdump.org/tcpdump_man.html.

一个过滤表达式是由几个简单的表达式通过and/or 及not连接在一起形成的

 
[not] 简单表达式[and|or [not] 简单表达式 ...]
      

一个例子,见Example 4.1, “ 一个捕获过滤:从一个主机到另一个主机的telnet ”.

Example 4.1.  A capture filter for telnet than captures traffic to and from a particular host

 
tcp port 23 and host 10.0.0.5
        

这个例子捕获进出主机10.0.0.5的telnet  数据包,且展示了两个简单表达式和and 连接符。另外一个例子Example 4.2, “ 捕获所有除10.0.0.5主机以外的telnet流量”, and shows how to capture all telnet traffic except that from 10.0.0.5.

Example 4.2.  Capturing all telnet traffic not from 10.0.0.5

 
tcp port 23 and not host 10.0.0.5
          

XXX - add examples to the following list.

一个简单表达式很简单,通常是下面的一种:

[src|dst] host <host>

这个允许基于主机IP或名称进行过滤,使用src|dst 指定是源还是目的。如果省略,将视为源或目的都被选择

ether [src|dst] host <ehost>

这个表达式允许按照以太网地址进行过滤。可以包括src|dst 去指是源还是目的,如果省略,将视为源或目的都被选择

gateway host <host>

这个表达式允许按照使用host 作为网关的包进行过滤。即以太网的源或目的是主机 host ,但源或目的IP不是主机host.

[src|dst] net <net> [{mask <mask>}|{len <len>}]

这个表达式允许按照网段号进行过滤。可以选择src|dst 指定源或目的如果省略,将视为源或目的都被选择。另外,可以指定网络掩码或CIDR 前缀的长度

[tcp|udp] [src|dst] port <port>

允许过按照TCP和UDP端口进行过滤。可以选择src|dst 和tcp|udp 来指定你感兴趣的内容。关键词tcp|udp 必须出现在src|dst. 之前。

 

less|greater <length>

按照包的长度进行过滤

ip|ether proto <protocol>

允许按照链路层或网络层的指定协议进行过滤

ether|ip broadcast|multicast

允许按照链路层或网层进行广播或多播过滤

<expr> relop <expr>

允许建立一个复杂的过滤表达式,如:包的字节或字节的范围。详细说明请参见tcpdump的man页http://www.tcpdump.org/tcpdump_man.html

4.9. 当捕获运行时 ...

当捕获运行时,下面的对话框将显示:

图 4.3. The "Capture Info"(捕获信息)对话框

这个对话框将告诉你一些关于捕获的包的一些信息,从捕获启动时算起。被统计的数据是不可更改的。

提示!

这个对话框是可以被隐藏的。使用"Hide capture info dialog"选项在Capture Options对话框中

4.9.1. 停止捕获

使用下面的任何一个方法可以停止一个捕获:

1.      在Capture Info捕获信息对话框中,使用" Stop" 按扭

注意!

如果"Hide capture info dialog" 选项被选中,Capture Info对话框就会被隐藏

2.      使用菜单项"Capture/ Stop".

3.      使用工具条项" Stop".

4.      使用快捷键: Ctrl+E.

5.      如果设置的停止捕获条件出现,捕获会自动停止。例如:达到了设定的最大捕获数据量

4.9.2. 重新启动一个捕获

可以用上次的捕获参数立即重新启动一个捕获。这会删除原来捕获的所有的包。当捕获到了一些不感 兴趣的包,没有必要保存他们时,这个功能就显得非常有用。

重新启动是一个方便性的功能,相当于停止一个捕获后立即开始一个新的捕获。 可以通过下面的任意一种方法进行重新启动捕获:

1.      使用菜单项"Capture/ Restart".

2.      使用工具条上的" Restart".

Chapter 5. 文件输入/输出及打印

5.1. 介绍

这一章将讲述捕获数据的输入和输出

·         打开/导入各种不同格式的捕获文件

·         保存/导出成不同格式的文件

·         合并文件

·         打印包

5.2. 打开捕获文件

Ethereal可以读以前保存下来的捕获文件。使用菜单或工具条的"File/ Open", Ethereal会弹出一个文件打开对话框,我们将在Section 5.2.1, “"打开捕获文件" 对话框”中详细讨论。

注意!

也可以使用拖放方式去打开一个文件。只需简单的将要打开的文件拖进Ethereal的主窗口中就可以打开文件了。但是这种方式不能保证在所有桌面环境下都可以工作。

如果之前未保存当前的捕获数据,系统将会提示是否保存,以避免丢失数据。(在参数设置里可以放弃这个功能)

除了正常的文件格式外 (libpcap格式, tcpdump/WinDump使用的格式和其它基于libpcap/WinPcap程序的格式), Ethereal能够读取许多其它程序捕获的文件。参见Section 5.2.2, “输入文件格式” ,列出了Ethereal可以读取的捕获文件格式列表。

5.2.1. "Open Capture File"(打开捕获文件)对话框

打开捕获文件对话框允许去查找一个捕获文件。The "Open Capture File" dialog box allows you to search for a capture file containing previously captured packets for display in Ethereal. Figure 5.1, “The "Open Capture File" Dialog box” shows an example of the Ethereal Open File Dialog box.

注意

Ethereal 使用GTK+ toolkit的打开文件对话框。在GTK 2.4中,对话框被完全重新设计。由于GTK版 本不同,你的对话框可能与下面的有一些不同。但是功能基本上是一样的。

图 5.1. 打开捕获文件对话框

在这个对话框中,可以完成下面的动作:

1.      "+ Add"(追加)按纽允许追加一个目录 。在右面板选择,填加到favorites (bookmarks?) 列表。这些改变是永久的

2.      "- Remove"(删除)按纽允许从左边的窗口移除(但: "Home", "Desktop", and "Filesystem" 不能被移除).

3.      在列表盒中选择文件和目录

4.      当浏览文件时,可以查看文件的预览信息 (如文件尺寸,包的数量, ...)

5.      在过滤字段中可以指定一个显示过滤。在打开新文件时,这个过滤将被使用。点击Filter按钮,会弹出一个过滤对话框(将来在Section 6.2, “在查看时进行包过滤”中讨论).

6.      指定哪些名称解析将被执行。关于名称解析的详细的说明见 Section 7.6, “名称解析”.

7.      点击Open按钮确认并打开文件。如果 Ethereal无法识别该文件的格式,Open按钮将变为灰色

8.      点击Cancel按纽将返回到Etherenet,且不装入任何文件

也可以稍后在查看包的时侯改变显示过滤和名称解析。但是,如果文件非常 在的话,稍后改变这些设置将会花费一些额外的时间。因此最好在这里至少设置一下过滤。

5.2.2. 输入文件格式

下列格式的捕获文件, Ethereal可以打开

·         libpcap, tcpdump 和其它使用tcpdump'的捕获格式的工具软件捕获的文件

·         Sun snoop and atmsnoop

·         Shomiti/Finisar Surveyor captures

·         Novell LANalyzer captures

·         Microsoft Network Monitor captures

·         AIX's iptrace captures

·         Cinco Networks NetXray captures

·         Network Associates Windows-based Sniffer and Sniffer Pro captures

·         Network General/Network Associates DOS-based Sniffer (compressed or uncompressed) captures

·         AG Group/WildPackets EtherPeek/TokenPeek/AiroPeek/EtherHelp/PacketGrabber captures

·         RADCOM's WAN/LAN Analyzer captures

·         Network Instruments Observer version 9 captures

·         Lucent/Ascend router debug output

·         HP-UX's nettl

·         Toshiba's ISDN routers dump output

·         ISDN4BSD i4btrace utility

·         traces from the EyeSDN USB S0

·         IPLog format from the Cisco Secure Intrusion Detection System

·         pppd logs (pppdump format)

·         the output from VMS's TCPIPtrace/TCPtrace/UCX$TRACE utilities

·         the text output from the DBS Etherwatch VMS utility

·         Visual Networks' Visual UpTime traffic capture

·         the output from CoSine L2 debug

·         the output from Accellent's 5Views LAN agents

·         Endace Measurement Systems' ERF format captures

·         Linux Bluez Bluetooth stack hcidump -w traces

注意!

It may not be possible to read some formats dependent on the packet types captured. 以太网捕获数据通常支持大多数的文件格式,但其它包类型 (如: token ring 包) 就不可从所有的文件格式中读出

5.3. 保存捕获的数据

使用Save As... 菜单项就可以简单的保存捕获的数据到一个指定的文件。用户可以选择哪些包被保存,采用什么格式保存

5.3.1. 另存为….对话框

"Save Capture File As"(另存为)对话框允许用户保存当前的捕获数据到一个文件。图 5.2, “"捕获文件另存为" 对话框” 显示了一个例子

注意

Ethereal 使用GTK+ toolkit的打开文件对话框。在GTK 2.4中,对话框被完全重新设计。由于GTK版 本不同,你的对话框可能与下面的有一些不同。但是功能基本上是一样的。

图 5.2. “另存为…”对话框

 

通过这个对话框,可以完成下列动作:

1.      键入一个符合当前文件系统的标准的文件名

2.      选择要保存的目标目录

3.      选择要保存的包的范围,见 Section 5.8, “包范围子框 架”

4.      指定保存的格式,通过下拉菜单,用户可以选择相应的类型。在Section 5.3.2, “输出文件格式”部分有相应的介绍

 

注意!

由于捕获的包的类型不同,有一些捕获格式可能不可用

 

提示!

可以通过读入一个捕获文件,然后另存为另外一种格式的文件的方式,完成捕获文件格式的转换

5.      使用 "Browse for other folders"可以浏览文件系统的文件和文件夹

6.      点击保存按纽保存到指定的文件中。如果保存出现问题,Ethereal将显示一个错误对话框。点击完错误对话框的OK后,可以再试一次

7.      点击Cancel取消按纽返回到Ethereal 而不保存捕获的数据包

5.3.2. 输出文件格式

Ethereal捕获数据可以保存成下列文件格式,这样其它捕获工具就可以从中读取捕获数据了:

·         libpcap (tcpdump)

·         Novell LANalyzer

·         Network Associates Sniffer

·         Sun snoop

·         Microsoft Network Monitor

·         Visual Networks Visual UpTime traffic

·         Accellent 5Views

·         Networks Instruments Observer version 9

·         HP-UX's nettl

 

为了能够正确的读出Ethereal建立的文件,其它协议分析仪可能会要求文件要含有一个特定的后缀Other protocol analyzers may 例如:

 ".DMP" 为 Tcpdump/libpcap 格式

".CAP" 为Network Associates Sniffer Windows 格式

5.4. 合并捕获文件

有时,需要合并多个捕获文件为一个大文件。例 如:用户同时从多个接口进行了捕获(例如:使用Ethereal的多实体方式)

合并文件可以通过三种方式完成

·         使用菜单项中的”file”->"Merge" 去打开一个合并捕获文件的对话框,见图 5.3, “"合并捕获文件"对话框”. 如果没有装入文件,这个菜单项将不可用

·         使用拖放的方式将多个文件放入主窗口中。Ethereal将按照顺序组合成一个新的临时文件。如果只拖放一个文件到主窗口中,那么只是简单的替换掉原来的文件。

·         使用 mergecap 工具。这是一个命令行工具,用来合并捕获文件。这个工具提供了非常多的选择,参见Section D.6, “mergecap: 合并多个文件为一个文件”.

5.4.1. 合并捕获文件对话框

这个对话框让用户选择一个要合并到当前装入的文件的文件。

 

注意!

当该对话框显示之前,如果当前数据未被保存,则会被提示是否何存

图 5.3. 合并捕获文件对话框

Prepend packets to existing file 将包放到文件的前面

将装入的包放在要合并的文件的包的前面

Merge packets chronologically(按捕获时间进行排序)

按捕获时间合并装入的文件与选择的文件

Append packets to existing file将包放到文件的后面

将装入的包放在要合并的文件的包的后面

其它的控制同此对话框,见Section 5.2.1, “"打开捕获文件"对话框”.

5.5. 文件组

当使用多文件选项进行捕获时(see: Section 4.6, “捕获文件和文件模式”), 捕获数据分布在几个文件上,我们称作一个文件组

由于手工处理一组文件是非常麻烦的,出于方便考虑, Ethereal提供了一些处理文件组的特性

Ethereal怎样检测文件组中的文件?

在文件组中的文件名使用格式:前缀_数字_时间日期.后缀,例: "test_00001_20060420183910.pcap"。文件组中的所有文件具有共同的前缀(例如. "test") 和后缀(例如. ".pcap") ,中间部分则是不同的。

要发现文件组中的文件,Ethereal 会扫描当前装入文件所在的目录,查找与当前装入的文件符合同样模板的文件。

原理很简单,通常能很好的工作。但也存在缺点。如果几个文件组采用了同样的前缀和后缀,Ethereal会认为他们是一个文件组。如果其中的文件被重新命名或都分布到几个不同的目录下,那么这种发现组中所有文件的机制将不再有效。

为了方便,在菜单"File"->"File Set" 中提供了下面的特性:

·         List Files(列文件) 对话框将列出该文件组中的所有文件

·         Next File(下一个) 关闭当前的文件,然后装入下一个文件

·         Previous File(前一个) 关闭当前文件,然后装入前一个文件

5.5.1. "List Files"(列文件)对话框

图 5.4. "List Files"列文件对话框

 

每一行包括文件组中一个文件的信息:

·         Filename 文件的名字。如果点击文件名,当前文件将被关闭,相应的捕获文件将被打开

·         Created 文件的建立时间

·         Last Modified 最后的修改时间

·         Size 文件大小

最后一行包含文件组所在的目录。

这个对话框的内容随着每一次文件的打开和关闭而变化着。

Close按纽将关闭这个对话框

5.6. 导出数据

Ethereal提供几种方法和格式来导出包数据。这一部分描述了从Ethereal导出数据的常用的几种方法。

注意!

有一些特殊功能来导出一些特定的数据,这将在适当的地方进行描述

XXX – 增加一些输出格式的详细描述和一些输出例子

5.6.1. "Export as Plain Text File"(做为明文导出)对话框

将数据包导出成一个明文的ASCII文本文件,如同打印包时使用的格式

图 5.5. "Export as Plain Text File"(做为明文导出)对话框

·         Export to file: (导出到文件)子框架:导出的文件名称

·         Packet Range 子框架在Section 5.8, “包范围子框架”进行说明

·         Packet Details 子框架在 Section 5.9, “包格式子框架” 进行说明

5.6.2. "Export as PostScript File"(做为PostScript文件导出)对话框

导出为PostScript格式

提示!

使用ghostscript可以很容易的将PostScript文件转换成PDF 文件。例如:导出到一个文件foo.ps ,然后ps2pdf foo.ps

Figure 5.6. The "Export as PostScript File"(导出到PostScript文件)对话框

·         Export to file: 要导出的文件

·         Packet Range :包范围,在Section 5.8, “包范围子框 架”进行描述

·         Packet Details 包细节,在Section 5.9, “包格式子框架” 进行描述

5.6.3.  "Export as CSV (Comma Seperated Values) File"(导出为CSV文件)对话框

XXX – 增加一些屏幕抓图

将包摘要导出到一个CSV文件,能常电子表格软件可以导入、导出的数据

·         Export to file: 要导出的文件

·         Packet Range :包范围,在Section 5.8, “包范围子框架”. 进行描述

5.6.4.  "Export as PSML File"(导出为PSML文件)对话框

导出为PSML格式。仅仅包含包摘要的内容,是一个基于XML的格式。

Figure 5.7. "Export as PSML File"(导出为PSML文件)对话框

·         Export to file: 要导出的文件.

·         Packet Range 包范围,在Section 5.8, “包范围子框架”进行描述

There's no such thing as a packet details frame for PSML export, as the packet format is defined by the PSML specification.

5.6.5.  "Export as PDML File"(导出为一个PDML文件)对话框

导出为PDML文件格式。这是一个基于XML的格式,包含包细节。PDML 文件规范在PDML 规范.

 

PDML规范还没有正式发布,Ethereal对其的使用仍是早期的beta 状态版本,因此将来的版 本可能会发生改变

图5.8. "Export as PDML File"(导出为PDML格式)对话框

·         Export to file: 要导出的文件.

·         Packet Range :包范围,在Section 5.8, “包范围子框架”进行描述

There's no such thing as a packet details frame for PDML export, as the packet format is defined by the PDML specification.

5.6.6. "Export selected packet bytes"(导出选择的包字节) 对话框

导出在包字节面板中选择的字节,文件为二进制格式

图 5.9. "Export Selected Packet Bytes"(导出选择的包字节)对话框

·         Name: 要导出的文件名称

·         Save in folder: 目标文件所在的目录

·         Browse for other folders (浏览其它目录)提供了一个灵活的选择目录的方式

5.7. 打印包

要打印包,从File菜单选择"Print..."项即可。 Ethereal 将弹出一个打印对话框,如图 5.10, “打印对话框”.

5.7.1. 打印对话框

图 5.10. 打印对话框

在打印对话框中,包括下面这些字段:

Printer(打印机)

这个字段包含一些单选按纽

·   Plain Text (明文 ),说明将做为明文打印

·   PostScript 将打印至PostScript 打印机.

·   Output to file: 打印到一个文件

如果选择了打印到一个文件,那么这个字段就是输入文件名的地方。或者可以点击按纽去浏览文件系统。如果未选中打印到一个文件,这个字段将变为灰的

·   Print command  (打印命令)指定一个用来打印的命令

注意!

这些 Print command 字段在windows平台是不可用的

·   这个字段指定用来打印的命令。典型地,是 lpr。用户可以改变到一个特殊的队列。例如:

·                       
·                      lpr -Pmypostscript
·                                    

·   如果Output to file  被选择,该项将变为灰色

Packet Range(包范围)

选择要打印的包,见 Section 5.8, “包范围子框架”

Packet Format(包格式)

选择要打印的包的输出格式。用户可以选择每一个包被怎样打印。见 图 5.12, “包格式子框架”

5.8. 包范围子框架

包范围子框架是许多与输出对话框相关的一部分。它提供了哪些包被输出的选择功能

图5.11. 包范围子框架

如果Captured 按纽按下(默认),那么所有的包将被处理。如果 Displayed 按纽按下,仅仅当前显示的包进入选择规则

·         All packets 将处理所有的包

·         Selected packet only 仅仅选择的包

·         Marked packets only 仅仅标记的包

·         From first to last marked packet process the packets from the first to the last marked one.

·         Specify a packet range指定一个包范围。例如:指定 5,10-15,20- 将处理第五个包,10至15个包,20个包到末尾的所有包。e.

5.9.  包格式子框架

包格式子框架是许多与输出对话框相关的一部分。 It provides options to select which parts of a packet should be used for the output function.

图 5.12. 包格式子框架

·         Packet summary line (包摘要行),使能输出摘要行,就象包列表面板一样

·         Packet details (包细节)使能包细节树的输出

o        All collapsed (全折叠状态)

o        As displayed (当前显示的状态)

o        All expanded (全展开状态)

·         Packet bytes (包字节),使能输出包的字节,就象包字节面板一样

·         Each packet on a new page (每个包一页)

Chapter 6. 利用捕获的包进行工作

6.1. 查看捕获的包

一旦捕获了一些包,或者打开了一个原来保存过的捕获文件,包就会显示在包列表面板中,可以通过点击某一个包来进行查看,以树状查看及字节面板。

点击+号可以扩展树的任何部分,并且可以选择单独的字段。下面的例子说明了选择一个TCP包的情况,见 图 6.1, “选择一个TCP包进行查看”. 同时也选择了TCP头部的Acknowledgment序列号,同时在字节面板中显示了选择的字节

Figure 6.1. 选择一个TCP包进行查看

如果在参数设置中选择了“实时更新包列表”,那么可以用同样的办法,在Ethereal捕获的过程中进查看。

另外,也可在一个单独的窗口查看一个包。如图 6.2, “在一个单独的窗口中查看一个包”.  做法是:首先在包列表中选择一个包,然后从Display菜单中选择"Show Packet in New Windows"。这可以容易比较两个甚至多个包。

图 6.2. 在一个单独的窗口中查看一个包

最后,在包列表面板,包细节面板和包字节面中,通过点击鼠标右键可以弹出一个菜单

The following table gives an overview which functions are available in the panes, where to find the corresponding function in the menu, and a short description of each item.

表 6.1. 弹出菜单的功能总览

项目

List

Details

Bytes

Menu

Description

Mark Packet (toggle)

X

-

-

Edit

标记一个包

Time Reference

X

-

-

Edit

设置/复位及发现时间参考

Expand Subtrees

-

X

-

View

扩展当前选择的子树

Expand All

-

X

-

View

扩展所有包的所有子树

Collapse All

-

X

-

View

Ethereal keeps a list of all the protocol subtrees that are expanded, and uses it to ensure that the correct subtrees are expanded when you display a packet. 这个菜单项将收起所有包的树状查看,即折叠。.

Apply as Filter

X

X

-

Analyze

.

Prepare a Filter

X

X

-

Analyze

.

Follow TCP stream

X

X

-

Analyze

查看一对结点之间的一个TCP流的所有数据

Wiki Protocol Page

-

X

-

-

Show the wiki page corresponding to the currently selected protocol in your web browser.

Filter Field Reference

-

X

-

-

Show the filter field reference web page corresponding to the currently selected protocol in your web browser.

Protocol Preferences...

-

X

-

-

The menu item takes you to the preferences dialog and selects the page corresponding to the protocol if there are settings associated with the highlighted field. More information on preferences can be found in Section 9.5, “Preferences”.

Decode As...

X

X

-

Analyze

.

Print...

X

-

-

File

打印 (选择的)包 .

Show Packet in New Window

X

-

-

View

在另一个窗口中显示选择的包

Resolve name

-

X

-

View/Name Resolution

调用一个名称解析,但不是所有包

Go to Corresponding Packet

-

X

-

Go

If the selected field has a packet number in it, go to it. The corresponding packet will often be a response which is requested by this packet, or the request for which this packet is a response.

Copy

-

-

X

-

Copy选择的数据至剪切板(XXX - in which format).

Export Selected Packet Bytes...

-

-

X

File->Export

将包字节导出至一个二进制文件

图 6.3. 包列表面板的弹出菜单

Mark Packet (toggle)标记包

对一个包打标记

Time Reference时间参考

与Edit菜单里的同名项功能相同。允许设置时间参考及利用时间参考工作

Apply as Filter应用过滤

与Analyze菜单项里的同名项功能相同。

Prepare a Filter准备一个过滤

与Analyze 菜单项里的同名项功能相同。

Follow TCP Stream追踪TCP 流

与Analyze菜单项里的同名项功能相同。允许查看一对站点间的TCP流的所有数据

Decode As... 按…解码

与Analyze菜单项里的同名项功能相同。

Print... 打印…..

与File菜单项里的同名项功能相同。允许打印包

Show Packet in New Window(在一个新窗口中显示包)

与View菜单项里的同名项功能相同。在一个新窗口中显示选择的包

图 6.4. 包细节面板弹出菜单项

Expand Subtrees扩展子树

扩展当前选择的子树

Expand All(扩展所有)

扩展捕获文件里所有包的所有子树

Collapse All(折叠所有)

Ethereal keeps a list of all the protocol subtrees that are expanded, and uses it to ensure that the correct subtrees are expanded when you display a packet. 这个菜单项收起所有包的树状查看方式

Apply as Filter(应用为过滤)

与Analyze菜单项里的同名项功能相同

Prepare a Filter(准备一个过滤)

与Analyze菜单项里的同名项功能相同

Follow TCP Stream(追踪TCP流)

与Analyze菜单项里的同名项功能相同。查看一对站点间TCP流的所有数据

Wiki Protocol Page

Show the wiki page corresponding to the currently selected protocol in your web browser.

Filter Field Reference

Show the filter field reference web page corresponding to the currently selected protocol in your web browser.

Protocol Properties...

The menu item takes you to the properties dialog and selects the page corresponding to the protocol if there are properties associated with the highlighted field. More information on preferences can be found inFigure 9.8, “The preferences dialog box”.

Decode As...用….解码

与Analyze菜单项里的同名项功能相同

Resolve Name(解析名字)

对选择的包进行名称解析,但不是每一个包

Go to Corresponding Packet(转到相应的包)

如果选择的字段有一个相应的包,就转到它。相应的包通常做为一个需求/应答对

图 6.5. 包字节面板的弹出菜单

Copy

复制选择的数据至剪切板

Export Selected Packet Bytes...(导出选择的包的字节….)

与File菜单里的同名项功能相同。允许导出包字节至一个二进制文件

6.2. 查看时进行包过滤

Ethereal有两种过滤语言:一个是在捕获时使用的,另一个在显示时使用的。在这一部分,我们探讨第二种类型的过滤:显示过滤。 第一种我们已经在Section 4.8, “捕获过滤” 讨论过了。

显示过滤允许用户隐藏不感兴趣的数据包,而只显示那些感 兴趣的数据包。允许按照如下条件显示:

·         协议

·         一个字段存在与否

·         一个字段的值

·         两个字段的比较

·         ... 以及更多

要基于协议类型选择包,只需要在工具条的Filter: 字段里写上,然后按回车就可以。field in the filter toolbar of the Ethereal window and press enter to initiate the filter. 图 6.6, “过滤TCP 协议 例子中显示了当在过滤字段里打入tcp 后显示的内容

注意!

所有协议和字段名要用小写。另外,输入完后,不要忘记按一下回车键

图 6.6. 过滤TCP 协议

正如我们注意到的,只有TCP协议的包被显示出来了(例,包1-10被隐藏了). 包的编号将被保留,因此第一个包的编号变成了11。

注意!

当使用显示过滤时,所有的包都保存在捕获文件里。显示过滤仅仅改变捕获文件的显示,但不改过捕获文件的内容

可以过滤任何Ethereal理解的协议。也可以按照解字段进行过滤(字段:解码器追加到树查看中的), You can also filter on any field that a dissector adds to the tree view, but only if the dissector has added an abbreviation for the field. A list of such fields is available in the Ethereal in the Add Expression... dialog box. You can find more information on the Add Expression... dialog box in Section 6.4, “The "Filter Expression" dialog box”.

For example, to narrow the packet list pane down to only those packets to or from the IP address 192.168.0.1, use ip.addr==192.168.0.1.

例如,为了减小包列表面板,仅显示那些来自或者发出者是192.168.0.1的包,使用ip.addr==192.168.0.1.

注意!

要删除过滤,点击过滤字段 右边的Clear 按钮。

6.3. 建立显示过滤表达式

Ethereal 提供了一个简单的,但功能强大的显示过滤语言。利用它,用户可以建立非常复杂的表达式。You can compare values in packets as well as combine expressions into more specific expressions. The following sections provide more information on doing this.

提示!

在下面的站点将提供一些显示过滤的例子Ethereal Wiki Display Filter page at http://wiki.ethereal.com/DisplayFilters.

6.3.1. 显示过滤字段

在包细节面板中的每一个字段都可以做为过滤串。仅仅包中的存在的字段才被显示。例:过滤串tcp 将只显示包含tcp 协议的数据包

在"Help/Supported Protocols"的"Display Filter Fields"是一份完整的可用字段的列表

 

6.3.2. 值的比较

用户也可以使用一些不同的比较操作符来建立显示过滤。这些操作符见 表 6.2, “显示过滤比较操作符”.

提示!

可以使用英语或类C的符号,甚至可以在一个过滤串中混合使用这两种符号

表 6.2. 显示过滤比较操作符

English

C-like

Description and example

eq

==

Equal

ip.addr==10.0.0.5

ne

!=

Not equal

ip.addr!=10.0.0.5

gt

Greater than

frame.pkt_len > 10

lt

Less than

frame.pkt_len < 128

ge

>=

Greater than or equal to

frame.pkt_len ge 0x100

le

<=

Less than or equal to

frame.pkt_len <= 0x20

另外,所有协义都是有类型的, 表 6.3, “显示过滤字段类型” 提供了一个类型列表及如何去表达

表 6.3. 显示过滤字段类型

Type

Example

无符号整数 (8-bit, 16-bit, 24-bit, 32-bit)

可以用十进制,八进制,十六进制表达整型。下面的显示过滤是相同的。

 
ip.len le 1500
ip.len le 02734
ip.len le 0x436
                       

有符号整数 (8-bit, 16-bit, 24-bit, 32-bit)

 

布尔

A boolean field is present in the protocol decode only if its value is true. 例如, tcp.flags.syn 出现了,因此是真。 only if the SYN flag is present in a TCP segment header.

因此,过滤表达式tcp.flags.syn 仅选择那些存在这个标记的包。也就是说 TCP 头中包含SYN 标记的。 同样的,要找源路由的token ring 包,使用tr.sr.

以太网地址 (6字节)

eth.addr == ff:ff:ff:ff:ff:ff

IPv4 地址

ip.addr == 192.168.0.1

IPv6 地址

 

IPX 网络号

 

String (text)

 

Double-precision floating point number

 

6.3.3. 结合表达式

逻辑操作符可以组合过滤表达式,这些逻辑操作符如 表 6.4, “显示过滤逻辑操作符”

表 6.4. 显示过滤逻辑操作符

English

C-like

Description and example

and

&&

Logical AND

ip.addr==10.0.0.5 and tcp.flags.fin

or

||

Logical OR

ip.addr==10.0.0.5 or ip.addr==192.1.1.1

xor

^^

Logical XOR

tr.dst[0:3] == 0.6.29 xor tr.src[0:3] == 0.6.29

not

!

Logical NOT

not llc

[...]

 

子串操作

Ethereal allows you to select subsequences of a sequence in rather elaborate ways. After a label you can place a pair of brackets [] containing a comma separated list of range specifiers.

eth.src[0:3] == 00:00:83

The example above uses the n:m format to specify a single range. In this case n is the beginning offset and m is the length of the range being specified.

 
eth.src[1-2] == 00:83
                   

The example above uses the n-m format to specify a single range. In this case n is the beginning offset and m is the ending offset.

eth.src[:4] == 00:00:83:00

The example above uses the :m format, which takes everything from the beginning of a sequence to offset m. It is equivalent to 0:m

eth.src[4:] == 20:20

The example above uses the n: format, which takes everything from offset n to the end of the sequence.

eth.src[2] == 83

The example above uses the n format to specify a single range. In this case the element in the sequence at offset n is selected. This is equivalent to n:1.

eth.src[0:3,1-2,:4,4:,2] == 
00:00:83:00:83:00:00:83:00:20:20:83

Ethereal allows you to string together single ranges in a comma separated list to form compound ranges as shown above.

6.3.4. 一个常见的错误

 

警告!

使用!= 操作符组合组合如下列表达式 eth.addr, ip.addr, tcp.port, udp.port 及相似的将不能正常的工作!

用户经常使用过滤串ip.addr == 1.2.3.4 来显示包含1.2.3.4. 的数据包

然后,使用ip.addr != 1.2.3.4 去查看不包含1.2.3.4 的数据包。不幸的是,这将不能得到想要的结果

Instead, that expression will even be true for packets where either source or destination IP address equals 1.2.3.4. The reason for this, is that the expression ip.addr != 1.2.3.4 must be read as "the packet contains a field named ip.addr with a value different from 1.2.3.4". As an IP datagram contains both a source and a destination address, the expression will evaluate to true whenever at least one of the two addresses differs from 1.2.3.4.

如果想过滤出所有包含1.2.3.4的数据包,更改!(ip.addr == 1.2.3.4) as it reads "show me all the packets for which it is not true that a field named ip.addr exists with a value of 1.2.3.4", or in other words, "filter out all packets for which there are no occurrences of a field named ip.addr with the value 1.2.3.4".

6.4. 过滤表达式对话框

When you are accustomed to Ethereal's filtering system and know what labels you wish to use in your filters it can be very quick to simply type a filter string. However if you are new to Ethereal or are working with a slightly unfamiliar protocol it can be very confusing to try to figure out what to type. The Filter Expression dialog box helps with this. 当用户习惯于Ethereal的过滤系统

提示!

“Filter Expression" 对话框是一个学习写Ethereal 显示过滤串的极好的方法

图 6.7. 过滤表达式对话框

 

刚第一次调用过滤表达式对话框时, 将显示一个字段名的树形列表,按照协议来组织的,另外还有一个Relation框选择操作符

Field Name字段名

从协议字段树中选择一个协议字段。Select a protocol field from the protocol field tree. Every protocol with filterable fields is listed at the top level. By clicking on the "+" next to a protocol name you can get a list of the field names available for filtering for that protocol.

Relation关系

从Relation列表中选择一个关系符。 is present 是一个一无关系符,如果选择的字段出现在包中,就为真。其它是二元关系符,需要追加数据来完成

当选择了一个字段,然后选择了一个二元操作符,用户需 要输入一个值来完善表达式。

Value 值

用户或许需要在Value文本框中输入一个适当值,Value 和field name 的类型需要一致

Predefined values 预定义值

有一些协议字段有预定义的值。Some of the protocol fields have predefined values available, much like enum's in C. If the selected protocol field has such values defined, you can choose one of them here.

Range(范围)

XXX - add an explanation here!

OK

当对建立的表达式满意时,点击OK,过滤串将被建立。

Cancel

Cancel 离开,不做任何事情

6.5. 定义和存贮过滤

用户可以定义一个过滤,并赋给它一个名字,以便以后使用。对于复杂的过滤,这能够节省回忆及键入的时间。

要想定义一个新的或者编辑一个存在 的过滤,一、从Capture菜单中选择 Capture Filters...或,二、从Analyze菜单中 Display Filters... . ;Ethereal 然后会弹出一个过滤对话框,如图 6.8, “"捕获过滤"和"显示过滤"对话框”.

注意!

定义和保存捕获过滤和显示过滤的机理几乎是一样的。因此两种都将在这儿描述,他们之间不同的地方将会标明

警告!

必须使用Save 去永久的保存过滤。 Ok 或 Apply 不会保存过滤,因此当关闭Ethereal后,他们会丢失

图 6.8. 捕获过滤和显示过滤对话框

New

该按纽追加一个新的过滤到过滤列表中。在过滤名和过滤串中输入的数将会被使用。If any of these fields are empty, it will be set to "new".

Delete

该按纽删除一个选择的过滤。如果没有过滤被选择,它将变为灰色.

Filter

可以从这个列表中选择一个过滤(which will fill in the filter name and filter string in the fields down the bottom of the dialog box).

Filter name:过滤名

可以更变当时选择的过滤的名字

注意!

过滤名将仅仅在这儿使用,以方便识别过滤,其它情况下它是不会使用的。可以追加多个过滤,但使用一个名字,但这是极不好的

Filter string:过滤串

可以在此外改变当前选择的过滤串。对于显示过滤,当用户键入时会有语法检查

Add Expression...(追加表达式)

仅显示过滤:这个按纽弹出一个追加表达 式对话框,辅助建立滤串。在Section 6.4, “"过滤表达式"对话框” 能得到更多追加表达式对话框的信息

OK

仅显示过滤:应用当前的过滤进行显示,并关闭对话框

Apply

仅显示过滤:应用当前的过滤进行显示,但不关闭对话框

Save

保存当前设置。文件位置和格式在Save the current settings in this dialog. The file location and format is explained in  附录A, 配置文件和文件夹. 中解释

Close

关闭对话框,这将放弃未保的设置

6.6. 发现包

一旦捕获到数据或者装入了一个原来的捕获文件,就可以进行查找包的动作。从Edit 菜单选Find Packet...  ,将弹出一下对话框,如图 6.9, “"查找包" 对话框”.

6.6.1.  查找包对话框

图 6.9. 查找包对话框

You might first select the kind of thing to search for:

·         Display filter 显示过滤

简单的输入一个显示过滤,然后选方向,最后点击OK

例如,要查找从主机192.168.0.1发出一个三次握手包, 使用下面的过滤串

ip.addr==192.168.0.1 and tcp.flags.syn

关于显示过滤的更多的信息,见 Section 6.2, “当查看的时侯进行过滤”

·         Hex Value 十六进制值

在数据包中查找一个指定字节的序列

例如"00:00" 去查找两个空字节的包

·         String  串

在数据包中查找一个字符串,可跟几个选项。

查找的值在你打入时将进行语法检查。如果语法检查成功,背景将变绿,否则将变红

可以选择查找的方向

·         Up向前

向前查找(包编号减小).

·         Down 向后

向后查找(包编号增加)

6.6.2. 查找下一个命令

查找下一个将利用同样的选项继续扫描

6.6.3. 查找前一个命令

查找前一个与查找下一个做同样的事情,但是是向反方向查找

6.7. 转到一个特定的包

利用go菜单,可以很容易的转到一个特定的数据包

6.7.1. Go back命令

回跳,类似于WEB浏览器的回跳

6.7.2.  "Go Forward"命令

前跳,类似于WEB浏览器的前跳

6.7.3. "Go to Packet"对话框

Figure 6.10. The "Go To Packet"对话框

这个对话框要求输入一个包的编号,然后跳转到这个包

6.7.4.  "Go to Corresponding Packet"(跳转到相应的包)命令

如果选择了一个协议字段 ,且指到了文件的另一个包,这个命令将跳转到那个包

注意!

由于这些协议字段 工作起来就象链接,因此可以简单的双击去跳到相应的包.

6.7.5. The "Go to First Packet"跳到第一个包命令

跳到显示的第一个包

6.7.6. "Go to Last Packet"跳到最后一个包命令

跳到显示的最后一个包

6.8. 标记包

可以在包列表面板对包进行标记。被标记的包将会显示黑色背景 。(除非重新着色了)在对一个大的捕获文件进行分析时,包标记是非常有用的。

警告!

包标记并不保存在捕获文件中,也不会保存在其它地方,因此,当关闭捕获文件后,所有的标记都将丢失.

当进行保存/导出/打印时,可以使用包标记控制输出。为达到这个目的,一个包范围选项是可用的,见 Section 5.8, “包范围子框架”.

There are three functions to manipulate the marked state of a packet:

·         Mark packet (toggle) 对单独的包进行标记/取消标记

·         Mark all packets 标记所有的包

·         Unmark all packets 取消所有的标记

这些标记功能可以从"Edit" 下找到,并且 "标记包" 功能可以从包列表面板的弹出菜单中选择.

6.9. 时间显示格式和时间参考

当包被捕获时,每一个包都被打上了一个时间戳。这些时间戳保存在捕获文件中,因此以后分析时可以用到。

关于时间戳,时区等的详细的描述,见: Section 7.3, “时间戳”.

在包列表面板中,时间戳的表达格式和精度可以通过view菜单来进行选择

可用的表达格式如下:

·         Date and Time of Day: 1970-01-01 01:02:03.123456 当包被捕获时的绝对日期和时间

·         Time of Day: 01:02:03.123456 当包被捕获时的,这天的绝对时间

·         Seconds Since Beginning of Capture: 123.123456 相对于捕获开始的时间或者相对于第一个时间参考包的时间,参见: Section 6.9.1, “数据包时间参考”).

·         Seconds Since Previous Packet: 1.123456 相对于前一个包的时间

可用的精度:

·         Automatic 使用捕获文件中的时间戳精度 (默认).

·         Seconds, Deciseconds, Centiseconds, Milliseconds, Microseconds or Nanoseconds 按强制的时间戳精度显示。如果事实上的精度小,那么以0补充,如果事实上精度大,就去除。

精度例子:如果时间戳显示使用的是"Seconds Since Previous Packet", 这个值或许是1.123456. 这将被使用"Automatic" 方式显示(libpcap 文件是这样设置的,用microseconds).。如果使用秒,那么将显示1;如果使用Nanoseconds 将显示1.123456000.

6.9.1. 包时间参考

用户可以对包设置时间参考。一个时间是一个起动点,外续包将以它为基准计算时间。如果你想看与某一个特定包的时间值,这是非常有用的。在一个捕获文件中可以设置多个时间参考点

警告!

时间参考不会被永久保存,关闭捕获文件后就会丢失

注意!

时间参仅在将时间显示格式设置成"Seconds Since Beginning of Capture".时才有用。如果是其显示格式,时间参考将不起作用(将会不可用)

想使用时间参考,选择”Edit”菜单下的"Time Reference"项,见Section 3.6, “"编辑Edit" 菜单”, 或者从包列表面板的弹出菜单中选.

·         Set Time Reference (toggle) 设置/取消当前的包为时间参考点

·         Find Next  在包列表面板中发现下一个时间参考点

·         Find Previous 发现前一个时间参考点

Figure 6.11. Ethereal 显示的一个时间参考的包

一个时间参考的包将被标为*REF* (见第10号包). 所有后续的包将显示从它开始的时间

Chapter 7. Advanced Topics

7.1. Introduction

In this chapter some of the advanced features of Ethereal will be described.

7.2. Following TCP streams

If you are working with TCP based protocols it can be very helpful to see the data from a TCP stream in the way that the application layer sees it. Perhaps you are looking for passwords in a Telnet stream, or you are trying to make sense of a data stream. Maybe you just need a display filter to show only the packets of that TCP stream. If so, Ethereal's ability to follow a TCP stream will be useful to you. 如果你的工作与基于TCP的协议有关,那么象应层一样看到一个TCP流是非常有用的。或许你正在一个Telnet流中查找密码,或许你正在设法搞清楚一个TCP流,如果是这样,Ethereal提供的跟踪TCP流的功能对你为讲将会非常有用。

首先,在包列表中选择一个TCP包,然后在工具菜单中选择“Follow TCP Stream”(或者从包列表的上 下文中选择),Ethereal将设置一个适当的过滤,然后弹出一个对话框,按顺序显示这个TCP流的所有数据,如图所示。Simply select a TCP packet in the packet list of the stream/connection you are interested in and then select the Follow TCP Stream menu item from the Ethereal Tools menu (or use the context menu in the packet list). Ethereal will set an appropriate display filter and pop up a dialog box with all the data from the TCP stream laid out in order, as shown in Figure 7.1, “The "Follow TCP Stream" dialog box”.

注意!

用户不需要做任何工作,Ethereal会设置一个显示过滤来显示你选择的包的整个TCP流

7.2.1. 跟踪TCP流对话框

图 7.1. 跟踪TCP流对话框

流的内容按在网络中出现的顺序显示出来。从A到B的流量标为红色,从B到A的标为兰色。用户可以按照自己的喜好,改变这些颜色设置。具体改变通过Edit/Prefeences菜单中的Colors页进行更改

不可打印的字符将用“.”来代替。

当正在做实时捕获的时侯,流内容不会实时更新。要得到最新的数据,用户需要重新打开这个对话框

在该对话框中,可以选择下面几种动作:You can choose from the following actions:

1.      Save As 按照当前选择的格式保存流数据

2.      Print 用当前选择的格式打印流数据

3.      Direction 选择特定方向流的数据显示("Entire conversation"整个会话, "data from A to B only" 仅从A到B或 "data from B to A only"仅从B到A).

4.      Filter out this stream 将当的TCP流滤出掉(自动设置一个显示 过滤)

5.      Close 关闭对话框,显示过滤仍然起作用。.

可以按照以下格式查看数据:

1.      ASCII. 以ASCII方式查看,很明显,对于基于文本的协议,如HTTP是最好的查看方式

2.      EBCDIC. For the big-iron freaks out there.

3.      HEX Dump. 这种方式可以看到所有数据。这将需要大的屏幕空间,适用于查看基于二进制的协议

4.      C Arrays. 允许将数据流导入自己的C程序

5.      Raw. 该项允许将未被改变的数据装入一个不同的程序,以便将来检查。显示看上去与ASCII一样,但会"Save As"成一个二进制文件

7.3. 时间戳

时间戳,精度以及其它的概念非常容易混淆,这一部分将讲解Ethereal如何处理时间戳。

当包被捕获的时候,每一个包都被打上了一个时间戳,即被捕获的时间。这些时间被保存在捕获文件里, so they also will be available for (later) analysis.

这些时间戳从哪来?当捕获时,Ethereal从libpcap库得到时间戳,该时间戳来源于操作系统内核。如果从一个捕获文件装入,则从文件中获得。

7.3.1. Ethereal 内部格式

Ethereal的内部时间戳格式由两部分组成:日期(距离1970.1.1的天数)和时间(午夜以后,精度十万分之一秒)。Ethereal显示时间戳的格式是可调整的,参 Section 3.7, “"查看"菜单”

当读或写捕获文件时,Ethereal会在捕获文件格式和内部格式之间按照需要进行相应的转换

在捕获时,Ethereal使用libpcap (WinPcap) 捕获库获得时间,支持微秒的精度。这个精度一般情况下来讲是足够了。

7.3.2. 捕获文件格式

Ethereal支持的每一种捕获文件格式都支持时间戳。每种格式支持的时间戳精度是不同的,从一秒级至十亿分之一秒("0"-"0.123456789"). 大多数文件格式采用固定精度(如:微秒)保存时间戳,有些文件格式甚至有能力自己保存时间精度。 (whatever the benefit may be).

Ethereal采用的普通libpcap捕获文件格式仅支持一个固定的微秒精度"0.123456"

注意!

将数据写入一个不支持现有精度的捕获文件格式,将会造成信息的丢失。例:如果装入了一个na秒级精度的文件,且要保存成一个只有毫秒级精度的 libpcap文件时,Ethereal 就会将精度从na秒减小到毫秒级。

7.3.3. 精度性

经常有人会问:“Ethereal提供怎样的时间戳精度?”,其实,Ethereal自己并不建立任何时间戳,仅仅简单的从其它地方获取然后显示。因此精度将取决于使用的捕获系统(操作系统,性能),由于这个原因,要回答上面的问题是很困难的。

注意!

USB连接的网卡常常不能提供足够精度的时间戳。进入的包不得不经过一个“长时间的,有大风”的旅程(通过USB电缆)然后到达内核,由于时间戳是他们被内核处理时打上去的,因此,此时的时间戳是非常不精确的。

结论:如果你需要一个精度的时间的话,就不要使用USB连接的网卡。

7.4. 时区

如果你在行星之间旅行,可能会把时区搞混,如果你从世界上另一个时间的地方得到一份捕获文件,可能也会有一些糊涂;-)

首先,在下列两种情况下,你不需要考 虑时区的问题:

·         你仅仅对包的时间的差异感兴趣 ,而不需要知道捕获包时的具体的日期和时间

·         你不会从一个与自己不同的时区得到捕获文个。因此,这也就不存在时区问题了。例如,在你的工作小组中的每一个人都与你在同一个时区。

什么是时区?

People expect that the time reflects the sunset. Dawn should be in the morning maybe around 06:00 and dusk in the evening maybe at 20:00. These times will obviously vary depending on the season. It would be very confusing if everyone on earth would use the same global time as this would correspond to the sunset only at a small part of the world.

For that reason, the earth is split into several different time zones, each zone with a local time that corresponds to the local sunset.

The time zone's base time is UTC (Coordinated Universal Time) or Zulu Time (military and aviation). The older term GMT (Greenwich Mean Time) shouldn't be used as it is slightly incorrect (up to 0.9 seconds difference to UTC). The UTC base time equals to 0 (based at Greenwich, England) and all time zones have an offset to UTC between -12 to +14 hours!

For example: If you live in Berlin you are in a time zone one hour earlier than UTC, so you are in time zone "+1" (time difference in hours compared to UTC). If it's 3 o'clock in Berlin it's 2 o'clock in UTC "at the same moment".

Be aware that at a few places on earth don't use time zones with even hour offsets (e.g. New Delhi uses UTC+05:30)!

Further information can be found at: http://en.wikipedia.org/wiki/Time_zone and http://en.wikipedia.org/wiki/Coordinated_Universal_Time.

什么是夏令时(DST)?

Daylight Saving Time (DST), also known as Summer Time, is intended to "save" some daylight during the summer months. To do this, a lot of countries (but not all!) add an DST hour to the already existing UTC offset. So you may need to take another hour (or in very rare cases even two hours!) difference into your "time zone calculations".

Unfortunately, the date at which DST actually takes effect is different throughout the world. You may also note, that the northern and southern hemispheres have opposite DST's (e.g. while it's summer in Europe it's winter in Australia).

Keep in mind: UTC remains the same all year around, regardless of DST!

Further information can be found at: http://en.wikipedia.org/wiki/Daylight_saving.

Further time zone and DST information can be found at: http://wwp.greenwichmeantime.com/ and http://www.timeanddate.com/worldclock/.

7.4.1. 正确设置自己计算机的时间

如果你与遍布世界的人打交道,那么正确设置计算机的时间和时区就显得非常有用。

按照以下正确的顺序设置你的计算机的时间和时区:

1.      设置你当前所在位置的时区

2.      设置所在位置的正确的时间

这样,就告诉了计算机本地时间及相对于UTC的时间偏移量。

提示!

如果你在世界旅行,经常犯的一个错误就是调整自己计算机的时钟为当地时间。其实正确的做法是不要调整时钟,只需要调整时区就可以了。对于你的计算机来讲,时间其实与以前是一样的,仅仅是时区不一样而已。

提示!

可以通过NTP自动调整自己的计算机为正确的时间。Ethreal支持的操作系统都支持NTP客户端。例子见http://www.ntp.org/.

7.4.2. Ethereal和时区

那么,Ethereal和时区之间是什么关系呢?

Ethereal的捕获文件格式(libpcap format)以及其它一些捕获文件格式,如Windows Sniffer, EtherPeek, AiroPeek,及 Sun snoop 格式,都是保存包的到达时间,以UTC值的形式保存。UN*X 系统及基于Windows NT 的系统 (Windows NT 4.0, Windows 2000, Windows XP, Windows Server 2003, Windows Vista) 在内部就是以UTC表示时间的。当Ethereal捕获时,不需要进行时间的转换。但是,如果系统时区没有正确的设置,系统的UTC时间可能不正确,即使正确的显示了时间。基于Windows 9x 的系统(Windows 95, Windows 98, Windows Me) 内部是以本地时间表示的。当捕获时WinPcap不得不转换成UTC后提交给Ethereal。如果时区没有正确的设置,转换就会不正确。

其它捕获文件格式,如Microsoft Network Monitor, DOS-based Sniffer, and Network Instruments Observer格式, 则用本地时间保存包的到达时间。

Ethereal内部,时间戳是以UTC表示的;这意味着,当读取捕获文件,包的到达时间如果是本地时间,那么就需要进行转换。

Ethereal总是以本地时间格式显示时关戳。计算机将翻译UTC时间为本地时间并显示。由于捕获文件是以UTC格式保存包的到达时间,这就味着包的到达时间将会以你 的时区来显示本地时间。which might not be the same as the arrival time in the time zone in which the packet was captured. 由于捕获文件以本地时间做包的到达时间进行保存,将会使用你的时区设置将其转换成UTC时间。which means the conversion will not be done correctly; the conversion back to local time for display might undo this correctly, in which case the arrival time will be displayed as the arrival time in which the packet was captured.

表 7.1. UTC时区的例子(没有DST)

 

洛杉矶

纽约

马德里

伦敦

柏林

东京

Capture File (UTC)

10:00

10:00

10:00

10:00

10:00

10:00

Local Offset to UTC

-8

-5

-1

0

+1

+9

Displayed Time (Local Time)

02:00

05:00

09:00

10:00

11:00

19:00

例: 让我们假设一个人在洛杉矶用Ethereal捕获了一个包,时间是本地时间2点,并将这个文件送给了你。捕获文件的时间戳将被换成UTC时间,即10点钟。你正位于柏林,在Ethereal上你看到的时间是11:00。

现在,你要通过电话,视频会议或InternetMeeting与那个人讨论捕获文件。由于你们俩都是看到的本地时间,一个看到的是洛杉矶时间2:00,而你在柏林看到的是11:00点。时间显示是不同的,因为Ethereal显示的是本地时间。

结论: 你或行不会因为日期/时间而烦恼,至少你确认那些日期/时间是你所期望的。因此,如果从一个不同的时区或者DST得到一个捕获文件,你不得不注意两个本地时间的不同,并且在心里调整时间戳。其它情况,尽量确认有问题的计算机设置了同样的时间和时区。

7.5. 包的重新封装

7.5.1. 这是什么?

网络协议经常需要传输大块的数据,直至全部完成。例如传输一个文件的情况。 下层协议不能够处理大块的数据(受网络包尺寸限制),或者如基于流的如TCP,不知道数据块太大。

在那种情况下,网络协议不得不自己处理大块的数据,将其分隔在多个包中。明显的,在接收端也需要一个机制来对其重新组装。

提示!

Ethereal称这个机制为重新封装, 虽然一个特定协议使用不同的术语 (例:分段,分帧).

7.5.2. Ethereal如何处理

对于Ethereal知道的一些网络协议,它有一个发现,解码并且显示大块数据的机制。Ethereal 试图发现大块数据的相应的包,并且显示组合过的数据,通常在包字节面板,做为追加的页(关于这个面板的信息,见Section 3.17, “包字节 面板”).

图 7.2. 带有重新封装的包字节面板

注意!

重新封装可能发生在几个协议层,因此,在包字节面板中有多个标签(tab)是可能的。

注意!

用户会在大块数据的最后一个包中发现重新封的数据

例子:在HTTP 的GET 的回应中,需要数据被返回(如:一个 HTML 页面)。 在包字节面板中,Ethereal会显示十六进制的dump数据,在一个新的叫做“Uncompressed entity body”的新的tab中。

重新封装在参数设置中默认是使能的。在2005年10月以后,这个参数可能更改了,可以enable,也可以disable。如果这个日期之前你设置了参数,你需要确认一下是否真的enable了。因为它对分析网络包太有用了。

一个协议的重新封装设置与否通常需要看两件事:

1.      低层协议必须支持重新封装(如 TCP) 。通常重新封可以通过协议参数设置为enabled 或disabled 。

2.      高层协议 (e.g., HTTP) 必须使用重封装机制进重新封装被分帧了的协议数据。这也能通过协议参数设置enable或disable

高层协议设置的工具提示将提醒你是否或者哪一个低层协议也需要考虑。

7.6. 名称解析

名称解析试图将一些数值型的地址值解析成人们可读的格式。取决于要解析的东西,有两种可能办法来完成这个转换,:调用系统/网络服务(如gethostname函数) 且/或从Ethereal配置文件中得到。有关Ethereal用来进行名称解析的配置文件的详细说明,见附录 A, 配置文件和文件夹.

对下列部分的协议层,名称解析特性可以被分别的enable及disable。

7.6.1. 名称解析的缺点

在使用Ethereal时,名称解析的价值有时是很高的,它可甚至可以节省你几个小时的工作。不幸的是,它也有缺点。

·         名称解析经常失败。被解析的名字可能域名服务器不知道,或者服务器不可用,或者在Ethereal的配置文件中无法找到

·         解析的名字不被存在捕获文件中,也不会存在其它任何地方。 因此,如果以后再打开这个捕获文件或在其它机器上打开,原来解析过的名字就不能用了。每次你打开一个捕获文件,可能看起来都有些不太一样,或许就是因为你不能连接到一个域名服务器(之前你可能可以连接)的原因

·         DNS可能会增加一些包到你的捕获文件中。Y由于进行域名解析,你可能会发现一些DNS包进入了你的捕获文件中,而这些DNS解析是由Ethereal发出的。XXX - are there any other such packets than DNS ones?

·         解析的 DNS名被Ethereal缓存了下来.  为了提高效率这是需要的。但是如果Ethereal运行过程中,域名进行了改变,而Ethereal又由于Cache了DNS名称,而没有注意到这个改变。

注意!

当包进入包列表时,名称解析就做完了。当一个包被追加到列表中时,如果一个名称不能被解析,那么已登记的项将不会改变。由于名称解析会被Cache,你可以使用"View/Reload"来重建包列表,这次就会正确的解析名字。但是当一个捕获正在进行时,这是不可能的。

7.6.2. 以太网名称解析 (MAC 层)

试图解析以太网的MAC地址(e.g. 00:09:5b:01:02:03) 更可读。

ARP 名称解析 (系统服务) Ethereal 将要求操作系统翻译一个以太网地址为相应的IP地址 (e.g. 00:09:5b:01:02:03 -> 192.168.0.1).

以太网代码(ethers 文件) 如果ARP 名称解析失败,Ethereal试图翻译以太网地址为一个已知的设备名(由用户在ethers文件中指定) (e.g. 00:09:5b:01:02:03 -> homerouter).

以太网厂家代码 (manuf文件) 如果ARP和ethers都不能返回一个结果, Ethereal 试图翻译MAC的前三个字节为一个缩写的厂家名, 这个厂家名通常已被EC指定了(e.g. 00:09:5b:01:02:03 -> Netgear_01:02:03).

7.6.3. IP名称解析(网络层)

试图解析一个IP地址,使其更具有可读性。

DNS/ADNS 名称解析(系统/库服务) Ethereal 将要求操作系统 (或者ADNS 库), 将一个IP地址翻译成一个与其相关的主机名(e.g. 65.208.228.223 -> www.ethereal.com). DNS 服务会呼叫到DNS服务器。因此,Ethereal将停止响应,直到一个DNS应答返回。如果可能,你或许可以考虑使用ADNS 库(不等待一个网络回应)

警告!

使能网络名称解析,而DNS又不可用时,将严重的降低Ethereal的速度,因为它要等待DNS应答直到超时。在这种情况下使用 ADNS

DNS 与 ADNS 一个简短的比较:都是翻译IP为一个可读性强的名称。通常DNS调用gethostname() 去翻译成名字。为了达到这个目的,它将首先查看hosts文件。如果失败,将要求DNS服务器给出名字。

因此当系统等待DNS服务器的回应时,DNS与 ADNS的本质区别就出来了。gethostname() 将一直等待只到名称被解析出来或者一个错误出现。如果一个DNS服务器不可用,那就会花费几秒钟的时间。ADNS的工作原理有点不一样。它也要求DNS服务器,但它不等待回答。它在很短的时间内返回Ethereal,实际的(包括随后的)地址字段将不显示解析的名称。直到ADNS呼叫返回。正如上面提到的,返回的值将被Cache下来,需要使用View/Reload 来更新这些字段来显示解析的值

hosts 文件名称解析   如果DNS 名称解析失败, Ethereal 将查看用户指定的hosts文件,试图翻译IP地址到一个相关的主机名 (e.g. 65.208.228.223 -> www.ethereal.com).

7.6.4. IPX名称解析 (网络层)

ipxnet 名称解析 (ipxnets 文件) XXX - add ipxnets name resolution explanation.

7.6.5. TCP/UDP 端口名称解析 (传输层)

试图解析一个TCP/UDP 端口,使其更具可读性。

TCP/UDP 端口转换(系统服务) Ethereal 将调用系统服务来翻译TCP 或UDP 端口为它的已知名字(e.g. 80 -> http).

7.7. 校验和

几个网络协议使用校验和来确保数据的完整性

提示!

Applying checksums as described here is also known as redundancy check.

校验和是做什么用的?

校验和是用来确保数据在传输或者存贮过程中的完整性的。校验和基本上是一部分数据的计算和。

网络传输经常产生错误,如丢失,重复等。因此在接收端收到的数据可能和发送端 的不一致。显然这是一件坏事情。

正是由于这些传输错误,网络协议常常使用校验和去检测这些错误。传输端将计算校验和,并将其和数据一起传输。接收端将用同样的算法计算接收的数据的校验和,如果计算得到的校验和与接收的校验和不一致,那么传输中肯定出现了错误。

有些校验和算法可以修复简单的错误。

如果错误不能被修复,接收端将丢弃包。取决于网络协议,这个数据丢失可能会被忽略,也可以会被检测到并要求重传。

使用校验和能够彻底的减少传输错误。但是校验和算法不能保证100%的能够发现传输错误,因此还有很少的一些传输错误不能被发现。

有几类不同类型的校验和算法。一个常用的例子是CRC32.。具体选用的校验和算法取决于网络介质希望检测出的错误的比例,错误检测t的重要性,执行计算时的处理器负载,效率等等许多事情。

更多关于校验和的信息参见: http://en.wikipedia.org/wiki/Checksum.

7.7.1. Ethereal 校验和确认

Ethereal 将确认几种协议的校验和,如IP, TCP, ...

它将做象接收端同样的计算,在包细节面板显示校验和字段及注释,如.: [correct], [invalid, must be 0x12345678] 等.

在Ethereal的参数设置的协议部分,可能关闭一些协议的检验和确认,能稍许的提高效率。

如果校验和确认使能了,并且检测出了一个非法的校验和,有一些功能将不被处理,如重新封装。这是为了避免错误的数据搞乱内部数据库。

7.7.2. 校验和卸载

校验和计算可以由网络驱动,协议驱动,甚至硬件来完成。

例如:以太网传输硬件计算以太网CRC32 校验和,接收端硬件确认这个校验和。如果接收端的校验和是错误的,Ethereal甚至都不能看到这个包,因为硬件可能直接就把这个包仍掉了。.

高层校验和传统上是由协议实施计算的,并且完成封包后,扔给硬件去处理。

最近网络硬件可以执行一些先进的特性了,如IP地址校验和的计算,也就是我们常说的校验和卸载。网络驱动自己不再计算校验和,而是简单的置为空后,直接由硬件去完成。

注意!

校验和卸载常常引起混乱。因为网络包在实际计算校验和之前已经由Ethereal处理了。Ethereal得到一些空的校验和,就认为是非法的,即使在离开网卡之前这些包都拥有 了合法的校验和。

校验和卸载会带来混乱,屏幕上会有许多[invalid] 恼人的信息。正如上面我们提到的,非法校验和可能造成无法重新封装,包的分析难度加大等问题。.

做两件事情,可能避免校验和卸载带来的问题:

·         在网络驱动层关闭校验和卸载(如果这个选项可用)

·         在Ethereal参数设置中关闭相应协议的校验和确认

Chapter 8. 统计

8.1. 介绍

Ethereal 提供了广泛的网络统计功能。

这些统计功能从常规信息统计(如捕获的包的数量),到特定协议的统计(如http请求和响应包的数量)

·         常规统计

o        汇总 关于捕获文件

o        捕获的数据包的协议分层式的统计

o        点到点 如从A到B的流量统计

o        会话 如:在一对特定地址之间的流量

o        输入输出图形 实时可视的查看包的数量

·         对特定协议的统计

o        服务响 应时间  某此协议的请和应答的时间差

o        其它  特定协议的统计

注意!

特定协议的统计需要知道该协议的详细的知识,除非你对这个协议很熟悉,否则统计数据会显示非常难以理解。

8.2. “Summary”(汇总)窗口

对捕获文件的常规统计

图 8.1. 汇总窗口

·         File(文件) 关于捕获文件的一常规性的信息

·         Time(时间) 第一个包及最后一个包的时间戳,以及之它们之间的时间差

·         Capture(捕获) 捕获完成后的信息(仅在数据是从网络上捕获的时侯可用,如果是从文件装入,该项不可用)

·         Display(显示)    与显示相关的信息

·         Traffic(流量) 网络流量的统计。如果显示过滤被设置,就会看两列值, Captured 列与前面讲的是一样的, Displayed 列将反映显示的包的相关的统计值

8.3. "Protocol Hierarchy"(协议分层)窗口

捕获的包的协议分层统计

图 8.2. The "Protocol Hierarchy"(协议分层)窗口

这是一个捕获后,所有协议的树。用户可以折叠或者展开任意一个子树,默认情况下,所有树都是展开的。

每一行包含一个协议的统计值

统计数值的下面这些列是可用的:

·         Protocol 协议的名称

·         % Packets 占所有包的百分比

·         Packets 该协议包的数量

·         Bytes 该协议流量的字节数

·         MBit/s 该协议占用的带宽

·         End Packets 协议的包的数量(这个协议是解码的最高层的协议[译:意指上层,靠进应用的部分])

·         End Bytes 协议的字节数(这个协议是解码的最高层的协议)

·         End MBit/s 带宽(这个协议是解码的最高层的协议)

注意!

包通常会包含着多个协议,因此每个包会有多个协议统计。例:在上图中IP是99,17%, TCP 85,83% (超过100%了).

注意!

一个单独的包可能包含同样的协议超 过一个。在这种情况下,协议统计也会超过一次。例如:在某些通道配置中,IP层可能出现两次

8.4. 端点

捕获的端点的统计

 

提示!

如果你正在找一个称为hostlist的网络工具,这个正好可以完成这个功能。以太网列表或IP地址通常就是你要的信息

8.4.1. 什么是端点?

A network endpoint is the logical endpoint of separate protocol traffic of a specific protocol layer. The endpoint statistics of Ethereal will take the following endpoints into account:

·         Ethernet 以太网的端点靠MAC地址来识别

·         Fibre Channel

·         FDDI FDDI靠FDDI MAC地址来识别.

·         IPv4 用它的IP地址来识别

·         IPX

·         TCP 是一个IP地址和一个端口的组合,因此同一IP地址下的不同的端口将做为不同的TCP端点

·         Token Ring Token Ring端点靠Token Ring MAC地址来识别

·         UDP  UDP端战火是一个IP地址和UDP端口的组合,因此同一个IP的不同端口是不同的UDP端点。

 

广播 /组播端点

广播 / 组播流量将被做为追加的端点单独显示。当然,由于这些端点是一些虚拟的端点,因此,实际的接收方将是在单播列表中列出的端点所接收的。

8.4.2. 端点窗口

这个窗口显示端点的统计数据

图 8.3. 端点窗口

 

在这个窗口中,对于每一个支持的协议,会有一个标签。标签标记中包含了捕获的端点数量(例:标为 "Ethernet: 5"说明有5个ethernet端点被捕获)。如果对于一个协议来讲没有捕获到任何端点,那么这个标答的标记就会变成灰色(虽然相关的页仍旧可以被选择)

在表中的每一行显示一个端点的统计数值

名称解析  将被执行,如果选择了该项。and if it is active for the specific protocol layer (MAC layer for the selected Ethernet endpoints page). 你可能已经注意到,第一行的前三个字节转换成了"Netgear", 第二行的地址解析成了一个IP地址 (使用 ARP),第三行则解析成一个广播 (如不解析则仍会为: ff:ff:ff:ff:ff:ff), 最后两个的以太网地址保持不变,未被解析。

 

提示!

这个窗口会不停的更新,甚至在开始捕获之前打开,这是非常有用的。

8.4.3. 特定协议的端点列表窗口

Before the combined window described above was available, each of its pages were shown as separate windows. 虽然组合的窗口也是非常方便使用,但这些独立的窗口仍旧可用的。主要理由是:这样在处理大文件时会快一些。但是由于他们的功能与组合窗口中的是一样的,所以就不在这儿再讨论了。

8.5. 会话

会话的统计

8.5.1. 什么是会话?

一个网络会话是指两个特定端点之间的通讯。例如:一个IP会话是两个IP地址之间的通讯。对已知的端点类型的描述可参见Section 8.4.1, “什么是端点类型”.

8.5.2. 会话窗口

在内容列表中,会话窗口的工作与端点的是一样的。可参考Section 8.4.2, “端点窗口”

图 8.4. 会话窗口

8.5.3. 特定协议的会话列表窗口

Before the combined window described above was available, each of its pages were shown as separate windows. 虽然组合的窗口也是非常方便使用,但这些独立的窗口仍旧可用的。主要理由是:这样在处理大文件时会快一些。但是由于他们的功能与组合窗口中的是一样的,所以就不在这儿再讨论了。

8.6. "IO图形"窗口

用户可配置捕获的网络包的图形

可以定义最多五个不同颜色的图形

图 8.5. "IO 图形"窗口

用户可以配置下面的内容

·         Graphs 图形

o        Graph 1-5 enable图形1-5 (默认仅仅图形1是使用的)

o        Color 图形的颜色(不可改变)

o        Filter: 为这个图形设置一个显示过滤 (仅仅符合条件的才被进行统计)

o        Style: 图形的类型 (线型Line/Impulse/柱形)

·         X 轴

o        Tick interval an interval in x direction lasts (10/1/0.1/0.01/0.001 seconds)

o        Pixels per tick use 10/5/2/1 pixels per tick interval

·         Y 轴

o        Unit the unit for the y direction (Packets/Tick, Bytes/Tick, Advanced...)

o        Scale the scale for the y unit (10,20,50,100,200,500,...)

 

8.7. 服务响应时间

服务响应时间是指一个请求与响应之间的时间间隔。这个信息对许多协议都很有用。

服务响应时间的统计目前可应用于如下协议:

·         DCE-RPC

·         Fibre Channel

·         H.225 RAS

·         LDAP

·         MGCP

·         ONC-RPC

·         SMB

做为一个例子, 对DCE-RPC 服务响应时间进行细质的描述

注意!

The other Service Response Time windows will work the same way (or only slightly different) compared to the following description.

8.7.1. DCE-RPC服务响应时间窗口

DCE-RPC的服务响应时间是指请求与响应之间的时间。

首先,选择一个DCE-RPC 接口

图 8.6. 计算DCE-RPC统计窗口

也可以设置一个显示过滤,以减少包的数量。

图 8.7. "DCE-RPC 统计 窗口

每一行对应一个接口选择的方法(EPM 接口的版本3有7个方法)。对于每一种方法,呼叫数,SRT时间统计 被计算的。

8.8. 特定协议统计窗口

特定协议统计显示特定协议的详细信息,将在该文档的以后版本中进行说明。

这些统计的一部分描述可参见http://wiki.ethereal.com/Statistics

Chapter 9. 定制Ethereal

9.1. 介绍

Ethereal的默认行为通常适合于用户的需要,工作几乎非常好。但是,要想熟练掌握Ethereal, 须要能够对其进行定制,以便更好的适应工作的需要,在这一章,我们将学习:

·         怎么在命令行启动Ethereal及命令行参数的应用

·         怎样对包列表进行着色?

·         怎样控制解码?

·         怎样使用参数设置

9.2. 从命令行启动Ethereal

用户可以从命令行启动Ethereal,但是它也可以从Windows管理器来启动。在这一部分,我们来看一下从命令行启动Ethereal。

Ethereal 支持大量的命令行参数。要想知道其支持的参数,使用命令ethereal -h 来得到帮助信息,例如例子 9.1, “Ethereal可用的帮助信息” (or something similar) 将被显示

例子 9.1. Ethereal可用的帮助信息

 
This is ethereal 0.10.13
 (C) 1998-2005 Gerald Combs <gerald@ethereal.com>
 
Compiled with GTK+ 2.6.9, with GLib 2.6.6, with WinPcap (version unknown),
with libz 1.2.3, with libpcre 6.3, with Net-SNMP 5.2.1.2, with ADNS.
 
Running with WinPcap version 3.1 (packet.dll version 3, 1, 0, 27), based on libp
cap version 0.9[.x] on Windows XP Service Pack 2, build 2600.
 
ethereal [ -vh ] [ -DklLnpQS ] [ -a <capture autostop condition> ] ...
        [ -b <capture ring buffer option> ] ...
        [ -B <capture buffer size> ]
        [ -c <capture packet count> ] [ -f <capture filter> ]
        [ -g <packet number> ] [ -i <capture interface> ] [ -m <font> ]
        [ -N <name resolving flags> ] [ -o <preference/recent setting> ] ...
        [ -r <infile> ] [ -R <read (display) filter> ] [ -s <capture snaplen> ]
        [ -t <time stamp format> ] [ -w <savefile> ] [ -y <capture link type> ]
        [ -X <eXtension option> ] [ -z <statistics> ] [ <infile> ]     

我们将依次检查每一个命令行选项

第一件事情就是注意到输入ethereal 将会运行Ethereal。 但是,你可以包含许多你喜欢的命令行参数。 它们的含义如下:

-a <捕获自动停止条件>

指定一个停止捕获的标准。这个标准的格式为: test:value,其中test是下面的其中之一:

duration:value

过设置的秒数后,停止捕获。

filesize:value

当到达设定的文件尺寸时停止捕获。文件大小的单位是K。注意1K等1000字节,而不是1024字节。如果这个选项与-b 一起使用, 当到达设定的文件大小后,Ethereal停止向当前文件写入数据,转而切换到下一个文件。

files:value

达到设定的文件数量后停止捕获。

-b <捕获环形buffer选项>

如果指定了一个最大捕获文件尺寸,引起Ethereal进入到环形buffer工作模式,这种工作模式需要特定的文件数量。在环形buffer模式,Ethereal将数据写入几个文件,文件名是基于建立日期时间及文件编号而组成的。

当第一个文件填满后,Ethereal切换到下一个文件,直到循环到最后一个文件,然后再放弃第一个文件的原数据,重新再写入到这个文件,如此循环下去。 (指定为0,那么文件数就不受限制了

如果指定了duration 选项, Ethereal会在规定的秒数后切换到下一个文件,即使当前的文件还没有填满。

duration:value

当规定的时间到达后,切换到下一个文件。即使当前的文件未满

filesize:value

当到达规定的文件大小后切换到下一个文件,以K为单位(在这里,1K等1000个字节,而不是1024字节)

files:value

当到达指定的文件数时,再从第一个文件开始写(形成一个环形buffer).

-B <捕获buffer 大小 (仅适用Win32)>

仅适用Win32: 设置捕获buffer的大小(默认为1M)。捕获驱动程序使用的,用来保存捕获的数据包的,一直到数据被写入磁盘。如果遇到包丢失的情况,可以试着增大这个值。

-c <捕获包统计>

这个选项指定捕获的包的最大数量。该参数可与-k 选项联合使用

-D

列出Ethereal可以进行捕获的接口卡的列表,然后退出。对于每一个网络接口,会有一个接口号,一个名字,然后是对该接口的文本描述,接口名或者编号可以支持-i 选项,以便指定在其上进行捕获。

这对于系统没有列出接口卡的命令时很有用处。(例如: Windows系统或都缺少ifconfig -a的UNIX系统) ;在Windows 2000及以后的系统中,接口编号是很有用的,因为WINDOWS系统的接口名称非常复杂

注意,“可捕获”意味着Ethereal可以打开那个设备去做一个实时捕获;通常要做一个网络捕获,程序必须在一个特定权限的帐房下进行(比如:root),那么Ethereal  -d如果没有在这个帐户下运行,就有可能不能列出你要的接口卡

-f <捕获过滤>

设置捕获时采用的捕获过滤表达式

-g <包的编号>

当使用-r 读入捕获文件后,跳转到指定编号的包。

-h

列出Ethereal的版本信息及帮助信息,然后退出

-i <捕获接口卡>

设置用来捕获的网络接口卡的名字或着管道的名字

网络接口卡的名字是ethereal -D 列表中的其中的一个(上面描述过了); 也可以用ethereal –D报告的一个数字。如果是UNIX系统, netstat -i or ifconfig -a 也可以显示 接 口卡的名字,虽然并不是所有的UNIX版本都支持-a选项

如果未指定接口卡,Ethereal会扫描接口卡列表,选择第一个非loopback接口作为捕获接口。如果没有非loopback接口,那么就选择就一个loopback接口;如果没有接口卡,Ethereal就会报告一个错误,不起动捕获。

Pipe names should be either the name of a FIFO (named pipe) or ``-'' to read data from the standard input. Data read from pipes must be in standard libpcap format.

-k

该参数使的Ethereal立即启动捕获,这个选项需要用 -i 参数指定将要运行捕获的接口

-l

这个选项打开自动滚动功能.

-L

列出接口支持的数据链路层,然后退出

-m <字体>

这个选项设置Ethereal显示大多数文本时使用的字体的名字

-n

放弃网络目标名称解析(比如主机名, TCP和UDP端口名).

-N <名称解析标志>

打开地址和端口号的名称解析。参数是一个字符串,如包含m 则指enable MAC 地址解析; n 表示 enable网络地址解析; t 表示enable 传输层端口解析。 如果-N and -n 都出现了,那么-N参数覆盖-n。The letter C enables concurrent (asynchronous) DNS lookups.

-o <preference/recent settings>

设置一个参数和值,以替代默认值或者从偏好参数文件中读出的值。参数是一个字符串,格式为:参数名:值。 参数名是指一个参数的名称与在(preference/recent文件中出现的名字一样), 值是将要被设成的值。多个-o <preference settings> 实例可以出现在同一命令行中

一个例子:

ethereal -o mgcp.display_dissect_tree:TRUE

设置多个偏好值的例子:

ethereal -o mgcp.display_dissect_tree:TRUE -o mgcp.udp.callagent_port:2627

提示!

用户可以得到一个可用的偏好字符串,参见附录 A, 配置文件和文件夹.中的偏好文件。

-p

不把网卡设置成混杂模式。注意,在混杂模式,可以捕获到任何到达该网络的数据包,而不管是不是真的要发给该网卡;而如果不设置成混杂模式,那么只能捕获到进出该机器的数据包,广播包和相应的多播包。其它到达捕获接口,但不是送到这台主机的包就会被网卡从低层过滤掉,而不会送到捕获程序

-Q

当捕获完成时,该选项强制Ethereal退出。可以与-c 一起使用。它必须与-i 和 -w 一起使用。

-r <文件名>

这个选项使用Ethereal从给定的捕获文件读入并显示。这个文件必须是Ethereal能够理解的格式。

-R <读(显示)过滤>

当从一个捕获文件读入时,该选项可以设置一上显示过滤。显示过滤的语法我们在Section 6.2, “Filtering packets while viewing”.中讨论过了。不匹配的包将不被显示

-s <捕获包长度( snaplen)>

当时行捕获时,这个选项可以指定snapshot的长度,Ethereal将根据snaplen的值,来捕获一个包的最大字节数。即它只捕获每个包的snaplen个字节

-S

这个选项指定在捕获时,Ethereal将自动显示捕获的包。这是通过显示进程与捕获进程分离来实现的。这与捕获选项中的"Update list of packets in real time"(实时更新包列表)功能是一样的。

-t <时间标签格式>

这个选项设置在包列表窗口中,时间戳的显示格式。格式可以是下面的一种:

·   r 关联, 即与第一个包的时间差

·   a 绝对时间,即捕获时的实际时间

·   ad 带日期的绝对时间,即实际的日期和时间

·   d delta, 即与前一个包的时间差

-v

列出Ethereal的版本信息然后退出

-w <保存的文件名>

将捕获保存到指定的文件中

-y <捕获链路类型>

如果在命令行采用了-k参数进行捕获,将设置捕获包的链路类型。链路类型可以通过-L 选 项获得

-X <eXtension option>

Specify an option to be passed to a Tethereal module. The eXtension option is in the form extension_key:value, where extension_key can be:

lua_script:lua_script_filename Tell Ethereal to load the given script in addition to the default Lua scripts.

-z <统计串>

Get Ethereal to collect various types of statistics and display the result in a window that updates in semi-real time. XXX - add more details here!

9.3. 包的着色

在Ethereal中,一个非常有用的机制就是对包的着色。用户可以按照不同的条件对包进行着色。这样可以实现对我们感兴趣的包进行强调的作用。

提示!

可以在下面的地址获得许多对包进行着色的例子: Ethereal Wiki Coloring Rules page at http://wiki.ethereal.com/ColoringRules.

要对包进行着色,选择菜单view- Coloring Rules... ,Ethereal 会弹出一个"Coloring Rules"(着色规则)对话框,如图 9.1, “着色规则对话框”所示。.

图 9.1. 着色规则对话框

着色规则窗口弹出后,会有一些按钮供用户使用。

注意!

用户需要仔细的选则着色规则的顺序,因为它们是从上到下依次被应用的。因此,某些规则应该放到前面。例如:如果在DNS着色规则之前有一个UDP着色规则,那么DNS着色规则永远不会被采用,因为DNS就是一个UDP包,因此,将首先匹配位于前面的UDP规则。

如果是第一次使用着色规则,单击New 按纽将会弹出一个编辑颜色过滤对话框,如图所示图 9.2, “编辑颜色过滤对话框”.

图 9.2. 编辑颜色过滤对话框

在编辑颜色对话框中,可以随便输入一个名字,然后输入一个过滤串。 图 9.2, “编辑颜色过滤对话框” 显示的是一个名字为ARP的着色规则,对应着将选择所有的ARP包进行基于这个规则的着色。输入完成这些后,就可以为这个规则选则前景色和背景 色。

图9.3. 选择颜色对话框

选择你想要的颜色,然后点击OK确认。

注意!

You must select a color in the colorbar next to the colorwheel to load values into the RGB values. Alternatively, you can set the values to select the color you want.

图 9.4, “在Etherenet中使用颜色过滤” 是一个在Ethernet中几个颜色过滤的例子。用户可能并不喜欢给出的颜色。

图 9.4. 在Ethereal中使用颜色过滤

9.4. 控制协议解码

用户可控制怎样对协议进行解码。

每一个协议有自己的解码器。因此,要解码一个完整的数据包通常将会调用几个解码器。对于每一个包Ethereal都试图去采用正确的解码器((using static "routes" and heuristics "guessing"), 在特殊情况下,有可能会选择一个错误的解码器。例如,如果使用800端口来运行http而不是通常的80端口,那么Ethereal就不知道要用http协议来解码这个包。

有两种方法可以控制协议与解码器之间的关系:完全的放弃一个协议解码器或者临时使用一个解码器。

9.4.1. Enable的协议对话框

Enabled 协议对话框使用用户可以enable/disable一个特定的协议,默认情况下所有协议都enable的。当一个协议被disable时,Ethereal停止处理这类包。

注意!

放弃一个协议将会避免高层协议显示。例如:假如用户放弃了IP协议的解码,当遇到一个包,包含Ethernet, IP, TCP,和 HTTP 信息时,以太网信息将会显示出来,但是IP,TCP,HTTP将不会显示出来。

图 9.5. "Enable的协议"对话框

要想disable/enable 一个协议,选中某个协议后,简单的通过鼠标点击或按空格就可以实现enable/disable。

警告!

用户必须使用SAVE保存。OK和APLLY按纽并不永久的保存你的改变,因此一旦Ethereal关闭了,你的改变也就丢失了

用户可以选择下列一些行为:

1.      Enable All Enable列表中的所有协议

2.      Disable All Disable列表中的所有协议

3.      Invert 反选列表中的所有协议

4.      OK 应用所做的修改并且关闭对话框

5.      Apply 应用所做的修改,不关闭对话框

6.      Save 保存设置到disabled_protos, 参见 附件 A, 配置文件和文件夹

7.      Cancel 取消所做的修改并退出对话框。

9.4.2. 用户指定的解码器

"Decode As"(用XX解码)功能让用户可以临时指定一个协含义解码器。如果用户想做一些非常规的实验,这个功能是非常有用的。

图 9.6. "Decode As"对话框

这个对话框的内容取决于它打时你所选的包。

警告!

用户指定的解码器不能被保存,当Ethereal退出时,这些设置会丢失。

1.      Decode 按所选的方式解码包

2.      Do not decode 不按所选的方式解码包

3.      Link/Network/Transport Specify the network layer at which "Decode As" should take place. Which of these pages are available, depends on the content of the selected packet when this dialog box wasopened.

4.      Show Current 打开一个窗口,显示当前用户定义的解码器列表

5.      OK 使用当前选择的解码器,并关闭这个对话框

6.      Apply 使用当前选择的解码器,不关闭对话框

7.      Cancel 取消所做修改并关闭对话框

9.4.3. 显示用户指定的解码器

这个对话框显示当前用户定义的解码器

图 9.7. "Decode As: Show"(按…解码:显示)对话框

1.      OK 关闭这个对话框

2.      Clear 删除所有的特定解码器

9.5. 参数选择

用户可以对Ethereal的一些参数进行设置。可以通过Edit->Preferences菜单项进入设置。Ethereal会弹出参数设置对话框,如 图 9.8, “参数设置对话框”, 默认是用户接口页。其中左边是一个树形的用户可以选择的页。

注意

参数设置部分经常被增加内容。最新的参数设置页的解释和设置可以参见Ethereal Wiki Preferences page at http://wiki.ethereal.com/Preferences.

警告!

OK和APPLY按纽将不保存参数设置,要想保存,必须使用Save按纽。

·         OK 按纽:应用设置的参数,关闭对话框

·         Apply 按纽:应用设置的参数,不关闭对话框

·         Save 按纽:应用设置的参数,保存设置,不关闭对话框

·         Cancel 按纽:恢复所有的设置到最近保存的状态

图 9.8. 参数设置对话框

附件 A. 配置文件及文件夹

Ethereal运行时,要用到一些文件和文件夹,其中一些文件保存在个人配置文件夹中,Some of these reside in the personal configuration folder and are used to maintain information between runs of Ethereal, while some of them are maintained in system areas.

提示

A list of the folders Ethereal actually uses can be found under the Folders tab in the dialog box coming up, when you select About Ethereal from the Help menu.

The content format of the configuration files is the same on all platforms. However, to match the different policies for unix and windows platforms, different folders for these files are used.

Table A.1. Configuration files and folders overview

File/Folder

Description

Unix/Linux folders

Windows folders

preferences

Settings from the Preferences dialog box.

/etc/ethereal.conf, $HOME/.ethereal/preferences

%ETHEREAL%\ethereal.conf, %APPDATA%\Ethereal\preferences

recent

Recent GUI settings (e.g. recent files lists).

$HOME/.ethereal/recent

%APPDATA%\Ethereal\recent

cfilters

Capture filters.

$HOME/.ethereal/cfilters

%ETHEREAL%\cfilters, %APPDATA%\Ethereal\cfilters

dfilters

Display filters.

$HOME/.ethereal/dfilters

%ETHEREAL%\dfilters, %APPDATA%\Ethereal\dfilters

colorfilters

Coloring rules.

$HOME/.ethereal/colorfilters

%ETHEREAL%\colorfilters, %APPDATA%\Ethereal\colorfilters

disabled_protos

Disabled protocols.

$HOME/.ethereal/disabled_protos

%ETHEREAL%\disabled_protos, %APPDATA%\Ethereal\disabled_protos

ethers

Ethernet name resolution.

/etc/ethers, $HOME/.ethereal/ethers

%ETHEREAL%\ethers, %APPDATA%\Ethereal\ethers

manuf

Ethernet name resolution.

/etc/manuf

%ETHEREAL%\manuf

hosts

IPv4 and IPv6 name resolution.

$HOME/.ethereal/hosts

%APPDATA%\hosts

ipxnets

IPX name resolution.

$HOME/.ethereal/ipxnets

%ETHEREAL%\ipxnets

plugins

Plugin directories.

/usr/share/ethereal/plugins, /usr/local/share/ethereal/plugins, $HOME/.ethereal/plugins

%ETHEREAL%\plugins\<version>, %APPDATA%\Ethereal\plugins

temp

Temporary files.

Environment: TMPDIR

Environment: TMPDIR or TEMP

Windows folders

%APPDATA% points to the personal configuration folder, typically C:\Documents and Settings\<username>\Application Data (for further details, have a look at Section A.1.1, “Windows profiles”), %ETHEREAL% points to the Ethereal program folder, typically C:\Program Files\Ethereal

Unix/Linux folders

The /etc folder is the global Ethereal configuration folder. The folder actually used on your system may vary, maybe something like: /usr/local/etc.

preferences/ethereal.conf

This file contains your Ethereal preferences, including defaults for capturing and displaying packets. It is a simple text file containing statements of the form:

 
variable: value
           

The settings from this file are read in at program start and written to disk when you press the Save button in the "Preferences" dialog box.

recent

This file contains various GUI related settings like the main window position and size, the recent files list and such. It is a simple text file containing statements of the form:

 
variable: value
           

It is read at program start and written at program exit.

cfilters

This file contains all the capture filters that you have defined and saved. It consists of one or more lines, where each line has the following format:

 
"<filter name>" <filter string>
        

The settings from this file are read in at program start and written to disk when you press the Save button in the "Capture Filters" dialog box.

dfilters

This file contains all the display filters that you have defined and saved. It consists of one or more lines, where each line has the following format:

 
"<filter name>" <filter string>
        

The settings from this file are read in at program start and written to disk when you press the Save button in the "Display Filters" dialog box.

colorfilters

This file contains all the color filters that you have defined and saved. It consists of one or more lines, where each line has the following format:

 
@<filter name>@<filter string>
@[<bg RGB(16-bit)>][<fg RGB(16-bit)>]
        

The settings from this file are read in at program start and written to disk when you press the Save button in the "Coloring Rules" dialog box.

disabled_protos

Each line in this file specifies a disabled protocol name. The following are some examples:

 
tcp
udp
           

The settings from this file are read in at program start and written to disk when you press the Save button in the "Enabled Protocols" dialog box.

ethers

When Ethereal is trying to translate Ethernet hardware addresses to names, it consults the files listed in Table A.1, “Configuration files and folders overview”. If an address is not found in /etc/ethers, Ethereal looks in $HOME/.ethereal/ethers

Each line in these files consists of one hardware address and name separated by whitespace. The digits of hardware addresses are separated by colons (:), dashes (-) or periods(.). The following are some examples:

 
ff-ff-ff-ff-ff-ff    Broadcast
c0-00-ff-ff-ff-ff    TR_broadcast
00.2b.08.93.4b.a1    Freds_machine
        

The settings from this file are read in at program start and never written by Ethereal.

manuf

Ethereal uses the files listed in Table A.1, “Configuration files and folders overview” to translate the first three bytes of an Ethernet address into a manufacturers name. This file has the same format as the ethers file, except addresses are three bytes long.

An example is:

 
00:00:01 Xerox                  # XEROX CORPORATION
        

The settings from this file are read in at program start and never written by Ethereal.

hosts

Ethereal uses the files listed in Table A.1, “Configuration files and folders overview” to translate IPv4 and IPv6 addresses into names.

This file has the same format as the usual /etc/hosts file in unix systems.

An example is:

 
# Comments must be prepended by the # sign!
192.168.0.1 homeserver
        

The settings from this file are read in at program start and never written by Ethereal.

ipxnets

Ethereal uses the files listed in Table A.1, “Configuration files and folders overview” to translate IPX network numbers into names.

An example is:

 
C0.A8.2C.00      HR
c0-a8-1c-00      CEO
00:00:BE:EF      IT_Server1
110f             FileServer3
        

The settings from this file are read in at program start and never written by Ethereal.

plugins folder

Ethereal searches for plugins in the directories listed in Table A.1, “Configuration files and folders overview”. They are searched in the order listed.

temp folder

If you start a new capture and don't specify a filename for it, Ethereal uses this directory to place that file in, see Section 4.6, “Capture files and file modes”.

A.1. Windows folders

Here you will find some details about the folders used in Ethereal on different Windows versions.

As already mentioned, you can find the currently used folders in the About Ethereal dialog.

A.1.1. Windows profiles

Windows uses some special directories to store user configuration files in, named the user profile. This can be confusing, as the default directory location changed from version to version and might also be different forenglish and internationalized versions of windows.

Note!

If you upgraded to a new windows version, your profile might be kept in the former location, so the defaults mentioned here might not apply.

The following will try to guide you to the right place where to look for Ethereals profile data.

95/98/ME

The default in Windows 95/98/ME is: all users work with the same profile, which is located at: C:\windows\Application Data\Ethereal

98/ME (with enabled user profiles)

In Windows 98 and ME you can enable separate user profiles. In that case, something like: C:\windows\Profiles\<username>\Application Data\Ethereal is used.

NT 4

C:\WINNT\Profiles\<username>\Application Data\Ethereal

2000/XP

C:\Documents and Settings\<username>\Application Data, "Documents and Settings" and "Application Data" might be internationalized.

A.1.2. Windows NT/2000/XP roaming profiles

The following will only be applicable if you are using roaming profiles. This might be the case, if you work in a Windows domain environment (used in huge company networks). The configurations of all programs you use won't be saved on the local harddrive of the computer you are currently working on, but on the domain server.

As Ethereal is using the correct places to store it's profile data, your settings will travel with you, if you logon to a different computer the next time.

There is an exception to this: The "Local Settings" folder in your profile data (typically something like: C:\Documents and Settings\<username>\Local Settings) will not be transferred to the domain server. This is the default for temporary capture files.

A.1.3. Windows temporary folder

Ethereal uses the folder which is set by the TMPDIR or TEMP environment variable. This variable will be set by the windows installer.

The default location for temporary files on NT 4 is just C:\TEMP, and in 2000 the default location is some directory under your profile directory but it might have "Temporary Files" in the path name.

Appendix B. Protocols and Protocol Fields

Ethereal distinguishes between protocols (e.g. tcp) and protocol fields (e.g. tcp.port).

A comprehensive list of all protocols and protocol fields can be found at: http://www.ethereal.com/docs/dfref/

Appendix C. Ethereal Messages

Ethereal provides you with additional information generated out of the plain packet data or it may need to indicate dissection problems. Messages generated by Ethereal are usually placed in [] parentheses.

C.1. Packet List Messages

These messages might appear in the packet list.

C.1.1. [Malformed Packet]

Malformed packet means that the protocol dissector can't work out the contents of the packet any further. This can have various reasons:

·         Wrong dissector Ethereal errorneously has chosen the wrong protocol dissector for this packet. This will happen e.g. if you are using a protocol not on it's well known TCP or UDP port. You may try Analyze|Decode As to circumvent this problem.

·         Packet not reassembled The packet is longer than a single frame and it is not reassembled, see Section 7.5, “Packet Reassembling” for further details.

·         Packet is malformed The packet is actually wrong (malformed), meaning that a part of the packet is just not as expected (not following the protocol specifications).

·         Dissector is buggy The corresponding protocol dissector is simply buggy or still incomplete.

Any of the above is possible. You'll have to look into the specific situation to determine what it is. You could disable the dissector by disabling the protocol on the Analyze menu and check how Ethereal displays the packet then. You could (if it's TCP) enable reassembly for TCP and the specific dissector (if possible) in the Edit|Preferences menu. You could check the packet contents yourself by reading the packet bytes and comparing it to the protocol specification. This could reveil a dissector bug. Or you could find out that the packet is indeed wrong.

C.1.2. [Packet size limited during capture]

The packet size was limited during capture, see "Limit each packet to n bytes" at the Section 4.5, “The "Capture Options" dialog box”. While dissecting, the current protocol dissector was simply running out of packet bytes and had to give up. There's nothing else you can do now, except to repeat the whole capture process again with a higher (or no) packet size limitation.

C.2. Packet Details Messages

These messages might appear in the packet details.

C.2.1. [Response in frame: 123]

The current packet is the request of a detected request/response pair. You can directly jump to the corresponding response packet just by double clicking on this message.

C.2.2. [Request in frame: 123]

Same as "Response in frame: 123" above, but the other way round.

C.2.3. [Time from request: 0.123 seconds]

The time between the request and the response packets.

Appendix D. Related command line tools

D.1. Introduction

Beside the Ethereal GUI application, there are some command line tools, which can be helpful for doing some more specialized things. These tools will be described in this chapter.

D.2. tcpdump: Capturing with tcpdump for viewing with Ethereal

There are occasions when you want to capture packets using tcpdump rather than ethereal, especially when you want to do a remote capture and do not want the network load associated with running Ethereal remotely (not to mention all the X traffic polluting your capture).

However, the default tcpdump parameters result in a capture file where each packet is truncated, because tcpdump, by default, does only capture the first 68 bytes of each packet.

To ensure that you capture complete packets, use the following command:

 
tcpdump -i <interface> -s 1500 -w <some-file>
      

You will have to specify the correct interface and the name of a file to save into. In addition, you will have to terminate the capture with ^C when you believe you have captured enough packets.

Note!

tcpdump is not part of the Ethereal distribution. You can get it from: http://www.tcpdump.org for various platforms.

D.3. tethereal: Terminal-based Ethereal

Tethereal is a terminal oriented version of ethereal designed for capturing and displaying packets when an interactive user interface isn't necessary or available. It supports the same options as ethereal. For more information on tethereal, see the manual pages (man tethereal).

D.4. capinfos: Print information about capture files

Included with Ethereal is a small utility called capinfos, which is a command-line utility to print information about binary capture files.

Example D.1. Help information available from capinfos

        
$ capinfos -h
Usage: capinfos [-t] [-c] [-s] [-d] [-u] [-a] [-e] [-y]
                [-i] [-z] [-h] <capfile>
  where -t display the capture type of <capfile>
        -c count the number of packets
        -s display the size of the file
        -d display the total length of all packets in the file
           (in bytes)
        -u display the capture duration (in seconds)
        -a display the capture start time
        -e display the capture end time
        -y display average data rate (in bytes)
        -i display average data rate (in bits)
        -z display average packet size (in bytes)
        -h produces this help listing.
 
            If no data flags are given, default is to display all statistics 
      

D.5. editcap: Edit capture files

Included with Ethereal is a small utility called editcap, which is a command-line utility for working with capture files. Its main function is to remove packets from capture files, but it can also be used to convert capture files from one format to another, as well as print information about capture files.

Example D.2. Help information available from editcap

        
$ editcap.exe -h
Usage: editcap [-r] [-h] [-v] [-T <encap type>] [-E <probability>]
               [-F <capture type>]> [-s <snaplen>] [-t <time adjustment>]
               <infile> <outfile> [ <record#>[-<record#>] ... ]
  where
        -E <probability> specifies the probability (between 0 and 1)
            that a particular byte will will have an error.
        -F <capture type> specifies the capture file type to write:
            libpcap - libpcap (tcpdump, Ethereal, etc.)
            rh6_1libpcap - RedHat Linux 6.1 libpcap (tcpdump)
            suse6_3libpcap - SuSE Linux 6.3 libpcap (tcpdump)
            modlibpcap - modified libpcap (tcpdump)
            nokialibpcap - Nokia libpcap (tcpdump)
            lanalyzer - Novell LANalyzer
            ngsniffer - Network Associates Sniffer (DOS-based)
            snoop - Sun snoop
            netmon1 - Microsoft Network Monitor 1.x
            netmon2 - Microsoft Network Monitor 2.x
            ngwsniffer_1_1 - Network Associates Sniffer (Windows-based) 1.1
            ngwsniffer_2_0 - Network Associates Sniffer (Windows-based) 2.00x
            nettl - HP-UX nettl trace
            visual - Visual Networks traffic capture
            5views - Accellent 5Views capture
            niobserverv9 - Network Instruments Observer version 9
            default is libpcap
        -h produces this help listing.
        -r specifies that the records specified should be kept, not deleted,
                           default is to delete
        -s <snaplen> specifies that packets should be truncated to
           <snaplen> bytes of data
        -t <time adjustment> specifies the time adjustment
           to be applied to selected packets
        -T <encap type> specifies the encapsulation type to use:
            ether - Ethernet
            tr - Token Ring
            slip - SLIP
            ppp - PPP
            fddi - FDDI
            fddi-swapped - FDDI with bit-swapped MAC addresses
            rawip - Raw IP
            arcnet - ARCNET
            arcnet_linux - Linux ARCNET
            atm-rfc1483 - RFC 1483 ATM
            linux-atm-clip - Linux ATM CLIP
            lapb - LAPB
            atm-pdus - ATM PDUs
            atm-pdus-untruncated - ATM PDUs - untruncated
            null - NULL
            ascend - Lucent/Ascend access equipment
            isdn - ISDN
            ip-over-fc - RFC 2625 IP-over-Fibre Channel
            ppp-with-direction - PPP with Directional Info
            ieee-802-11 - IEEE 802.11 Wireless LAN
            prism - IEEE 802.11 plus Prism II monitor mode header
            ieee-802-11-radio - IEEE 802.11 Wireless LAN with radio information
            ieee-802-11-radiotap - IEEE 802.11 plus radiotap WLAN header
            ieee-802-11-avs - IEEE 802.11 plus AVS WLAN header
            linux-sll - Linux cooked-mode capture
            frelay - Frame Relay
            frelay-with-direction - Frame Relay with Directional Info
            chdlc - Cisco HDLC
            ios - Cisco IOS internal
            ltalk - Localtalk
            pflog-old - OpenBSD PF Firewall logs, pre-3.4
            hhdlc - HiPath HDLC
            docsis - Data Over Cable Service Interface Specification
            cosine - CoSine L2 debug log
            whdlc - Wellfleet HDLC
            sdlc - SDLC
            tzsp - Tazmen sniffer protocol
            enc - OpenBSD enc(4) encapsulating interface
            pflog - OpenBSD PF Firewall logs
            chdlc-with-direction - Cisco HDLC with Directional Info
            bluetooth-h4 - Bluetooth H4
            mtp2 - SS7 MTP2
            mtp3 - SS7 MTP3
            irda - IrDA
            user0 - USER 0
            user1 - USER 1
            user2 - USER 2
            user3 - USER 3
            user4 - USER 4
            user5 - USER 5
            user6 - USER 6
            user7 - USER 7
            user8 - USER 8
            user9 - USER 9
            user10 - USER 10
            user11 - USER 11
            user12 - USER 12
            user13 - USER 13
            user14 - USER 14
            user15 - USER 15
            symantec - Symantec Enterprise Firewall
            ap1394 - Apple IP-over-IEEE 1394
            bacnet-ms-tp - BACnet MS/TP
            raw-icmp-nettl - Raw ICMP with nettl headers
            raw-icmpv6-nettl - Raw ICMPv6 with nettl headers
            gprs-llc - GPRS LLC
            juniper-atm1 - Juniper ATM1
            juniper-atm2 - Juniper ATM2
            redback - Redback SmartEdge
            rawip-nettl - Raw IP with nettl headers
            ether-nettl - Ethernet with nettl headers
            tr-nettl - Token Ring with nettl headers
            fddi-nettl - FDDI with nettl headers
            unknown-nettl - Unknown link-layer type with nettl headers
            mtp2-with-phdr - MTP2 with pseudoheader
            juniper-pppoe - Juniper PPPoE
            gcom-tie1 - GCOM TIE1
            gcom-serial - GCOM Serial
            x25-nettl - X25 with nettl headers
            default is the same as the input file
        -v specifies verbose operation, default is silent
 
            A range of records can be specified as well
      

Where each option has the following meaning:

-r

This option specifies that the frames listed should be kept, not deleted. The default is to delete the listed frames.

-h

This option provides help.

-v

This option specifies verbose operation. The default is silent operation.

-T {encap type}

This option specifies the frame encapsulation type to use.

It is mainly for converting funny captures to something that Ethereal can deal with.

The default frame encapsulation type is the same as the input encapsulation.

-F {capture type}

This option specifies the capture file format to write the output file in.

The default is libpcap format.

-s {snaplen}

Specifies that packets should be truncated to {snaplen} bytes of data.

-t {time adjustment}

Specifies the time adjustment to be applied to selected packets.

{infile}

This parameter specifies the input file to use. It must be present.

{outfile}

This parameter specifies the output file to use. It must be present.

[record#[-][record# ...]]

This optional parameter specifies the records to include or exclude (depending on the -r option. You can specify individual records or a range of records.

D.6. mergecap: Merging multiple capture files into one

Mergecap is a program that combines multiple saved capture files into a single output file specified by the -w argument. Mergecap knows how to read libpcap capture files, including those of tcpdump. In addition, Mergecap can read capture files from snoop (including Shomiti) and atmsnoop, LanAlyzer, Sniffer (compressed or uncompressed), Microsoft Network Monitor, AIX's iptrace, NetXray, Sniffer Pro, RADCOM's WAN/LAN analyzer, Lucent/Ascend router debug output, HP-UX's nettl, and the dump output from Toshiba's ISDN routers. There is no need to tell Mergecap what type of file you are reading; it will determine the file type by itself. Mergecap is also capable of reading any of these file formats if they are compressed using gzip. Mergecap recognizes this directly from the file; the '.gz' extension is not required for this purpose.

By default, it writes the capture file in libpcap format, and writes all of the packets in both input capture files to the output file. The -F flag can be used to specify the format in which to write the capture file; it can write the file in libpcap format (standard libpcap format, a modified format used by some patched versions of libpcap, the format used by Red Hat Linux 6.1, or the format used by SuSE Linux 6.3), snoop format, uncompressed Sniffer format, Microsoft Network Monitor 1.x format, and the format used by Windows-based versions of the Sniffer software.

Packets from the input files are merged in chronological order based on each frame's timestamp, unless the -a flag is specified. Mergecap assumes that frames within a single capture file are already stored in chronological order. When the -a flag is specified, packets are copied directly from each input file to the output file, independent of each frame's timestamp.

If the -s flag is used to specify a snapshot length, frames in the input file with more captured data than the specified snapshot length will have only the amount of data specified by the snapshot length written to the output file. This may be useful if the program that is to read the output file cannot handle packets larger than a certain size (for example, the versions of snoop in Solaris 2.5.1 and Solaris 2.6 appear to reject Ethernet frames larger than the standard Ethernet MTU, making them incapable of handling gigabit Ethernet captures if jumbo frames were used).

If the -T flag is used to specify an encapsulation type, the encapsulation type of the output capture file will be forced to the specified type, rather than being the type appropriate to the encapsulation type of the input capture file. Note that this merely forces the encapsulation type of the output file to be the specified type; the packet headers of the packets will not be translated from the encapsulation type of the input capture file to the specified encapsulation type (for example, it will not translate an Ethernet capture to an FDDI capture if an Ethernet capture is read and '-T fddi' is specified).

Example D.3. Help information available from mergecap

 
$ mergecap.exe -h
mergecap version 0.10.5
Usage: mergecap [-hva] [-s <snaplen>] [-T <encap type>]
          [-F <capture type>] -w <outfile> <infile> [...]
 
  where -h produces this help listing.
        -v verbose operation, default is silent
        -a files should be concatenated, not merged
             Default merges based on frame timestamps
        -s <snaplen>: truncate packets to <snaplen> bytes of data
        -w <outfile>: sets output filename to <outfile>
        -T <encap type> encapsulation type to use:
             ether - Ethernet
             tr - Token Ring
             slip - SLIP
             ppp - PPP
             fddi - FDDI
             fddi-swapped - FDDI with bit-swapped MAC addresses
             rawip - Raw IP
             arcnet - ARCNET
             arcnet_linux - Linux ARCNET
             atm-rfc1483 - RFC 1483 ATM
             linux-atm-clip - Linux ATM CLIP
             lapb - LAPB
             atm-pdus - ATM PDUs
             atm-pdus-untruncated - ATM PDUs - untruncated
             null - NULL
             ascend - Lucent/Ascend access equipment
             isdn - ISDN
             ip-over-fc - RFC 2625 IP-over-Fibre Channel
             ppp-with-direction - PPP with Directional Info
             ieee-802-11 - IEEE 802.11 Wireless LAN
             prism - IEEE 802.11 plus Prism II monitor mode header
             ieee-802-11-radio - IEEE 802.11 Wireless LAN with radio information
             ieee-802-11-bsd - IEEE 802.11 plus BSD WLAN header
             ieee-802-11-avs - IEEE 802.11 plus AVS WLAN header
             linux-sll - Linux cooked-mode capture
             frelay - Frame Relay
             frelay-with-direction - Frame Relay with Directional Info
             chdlc - Cisco HDLC
             ios - Cisco IOS internal
             ltalk - Localtalk
             pflog-old - OpenBSD PF Firewall logs, pre-3.4
             hhdlc - HiPath HDLC
             docsis - Data Over Cable Service Interface Specification
             cosine - CoSine L2 debug log
             whdlc - Wellfleet HDLC
             sdlc - SDLC
             tzsp - Tazmen sniffer protocol
             enc - OpenBSD enc(4) encapsulating interface
             pflog - OpenBSD PF Firewall logs
             chdlc-with-direction - Cisco HDLC with Directional Info
             bluetooth-h4 - Bluetooth H4
             mtp2 - SS7 MTP2
             mtp3 - SS7 MTP3
             irda - IrDA
             user0 - USER 0
             user1 - USER 1
             user2 - USER 2
             user3 - USER 3
             user4 - USER 4
             user5 - USER 5
             user6 - USER 6
             user7 - USER 7
             user8 - USER 8
             user9 - USER 9
             user10 - USER 10
             user11 - USER 11
             user12 - USER 12
             user13 - USER 13
             user14 - USER 14
             user15 - USER 15
             symantec - Symantec Enterprise Firewall
             ap1394 - Apple IP-over-IEEE 1394
             bacnet-ms-tp - BACnet MS/TP
             default is the same as the first input file
        -F <capture type> capture file type to write:
             libpcap - libpcap (tcpdump, Ethereal, etc.)
             rh6_1libpcap - RedHat Linux 6.1 libpcap (tcpdump)
             suse6_3libpcap - SuSE Linux 6.3 libpcap (tcpdump)
             modlibpcap - modified libpcap (tcpdump)
             nokialibpcap - Nokia libpcap (tcpdump)
             lanalyzer - Novell LANalyzer
             ngsniffer - Network Associates Sniffer (DOS-based)
             snoop - Sun snoop
             netmon1 - Microsoft Network Monitor 1.x
             netmon2 - Microsoft Network Monitor 2.x
             ngwsniffer_1_1 - Network Associates Sniffer (Windows-based) 1.1
             ngwsniffer_2_0 - Network Associates Sniffer (Windows-based) 2.00x
             visual - Visual Networks traffic capture
             5views - Accellent 5Views capture
             niobserverv9 - Network Instruments Observer version 9
             default is libpcap
      

-h

Prints the version and options and exits.

-v

Causes mergecap to print a number of messages while it's working.

-a

Causes the frame timestamps to be ignored, writing all packets from the first input file followed by all packets from the second input file. By default, when -a is not specified, the contents of the input files are merged in chronological order based on each frame's timestamp. Note: when merging, mergecap assumes that packets within a capture file are already in chronological order.

-s

Sets the snapshot length to use when writing the data.

-w

Sets the output filename.

-T

Sets the packet encapsulation type of the output capture file.

-F

Sets the file format of the output capture file.

A simple example merging dhcp-capture.libpcap and imap-1.libpcap into outfile.libpcap is shown below.

Example D.4. Simple example of using mergecap

$ mergecap -w outfile.libpcap dhcp-capture.libpcap imap-1.libpcap 
      

D.7. text2pcap: Converting ASCII hexdumps to network captures

There may be some occasions when you wish to convert a hex dump of some network traffic into a libpcap file.

Text2pcap is a program that reads in an ASCII hex dump and writes the data described into a libpcap-style capture file. text2pcap can read hexdumps with multiple packets in them, and build a capture file of multiple packets. text2pcap is also capable of generating dummy Ethernet, IP and UDP headers, in order to build fully processable packet dumps from hexdumps of application-level data only.

Text2pcap understands a hexdump of the form generated by od -t x1. In other words, each byte is individually displayed and surrounded with a space. Each line begins with an offset describing the position in the file. The offset is a hex number (can also be octal - see -o), of more than two hex digits. Here is a sample dump that text2pcap can recognize:

 
000000 00 e0 1e a7 05 6f 00 10 ........
000008 5a a0 b9 12 08 00 46 00 ........
000010 03 68 00 00 00 00 0a 2e ........
000018 ee 33 0f 19 08 7f 0f 19 ........
000020 03 80 94 04 00 00 10 01 ........
000028 16 a2 0a 00 03 50 00 0c ........
000030 01 01 0f 19 03 80 11 01 ........
    

There is no limit on the width or number of bytes per line. Also the text dump at the end of the line is ignored. Bytes/hex numbers can be uppercase or lowercase. Any text before the offset is ignored, including email forwarding characters '>'. Any lines of text between the bytestring lines is ignored. The offsets are used to track the bytes, so offsets must be correct. Any line which has only bytes without a leading offset is ignored. An offset is recognized as being a hex number longer than two characters. Any text after the bytes is ignored (e.g. the character dump). Any hex numbers in this text are also ignored. An offset of zero is indicative of starting a new packet, so a single text file with a series of hexdumps can be converted into a packet capture with multiple packets. Multiple packets are read in with timestamps differing by one second each. In general, short of these restrictions, text2pcap is pretty liberal about reading in hexdumps and has been tested with a variety of mangled outputs (including being forwarded through email multiple times, with limited line wrap etc.)

There are a couple of other special features to note. Any line where the first non-whitespace character is '#' will be ignored as a comment. Any line beginning with #TEXT2PCAP is a directive and options can be inserted after this command to be processed by text2pcap. Currently there are no directives implemented; in the future, these may be used to give more fine grained control on the dump and the way it should be processed e.g. timestamps, encapsulation type etc.

Text2pcap also allows the user to read in dumps of application-level data, by inserting dummy L2, L3 and L4 headers before each packet. The user can elect to insert Ethernet headers, Ethernet and IP, or Ethernet, IP and UDP headers before each packet. This allows Ethereal or any other full-packet decoder to handle these dumps.

Example D.5. Help information available for text2pcap

 
$ text2pcap.exe -h
 
Usage: text2pcap.exe [-h] [-d] [-q] [-o h|o] [-l typenum] [-e l3pid] [-i proto]
          [-m max-packet] [-u srcp,destp] [-T srcp,destp] [-s srcp,destp,tag]
          [-S srcp,destp,tag] [-t timefmt] <input-filename> <output-filename>
 
where <input-filename> specifies input filename (use - for standard input)
      <output-filename> specifies output filename (use - for standard output)
 
[options] are one or more of the following
 
 -h              : Display this help message
 -d              : Generate detailed debug of parser states
 -o hex|oct      : Parse offsets as (h)ex or (o)ctal. Default is hex
 -l typenum      : Specify link-layer type number. Default is 1 (Ethernet).
                   See net/bpf.h for list of numbers.
 -q              : Generate no output at all (automatically turns off -d)
 -e l3pid        : Prepend dummy Ethernet II header with specified L3PID (in
                   HEX)
                   Example: -e 0x800
 -i proto        : Prepend dummy IP header with specified IP protocol (in
                   DECIMAL).
                   Automatically prepends Ethernet header as well.
                   Example: -i 46
 -m max-packet   : Max packet length in output, default is 64000
 -u srcp,destp   : Prepend dummy UDP header with specified dest and source ports
                   (in DECIMAL).
                   Automatically prepends Ethernet and IP headers as well
                   Example: -u 30,40
 -T srcp,destp   : Prepend dummy TCP header with specified dest and source ports
                   (in DECIMAL).
                   Automatically prepends Ethernet and IP headers as well
                   Example: -T 50,60
 -s srcp,dstp,tag: Prepend dummy SCTP header with specified dest/source ports
                   and verification tag (in DECIMAL).
                   Automatically prepends Ethernet and IP headers as well
                   Example: -s 30,40,34
 -S srcp,dstp,ppi: Prepend dummy SCTP header with specified dest/source ports
                   and verification tag 0. It also prepends a dummy SCTP DATA
                   chunk header with payload protocol identifier ppi.
                   Example: -S 30,40,34
 -t timefmt      : Treats the text before the packet as a date/time code; the
                   specified argument is a format string of the sort supported
                   by strptime.
                   Example: The time "10:15:14.5476" has the format code
                   "%H:%M:%S."
                   NOTE:    The subsecond component delimiter must be specified
                            (.) but no pattern is required; the remaining number
                            is assumed to be fractions of a second.
      

-w <filename>

Write the capture file generated by text2pcap to <filename>. The default is to write to standard output.

-h

Display the help message

-d

Displays debugging information during the process. Can be used multiple times to generate more debugging information.

-q

Be completely quiet during the process.

-o hex|oct

Specify the radix for the offsets (hex or octal). Defaults to hex. This corresponds to the -A option for od.

-l

Specify the link-layer type of this packet. Default is Ethernet(1). See net/bpf.h for the complete list of possible encapsulations. Note that this option should be used if your dump is a complete hex dump of an encapsulated packet and you wish to specify the exact type of encapsulation. Example: -l 7 for ARCNet packets.

-e l3pid

Include a dummy Ethernet header before each packet. Specify the L3PID for the Ethernet header in hex. Use this option if your dump has Layer 3 header and payload (e.g. IP header), but no Layer 2 encapsulation. Example: -e 0x806 to specify an ARP packet.

For IP packets, instead of generating a fake Ethernet header you can also use -l 12 to indicate a raw IP packet to Ethereal. Note that -l 12 does not work for any non-IP Layer 3 packet (e.g. ARP), whereas generating a dummy Ethernet header with -e works for any sort of L3 packet.

-u srcport destport

Include dummy UDP headers before each packet. Specify the source and destination UDP ports for the packet in decimal. Use this option if your dump is the UDP payload of a packet but does not include any UDP, IP or Ethernet headers. Note that this automatically includes appropriate Ethernet and IP headers with each packet. Example: -u 1000 69 to make the packets look like TFTP/UDP packets.

D.8. idl2eth: Creating dissectors from Corba IDL files

In an ideal world idl2eth would be mentioned in the users guide in passing and documented in the developers guide. As the developers guide has not yet been completed it will be documented here.

D.8.1. What is it?

As you have probably guessed from the name, idl2eth takes a user specified IDL file and attempts to build a dissector that can decode the IDL traffic over GIOP. The resulting file is "C" code, that should compile okay as an ethereal dissector.

idl2eth basically parses the data struct given to it by the omniidl compiler, and using the GIOP API available in packet-giop.[ch], generates get_CDR_xxx calls to decode the CORBA traffic on the wire.

It consists of 4 main files.

README.idl2eth

This document

ethereal_be.py

The main compiler backend

ethereal_gen.py

A helper class, that generates the C code.

idl2eth

A simple shell script wrapper that the end user should use to generate the dissector from the IDL file(s).

D.8.2. Why do this?

It is important to understand what CORBA traffic looks like over GIOP/IIOP, and to help build a tool that can assist in troubleshooting CORBA interworking. This was especially the case after seeing a lot of discussions about how particular IDL types are represented inside an octet stream.

I have also had comments/feedback that this tool would be good for say a CORBA class when teaching students what CORBA traffic looks like "on the wire".

It is also COOL to work on a great Open Source project such as the case with "Ethereal" ( http://www.ethereal.com )

D.8.3. How to use idl2eth

To use the idl2eth to generate ethereal dissectors, you need the following:

Prerequisites to using idl2eth

1.      Python must be installed. See http://python.org/

2.      omniidl from the the omniORB package must be available. See http://omniorb.sourceforge.net/

3.      Of course you need ethereal installed to compile the code and tweak it if required. idl2eth is part of the standard Ethereal distribution

To use idl2eth to generate an ethereal dissector from an idl file use the following procedure:

Procedure for converting a Corba idl file into an ethereal dissector

1.      To write the C code to stdout.

idl2eth  <your file.idl>

eg:

idl2eth echo.idl

2.      To write to a file, just redirect the output.

idl2eth echo.idl > packet-test-idl.c

You may wish to comment out the register_giop_user_module() code and that will leave you with heuristic dissection.

If you don't want to use the shell script wrapper, then try steps 3 or 4 instead.

3.      To write the C code to stdout.

Usage: omniidl  -p ./ -b ethereal_be <your file.idl>

eg:

omniidl  -p ./ -b ethereal_be echo.idl

4.      To write to a file, just redirect the output.

omniidl  -p ./ -b ethereal_be echo.idl > packet-test-idl.c

You may wish to comment out the register_giop_user_module() code and that will leave you with heuristic dissection.

5.      Copy the resulting C code to your ethereal src directory, edit the 2 make files to include the packet-test-idl.c

6.            
7.           cp packet-test-idl.c /dir/where/ethereal/lives/
8.           edit Makefile.am
9.           edit Makefile.nmake
      

10.  Run configure

./configure (or ./autogen.sh)

11.  Compile the code

make

12.  Good Luck !!

D.8.4. TODO

1.      Exception code not generated (yet), but can be added manually.

2.      Enums not converted to symbolic values (yet), but can be added manually.

3.      Add command line options etc

4.      More I am sure :-)

D.8.5. Limitations

See the TODO list inside packet-giop.c

D.8.6. Notes

1.      The "-p ./" option passed to omniidl indicates that the ethereal_be.py and ethereal_gen.py are residing in the current directory. This may need tweaking if you place these files somewhere else.

2.      If it complains about being unable to find some modules (eg tempfile.py), you may want to check if PYTHONPATH is set correctly. On my Linux box, it is PYTHONPATH=/usr/lib/python1.5/

Appendix E. This Document's License (GPL)

As with the original licence and documentation distributed with Ethereal, this document is covered by the GNU General Public Licence (GNU GPL).

If you haven't read the GPL before, please do so. It explains all the things that you are allowed to do with this code and documentation.

 
 
                   GNU GENERAL PUBLIC LICENSE
                      Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.
 
                           Preamble
 
  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.
 
  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
 
  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
 
  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.
 
  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
 
  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
 
  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
 
  The precise terms and conditions for copying, distribution and
modification follow.
 
                   GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".
 
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
 
  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
 
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
 
  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
 
    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.
 
    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.
 
    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)
 
These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
 
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
 
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
 
  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
 
    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,
 
    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,
 
    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)
 
The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
 
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
 
  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
 
  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
 
  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
 
  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
 
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
 
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
 
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
 
  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.
 
  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
 
  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
 
                           NO WARRANTY
 
  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
 
  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
 
                    END OF TERMS AND CONDITIONS
 
            How to Apply These Terms to Your New Programs
 
  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
Also add information on how to contact you by electronic and paper mail.
 
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
 
    Gnomovision version 69, Copyright (C) year  name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
 
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:
 
  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.
 
  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice
 
This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
 
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值