简洁的Pcap文件格式--Wireshark

合集下载

Wireshark图解教程(简介、抓包、过滤器)配置

Wireshark图解教程(简介、抓包、过滤器)配置

Wireshark是世界上最流行的网络分析工具。

这个强大的工具可以捕捉网络中的数据,并为用户提供关于网络和上层协议的各种信息。

与很多其他网络工具一样,Wireshark也使用pcap network library来进行封包捕捉。

可破解局域网内QQ、邮箱、msn、账号等的密码!!wireshark的原名是Ethereal,新名字是2006年起用的。

当时Ethereal的主要开发者决定离开他原来供职的公司,并继续开发这个软件。

但由于Ethereal这个名称的使用权已经被原来那个公司注册,Wireshark这个新名字也就应运而生了。

在成功运行Wireshark之后,我们就可以进入下一步,更进一步了解这个强大的工具。

下面是一张地址为192.168.1.2的计算机正在访问“”网站时的截图。

1. MENUS(菜单)2. SHORTCUTS(快捷方式)3. DISPLAY FILTER(显示过滤器)4. PACKET LIST PANE(封包列表)5. PACKET DETAILS PANE(封包详细信息)6. DISSECTOR PANE(16进制数据)7. MISCELLANOUS(杂项)1. MENUS(菜单)程序上方的8个菜单项用于对Wireshark进行配置:- "File"(文件)- "Edit" (编辑)- "View"(查看)- "Go" (转到)- "Capture"(捕获)- "Analyze"(分析)- "Statistics" (统计)- "Help" (帮助)打开或保存捕获的信息。

查找或标记封包。

进行全局设置。

设置Wireshark的视图。

跳转到捕获的数据。

设置捕捉过滤器并开始捕捉。

设置分析选项。

查看Wireshark的统计信息。

Wireshark的Pcap文件格式分析及解析源码

Wireshark的Pcap文件格式分析及解析源码

Wireshark的Pcap文件格式分析及解析源码Wireshark的Pcap文件格式分析及解析源码下面主要介绍下Ethereal默认的*.pcap文件保存格式。

Pcap文件头24B各字段说明:Magic:4B:0x1A 2B 3C 4D:用来标示文件的开始Major:2B,0x02 00:当前文件主要的版本号Minor:2B,0x04 00当前文件次要的版本号ThisZone:4B当地的标准时间;全零SigFigs:4B时间戳的精度;全零SnapLen:4B最大的存储长度LinkType:4B链路类型常用类型:0 BSD loopback devices, except for later OpenBSD1 Ethernet, and Linux loopback devices6 802.5 Token Ring7 ARCnet8 SLIP9 PPP10 FDDI100 LLC/SNAP-encapsulated ATM101 "raw IP", with no link102 BSD/OS SLIP103 BSD/OS PPP104 Cisco HDLC105 802.11108 later OpenBSD loopback devices (with the AF_value in network byte order)113 special Linux "cooked" capture114 LocalTalkPacket 包头和Packet数据组成字段说明:Timestamp:时间戳高位,精确到secondsTimestamp:时间戳低位,精确到microsecondsCaplen:当前数据区的长度,即抓取到的数据帧长度,由此可以得到下一个数据帧的位置。

Len:离线数据长度:网络中实际数据帧的长度,一般不大于caplen,多数情况下和Caplen数值相等。

wireshark 抓包的格式

wireshark 抓包的格式

Wireshark是一种流行的网络分析工具,它可以捕获和分析网络数据包。

Wireshark抓包的格式是非常重要的,它决定了我们如何解析和分析捕获到的数据包。

本文将介绍Wireshark抓包的格式,包括常见的文件类型和数据结构,并探讨如何有效地利用这些格式进行网络分析和故障排查。

一、Wireshark抓包的文件格式Wireshark可以将捕获到的数据包保存为不同的文件格式,其中常见的包括pcap、pcapng、cap、etl等。

不同的文件格式具有不同的特点和用途,下面我们将逐一介绍它们。

1. pcap格式pcap(Packet Capture)是Wireshark最常用的文件格式,它可以保存捕获到的网络数据包以及相关的信息,如时间戳、数据长度、数据内容等。

pcap格式的文件通常使用libpcap或WinPcap库进行读取和分析,它可以跨评台使用,并且被许多网络工具和应用程序所支持。

2. pcapng格式pcapng(Packet Capture Next Generation)是Wireshark的一种新文件格式,它在pcap的基础上进行了扩展和改进,支持更多的元数据和信息字段。

pcapng格式的文件通常包含多个数据块(Block),每个数据块都可以保存不同类型的数据,如捕获配置信息、数据包数据、接口信息等。

pcapng格式的文件在Wireshark 1.8及以上版本中得到支持,在一些特定场景下具有更好的灵活性和可扩展性。

3. cap格式cap格式是一种比较老旧的文件格式,它通常用于微软网络监控工具或特定的硬件设备。

cap格式的文件结构较为简单,通常包含数据包的原始内容和一些简单的元数据信息,不支持一些高级的特性和功能。

4. etl格式etl(Event Trace Log)格式是一种Windows事件跟踪日志文件格式,它通常用于收集系统和应用程序的事件信息。

在一些特定情况下,我们也可以使用Wireshark来解析和分析etl格式的数据包,不过需要借助一些额外的工具和插件。

Wireshark安装使用及报文分析(图文详解)

Wireshark安装使用及报文分析(图文详解)

Wireshark安装使⽤及报⽂分析(图⽂详解)⼀、Wireshark介绍1、Wireshark是世界上最流⾏的⽹络分析⼯具。

这个强⼤的⼯具可以捕捉⽹络中的数据,并为⽤户提供关于⽹络和上层协议的各种信息。

与很多其他⽹络⼯具⼀样,Wireshark也使⽤pcapnetwork library来进⾏封包捕捉。

可破解局域⽹内QQ、邮箱、msn、账号等的密码!2、wireshark能获取HTTP,也能获取HTTPS,但是不能解密HTTPS,所以wireshark看不懂HTTPS中的内容,总结,如果是处理其他协议⽐如TCP,UDP 就⽤wireshark.HTTP,HTTPS 还是⽤Fiddler, 其他协议⽐如TCP,UDP 就⽤wireshark.⼆、Wireshark下载与安装1、2、默认安装就好三、抓包流程1、软件界⾯2、选定⽹卡Wireshare捕获某⼀块⽹卡的⽹络包,当你的机器上有多快⽹卡,需要选定⼀块⽹卡!点击【Inteface list】出现以下界⾯,选择正确的⽹卡信息,点击【Start】,开始抓包3、软解各个模块介绍1. MENUS(菜单)2. SHORTCUTS(快捷⽅式)3. DISPLAY FILTER(显⽰过滤器)4. PACKET LIST PANE(封包列表)5. PACKET DETAILS PANE(封包详细信息)6. DISSECTOR PANE(16进制数据)7. MISCELLANOUS(杂项)注意:在快捷⽅式⾥⾯有⼀选项Colorize Packet List,会根据报⽂的不同⽤颜⾊区分(我这⾥就不展⽰了)4、抓包数据分析(1)这是我抓取的⼀段HTTP建联过程(三次握⼿)(2)以某⼀段数据包分析(这⾥是以第三个包分析),⼤概了解⼀下注意:右击⿏标---->Follow TCP Stream 显⽰服务器和⽬标之间的全部的对话 如下HTTP数据包分析HTTP分为请求报⽂、响应报⽂请求报⽂分析:响应报⽂分析:5、Wireshare数据包过滤(1)点击---->Filter,创建新的过滤条件(2)具体的过滤语法书写、致谢1、。

pcap及pcapng格式解析中文版

pcap及pcapng格式解析中文版

PCAP下一代转储文件格式PCAP-DumpFileFormatStatus of this MemoThis document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC 2026.Internet-Drafts are working documents of the InternetEngineering Task Force (IETF), its areas, and its workinggroups. Note that other groups may also distribute working documents as Internet-Drafts.Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to useInternet-Drafts as reference material or to cite them other than as “work in progress.”The list of current Internet-Drafts can be accessedat /ietf/1id-abstracts.txt.The list of Internet-Draft Shadow Directories can be accessed at /shadow.html.This Internet-Draft will expire on September 2, 2004. Copyright NoticeCopyright © The Internet Society (2004). All RightsReserved.AbstractThis document describes a format to dump captured packets on a file. This format is extensible and it is currently proposed for implementation in the libpcap/WinPcap packet capturelibrary.Updates∙[27 Jul 2009] Guy Harris: added some missing reserved block types in Appendix B.∙[27 Jul 2009] Guy Harris: fixed a typo in Appendix B.The range of standardized blocks are in the range0x00000000-0x7FFFFFFF.∙[ 8 Feb 2008] Gianluca Varenni: better documentation for the format of the timestamps. Renamed theif_tsaccur option into if_tsresol.∙[22 Oct 2007] Gianluca Varenni: added a note related to 64-bit alignment. Specified that the option lengthfield is the length without padding. typos here and there.Added some option examples.∙[17 Oct 2007] Ulf Lamping: Major review: "Interface ID" in "ISB" now 32 bits. isb_starttime/isb_endtimedepends on if_tsaccur. Lot's of other editing ...∙[ 8 Oct 2007] Ulf Lamping: Fixed several typos.Grouped the block types into mandatory, optional,experimental, obsolete.∙[14 Sep 2006] Gianluca Varenni: Added the block type code for Arinc 429 in AFDX Encapsulation InformationBlock∙[23 May 2006] Gianluca Varenni: Added the block type code for IRIG Timestamp Block∙[23 Apr 2006] Gianluca Varenni: Cleaned up AppendixC a bit: we should use the LINKTYPE_xxx values fromlibpcap, not the DLT_xxx ones. Fixed the introduction tothe appendix and added some comments.∙[21 Mar 2006] Gianluca Varenni: Added a preliminary version of Appendix C, detailing the Standardized LinkTypes.∙[21 Mar 2006] Gianluca Varenni: Added a preliminary version of Appendix B, detailing the Standardized BlockType codes.∙[21 Mar 2006] Gianluca Varenni: Added the Enhanced Packet Block in section 2.2. Fixed a typo in the list: it'sInterface Statistics Block, and not Capture StatisticsBlock.∙[21 Mar 2006] Gianluca Varenni: Fixed some minor typos in the document.∙[21 Mar 2006] Gianluca Varenni: Fixed an error inPacket Block: option pack_hash should have code 3.∙[21 Mar 2006] Gianluca Varenni: Added the definition of the Enhanced Packet Block.∙[12 Mar 2006] Gianluca Varenni: Added optionif_tsoffset in the Interface Description Block.目录PCAP下一代转储文件格式 (1)PCAP-DumpFileFormat (1)Status of this Memo (1)Copyright Notice (1)Abstract (2)Updates (2)1. 目标 (5)2. 文件结构(General File Structure) (5)2.1. 块结构(General Block Structure) (5)2.2. 块类型(Block Types) (6)2.3. 逻辑块层次结构(Logical Block Hierarchy) (7)2.4. 物理文件的布局(Physical File Layout) (7)2.5. 选项(Options) (9)2.6. 数据格式(Data format) (10)3. 块定义(Block Definition) (11)3.1. 节头块(Section Header Block) (11)3.2. 接口描述块(Interface Description Block) (12)3.3. 增强分组块(Enhanced Packet Block) (15)3.4. 简单分组块(Simple Packet Block) (17)3.5. 分组块(Packet Block) (18)3.6. 名称解析块(Name Resolution Block) (20)3.7. 接口统计块(Interface Statistics Block) (22)4. 实验块(Experimental Blocks) (23)4.1. 替代性分组块(Alternative Packet Blocks) (23)4.2. 压缩块(Compression Block) (24)4.3. 加密块(Encryption Block) (24)4.4. 固定长度块(Fixed Length Block) (25)4.5. 目录块(Directory Block) (26)4.6. 流量统计和监控块(Traffic Statistics and Monitoring Blocks) (26)4.7.事件/安全块(Event/Security Block) (26)5. 推荐的扩展名: .pcapng (27)6. 怎样增加供应商/域特定扩展 (27)7. 结论 (27)Appendix A. Packet Block Flags Word (28)Appendix B. Standardized Block Type Codes (28)Appendix C. Standardized Link Type Codes (29)Appendix D. Link Layer Headers (33)Authors' Addresses (34)Full Copyright Statement (34)Intellectual Property (35)Acknowledgment (35)附录:pcap文件格式说明 (36)文件格式 (36)ile Header (36)Record (Packet) Header (37)Packet Data (38)1. 目标交换分组痕迹的问题变得越来越关键。

wireshark简介

wireshark简介

12
实例:
snmp || dns || icmp //显示SNMP或DNS或ICMP封包。 ip.addr == 10.1.1.1 //显示来源或目的IP地址为10.1.1.1的封包。
ip.src != 10.1.2.3 or ip.dst != 10.4.5.6 //显示来源不为10.1.2.3 或者目的不为 10.4.5.6的封包。
Wireshark简介 Wireshark界面组成
Wireshark基本操作
Wireshark是网络包分析工具,捕获网络包数据,并为 用户提供关于网络和上层协议的各种信息。 Wireshark优势: 安装方便,简单易用; 开源免费; 支持Windows、Unix等多平台。 应用场景: 解决网络问题; 检测安全隐患; 测试协议执行情况; 学习网络协议; × 入侵检测; 3 × 处理网络事务。
9
捕捉过滤器
• • • • Protocol(协议): 可能的值: ether, fddi, ip, arp, rarp, decnet, lat, sca, moprc, mopdl, tcp and udp. 如果没有特别指明是什么协议,则默认使用所有支持的协议。 Direction(方向):可能的值: src, dst, src and dst, src or dst 如果没有特别指明来源或目的地,则默认使用 "src or dst" 作为关键字。 例如,"host 10.2.2.2"与"src or dst host 10.2.2.2"是一样的。 Host(s):可能的值: net, port, host, portrange. 如果没有指定此值,则默认使用"host"关键字。 例如,"src 10.1.1.1"与"src host 10.1.1.1"相同。 Logical Operations(逻辑运算):可能的值:not, and, or. 否(“not”)具有最高的优先级。或(“or”)和与(“and”)具有相同的优先级,运算时从左 至右进行。 例如, "not tcp port 3128 and tcp port 23"与"(not tcp port 3128) and tcp port 23"相同。 "not tcp port 3128 and tcp port 23"与"not (tcp port 3128 and tcp port 23)"不同。

Wireshark简要使用说明(宝典)

Wireshark简要使用说明(宝典)

Wireshark使用说明Wireshark简介:Wireshark是世界上最流行的网络分析工具。

这个强大的工具可以捕捉网络中的数据,并为用户提供关于网络和上层协议的各种信息。

与很多其他网络工具一样,Wireshark也使用pcap network library来进行封包捕捉。

可破解局域网内QQ、邮箱、msn、账号等的密码!!wireshark的原名是Ethereal,新名字是2006年起用的。

当时Ethereal的主要开发者决定离开他原来供职的公司,并继续开发这个软件。

但由于Ethereal这个名称的使用权已经被原来那个公司注册,Wireshark这个新名字也就应运而生了。

Wireshark使用说明:Protocol(协议):可能的值: ether, fddi, ip, arp, rarp, decnet, lat, sca, moprc, mopdl, tcp and udp.如果没有特别指明是什么协议,则默认使用所有支持的协议。

Direction(方向):可能的值: src, dst, src and dst, src or dst如果没有特别指明来源或目的地,则默认使用 "src or dst" 作为关键字。

例如,"host 10.2.2.2"与"src or dst host 10.2.2.2"是一样的。

Host(s):可能的值: net, port, host, portrange.如果没有指定此值,则默认使用"host"关键字。

例如,"src 10.1.1.1"与"src host 10.1.1.1"相同。

Logical Operations(逻辑运算):可能的值:not, and, or.否("not")具有最高的优先级。

或("or")和与("and")具有相同的优先级,运算时从左至右进行。

pcap文件格式和wireshark解析

pcap文件格式和wireshark解析

pcap文件格式和wireshark解析pcap文件头pcap文件头参见官方说明用python代码表达结构如下,I是32位无符号数,下面的定义均采用32位方式# bpf_u_int32 magic; 固定为0xA1B2C3D4,表示pcap包文件# u_short version_major; 主版本号# u_short version_minor; 分支版本号# bpf_int32 thiszone; 时区# bpf_u_int32 sigfigs;# bpf_u_int32 snaplen; 每个包的最大长度# bpf_u_int32 linktype; 链路层协议族self.struct_pcap_file_header = '!I2H4I'pcap每个包的头参见# struct timeval ts;# bpf_u_int32 caplen;# bpf_u_int32 len;self.struct_pcap_pkthdr = '!4I'timeval是c的时间戳结构体,前面一个整型数是秒数偏置,后面一个整型数是微秒偏置,详情可以查阅相关文档生成pcap文件使用python简单生成,写入到test.pcap文件,写入了两个包到该文件,linktype设置为162,在wireshark源码中表示保留给用户的USER15 类型# -*-coding:utf-8-*-"""Author:yinshunyaoDate:2017/3/24 0024上午 10:47"""import unittestimport structclass PacpTest(unittest.TestCase):def setUp(self):# pcap文件头格式## bpf_u_int32 magic; 固定为0xA1B2C3D4,表示pcap包文件# u_short version_major; 主版本号# u_short version_minor; 分支版本号# bpf_int32 thiszone; 时区# bpf_u_int32 sigfigs;# bpf_u_int32 snaplen; 每个包的最大长度# bpf_u_int32 linktype; 链路层协议族self.struct_pcap_file_header = '!I2H4I'# pcap包头格式## struct timeval ts;# bpf_u_int32 caplen;# bpf_u_int32 len;self.struct_pcap_pkthdr = '!4I'# 文件头self.file_header = struct.pack(self.struct_pcap_file_header,0xA1B2C3D4, 4, 1, 0, 0, 0xFFFF, 162 # USER15)def test_generate_pcap(self):# 消息体内容pkg_content1 = struct.pack('!2I', 100,101)pkg_content2 = struct.pack('!2I', 101,100)#pkg_header = struct.pack(self.struct_pcap_pkthdr, 0x4A5B1784,0x00081C6D,len(pkg_content1), len(pkg_content1))with open('test.pcap', 'wb') as test:test.write(self.file_header+pkg_header+pkg_content1+pkg_header+pkg_content2)wireshark解析效果用自定义的wireshark插件协议解析整体效果如下,后面具体介绍插件内容,可以看到Encapsulation type字段值是60,协议是USER15这个值跟前面文件头里面的link162的映射关系,在wireshark中完成,具体处理可以查看wireshark的C源码。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

PCAP 文件格式协议分析一、基本格式:文件头数据包头数据报数据包头数据报......pcap文件格式结构格式如结构体pcap_file_header格式如pcap_pkthdr数据包格式如pcap_pkthdr数据包格式如pcap_pkthdr数据包二、文件头结构体:sturct pcap_file_header{DWORD magic;WORD version_major;WORD version_minor;DWORD thiszone;DWORD sigfigs;DWORD snaplen;DWORD linktype;}说明:1、标识位:32位的,这个标识位的值是16进制的 0xa1b2c3d4。

a 32-bit magic number ,The magic number has the value hex a1b2c3d4.2、主版本号:16位,默认值为0x2。

a 16-bit major version number,The major version number should have the value 2.3、副版本号:16位,默认值为0x04。

a 16-bit minor version number,The minor version number should have the value 4.4、区域时间:32位,实际上该值并未使用,因此可以将该位设置为0。

a 32-bit time zone offset field that actually not used, so youcan (and probably should) just make it 0;5、精确时间戳:32位,实际上该值并未使用,因此可以将该值设置为0。

a 32-bit time stamp accuracy field tha not actually used,so you can (and probably should) just make it 0;6、数据包最大长度:32位,该值设置所抓获的数据包的最大长度,如果所有数据包都要抓获,将该值设置为65535;例如:想获取数据包的前64字节,可将该值设置为64。

a 32-bit snapshot length" field;The snapshot length field should be the maximum number of bytes perpacket that will be captured. If the entire packet is captured, make it 65535; if you only capture, for example, the first 64 bytes of the packet, make it 64.7、链路层类型:32位,数据包的链路层包头决定了链路层的类型。

a 32-bit link layer type field.The link-layer type depends on the type of link-layer header that thepackets in the capture file have:以下是数据值与链路层类型的对应表0 BSD loopback devices, except for later OpenBSD1 Ethernet, and Linux loopback devices 以太网类型,大多数的数据包为这种类型。

6 802.5 Token Ring7 ARCnet8 SLIP9 PPP10 FDDI100 LLC/SNAP-encapsulated ATM101 raw IP, with no link102 BSD/OS SLIP103 BSD/OS PPP104 Cisco HDLC105 802.11108 later OpenBSD loopback devices (with the AF_value in network byte order)113 special Linux cooked capture114 LocalTalk三、数据包头结构体:struct pcap_pkthdr{struct timeval ts;DWORD caplen;DWORD len;}struct timeval{DWORD GMTtime;DWORD microTime}说明:1、时间戳,包括:秒计时:32位,一个UNIX格式的精确到秒时间值,用来记录数据包抓获的时间,记录方式是记录从格林尼治时间的1970年1月1日 00:00:00 到抓包时经过的秒数;毫秒计时:32位,抓取数据包时的毫秒值。

a time stamp, consisting of:a UNIX-format time-in-seconds when the packet was captured, i.e. the number of seconds since January 1,1970, 00:00:00 GMT (that GMT, *NOT* local time!);the number of microseconds since that second when the packet was captured;2、数据包长度:32位,标识所抓获的数据包保存在pcap文件中的实际长度,以字节为单位。

a 32-bit value giving the number of bytes of packet data that were captured;3、数据包实际长度:所抓获的数据包的真实长度,如果文件中保存不是完整的数据包,那么这个值可能要比前面的数据包长度的值大。

a 32-bit value giving the actual length of the packet, in bytes (which may be greater than the previous number, if you are not saving the entire packet).Wireshark的Pcap文件格式分析前段时间因工作要求,需要对各种数据包进行分析和操作,内容涉及网路协议分析,socket,文件操作等。

在此分享下学习和实践的经验。

首先介绍下网络抓包、协议分析的必备软件Ethereal,新版(Wireshark)以下还以 Ethereal代之,目前最新版本已经支持在无线局域网抓包了。

Linux和Windows均有对应安装包,它们分别是gcc和VC++编译的。

不过 Windows下是基于Winpcap而Linux下则是Libcap。

Ethereal作为网路协议分析、学习、开发的敲门软件,其使用技巧及其原理机制(BPF)网上都有比较详尽的介绍,当初我收集的相关资料随后也会上传,不再多说。

下面主要介绍下Ethereal默认的*.pcap文件保存格式。

Pcap文件头24B各字段说明:Magic:4B:0x1A 2B 3C 4D:用来标示文件的开始Major:2B,0x02 00:当前文件主要的版本号Minor:2B,0x04 00当前文件次要的版本号ThisZone:4B当地的标准时间;全零SigFigs:4B时间戳的精度;全零SnapLen:4B最大的存储长度LinkType:4B链路类型常用类型:0 BSD loopback devices, except for later OpenBSD1 Ethernet, and Linux loopback devices6 802.5 Token Ring7 ARCnet8 SLIP9 PPP10 FDDI100 LLC/SNAP-encapsulated ATM101 "raw IP", with no link102 BSD/OS SLIP103 BSD/OS PPP104 Cisco HDLC105 802.11108 later OpenBSD loopback devices (with the AF_value in network byte order)113 special Linux "cooked" capture114 LocalTalkPacket 包头和Packet数据组成字段说明:Timestamp:时间戳高位,精确到secondsTimestamp:时间戳低位,精确到microsecondsCaplen:当前数据区的长度,即抓取到的数据帧长度,由此可以得到下一个数据帧的位置。

Len:离线数据长度:网络中实际数据帧的长度,一般不大于caplen,多数情况下和Caplen数值相等。

Packet 数据:即 Packet(通常就是链路层的数据帧)具体内容,长度就是Caplen,这个长度的后面,就是当前PCAP文件中存放的下一个Packet数据包,也就是说:PCAP文件里面并没有规定捕获的Packet数据包之间有什么间隔字符串,下一组数据在文件中的起始位置。

我们需要靠第一个Packet包确定。

最后,Packet数据部分的格式其实就是标准的网路协议格式了可以任何网络教材上找得到。

网络抓包、协议分析的强大的软件Ethereal,由自由软件发展而来,由于众多爱好者的不断完善和添加网络协议模块,现在已经能够支持几乎所有常见的网络协议数据的分析。

现在Ethereal改称Wireshark了,目前最新版本已经支持在无线局域网抓包了。

Linux和Windows均有对应安装包,它们分别是gcc和VC++编译的。

不过 Windows下是基于Winpcap而Linux下则是Libcap。

Ethereal作为网路协议分析、学习、开发的专业门软件,其保存网络数据包的格式逐渐成为了一种标准,下面就介绍下Ethereal默认的*.pcap文件保存格式。

Pcap文件头24B各字段说明:Magic:4B:0x1A 2B 3C 4D:用来标示文件的开始Major:2B,0x02 00:当前文件主要的版本号Minor:2B,0x04 00当前文件次要的版本号ThisZone:4B当地的标准时间;全零SigFigs:4B时间戳的精度;全零SnapLen:4B最大的存储长度LinkType:4B链路类型常用类型:0 BSD loopback devices, except for later OpenBSD1 Ethernet, and Linux loopback devices6 802.5 Token Ring7 ARCnet8 SLIP9 PPP10 FDDI100 LLC/SNAP-encapsulated ATM101 "raw IP", with no link102 BSD/OS SLIP103 BSD/OS PPP104 Cisco HDLC105 802.11108 later OpenBSD loopback devices (with the AF_value in network byte order)113 special Linux "cooked" capture114 LocalTalkPacket 包头和Packet数据组成字段说明:Timestamp:时间戳高位,精确到secondsTimestamp:时间戳低位,精确到microsecondsCaplen:当前数据区的长度,即抓取到的数据帧长度,由此可以得到下一个数据帧的位置。

相关文档
最新文档