2 #------------------------------------------------------------------------------
3 # $File: sniffer,v 1.30 2021/07/03 13:51:56 christos Exp $
4 # sniffer: file(1) magic for packet capture files
6 # From: guy@alum.mit.edu (Guy Harris)
10 # Microsoft Network Monitor 1.x capture files.
12 0 string RTSS NetMon capture file
13 >5 byte x - version %d
15 >6 leshort 0 (Unknown)
16 >6 leshort 1 (Ethernet)
17 >6 leshort 2 (Token Ring)
20 >6 leshort >4 (type %d)
23 # Microsoft Network Monitor 2.x capture files.
25 0 string GMBU NetMon capture file
26 >5 byte x - version %d
28 >6 leshort 0 (Unknown)
29 >6 leshort 1 (Ethernet)
30 >6 leshort 2 (Token Ring)
33 >6 leshort 5 (IP-over-IEEE 1394)
38 >6 leshort >9 (type %d)
41 # Network General Sniffer capture files.
42 # Sorry, make that "Network Associates Sniffer capture files."
43 # Sorry, make that "Network General old DOS Sniffer capture files."
45 0 string TRSNIFF\040data\040\040\040\040\032 Sniffer capture file
46 >33 byte 2 (compressed)
47 >23 leshort x - version %d
49 >32 byte 0 (Token Ring)
53 >32 byte 4 (PC Network broadband)
54 >32 byte 5 (LocalTalk)
56 >32 byte 7 (Internetwork Analyzer)
61 # Cinco Networks NetXRay capture files.
62 # Sorry, make that "Network General Sniffer Basic capture files."
63 # Sorry, make that "Network Associates Sniffer Basic capture files."
64 # Sorry, make that "Network Associates Sniffer Basic, and Windows
65 # Sniffer Pro", capture files."
66 # Sorry, make that "Network General Sniffer capture files."
67 # Sorry, make that "NetScout Sniffer capture files."
69 0 string XCP\0 NetXRay capture file
70 >4 string >\0 - version %s
71 >44 leshort 0 (Ethernet)
72 >44 leshort 1 (Token Ring)
76 >44 leshort 9 (802.11)
79 # "libpcap" capture files.
80 # https://www.tcpdump.org/manpages/pcap-savefile.5.html
81 # (We call them "tcpdump capture file(s)" for now, as "tcpdump" is
82 # the main program that uses that format, but there are other programs
83 # that use "libpcap", or that use the same capture file format.)
86 >4 beshort x - version %d
88 # clear that continuation level match
90 >20 belong&0x03FFFFFF 0 (No link-layer encapsulation
91 >20 belong&0x03FFFFFF 1 (Ethernet
92 >20 belong&0x03FFFFFF 2 (3Mb Ethernet
93 >20 belong&0x03FFFFFF 3 (AX.25
94 >20 belong&0x03FFFFFF 4 (ProNET
95 >20 belong&0x03FFFFFF 5 (CHAOS
96 >20 belong&0x03FFFFFF 6 (Token Ring
97 >20 belong&0x03FFFFFF 7 (BSD ARCNET
98 >20 belong&0x03FFFFFF 8 (SLIP
99 >20 belong&0x03FFFFFF 9 (PPP
100 >20 belong&0x03FFFFFF 10 (FDDI
101 >20 belong&0x03FFFFFF 11 (RFC 1483 ATM
102 >20 belong&0x03FFFFFF 12 (Raw IP
103 >20 belong&0x03FFFFFF 13 (BSD/OS SLIP
104 >20 belong&0x03FFFFFF 14 (BSD/OS PPP
105 >20 belong&0x03FFFFFF 19 (Linux ATM Classical IP
106 >20 belong&0x03FFFFFF 50 (PPP or Cisco HDLC
107 >20 belong&0x03FFFFFF 51 (PPP-over-Ethernet
108 >20 belong&0x03FFFFFF 99 (Symantec Enterprise Firewall
109 >20 belong&0x03FFFFFF 100 (RFC 1483 ATM
110 >20 belong&0x03FFFFFF 101 (Raw IP
111 >20 belong&0x03FFFFFF 102 (BSD/OS SLIP
112 >20 belong&0x03FFFFFF 103 (BSD/OS PPP
113 >20 belong&0x03FFFFFF 104 (BSD/OS Cisco HDLC
114 >20 belong&0x03FFFFFF 105 (802.11
115 >20 belong&0x03FFFFFF 106 (Linux Classical IP over ATM
116 >20 belong&0x03FFFFFF 107 (Frame Relay
117 >20 belong&0x03FFFFFF 108 (OpenBSD loopback
118 >20 belong&0x03FFFFFF 109 (OpenBSD IPsec encrypted
119 >20 belong&0x03FFFFFF 112 (Cisco HDLC
120 >20 belong&0x03FFFFFF 113 (Linux cooked v1
121 >20 belong&0x03FFFFFF 114 (LocalTalk
122 >20 belong&0x03FFFFFF 117 (OpenBSD PFLOG
123 >20 belong&0x03FFFFFF 119 (802.11 with Prism header
124 >20 belong&0x03FFFFFF 122 (RFC 2625 IP over Fibre Channel
125 >20 belong&0x03FFFFFF 123 (SunATM
126 >20 belong&0x03FFFFFF 127 (802.11 with radiotap header
127 >20 belong&0x03FFFFFF 129 (Linux ARCNET
128 >20 belong&0x03FFFFFF 130 (Juniper Multi-Link PPP
129 >20 belong&0x03FFFFFF 131 (Juniper Multi-Link Frame Relay
130 >20 belong&0x03FFFFFF 132 (Juniper Encryption Services PIC
131 >20 belong&0x03FFFFFF 133 (Juniper GGSN PIC
132 >20 belong&0x03FFFFFF 134 (Juniper FRF.16 Frame Relay
133 >20 belong&0x03FFFFFF 135 (Juniper ATM2 PIC
134 >20 belong&0x03FFFFFF 136 (Juniper Advanced Services PIC
135 >20 belong&0x03FFFFFF 137 (Juniper ATM1 PIC
136 >20 belong&0x03FFFFFF 138 (Apple IP over IEEE 1394
137 >20 belong&0x03FFFFFF 139 (SS7 MTP2 with pseudo-header
138 >20 belong&0x03FFFFFF 140 (SS7 MTP2
139 >20 belong&0x03FFFFFF 141 (SS7 MTP3
140 >20 belong&0x03FFFFFF 142 (SS7 SCCP
141 >20 belong&0x03FFFFFF 143 (DOCSIS
142 >20 belong&0x03FFFFFF 144 (Linux IrDA
143 >20 belong&0x03FFFFFF 147 (Private use 0
144 >20 belong&0x03FFFFFF 148 (Private use 1
145 >20 belong&0x03FFFFFF 149 (Private use 2
146 >20 belong&0x03FFFFFF 150 (Private use 3
147 >20 belong&0x03FFFFFF 151 (Private use 4
148 >20 belong&0x03FFFFFF 152 (Private use 5
149 >20 belong&0x03FFFFFF 153 (Private use 6
150 >20 belong&0x03FFFFFF 154 (Private use 7
151 >20 belong&0x03FFFFFF 155 (Private use 8
152 >20 belong&0x03FFFFFF 156 (Private use 9
153 >20 belong&0x03FFFFFF 157 (Private use 10
154 >20 belong&0x03FFFFFF 158 (Private use 11
155 >20 belong&0x03FFFFFF 159 (Private use 12
156 >20 belong&0x03FFFFFF 160 (Private use 13
157 >20 belong&0x03FFFFFF 161 (Private use 14
158 >20 belong&0x03FFFFFF 162 (Private use 15
159 >20 belong&0x03FFFFFF 163 (802.11 with AVS header
160 >20 belong&0x03FFFFFF 164 (Juniper Passive Monitor PIC
161 >20 belong&0x03FFFFFF 165 (BACnet MS/TP
162 >20 belong&0x03FFFFFF 166 (PPPD
163 >20 belong&0x03FFFFFF 167 (Juniper PPPoE
164 >20 belong&0x03FFFFFF 168 (Juniper PPPoE/ATM
165 >20 belong&0x03FFFFFF 169 (GPRS LLC
166 >20 belong&0x03FFFFFF 170 (GPF-T
167 >20 belong&0x03FFFFFF 171 (GPF-F
168 >20 belong&0x03FFFFFF 174 (Juniper PIC Peer
169 >20 belong&0x03FFFFFF 175 (Ethernet with Endace ERF header
170 >20 belong&0x03FFFFFF 176 (Packet-over-SONET with Endace ERF header
171 >20 belong&0x03FFFFFF 177 (Linux LAPD
172 >20 belong&0x03FFFFFF 178 (Juniper Ethernet
173 >20 belong&0x03FFFFFF 179 (Juniper PPP
174 >20 belong&0x03FFFFFF 180 (Juniper Frame Relay
175 >20 belong&0x03FFFFFF 181 (Juniper C-HDLC
176 >20 belong&0x03FFFFFF 182 (FRF.16 Frame Relay
177 >20 belong&0x03FFFFFF 183 (Juniper Voice PIC
178 >20 belong&0x03FFFFFF 184 (Arinc 429
179 >20 belong&0x03FFFFFF 185 (Arinc 653 Interpartition Communication
180 >20 belong&0x03FFFFFF 186 (USB with FreeBSD header
181 >20 belong&0x03FFFFFF 187 (Bluetooth HCI H4
182 >20 belong&0x03FFFFFF 188 (802.16 MAC Common Part Sublayer
183 >20 belong&0x03FFFFFF 189 (Linux USB
184 >20 belong&0x03FFFFFF 190 (Controller Area Network (CAN) v. 2.0B
185 >20 belong&0x03FFFFFF 191 (802.15.4 with Linux padding
186 >20 belong&0x03FFFFFF 192 (PPI
187 >20 belong&0x03FFFFFF 193 (802.16 MAC Common Part Sublayer plus radiotap header
188 >20 belong&0x03FFFFFF 194 (Juniper Integrated Service Module
189 >20 belong&0x03FFFFFF 195 (802.15.4 with FCS
190 >20 belong&0x03FFFFFF 196 (SITA
191 >20 belong&0x03FFFFFF 197 (Endace ERF
192 >20 belong&0x03FFFFFF 198 (Ethernet with u10 Networks pseudo-header
193 >20 belong&0x03FFFFFF 199 (IPMB
194 >20 belong&0x03FFFFFF 200 (Juniper Secure Tunnel
195 >20 belong&0x03FFFFFF 201 (Bluetooth HCI H4 with pseudo-header
196 >20 belong&0x03FFFFFF 202 (AX.25 with KISS header
197 >20 belong&0x03FFFFFF 203 (LAPD
198 >20 belong&0x03FFFFFF 204 (PPP with direction pseudo-header
199 >20 belong&0x03FFFFFF 205 (Cisco HDLC with direction pseudo-header
200 >20 belong&0x03FFFFFF 206 (Frame Relay with direction pseudo-header
201 >20 belong&0x03FFFFFF 209 (Linux IPMB
202 >20 belong&0x03FFFFFF 215 (802.15.4 with non-ASK PHY header
203 >20 belong&0x03FFFFFF 216 (Linux evdev events
204 >20 belong&0x03FFFFFF 219 (MPLS with label as link-layer header
205 >20 belong&0x03FFFFFF 220 (Memory-mapped Linux USB
206 >20 belong&0x03FFFFFF 221 (DECT
207 >20 belong&0x03FFFFFF 222 (AOS Space Data Link protocol
208 >20 belong&0x03FFFFFF 223 (Wireless HART
209 >20 belong&0x03FFFFFF 224 (Fibre Channel FC-2
210 >20 belong&0x03FFFFFF 225 (Fibre Channel FC-2 with frame delimiters
211 >20 belong&0x03FFFFFF 226 (Solaris IPNET
212 >20 belong&0x03FFFFFF 227 (SocketCAN
213 >20 belong&0x03FFFFFF 228 (Raw IPv4
214 >20 belong&0x03FFFFFF 229 (Raw IPv6
215 >20 belong&0x03FFFFFF 230 (802.15.4 without FCS
216 >20 belong&0x03FFFFFF 231 (D-Bus messages
217 >20 belong&0x03FFFFFF 232 (Juniper Virtual Server
218 >20 belong&0x03FFFFFF 233 (Juniper SRX E2E
219 >20 belong&0x03FFFFFF 234 (Juniper Fibre Channel
220 >20 belong&0x03FFFFFF 235 (DVB-CI
221 >20 belong&0x03FFFFFF 236 (MUX27010
222 >20 belong&0x03FFFFFF 237 (STANAG 5066 D_PDUs
223 >20 belong&0x03FFFFFF 238 (Juniper ATM CEMIC
224 >20 belong&0x03FFFFFF 239 (Linux netfilter log messages
225 >20 belong&0x03FFFFFF 240 (Hilscher netAnalyzer
226 >20 belong&0x03FFFFFF 241 (Hilscher netAnalyzer with delimiters
227 >20 belong&0x03FFFFFF 242 (IP-over-Infiniband
228 >20 belong&0x03FFFFFF 243 (MPEG-2 Transport Stream packets
229 >20 belong&0x03FFFFFF 244 (ng4t ng40
230 >20 belong&0x03FFFFFF 245 (NFC LLCP
231 >20 belong&0x03FFFFFF 246 (Packet filter state syncing
232 >20 belong&0x03FFFFFF 247 (InfiniBand
233 >20 belong&0x03FFFFFF 248 (SCTP
234 >20 belong&0x03FFFFFF 249 (USB with USBPcap header
235 >20 belong&0x03FFFFFF 250 (Schweitzer Engineering Laboratories RTAC packets
236 >20 belong&0x03FFFFFF 251 (Bluetooth Low Energy air interface
237 >20 belong&0x03FFFFFF 252 (Wireshark Upper PDU export
238 >20 belong&0x03FFFFFF 253 (Linux netlink
239 >20 belong&0x03FFFFFF 254 (Bluetooth Linux Monitor
240 >20 belong&0x03FFFFFF 255 (Bluetooth Basic Rate/Enhanced Data Rate baseband packets
241 >20 belong&0x03FFFFFF 256 (Bluetooth Low Energy air interface with pseudo-header
242 >20 belong&0x03FFFFFF 257 (PROFIBUS data link layer
243 >20 belong&0x03FFFFFF 258 (Apple DLT_PKTAP
244 >20 belong&0x03FFFFFF 259 (Ethernet with 802.3 Clause 65 EPON preamble
245 >20 belong&0x03FFFFFF 260 (IPMI trace packets
246 >20 belong&0x03FFFFFF 261 (Z-Wave RF profile R1 and R2 packets
247 >20 belong&0x03FFFFFF 262 (Z-Wave RF profile R3 packets
248 >20 belong&0x03FFFFFF 263 (WattStopper Digital Lighting Mngmt/Legrand Nitoo Open Proto
249 >20 belong&0x03FFFFFF 264 (ISO 14443 messages
250 >20 belong&0x03FFFFFF 265 (IEC 62106 Radio Data System groups
251 >20 belong&0x03FFFFFF 266 (USB with Darwin header
252 >20 belong&0x03FFFFFF 267 (OpenBSD DLT_OPENFLOW
253 >20 belong&0x03FFFFFF 268 (IBM SDLC frames
254 >20 belong&0x03FFFFFF 269 (TI LLN sniffer frames
255 >20 belong&0x03FFFFFF 271 (Linux vsock
256 >20 belong&0x03FFFFFF 272 (Nordic Semiconductor Bluetooth LE sniffer frames
257 >20 belong&0x03FFFFFF 273 (Excentis XRA-31 DOCSIS 3.1 RF sniffer frames
258 >20 belong&0x03FFFFFF 274 (802.3br mPackets
259 >20 belong&0x03FFFFFF 275 (DisplayPort AUX channel monitoring data
260 >20 belong&0x03FFFFFF 276 (Linux cooked v2
261 >20 belong&0x03FFFFFF 278 (OpenVizsla USB
262 >20 belong&0x03FFFFFF 279 (Elektrobit High Speed Capture and Replay (EBHSCR)
263 >20 belong&0x03FFFFFF 281 (Broadcom tag
264 >20 belong&0x03FFFFFF 282 (Broadcom tag (prepended)
265 >20 belong&0x03FFFFFF 283 (802.15.4 with TAP
266 >20 belong&0x03FFFFFF 284 (Marvell DSA
267 >20 belong&0x03FFFFFF 285 (Marvell EDSA
268 >20 belong&0x03FFFFFF 286 (ELEE lawful intercept
269 >20 belong&0x03FFFFFF 287 (Z-Wave serial
270 >20 belong&0x03FFFFFF 288 (USB 2.0
271 >20 belong&0x03FFFFFF 289 (ATSC ALP
272 >20 belong&0x03FFFFFF 290 (Event Tracing for Windows
273 # print default match
275 >>20 belong x (linktype#%u
276 >16 belong x \b, capture length %u)
278 # packets time stamps in seconds and microseconds.
279 0 ubelong 0xa1b2c3d4 pcap capture file, microseconds ts (big-endian)
280 !:mime application/vnd.tcpdump.pcap
282 0 ulelong 0xa1b2c3d4 pcap capture file, microsecond ts (little-endian)
283 !:mime application/vnd.tcpdump.pcap
286 # packets time stamps in seconds and nanoseconds.
287 0 ubelong 0xa1b23c4d pcap capture file, nanosecond ts (big-endian)
288 !:mime application/vnd.tcpdump.pcap
290 0 ulelong 0xa1b23c4d pcap capture file, nanosecond ts (little-endian)
291 !:mime application/vnd.tcpdump.pcap
295 # "libpcap"-with-Alexey-Kuznetsov's-patches capture files.
297 0 ubelong 0xa1b2cd34 pcap capture file, microsecond ts, extensions (big-endian)
299 0 ulelong 0xa1b2cd34 pcap capture file, microsecond ts, extensions (little-endian)
303 # "pcapng" capture files.
304 # https://github.com/pcapng/pcapng
305 # Pcapng files can contain multiple sections. Printing the endianness,
306 # snaplen, or other information from the first SHB may be misleading.
309 >8 ubelong 0x1a2b3c4d pcapng capture file
310 >>12 beshort x - version %d
313 >8 ulelong 0x1a2b3c4d pcapng capture file
314 >>12 leshort x - version %d
318 # AIX "iptrace" capture files.
320 0 string iptrace\0401.0 AIX iptrace capture file
321 0 string iptrace\0402.0 AIX iptrace capture file
324 # Novell LANalyzer capture files.
326 0 leshort 0x1001 Novell LANalyzer capture file
327 0 leshort 0x1007 Novell LANalyzer capture file
330 # HP-UX "nettl" capture files.
332 0 string \x54\x52\x00\x64\x00 HP/UX nettl capture file
335 # RADCOM WAN/LAN Analyzer capture files.
337 0 string \x42\xd2\x00\x34\x12\x66\x22\x88 RADCOM WAN/LAN Analyzer capture file
340 # NetStumbler log files. Not really packets, per se, but about as
341 # close as you can get. These are log files from NetStumbler, a
342 # Windows program, that scans for 802.11b networks.
344 0 string NetS NetStumbler log file
345 >8 lelong x \b, %d stations found
348 # *Peek tagged capture files.
350 0 string \177ver EtherPeek/AiroPeek/OmniPeek capture file
353 # Visual Networks traffic capture files.
355 0 string \x05VNF Visual Networks traffic capture file
358 # Network Instruments Observer capture files.
360 0 string ObserverPktBuffe Network Instruments Observer capture file
363 # Files from Accellent Group's 5View products.
365 0 string \xaa\xaa\xaa\xaa 5View capture file