Skip to content

Instantly share code, notes, and snippets.

View rgerganov's full-sized avatar

Radoslav Gerganov rgerganov

View GitHub Profile
@rgerganov
rgerganov / perf.sh
Created December 19, 2024 08:32
perf usage
#!/bin/bash
perf record -F 99 -g python foo.py
perf script | ./stackcollapse-perf.pl > out.perf-folded
./flamegraph.pl out.perf-folded > result.svg
@rgerganov
rgerganov / stb-update-proxy.md
Last active August 4, 2024 14:00
Proxying the update host for Eurolan STBs

Proxying the update host for Eurolan STBs

Firmware updates for TH100/TH200/TH300 set-top boxes are served from stb.xakcop.com:443. If this host is not reachable from your internal IPTV network, then you can setup a proxy update host:

+------------+           +--------------+           +--------------------+
|            |           |              |           |                    |
| TH100 STBs |<--------->| Proxy Update |<--------->| stb.xakcop.com:443 |
|            |           |     Host     |           |                    |
+------------+ +--------------+ +--------------------+
@rgerganov
rgerganov / build.md
Last active December 20, 2023 08:33
Pixel 8 Pro results
➜  build-android2 git:(master) ✗ make -j
[  1%] Generating build details from Git
[  2%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[  3%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
[  4%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[  5%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
-- Found Git: /usr/bin/git (found version "2.25.1") 
Scanning dependencies of target build_info
[  6%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
@rgerganov
rgerganov / dump_signatures.py
Last active September 28, 2023 11:13
Get precomputed signatures from AirReceiver
#!/usr/bin/env python3
import os
import sys
import time
import subprocess
from datetime import date, timedelta
ADB_PATH = '/tmp/platform-tools/adb'
AUTH_CMD = '/tmp/auth'
IP_ADDR = '192.168.1.213'
@rgerganov
rgerganov / SimpleHTTPServerWithUpload.py
Created May 12, 2022 14:53 — forked from smidgedy/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/env python3
########################################################################
#
# Simple HTTP server that supports file upload for moving data around
# between boxen on HTB. Based on a gist by bones7456, but mangled by me
# as I've tried (badly) to port it to Python 3, code golf it, and make
# It a little more robust. I was also able to strip out a lot of the
# code trivially because Python3 SimpleHTTPServer is a thing, and the
# cgi module handles multipart data nicely.
#
@rgerganov
rgerganov / th100-howto-wg.md
Last active May 21, 2023 19:50
TH100 Wireguard HOWTO

Connecting TH-100 STBs to Wireguard VPN server

This guide shows how to connect TH-100 STBs to a Wireguard VPN server. On the server side you need a Linux box with Wireguard installed. For Debian/Ubuntu simply run:

$ sudo apt install wireguard
$ sudo sysctl -w net.ipv4.ip_forward=1

Your TH-100 STBs needs to run firmware version 286 or later.

@rgerganov
rgerganov / nss-db.sh
Last active May 10, 2024 13:40
Create NSS db for Firefox/Chrome/LibreOffice
# build and install libccid from source
# do not install opensc from packages, build it from source
sudo apt-get install libnss3-tools
cd $HOME
mkdir -p .pki/nssdb
modutil -dbdir sql:.pki/nssdb -add "stampit" -libfile /usr/local/lib/opensc-pkcs11.so
modutil -dbdir .pki/nssdb -add "stampit" -libfile /usr/local/lib/opensc-pkcs11.so
@rgerganov
rgerganov / passcode.py
Created July 30, 2021 12:01
APRS passcode generator
#!/usr/bin/env python3
import sys
if __name__ == '__main__':
callsign = sys.argv[1].upper()
print(callsign)
hash = 0x73e2
for i in range(0, len(callsign), 2):
hash ^= ord(callsign[i]) << 8
if i + 1 < len(callsign):
@rgerganov
rgerganov / softhsmv2.py
Last active April 13, 2021 07:27
SoftHSMv2
#!/usr/bin/env python3
# This script derives the masterKey and tokenKey from a SoftHSMv2 token.
# For more details: https://xakcop.com/post/softhsmv2/
import sys
from Cryptodome.Hash import SHA256
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad
PBE_ITERATION_BASE_COUNT = 1500
@rgerganov
rgerganov / create-vmdk.sh
Created August 26, 2020 08:44
Create VMDK disk suitable for syzkaller
#!/bin/bash
VMDK_FILE="syzkaller.vmdk"
VMDK_SIZE="3GB"
NBD_DEV="/dev/nbd0"
NBD_DEVP1="${NBD_DEV}p1"
MOUNT_DIR="/tmp/vmdk"
ROOTFS="${1:-stretch.img}"
echo "Using ROOTFS=$ROOTFS"