<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>sniffer nRF 802.15.4 paquets  live with python-script</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76773/sniffer-nrf-802-15-4-paquets-live-with-python-script</link><description>Hello, 
 
 I want to capture 802.15.4 nRF packets with a python script using the pyshark library and an nRF52840 DK sniffer and an nRF52840 Dongle. the problem is that when I launch my python script I receive 0 packets. on the other hand on Wireshark</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Jun 2021 14:43:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76773/sniffer-nrf-802-15-4-paquets-live-with-python-script" /><item><title>RE: sniffer nRF 802.15.4 paquets  live with python-script</title><link>https://devzone.nordicsemi.com/thread/317519?ContentTypeID=1</link><pubDate>Mon, 28 Jun 2021 14:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:015a7689-7030-4ede-ad56-b613a236d156</guid><dc:creator>kacper.szewenko</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately, I have never used pyshark with LiveCapture API for sniffing packets, but I think you can use the existing implementation of 802.15.4 sniffer:&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/nRF-Sniffer-for-802.15.4"&gt;https://github.com/NordicSemiconductor/nRF-Sniffer-for-802.15.4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can use the &lt;em&gt;extcap_cature&lt;/em&gt;&amp;nbsp;API method giving the path to the output pcap file, comport, channel, and metadata to start sniffing. It reads the packets straight from the serial port and creates the .pcap file for logging purposes. Then this file can be opened in python and can be taken into parsing through pyshark&amp;nbsp;- I am using pyshark API:&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;capture = CaptureFromPipe(pipe=pcap_file_pipe)&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Moreover, pyshark is a wrapper for Tshark and Tshark needs to have a configuration file with the master key to properly decode the packets. In case of running it under Linux the file should be in the directory:&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;~/.config/wireshark/ieee802154_keys&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;and it should contain the master key, e.g. of the file:&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;# This file is automatically generated, DO NOT MODIFY.
&amp;quot;00112233445566778899aabbccddeeff&amp;quot;,&amp;quot;0&amp;quot;,&amp;quot;Thread hash&amp;quot;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>