Skip to content

Commit

Permalink
added pcapng samples
Browse files Browse the repository at this point in the history
  • Loading branch information
JarryShaw committed May 4, 2023
1 parent 428c60c commit e67088c
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ sample/*
!sample/out.plist
!sample/out.txt
!sample/in.pcap
!sample/dhcp.pcapng
!sample/pcapng.txt

src
!requirements.txt
Expand Down
Binary file added sample/dhcp.pcapng
Binary file not shown.
303 changes: 303 additions & 0 deletions sample/pcapng.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
Section Header 1
|-- type
| |--> BlockType::Section_Header_Block
| [168627466]
|-- length -> 28
|-- byteorder -> little
|-- version
| |-- type -> VersionInfo
| |-- value
| |--> 1
| |--> 0
|-- section_length -> 18446744073709551615
|-- options -> NIL

Interface Description 1
|-- type
| |--> BlockType::Interface_Description_Block
| [1]
|-- length -> 32
|-- linktype -> LinkType::ETHERNET [1]
|-- snaplen -> 65535
|-- options
|-- OptionType::if_tsresol [9_if_tsresol]
| |--> --
| |-- type
| | |-- enum -> OptionType::if_tsresol [9_if_tsresol]
| | |-- opt_name -> if_tsresol
| | |-- opt_value -> 9
| |-- length -> 1
| |-- resolution -> 1000000
|-- OptionType::opt_endofopt [0_opt_endofopt]
|--> --
|-- type
| |-- enum
| | |--> OptionType::opt_endofopt
| | [0_opt_endofopt]
| |-- opt_name -> opt_endofopt
| |-- opt_value -> 0
|-- length -> 0

Frame 1
|-- type -> BlockType::Enhanced_Packet_Block [6]
|-- length -> 348
|-- section_number -> 1
|-- number -> 1
|-- interface_id -> 0
|-- timestamp -> 2004-12-06T03:16:24.317453+08:00
|-- timestamp_epoch -> 1102302984.317453
|-- captured_len -> 314
|-- original_len -> 314
|-- options -> NIL
|-- ethernet
| |-- dst -> ff:ff:ff:ff:ff:ff
| |-- src -> 00:0b:82:01:fc:42
| |-- type
| | |--> EtherType::Internet_Protocol_version_4
| | [2048]
| |-- ipv4
| |-- version -> 4
| |-- hdr_len -> 20
| |-- tos
| | |-- pre -> ToSPrecedence::Routine [0]
| | |-- del -> ToSDelay::NORMAL [0]
| | |-- thr -> ToSThroughput::NORMAL [0]
| | |-- rel -> ToSReliability::NORMAL [0]
| | |-- ecn -> ToSECN::Not_ECT [0]
| |-- len -> 300
| |-- id -> 43062
| |-- flags
| | |-- df -> False
| | |-- mf -> False
| |-- offset -> 0
| |-- ttl -> 250.0
| |-- protocol -> TransType::UDP [17]
| |-- checksum -> 17 8b
| |-- src -> 0.0.0.0
| |-- dst -> 255.255.255.255
| |-- udp
| |-- srcport -> 68
| |-- dstport -> 67
| |-- len -> 280
| |-- checksum -> 59 1f
| |-- raw
| |-- protocol -> NIL
| |-- packet
| | |--> 01 01 06 00 00 00 3d 1d 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 0b 82 01
| | fc 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 63 82 53 63
| | 35 01 01 3d 07 01 00 0b 82 01 fc 42 32 04 00 00
| | 00 00 37 04 01 03 06 2a ff 00 00 00 00 00 00 00
| |-- error -> NIL
|-- protocols -> Ethernet:IPv4:UDP:Raw

Frame 2
|-- type -> BlockType::Enhanced_Packet_Block [6]
|-- length -> 376
|-- section_number -> 1
|-- number -> 2
|-- interface_id -> 0
|-- timestamp -> 2004-12-06T03:16:24.317748+08:00
|-- timestamp_epoch -> 1102302984.317748
|-- captured_len -> 342
|-- original_len -> 342
|-- options -> NIL
|-- ethernet
| |-- dst -> 00:0b:82:01:fc:42
| |-- src -> 00:08:74:ad:f1:9b
| |-- type
| | |--> EtherType::Internet_Protocol_version_4
| | [2048]
| |-- ipv4
| |-- version -> 4
| |-- hdr_len -> 20
| |-- tos
| | |-- pre -> ToSPrecedence::Routine [0]
| | |-- del -> ToSDelay::NORMAL [0]
| | |-- thr -> ToSThroughput::NORMAL [0]
| | |-- rel -> ToSReliability::NORMAL [0]
| | |-- ecn -> ToSECN::Not_ECT [0]
| |-- len -> 328
| |-- id -> 1093
| |-- flags
| | |-- df -> False
| | |-- mf -> False
| |-- offset -> 0
| |-- ttl -> 128.0
| |-- protocol -> TransType::UDP [17]
| |-- checksum -> 00 00
| |-- src -> 192.168.0.1
| |-- dst -> 192.168.0.10
| |-- udp
| |-- srcport -> 67
| |-- dstport -> 68
| |-- len -> 308
| |-- checksum -> 22 33
| |-- raw
| |-- protocol -> NIL
| |-- packet
| | |--> 02 01 06 00 00 00 3d 1d 00 00 00 00 00 00 00 00
| | c0 a8 00 0a c0 a8 00 01 00 00 00 00 00 0b 82 01
| | fc 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 63 82 53 63
| | 35 01 02 01 04 ff ff ff 00 3a 04 00 00 07 08 3b
| | 04 00 00 0c 4e 33 04 00 00 0e 10 36 04 c0 a8 00
| | 01 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00
| |-- error -> NIL
|-- protocols -> Ethernet:IPv4:UDP:Raw

Frame 3
|-- type -> BlockType::Enhanced_Packet_Block [6]
|-- length -> 348
|-- section_number -> 1
|-- number -> 3
|-- interface_id -> 0
|-- timestamp -> 2004-12-06T03:16:24.387484+08:00
|-- timestamp_epoch -> 1102302984.387484
|-- captured_len -> 314
|-- original_len -> 314
|-- options -> NIL
|-- ethernet
| |-- dst -> ff:ff:ff:ff:ff:ff
| |-- src -> 00:0b:82:01:fc:42
| |-- type
| | |--> EtherType::Internet_Protocol_version_4
| | [2048]
| |-- ipv4
| |-- version -> 4
| |-- hdr_len -> 20
| |-- tos
| | |-- pre -> ToSPrecedence::Routine [0]
| | |-- del -> ToSDelay::NORMAL [0]
| | |-- thr -> ToSThroughput::NORMAL [0]
| | |-- rel -> ToSReliability::NORMAL [0]
| | |-- ecn -> ToSECN::Not_ECT [0]
| |-- len -> 300
| |-- id -> 43063
| |-- flags
| | |-- df -> False
| | |-- mf -> False
| |-- offset -> 0
| |-- ttl -> 250.0
| |-- protocol -> TransType::UDP [17]
| |-- checksum -> 17 8a
| |-- src -> 0.0.0.0
| |-- dst -> 255.255.255.255
| |-- udp
| |-- srcport -> 68
| |-- dstport -> 67
| |-- len -> 280
| |-- checksum -> 9f bd
| |-- raw
| |-- protocol -> NIL
| |-- packet
| | |--> 01 01 06 00 00 00 3d 1e 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 0b 82 01
| | fc 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 63 82 53 63
| | 35 01 03 3d 07 01 00 0b 82 01 fc 42 32 04 c0 a8
| | 00 0a 36 04 c0 a8 00 01 37 04 01 03 06 2a ff 00
| |-- error -> NIL
|-- protocols -> Ethernet:IPv4:UDP:Raw

Frame 4
|-- type -> BlockType::Enhanced_Packet_Block [6]
|-- length -> 376
|-- section_number -> 1
|-- number -> 4
|-- interface_id -> 0
|-- timestamp -> 2004-12-06T03:16:24.387798+08:00
|-- timestamp_epoch -> 1102302984.387798
|-- captured_len -> 342
|-- original_len -> 342
|-- options -> NIL
|-- ethernet
| |-- dst -> 00:0b:82:01:fc:42
| |-- src -> 00:08:74:ad:f1:9b
| |-- type
| | |--> EtherType::Internet_Protocol_version_4
| | [2048]
| |-- ipv4
| |-- version -> 4
| |-- hdr_len -> 20
| |-- tos
| | |-- pre -> ToSPrecedence::Routine [0]
| | |-- del -> ToSDelay::NORMAL [0]
| | |-- thr -> ToSThroughput::NORMAL [0]
| | |-- rel -> ToSReliability::NORMAL [0]
| | |-- ecn -> ToSECN::Not_ECT [0]
| |-- len -> 328
| |-- id -> 1094
| |-- flags
| | |-- df -> False
| | |-- mf -> False
| |-- offset -> 0
| |-- ttl -> 128.0
| |-- protocol -> TransType::UDP [17]
| |-- checksum -> 00 00
| |-- src -> 192.168.0.1
| |-- dst -> 192.168.0.10
| |-- udp
| |-- srcport -> 67
| |-- dstport -> 68
| |-- len -> 308
| |-- checksum -> df db
| |-- raw
| |-- protocol -> NIL
| |-- packet
| | |--> 02 01 06 00 00 00 3d 1e 00 00 00 00 00 00 00 00
| | c0 a8 00 0a 00 00 00 00 00 00 00 00 00 0b 82 01
| | fc 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00 63 82 53 63
| | 35 01 05 3a 04 00 00 07 08 3b 04 00 00 0c 4e 33
| | 04 00 00 0e 10 36 04 c0 a8 00 01 01 04 ff ff ff
| | 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00
| | 00 00 00 00 00 00 00 00 00 00 00 00
| |-- error -> NIL
|-- protocols -> Ethernet:IPv4:UDP:Raw
2 changes: 1 addition & 1 deletion test/test_pcapng.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import pcapkit

plist = pcapkit.extract(fin='../sample/test.pcapng',
plist = pcapkit.extract(fin='../sample/dhcp.pcapng',
fout='../sample/pcapng.txt', format='tree', verbose=True)

0 comments on commit e67088c

Please sign in to comment.