Skip to main content

A pcap file parser

Project description

A pcap file parser implemented by Python. Only supports TCP and UDP packet.

Installation

pip install PacketReader

Usage

1. Import module.

import PacketReader

2. Read from a pcap file. read_pcap return a list of packets.

packets = PacketReader.read_pcap(pcap_file)

3. You can print the information of each packet.

print(packets[0])

4. PacketReader supports IP/TCP/UDP. You can get the MAC address, IP address or flags of packets.

print(packets[0].src_mac_address)
print(packets[0].tcp_header['SYN'])

Example

>>> import PacketReader
>>> pl=PacketReader.read_pcap('test.pcap')
>>> print(len(pl))
179
>>> print(pl[0])
Packet 1 Information:
[1] Epoch Time: 1448157839.796592 seconds
[2] Frame Length: 85 bytes
[3] Destination Mac Address: 28:C2:DD:1D:75:C1
[4] Source Mac Address: 88:25:93:37:60:84
[5] Destination IP Address: 192.168.1.183
[6] Source IP Address: 192.30.252.88
[7] Destination Port: 57747
[8] Source Port :443
[9] Protocol: 6

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

packetreader-1.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

packetreader-1.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file packetreader-1.1.0.tar.gz.

File metadata

  • Download URL: packetreader-1.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.4.0-1103-azure

File hashes

Hashes for packetreader-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cb832573faa88f8ea600646c7bc01c1ef512bd658aa9ef56a84a08ef51d2db19
MD5 05bac72a5ebc98cb783fa879cd027697
BLAKE2b-256 23a2a5f891aa528bbc07cb2c32bea0a14cdbf1a5d982597763d3e36719fae88b

See more details on using hashes here.

File details

Details for the file packetreader-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: packetreader-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.4.0-1103-azure

File hashes

Hashes for packetreader-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e00cf96fb0eab7295e43bc101f9867c3ab03ccb476be10e862f4807940e452f
MD5 2cd14b6a210083c3d01034e8d72707bd
BLAKE2b-256 8fba5fa449f609a702b141c7c67b5525c3c405eb75c2876d4ed65635b0774519

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page