Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lmangani/rtptool-wasm
Experimental WASM PCAP RTP Extraction and SRTP Decryption
https://github.com/lmangani/rtptool-wasm
c ecmascript libpcap nodejs pcap rtp srtp wasm webassembly
Last synced: 3 months ago
JSON representation
Experimental WASM PCAP RTP Extraction and SRTP Decryption
- Host: GitHub
- URL: https://github.com/lmangani/rtptool-wasm
- Owner: lmangani
- License: agpl-3.0
- Created: 2020-10-26T00:33:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-21T10:39:45.000Z (over 2 years ago)
- Last Synced: 2024-10-04T16:48:46.887Z (4 months ago)
- Topics: c, ecmascript, libpcap, nodejs, pcap, rtp, srtp, wasm, webassembly
- Language: C
- Homepage: https://lmangani.github.io/rtptool-wasm/
- Size: 508 KB
- Stars: 11
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```
┬─┐┌┬┐┌─┐┌┬┐┌─┐┌─┐┬ ┬ ┬┌─┐┌─┐┌┬┐
├┬┘ │ ├─┘ │ │ ││ ││ │││├─┤└─┐│││
┴└─ ┴ ┴ ┴ └─┘└─┘┴─┘ └┴┘┴ ┴└─┘┴ ┴
```Extract RTP and Decrypt SRTP Audio streams from .PCAP files in the browser using WASM
### Status
- [x] WASM code is working, but experimental!
- [x] PCAP-> RTP-> SSRC Extraction
- [x] PCMA/PCMU native decoder
- [ ] Raw decoding with [FFMPEG-WASM](https://github.com/lmangani/ffmpeg-wasm-voip)### Build Native
###### x86_64
`./build.sh`###### WASM using Docker
`./build-wasm-docker.sh`-------------------
### WASM Module Usage
Check out the included [example](wasm/dist/api.js) for API usage.
```
npm run test
```In a nutshell:
```javascript
// 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
- [x] analyze_pcap
- [x] extract_pcap
- [x] decrypt_pcap##### API
```javascript
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
```Extract RTP streams by ssrc prefixed by `0x`
```
./dist/rtptool extract
```Decrypt SRTP streams by ssrc using the RFC4568 key
```
./dist/rtptool decrypt
```
Example Key: `AES_CM_128_HMAC_SHA1_80 inline:fCaLYx1IEhD62eKqFIGOk1qykNikYcamkFVkde1b|2^31|1:1`### Credits
Based on [srtpdecrypt]([email protected])