How can I list the packet not in Wireshark using python API?

Hi,I am a rookie.

Recently,I want to use nRF52832 BLE dongle as a sniffer and try to capture BLE packets.I can see and analyze BLE packets in wireshark,but my teacher asked me to capture this packets not through Wireshark.

So I think the first step is understand this code of python API and run the official example.py. I refered this qustion:Unable to list the device using python API - Sniffer software but it doesn't seem to work.

Still the output is "Sniffer Device List:[]"

Attached CLI output and code file which I'm trying to execute.Consequently,My goal is capture the BLE packets using python.If you know any solution or similar open source repo, I am very glad that you tell me.

Best Regards.

import time
from SnifferAPI import Sniffer, UART
nPackets = 0
global mySniffer
ports = UART.find_sniffer()
print(ports)
mySniffer = Sniffer.Sniffer(portnum=ports[0], baudrate=1000000)
time.sleep(5)
# print(mySniffer)
# mySniffer.scan()
mySniffer.start()
time.sleep(5)
# d = mySniffer.getDevices()
# print(d)

mySniffer.scan()

d=mySniffer.getDevices()
packets=mySniffer.getPackets()
print(packets)
print(d)

Related