Skip to content

Instantly share code, notes, and snippets.

@oborichkin
oborichkin / sip-grok-patterns
Created March 13, 2023 12:36
Grok patterns for SIP
TOKEN [\w\d\-\.!%\*_\+`'~]+
WORD [\d\w\-\.!%\*_+`'~()<>:\\"\/\[\]?{}]+
SIP_CALL_ID %{WORD}[@%{WORD}]?
BRANCH %{TOKEN}
@oborichkin
oborichkin / bash_wait_for_key.sh
Created October 20, 2019 14:52
Waiting for keypress in bash
#!/bin/bash
wait_for_key () {
echo "Press any key to continue"
while [ true ] ; do
read -t 3 -n 1
if [ $? = 0 ] ; then
break ;
fi
done
@oborichkin
oborichkin / certificate.py
Created May 17, 2019 10:59
📝 Create self signed SSL certificate in Python
import socket
import os
# pip install pyOpenSSL
from OpenSSL import crypto
def create_self_signed_cert(name=None):
CERT_FILE = os.path.join("certificates", name + "_cert.pem" if name else "cert.pem")
KEY_FILE = os.path.join("certificates", name + "_key.pem" if name else "key.pem")
@oborichkin
oborichkin / tls_client.py
Last active April 11, 2024 14:27
Simple TLS client and server on python
import socket
import ssl
from tls_server import HOST as SERVER_HOST
from tls_server import PORT as SERVER_PORT
HOST = "127.0.0.1"
PORT = 60002
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)