Skip to content

Instantly share code, notes, and snippets.

View superstes's full-sized avatar
🎯
Focusing

Rath Pascal superstes

🎯
Focusing
View GitHub Profile
@superstes
superstes / inter_proccess_secrets_via_fifo_pipes.py
Created April 3, 2026 21:58
Utilizing FIFO-pipes on linux to transfer secrets between processes
#/usr/bin/env python3
import os
from threading import Thread
# writing secret values to FIFO-pipes so they can only be read/consumed once
# safer than writing a text-file and then deleting it
# read-out the fifo-pipes via: cat /tmp/t555_1 /tmp/t555_3 /tmp/t555_2
payload = {
@superstes
superstes / easyrsa-ca-subca-server.sh
Last active January 1, 2026 18:09
EasyRSA - create CA, Sub-CA & Server-Cert
#!/usr/bin/env bash
# PREPARE:
# download & extract easyrsa: https://github.com/openvpn/easy-rsa/releases
# cd into the EasyRSA* dir
# cp vars.example vars
# edit the vars to your needs - you might want to change 'rsa' to 'ec' and set the 'EASYRSA_REQ_*' infos
mkdir rootca subca
cp vars rootca/
@superstes
superstes / netfilter_rate_limit_test.py
Last active March 3, 2026 19:05
Netfilter Rate-Limit Test-Script (NFTables/IPTables)
#!/usr/bin/env python3
# the netfilter uses the 'token bucket algorithm'
# it sometimes can be a bit 'unintuitive' how this rate-limit-algorithm works
# the algorithm expects the packets, as defined by the limit, to be somewhat spread over the whole timewindow (second/minute/..)
# token bucket punishes short-term overages beyond the burst capacity
# limit source code: https://github.com/torvalds/linux/blob/master/net/netfilter/nft_limit.c
# this script provides a way to easily test "rate-limit + burst" configurations
# to get practical data you can simply run "tcpdump" on your target system and extract the packet-times from its output
@superstes
superstes / form_input_validation_regex.js
Last active March 5, 2025 19:37
Simple Regex for Form-Input-Validation
/*
NOTE:
These are not perfect, but good enough for frontend-validation.
A exact validation needs to be done on the backend anyways..
*/
const REGEX_IP4 = /^([1-2]?)[0-9]{1,2}\.([1-2]?)[0-9]{1,2}\.([1-2]?)[0-9]{1,2}\.([1-2]?)[0-9]{1,2}$/
/*
tested:
10.0.0.0
@superstes
superstes / ssl-ocsp-check.sh
Created October 14, 2024 20:27 — forked from NiceRath/ssl-ocsp-check.sh
Script to check if website has OCSP enabled or issues with it
#!/bin/bash
if [ -z "$1" ]
then
echo 'Provide a hostname of a website to check!'
exit 1
fi
if [ -z "$2" ]
then
@superstes
superstes / ssl-validate.sh
Created October 14, 2024 20:26 — forked from NiceRath/ssl-validate.sh
Script to validate certificate of service
#!/bin/bash
if [ -z "$1" ]
then
echo 'Provide the target hostname!'
exit 1
fi
TARGET="$1"
@superstes
superstes / in_ip_list.py
Created October 12, 2024 15:46
Python Script to check if an IP is inside an IP-List-File
#!/usr/bin/env python3
from sys import exit as sys_exit
from pathlib import Path
from argparse import ArgumentParser
from ipaddress import IPv4Address, IPv6Address, IPv4Network, IPv6Network, AddressValueError, NetmaskValueError
def _load_ip_list(ip_list_file: str) -> (list, list):
safe_ips = []
@superstes
superstes / check_IP_is_public.sh
Created October 8, 2024 17:19
Bash Script to check if IP is Public (using Python3 inline)
#!/bin/bash
IP="1.1.1.1"
ip4="$(python3 -c "from ipaddress import IPv4Address; from sys import argv; ip=argv[1]; print(ip) if IPv4Address(ip).is_global else print('1')" "$IP" 2>/dev/null || echo '0')"
if [[ "$ip4" == '0' ]]
then
ip6="$(python3 -c "from ipaddress import IPv6Address; from sys import argv; ip=argv[1]; print(ip) if IPv6Address(ip).is_global else print('1')" "$IP" 2>/dev/null || echo '0')"
@superstes
superstes / log_top_ps.sh
Created October 3, 2024 20:55
Bash script to log top N resource-consuming processes
#!/bin/bash
LOG_DIR='/var/log/ps/'
TOP_N=5
TOP_N_H=$(( TOP_N + 1 ))
mkdir -p "$LOG_DIR"
date >> "${LOG_DIR}/mem.log"
ps -eo rss,pid,user,command --sort -rss | head -n "$TOP_N_H" | tail -n "$TOP_N" >> "${LOG_DIR}/mem.log"
@superstes
superstes / light-dark-element-switch.css
Last active September 27, 2024 08:52
CSS Switch Images/Elements with Light/Dark-Mode
body.light {
--darkVisible: hidden;
--darkDisplay: none;
--lightVisible: unset;
--lightDisplay: inline-block;
}
body.dark {
--darkVisible: unset;
--darkDisplay: inline-block;