sniffer 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. #------------------------------------------------------------------------------
  2. # $File: sniffer,v 1.20 2018/10/18 16:49:19 christos Exp $
  3. # sniffer: file(1) magic for packet capture files
  4. #
  5. # From: guy@alum.mit.edu (Guy Harris)
  6. #
  7. #
  8. # Microsoft Network Monitor 1.x capture files.
  9. #
  10. 0 string RTSS NetMon capture file
  11. >5 byte x - version %d
  12. >4 byte x \b.%d
  13. >6 leshort 0 (Unknown)
  14. >6 leshort 1 (Ethernet)
  15. >6 leshort 2 (Token Ring)
  16. >6 leshort 3 (FDDI)
  17. >6 leshort 4 (ATM)
  18. >6 leshort >4 (type %d)
  19. #
  20. # Microsoft Network Monitor 2.x capture files.
  21. #
  22. 0 string GMBU NetMon capture file
  23. >5 byte x - version %d
  24. >4 byte x \b.%d
  25. >6 leshort 0 (Unknown)
  26. >6 leshort 1 (Ethernet)
  27. >6 leshort 2 (Token Ring)
  28. >6 leshort 3 (FDDI)
  29. >6 leshort 4 (ATM)
  30. >6 leshort 5 (IP-over-IEEE 1394)
  31. >6 leshort 6 (802.11)
  32. >6 leshort 7 (Raw IP)
  33. >6 leshort 8 (Raw IP)
  34. >6 leshort 9 (Raw IP)
  35. >6 leshort >9 (type %d)
  36. #
  37. # Network General Sniffer capture files.
  38. # Sorry, make that "Network Associates Sniffer capture files."
  39. # Sorry, make that "Network General old DOS Sniffer capture files."
  40. #
  41. 0 string TRSNIFF\040data\040\040\040\040\032 Sniffer capture file
  42. >33 byte 2 (compressed)
  43. >23 leshort x - version %d
  44. >25 leshort x \b.%d
  45. >32 byte 0 (Token Ring)
  46. >32 byte 1 (Ethernet)
  47. >32 byte 2 (ARCNET)
  48. >32 byte 3 (StarLAN)
  49. >32 byte 4 (PC Network broadband)
  50. >32 byte 5 (LocalTalk)
  51. >32 byte 6 (Znet)
  52. >32 byte 7 (Internetwork Analyzer)
  53. >32 byte 9 (FDDI)
  54. >32 byte 10 (ATM)
  55. #
  56. # Cinco Networks NetXRay capture files.
  57. # Sorry, make that "Network General Sniffer Basic capture files."
  58. # Sorry, make that "Network Associates Sniffer Basic capture files."
  59. # Sorry, make that "Network Associates Sniffer Basic, and Windows
  60. # Sniffer Pro", capture files."
  61. # Sorry, make that "Network General Sniffer capture files."
  62. # Sorry, make that "NetScout Sniffer capture files."
  63. #
  64. 0 string XCP\0 NetXRay capture file
  65. >4 string >\0 - version %s
  66. >44 leshort 0 (Ethernet)
  67. >44 leshort 1 (Token Ring)
  68. >44 leshort 2 (FDDI)
  69. >44 leshort 3 (WAN)
  70. >44 leshort 8 (ATM)
  71. >44 leshort 9 (802.11)
  72. #
  73. # "libpcap" capture files.
  74. # https://www.tcpdump.org/manpages/pcap-savefile.5.html
  75. # (We call them "tcpdump capture file(s)" for now, as "tcpdump" is
  76. # the main program that uses that format, but there are other programs
  77. # that use "libpcap", or that use the same capture file format.)
  78. #
  79. 0 name pcap-be
  80. >4 beshort x - version %d
  81. >6 beshort x \b.%d
  82. >20 belong 0 (No link-layer encapsulation
  83. >20 belong 1 (Ethernet
  84. >20 belong 2 (3Mb Ethernet
  85. >20 belong 3 (AX.25
  86. >20 belong 4 (ProNET
  87. >20 belong 5 (CHAOS
  88. >20 belong 6 (Token Ring
  89. >20 belong 7 (BSD ARCNET
  90. >20 belong 8 (SLIP
  91. >20 belong 9 (PPP
  92. >20 belong 10 (FDDI
  93. >20 belong 11 (RFC 1483 ATM
  94. >20 belong 12 (raw IP
  95. >20 belong 13 (BSD/OS SLIP
  96. >20 belong 14 (BSD/OS PPP
  97. >20 belong 19 (Linux ATM Classical IP
  98. >20 belong 50 (PPP or Cisco HDLC
  99. >20 belong 51 (PPP-over-Ethernet
  100. >20 belong 99 (Symantec Enterprise Firewall
  101. >20 belong 100 (RFC 1483 ATM
  102. >20 belong 101 (raw IP
  103. >20 belong 102 (BSD/OS SLIP
  104. >20 belong 103 (BSD/OS PPP
  105. >20 belong 104 (BSD/OS Cisco HDLC
  106. >20 belong 105 (802.11
  107. >20 belong 106 (Linux Classical IP over ATM
  108. >20 belong 107 (Frame Relay
  109. >20 belong 108 (OpenBSD loopback
  110. >20 belong 109 (OpenBSD IPsec encrypted
  111. >20 belong 112 (Cisco HDLC
  112. >20 belong 113 (Linux "cooked"
  113. >20 belong 114 (LocalTalk
  114. >20 belong 117 (OpenBSD PFLOG
  115. >20 belong 119 (802.11 with Prism header
  116. >20 belong 122 (RFC 2625 IP over Fibre Channel
  117. >20 belong 123 (SunATM
  118. >20 belong 127 (802.11 with radiotap header
  119. >20 belong 129 (Linux ARCNET
  120. >20 belong 138 (Apple IP over IEEE 1394
  121. >20 belong 139 (MTP2 with pseudo-header
  122. >20 belong 140 (MTP2
  123. >20 belong 141 (MTP3
  124. >20 belong 142 (SCCP
  125. >20 belong 143 (DOCSIS
  126. >20 belong 144 (IrDA
  127. >20 belong 147 (Private use 0
  128. >20 belong 148 (Private use 1
  129. >20 belong 149 (Private use 2
  130. >20 belong 150 (Private use 3
  131. >20 belong 151 (Private use 4
  132. >20 belong 152 (Private use 5
  133. >20 belong 153 (Private use 6
  134. >20 belong 154 (Private use 7
  135. >20 belong 155 (Private use 8
  136. >20 belong 156 (Private use 9
  137. >20 belong 157 (Private use 10
  138. >20 belong 158 (Private use 11
  139. >20 belong 159 (Private use 12
  140. >20 belong 160 (Private use 13
  141. >20 belong 161 (Private use 14
  142. >20 belong 162 (Private use 15
  143. >20 belong 163 (802.11 with AVS header
  144. >20 belong 165 (BACnet MS/TP
  145. >20 belong 166 (PPPD
  146. >20 belong 169 (GPRS LLC
  147. >20 belong 177 (Linux LAPD
  148. >20 belong 187 (Bluetooth HCI H4
  149. >20 belong 189 (Linux USB
  150. >20 belong 192 (PPI
  151. >20 belong 195 (802.15.4
  152. >20 belong 196 (SITA
  153. >20 belong 197 (Endace ERF
  154. >20 belong 201 (Bluetooth HCI H4 with pseudo-header
  155. >20 belong 202 (AX.25 with KISS header
  156. >20 belong 203 (LAPD
  157. >20 belong 204 (PPP with direction pseudo-header
  158. >20 belong 205 (Cisco HDLC with direction pseudo-header
  159. >20 belong 206 (Frame Relay with direction pseudo-header
  160. >20 belong 209 (Linux IPMB
  161. >20 belong 215 (802.15.4 with non-ASK PHY header
  162. >20 belong 220 (Memory-mapped Linux USB
  163. >20 belong 224 (Fibre Channel FC-2
  164. >20 belong 225 (Fibre Channel FC-2 with frame delimiters
  165. >20 belong 226 (Solaris IPNET
  166. >20 belong 227 (SocketCAN
  167. >20 belong 228 (Raw IPv4
  168. >20 belong 229 (Raw IPv6
  169. >20 belong 230 (802.15.4 without FCS
  170. >20 belong 231 (D-Bus messages
  171. >20 belong 235 (DVB-CI
  172. >20 belong 236 (MUX27010
  173. >20 belong 237 (STANAG 5066 D_PDUs
  174. >20 belong 239 (Linux netlink NFLOG messages
  175. >20 belong 240 (Hilscher netAnalyzer
  176. >20 belong 241 (Hilscher netAnalyzer with delimiters
  177. >20 belong 242 (IP-over-Infiniband
  178. >20 belong 243 (MPEG-2 Transport Stream packets
  179. >20 belong 244 (ng4t ng40
  180. >20 belong 245 (NFC LLCP
  181. >20 belong 247 (Infiniband
  182. >20 belong 248 (SCTP
  183. >16 belong x \b, capture length %d)
  184. # packets time stamps in seconds and microseconds.
  185. 0 ubelong 0xa1b2c3d4 pcap capture file, microseconds ts (big-endian)
  186. !:mime application/vnd.tcpdump.pcap
  187. >0 use pcap-be
  188. 0 ulelong 0xa1b2c3d4 pcap capture file, microsecond ts (little-endian)
  189. !:mime application/vnd.tcpdump.pcap
  190. >0 use \^pcap-be
  191. # packets time stamps in seconds and nanoseconds.
  192. 0 ubelong 0xa1b23c4d pcap capture file, nanosecond ts (big-endian)
  193. !:mime application/vnd.tcpdump.pcap
  194. >0 use pcap-be
  195. 0 ulelong 0xa1b23c4d pcap capture file, nanosecond ts (little-endian)
  196. !:mime application/vnd.tcpdump.pcap
  197. >0 use \^pcap-be
  198. #
  199. # "libpcap"-with-Alexey-Kuznetsov's-patches capture files.
  200. #
  201. 0 ubelong 0xa1b2cd34 pcap capture file, microsecond ts, extensions (big-endian)
  202. >0 use pcap-be
  203. 0 ulelong 0xa1b2cd34 pcap capture file, microsecond ts, extensions (little-endian)
  204. >0 use \^pcap-be
  205. #
  206. # "pcap-ng" capture files.
  207. # http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html
  208. # Pcap-ng files can contain multiple sections. Printing the endianness,
  209. # snaplen, or other information from the first SHB may be misleading.
  210. #
  211. 0 ubelong 0x0a0d0d0a
  212. >8 ubelong 0x1a2b3c4d pcap-ng capture file
  213. >>12 beshort x - version %d
  214. >>14 beshort x \b.%d
  215. 0 ulelong 0x0a0d0d0a
  216. >8 ulelong 0x1a2b3c4d pcap-ng capture file
  217. >>12 leshort x - version %d
  218. >>14 leshort x \b.%d
  219. #
  220. # AIX "iptrace" capture files.
  221. #
  222. 0 string iptrace\0401.0 AIX iptrace capture file
  223. 0 string iptrace\0402.0 AIX iptrace capture file
  224. #
  225. # Novell LANalyzer capture files.
  226. #
  227. 0 leshort 0x1001 Novell LANalyzer capture file
  228. 0 leshort 0x1007 Novell LANalyzer capture file
  229. #
  230. # HP-UX "nettl" capture files.
  231. #
  232. 0 string \x54\x52\x00\x64\x00 HP/UX nettl capture file
  233. #
  234. # RADCOM WAN/LAN Analyzer capture files.
  235. #
  236. 0 string \x42\xd2\x00\x34\x12\x66\x22\x88 RADCOM WAN/LAN Analyzer capture file
  237. #
  238. # NetStumbler log files. Not really packets, per se, but about as
  239. # close as you can get. These are log files from NetStumbler, a
  240. # Windows program, that scans for 802.11b networks.
  241. #
  242. 0 string NetS NetStumbler log file
  243. >8 lelong x \b, %d stations found
  244. #
  245. # *Peek tagged capture files.
  246. #
  247. 0 string \177ver EtherPeek/AiroPeek/OmniPeek capture file
  248. #
  249. # Visual Networks traffic capture files.
  250. #
  251. 0 string \x05VNF Visual Networks traffic capture file
  252. #
  253. # Network Instruments Observer capture files.
  254. #
  255. 0 string ObserverPktBuffe Network Instruments Observer capture file
  256. #
  257. # Files from Accellent Group's 5View products.
  258. #
  259. 0 string \xaa\xaa\xaa\xaa 5View capture file