Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@damianjwilliams
Created May 27, 2022 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damianjwilliams/0d2887b5677f2f32f185d451cf79524c to your computer and use it in GitHub Desktop.
Save damianjwilliams/0d2887b5677f2f32f185d451cf79524c to your computer and use it in GitHub Desktop.
Return BLE advertisement data from tshark
import subprocess
tsharkCall = ["C:\\Program Files\\Wireshark\\tshark.exe", "-i", "5","-l"]
tsharkProc = subprocess.Popen(tsharkCall,
bufsize=0,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
for packet in iter(tsharkProc.stdout.readline, b" "):
packet_string = packet.rstrip().decode("utf-8") #bytes to string
#packet_info
print(packet_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment