lmangani / rtptool-wasm

Experimental WASM PCAP RTP Extraction and SRTP Decryption

Home Page:https://lmangani.github.io/rtptool-wasm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

┬─┐┌┬┐┌─┐┌┬┐┌─┐┌─┐┬    ┬ ┬┌─┐┌─┐┌┬┐
├┬┘ │ ├─┘ │ │ ││ ││    │││├─┤└─┐│││
┴└─ ┴ ┴   ┴ └─┘└─┘┴─┘  └┴┘┴ ┴└─┘┴ ┴

Extract RTP and Decrypt SRTP Audio streams from .PCAP files in the browser using WASM

Status

  • WASM code is working, but experimental!
  • PCAP-> RTP-> SSRC Extraction
  • PCMA/PCMU native decoder
  • Raw decoding with FFMPEG-WASM

Build Native

x86_64

./build.sh

WASM using Docker

./build-wasm-docker.sh


WASM Module Usage

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
Functions
  • analyze_pcap
  • extract_pcap
  • decrypt_pcap
API
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
};

Command-Line Usage

./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

Credits

Based on srtpdecrypt

About

Experimental WASM PCAP RTP Extraction and SRTP Decryption

https://lmangani.github.io/rtptool-wasm/

License:GNU Affero General Public License v3.0


Languages

Language:C 94.9%Language:HTML 2.9%Language:Shell 2.2%