┬─┐┌┬┐┌─┐┌┬┐┌─┐┌─┐┬ ┬ ┬┌─┐┌─┐┌┬┐
├┬┘ │ ├─┘ │ │ ││ ││ │││├─┤└─┐│││
┴└─ ┴ ┴ ┴ └─┘└─┘┴─┘ └┴┘┴ ┴└─┘┴ ┴
Extract RTP and Decrypt SRTP Audio streams from .PCAP files in the browser using WASM
- WASM code is working, but experimental!
- PCAP-> RTP-> SSRC Extraction
- PCMA/PCMU native decoder
- Raw decoding with FFMPEG-WASM
./build.sh
./build-wasm-docker.sh
Check out the included example for API usage.
npm run test
In a nutshell:
// Write or fetch binary PCAP data from JS to the virtual FS
Module.FS.writeFile('tmp.pcap', raw_pcap_data);
// Analyze the virtual PCAP file in wasm
Module.api.analyze('tmp.pcap', 'report.json');
// Read the analysis output back into JS
Module.FS.readFile('report.json', {encoding: 'utf8'});
npm run test
- analyze_pcap
- extract_pcap
- decrypt_pcap
const api = {
version: Module.cwrap('version', 'string', []), // null
analyze: Module.cwrap('analyze_pcap', 'string', ['string']), // filename
extract: Module.cwrap('extract_pcap', 'string', ['string', 'string']), // ssrc, filename
decrypt: Module.cwrap('decrypt_pcap', 'string', ['string', 'string', 'string']), // ssrc, key, filename
};
./dist/rtptool analyze <input file>
Extract RTP streams by ssrc prefixed by 0x
./dist/rtptool extract <ssrc> <input file>
Decrypt SRTP streams by ssrc using the RFC4568 key
./dist/rtptool decrypt <ssrc> <key> <input file>
Example Key: AES_CM_128_HMAC_SHA1_80 inline:fCaLYx1IEhD62eKqFIGOk1qykNikYcamkFVkde1b|2^31|1:1
Based on srtpdecrypt