Questions tagged [dpkt]

A python library for fast, simple packet creation and parsing, with definitions for basic TCP/IP protocols.

85 questions
2
votes
1 answer

How to read from stdin using dpkt.pcap.Reader?

I'm currently trying to analyse incoming USB traffic using USBPcap + Python/dpkt, with an optical USB-mouse as an example input device. After launching batch file containing the command USBPcapCMD.exe -d \\.\USBPcap7 -o - | pipetest.py the…
Vifonius
  • 43
  • 8
2
votes
1 answer

How to parse and retrieve diameter AVPs in python?

I have a diameter packet capture pcap file (using tcpdump) containing some AVPs. I'd like to parse the pcap file and access/retrieve the AVPs. I'm using python3.5.1. The dpkt library apparently supports diameter well but it's not yet available for…
Sharad
  • 9,282
  • 3
  • 19
  • 36
2
votes
3 answers

Parsing a PCAP File in python

I am trying to parse a Pcap file in python. When i run this code for ts, buf in pcap: eth = dpkt.ethernet.Ethernet(buf) print eth I get junk values instead of getting the following output: Ethernet(src='\x00\x1a\xa0kUf',…
Normal one
  • 145
  • 1
  • 2
  • 12
2
votes
1 answer

dpkt ipv6 extension header

I am trying to get ipv6 extension header from pcap packet using dpkt and print it out. But for some reason it didnt work. I have tried many different ways. here is the part of the code that cause the problem. is there anyone have an idea how to…
NOPO
  • 31
  • 5
2
votes
1 answer

can't parse tcpdump capture using python dpkt

Python dpkt can parse Wireshark/pcap files and show packet data successfully: >>> for ts, pkt in pcap: eth = dpkt.ethernet.Ethernet(pkt) type(eth.data) But when I tried to parse the tcpdump file I…
boeingdream
  • 143
  • 6
2
votes
2 answers

python dpkt pcap how to get protocol?

I have a lab and I need to find the protocol for each packet of a huge pcap file. I am going to make a dictionary to hold them all but my first step is just to pull the information using dpkt. It looks like ip.get_proto is what I want but I missing…
JMJ
  • 531
  • 1
  • 5
  • 16
2
votes
2 answers

Install dpkt on python 3

I am trying to install dpkt on python 3 and I get the following error when I am installing: (venv)[root@miura dpkt-1.8]# python setup.py install Traceback (most recent call last): File "setup.py", line 4, in import dpkt File…
badtrains
  • 91
  • 1
  • 2
  • 9
1
vote
3 answers

Convert binary/hex encoded string to an integer

Hi sorry if this is a duplicate. Have done my best to look for an answer BACKGROUND: I am using dpkt to try and read the src and destination ip of packets in a PCAP file. The raw data in the file is stored simply as bytes: c0 a8 00 28 => 192 168 0…
Micheal Nestor
  • 91
  • 1
  • 10
1
vote
0 answers

Estimating Congestion Window Sizes in Python using DPKT from pcap file

I am currently completing an assignment for a Networking course related to parsing PCAP files and outputting some information about the TCP flows. I have pretty much finished but I've been stuck on one part for days. This part of the assignment…
1
vote
1 answer

How to calculate payload size by using python dpkt library

I need to process a 7GB pcap file to extract their packets size, payloads size. I initially use scapy's PcapReader to extract these sizes, but scapy run truly slow for 7GB file. So I change to use DPKT library, however, I don't know how to check its…
1
vote
0 answers

Extract email addresses from pcap file with dpkt

I'm new to python and I'm trying to write a script that will open and parse a pcap file. I have managed to do that but now I need to extract email addresses present in the fields To: and From: included in the packets and then print them. I have been…
sophia
  • 11
  • 2
1
vote
0 answers

How do I summarise my pcap's parsed info into its different traffic types?

Hi there I am building a packet analysis tool. So far my code simply opens the pcap, parses it and closes the file. The code I have used has been adapted from the dpkt documentation. My pcap test files use different types of traffic (tcp, udp, igmp…
Sly_Lamp
  • 47
  • 1
  • 6
1
vote
1 answer

How can I parse all the packets in my pcap file instead of one?

I am a beginner at python, currently trying to build a packet capture analysis tool using dpkt in python 3. I have not done much yet, I'm attempting to build it slowly, step by step so I can really understand my problems and learn from them. As it…
Sly_Lamp
  • 47
  • 1
  • 6
1
vote
0 answers

Can I extract Client Hello information using dpkt.ssl.TLSClientHello?

I want to parse the Client Hello message of the TLS handshake record. I was taking a look at a code in Github that was very helpful and used dpkt library in order to parse the packets. The code is clear but I have a question about a part of the code…
Jamin
  • 55
  • 2
1
vote
1 answer

How to process packet captures with Python's dpkt module

I am trying to write a python program to parse packet capture using dpkt module. I have used it on packet captures that had Ethernet and tcpdump captures and it worked fine. However, my current packet capture is raw packet capture that directly has…