filmov
tv
Python Script: Python Script To get Audio from VOIP Packet Capture (PCAP) file

Показать описание
Python Script: Python Script To get Audio from VOIP Packet Capture (PCAP) file
Python is a great choice for a language as it’s easy to learn and has a wealth of great packages available to it. In this case, I’m utilizing the Python package: PyShark to act as a wrapper for thsark. If you don’t know what tshark is, it’s a command line version of Wireshark. If you don’t know what wireshark is, well it’s a wonderful GUI application that records and analyzes packet captures (links on these below.)
Before Python, I used a bash script to call tshark functions on the pcap (link below.)
While Wireshark is useful in many cases, it’s not very programable. If you had a Virtual Machine running as a test asterix/freeswitch box in a VOIP/SIP test environment, you won’t have a visual front end. But you can write a script to kick off the recording of packet captures, along with the removal of audio from the packets to RAW form.
Once you have audio in RAW form, you can simply use sox or other audio conversion utilities to convert the file to a wav, mp3, etc.
Specifically these links for this particular code exercise:
Links:
Python is a great choice for a language as it’s easy to learn and has a wealth of great packages available to it. In this case, I’m utilizing the Python package: PyShark to act as a wrapper for thsark. If you don’t know what tshark is, it’s a command line version of Wireshark. If you don’t know what wireshark is, well it’s a wonderful GUI application that records and analyzes packet captures (links on these below.)
Before Python, I used a bash script to call tshark functions on the pcap (link below.)
While Wireshark is useful in many cases, it’s not very programable. If you had a Virtual Machine running as a test asterix/freeswitch box in a VOIP/SIP test environment, you won’t have a visual front end. But you can write a script to kick off the recording of packet captures, along with the removal of audio from the packets to RAW form.
Once you have audio in RAW form, you can simply use sox or other audio conversion utilities to convert the file to a wav, mp3, etc.
Specifically these links for this particular code exercise:
Links: