예제 #1
0
파일: test_dsrtp.py 프로젝트: vojkic/dsrtp
def test_decrypt_outbound_srtp(fixtures, capture, material, out_address,
                               out_port, expected):
    km = dsrtp.KeyingMaterial.unpack_encoded(fixtures.join(material).read())
    with fixtures.join(capture).open('rb') as fo:
        dec_pkts = dsrtp.decrypt_packets(
            dsrtp.SRTPStream(km.local, out_address, out_port),
            dsrtp.read_packets(fo),
            unknown='drop',
            malformed='raise',
        )
        count = 0
        for _, pkt in dec_pkts:
            assert (dsrtp.is_srtp_packet(pkt) or dsrtp.is_srtcp_packet(pkt))
            count += 1
        assert count == expected
예제 #2
0
def test_decrypt_inbound_srtp(
        fixtures,
        capture,
        material,
        in_address,
        in_port,
        expected):
    km = dsrtp.KeyingMaterial.unpack_encoded(
        fixtures.join(material).read()
    )
    with fixtures.join(capture).open('rb') as fo:
        dec_pkts = dsrtp.decrypt_packets(
            dsrtp.SRTPStream(km.remote, in_address, in_port),
            dsrtp.read_packets(fo),
            unknown='drop',
            malformed='raise',
        )
        count = 0
        for _, pkt in dec_pkts:
            assert (
                dsrtp.is_srtp_packet(pkt) or dsrtp.is_srtcp_packet(pkt)
            )
            count += 1
        assert count == expected
예제 #3
0
파일: test_dsrtp.py 프로젝트: vojkic/dsrtp
def test_is_srtp(fixtures, packet, expected):
    raw = fixtures.join(packet).read().decode('hex')
    eth = dpkt.ethernet.Ethernet(raw)
    assert dsrtp.is_srtp_packet(eth) is expected
예제 #4
0
def test_is_srtp(fixtures, packet, expected):
    raw = fixtures.join(packet).read().decode('hex')
    eth = dpkt.ethernet.Ethernet(raw)
    assert dsrtp.is_srtp_packet(eth) is expected