Skip to content

Instantly share code, notes, and snippets.

@umutbasal
umutbasal / m1cat.c
Created March 26, 2023 05:45 — forked from marcan/m1cat.c
m1cat: a PoC for the M1RACLES covert channel vulnerability in the Apple M1
/*
* m1cat: a proof of concept for the M1RACLES vulnerability in the Apple M1.
*
* This program implements a covert channel that can be used to transmit data
* between two processes when run on the Apple Silicon "M1" CPUs.
*
* The channel is slightly lossy due to (presumably) the scheduler sometimes
* scheduling us on the wrong CPU cluster, so this PoC sends every byte twice
* together with some metadata/framing bits, which is usually good enough.
* A better approach would be to use proper FEC or something like that.
Ali-CDN-Real-IP
CF-Connecting-IP
Cdn-Real-Ip
Cdn-Src-Ip
Client-IP
Fastly-Client-Ip
Forwarded
Forwarded-For
Proxy-Client-IP
True-Client-IP
@umutbasal
umutbasal / book.sh
Created January 29, 2024 15:49
pandoc md to pdf
pandoc -i p1hlafsis71j51eol1rjn12gd1v694.md -o podsuj.pdf --template=./eisvogel.latex -V book -V table-use-row-colors:true -V toc-own-page:true -V papersize:a5 -V fontsize="8pt" --listings --number-sections --highlight-style espresso --top-level-division=chapter -V classoption=oneside -V listings-no-page-break -V geometry:top=2cm -V geometry:bottom=2cm -V geometry:left=1cm -V geometry:right=1cm
# usage pods_on.sh <node1> <node2> <label1=value1> <label2=value2> <...> <kubectl_flags>
# example pods_on.sh node1 "ingress in (true)" -o wide
flags=(); nodes=(); k=true
for arg in "${@}"; do
if [[ $arg == "-"* ]]; then k=false; fi
$k && { [[ $arg == *"="* || $arg == *"("* ]] && nodes+=($(kubectl get nodes -l "$arg" -o jsonpath='{.items[*].metadata.name}')) || nodes+=($arg); } || flags+=($arg)
done
nodes=($(echo "${nodes[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
@umutbasal
umutbasal / jqw.sh
Last active March 23, 2024 22:33
interactive jq
# jqw data.json
jqw ()
{
echo '' | fzf --print-query --preview "cat $1 | jq {q}"
}
# fzi "cat a.json | jq {q}"
# fzi "cat a.json | awk {q}"
fzi ()
{
echo '' | fzf --print-query --preview $1
@umutbasal
umutbasal / bpf_syscall_count.py
Last active April 27, 2024 13:12
ebpf syscall count by user
#!/usr/bin/python3
from bcc import BPF
from time import sleep
from bcc.syscall import syscall_name, syscalls
program = r"""
RAW_TRACEPOINT_PROBE(sys_enter) {
u64 uid;
u64 counter = 0;
table_alphabet = "AZBYCVÇÜDUETFŞGSĞRHPIÖİOJNKML"
alphabet = "ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ"
def vinegere_table(alphabet):
table = []
for i in range(len(alphabet)):
table.append(alphabet[-i:] + alphabet[:-i])
return table
table = vinegere_table(table_alphabet)
package main
import "fmt"
type AND map[bool]map[bool]bool
const (
TRUE = true
FALSE = false
)
@umutbasal
umutbasal / check.sh
Last active October 13, 2024 22:22
aerial views for offline
list=$(ls out)
# #ffmpeg -i out/comp_GMT329_113NC_396B_1105_CHINA_v04_SDR_FINAL_20180706_F900F2700_SDR_2K_HEVC.mkv -c copy -f null - 2>&1 | grep time= | awk -F 'time=' '{print $2}' | awk '{print $1}' | awk '{split($1,a,":"); print a[3]}'
for file in $list; do
time=$(ffmpeg -i out/$file -c copy -f null - 2>&1 | grep time= | awk -F 'time=' '{print $2}' | awk '{print $1}' | awk '{split($1,a,":"); print a[3]}')
# parse float
time=$(echo $time | awk '{print int($1)}')
if [ $time -lt 20 ]; then
#rm out/$file