Questions tagged [pyshark]

PyShark is a Python wrapper allowing packet parsing using Wireshark dissectors. This package allows parsing from a capture file or a live capture, using all installed Wireshark dissectors.

PyShark is a Python wrapper allowing packet parsing using Wireshark dissectors. This package allows parsing from a capture file or a live capture, using all installed Wireshark dissectors.

189 questions
11
votes
1 answer

Counting TCP retransmission in pyshark

As far as I know pyshark is a Python wrapper to tshark which is the command line version of Wireshark. Since Wireshark and tshark allow to detect TCP retransmission, I was wondering how I could to that using pyshark. I haven't find any good…
user1315621
  • 3,044
  • 9
  • 42
  • 86
10
votes
3 answers

pyshark - data from TCP packet

Is there anyway to get the payload of a TCP packet using pyshark? I am trying to compare the data sections of different packets across multiple TCP streams but I can't find a way to get at the data of the packet. pkt['tcp'].data does not seem to…
Cru Jones
  • 101
  • 1
  • 1
  • 3
7
votes
1 answer

Python 3.4.3 - Error Pyshark capture.sniff()

Here is my code: import pyshark capture = pyshark.LiveCapture(interface='en0') capture.sniff() Now here is the error: Traceback (most recent call last): File "", line 1, in capture.sniff() File…
Bob Ebert
  • 1,342
  • 4
  • 22
  • 41
6
votes
1 answer

signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object

I am trying to write some code to perform some packet sniffing with python using pyshark.I have the following piece of code: import pyshark print('Pyshark demo') capture = pyshark.LiveCapture(interface='enp0s8') However when I try to run this…
6
votes
2 answers

pyshark can not capture the packet on windows 7 (python)

I want to capture the packet using pyshark. but I could not capture the packet on windows 7. this is my python code import pyshark def NetCap(): print 'capturing...' livecapture = pyshark.LiveCapture(interface="eth0",…
Choi Doo-Seop
  • 95
  • 1
  • 2
  • 10
5
votes
3 answers

How to extract the payload of a packet using Pyshark

I am trying to read the payload of all packets in a .pcap file using Pyshark. I am able to open and read the file, access the packets and their other information but I am not able to find the correct attribute/method to use to access the payload of…
5
votes
2 answers

Get full hexdump of parsed packet in Pyshark

I am using Pyshark to parse packet from pcap file. I have object of parsed packet. Separately I can get hex_value of each fields after changed raw_mode attribute to True. >>> packet = pyshark.FileCapture("ip_packet.pcap") >>> packet_1 =…
Misha
  • 136
  • 1
  • 7
5
votes
4 answers

Count the number of packets with pyshark

In this code with pyshark import pyshark cap = pyshark.FileCapture(filename) i = 0 for idx, packet in enumerate(cap): i += 1 print i print len(cap._packets) i and len(cap._packets) give two different results. Why is that?
Bob
  • 10,741
  • 27
  • 89
  • 143
4
votes
1 answer

Run pyshark in background

I'd like to run pyshark in the background so while its running I'll still be able to perform some web actions and capture them. One mandatory condition is that I must be able to parse using tshark because I have some proprietary Wireshark…
someuser
  • 43
  • 4
3
votes
1 answer

getting "Error on reading from the event loop self pipe" error

I am looking to write a program to filter out and analyze PCAP file. Here is my current code, which is throwing an error. import pyshark import asyncio pcap_file = 'c:/sip.cap' capture = pyshark.FileCapture(pcap_file,display_filter='sip contains…
3
votes
1 answer

pyshark.LiveCapture not capturing packets

I am running pyshark version 0.4.2.9 on my Linux system. I am trying to capture packets from my wireless interface 'wl01', but pyshark.LiveCapture(interface='wl01') captures 0 packets. Where as tshark captures packets, just fine. >>> import…
Aritri
  • 33
  • 1
  • 5
3
votes
0 answers

How to build a ping message for ethereum node discovery using python?

I am trying to collect Ethereum node information from existing nodes. I would like to exchange PING/PONG/FIND_NODE messages from a seed node and identify more nodes recursively. As per the Ethereum documentation, I would require to build and…
Sajan Maharjan
  • 118
  • 1
  • 10
3
votes
1 answer

How to access the text representation of a xml payload contained in a sniffed http packet in pyshark?

I need to reverse engineer the XML based communication between an application and a server. In Wireshark there is an option to export the raw text of the http packet's xml payload to a text file or to the clipboard. I'd like to achive the same in…
Jabb
  • 3,414
  • 8
  • 35
  • 58
3
votes
1 answer

Pyshark - tshark can't use user plugin in 'decode_as'

I use Pyshark that uses tshark to decode a pcap file, and I have a problem using 'decode_as' option. I'm trying to decode a specific UDP port as SOMEIP protocol. This is a dissector I added that is taken from here. It is important to say that both…
Shir
  • 1,157
  • 13
  • 35
3
votes
3 answers

Whey I get errors when running pyshark on python3 virtual env ?

Recently I have installed Pyshark on my Pycharm. This is my code : import pyshark cap = pyshark.FileCapture('/root/captures/initialize_db.pcap') print (dir(cap[184]['DB-LSP-DISC'])) When I run I get the answer along with some warnings:…
vahidzolf
  • 109
  • 1
  • 1
  • 13
1
2 3
12 13