Skip to content

Instantly share code, notes, and snippets.

View hyavari's full-sized avatar
👋

H. Yavari hyavari

👋
View GitHub Profile
@hyavari
hyavari / ipsec_tester.sh
Created January 24, 2024 00:24
Script to Create numbers of IPSec Tunnels on Linux
#!/bin/bash
# Create numbers of IPsec Tunnels (transport mode) between two host machine for testing
# Usage: ./ipsec_tester.sh <create | flush> <Local_Machine_IP> <Remote_Machine_IP> <Number_of_Tunnels>
generate_random_value() {
echo "0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)"
}
generate_random_port() {
@hyavari
hyavari / rtp_decoder_encoder.py
Created August 19, 2023 07:28
Simple RTP Encode/Decoder in Python
'''
RTP Packet Structure from RFC 3550:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp |