用于解密捕获的SRTP数据包的前端。
dsrtp的Python项目详细描述
用于使用:
解密捕获的SRTP and SRTCP数据包的简单前端安装
如果需要,请安装devellibpcap和libsrtp,例如:
sudo apt-get install libpcap-dev libsrtp0-dev
然后:
pip install dsrtp
用法
命令
例如,解密捕获的数据包,然后写入捕获文件:
dsrtp test/fixtures/av.pcap /tmp/rtp.pcap -ld -k test/fixtures/av_material.hex
如果您有一个混乱的捕获(例如,多个srtp流),那么您可以 例如,通过address:port选择绑定流,例如:
dsrtp test/fixtures/av.pcap /tmp/rtp.pcap -k test/fixtures/av_material.hex -l d -i 192.168.121.234:60401
lib
在代码中执行相同操作:
importdsrtpenc_km=open('test/fixtures/av_material.hex').read()km=dsrtp.KeyingMaterial.unpack_hex(enc_km)p=dsrtp.SRTPPolicy(ssrc_type=dsrtp.SRTPPolicy.SSRC_ANY_INBOUND,key=km.local)withdsrtp.SRTP(p)asctx, \ open('test/fixtures/av.pcap','rb')assrtp_pcap, \ open('/tmp/rtp.pcap','wb')asrtp_pcap:pkts=dsrtp.read_packets(srtp_pcap)decrypted_pkts=dsrtp.decrypt_packets(ctx,pkts)dsrtp.write_packets(rtp_pcap,decrypted_pkts)
开发
创建venv:
mkvirtualenv dsrtp pip install Cython
然后得到它:
git clone git@github.com:mayfieldrobotics/dsrtp.git cd dsrtp workon dsrtp pip install -e .[test]
并进行测试:
py.test test/ --cov dsrtp --cov-report term-missing --pep8
释放
测试通过:
py.test test/ --cov dsrtp --cov-report term-missing --pep8
所以更新__version__in:
- dsrtp/__init__.py
提交并标记:
git commit -am "release v{version}" git tag -a v{version} -m "release v{version}" git push --tags