Skip to content

Instantly share code, notes, and snippets.

View teknoraver's full-sized avatar
🖥️
coding

Matteo Croce teknoraver

🖥️
coding
View GitHub Profile
@teknoraver
teknoraver / debianttyinstall
Created September 24, 2021 15:54
Install Debian via a serial console
#!/bin/sh
[ $# -eq 2 ] || exec echo "Usage: $0 <install.iso> <disk.img>"
for k in qemu kvm qemu-kvm; do
which $k 2>/dev/null >/dev/null && kvm=$k && break
done
[ -n "$kvm" ] || exec echo "error: KVM not found!"
cores=$(nproc)
@teknoraver
teknoraver / oediv
Created September 16, 2021 11:27
reverse an mp4 video
#!/bin/sh
[ $# -ne 2 ] && exec echo "Usage: ${0##*/} <input> <output>"
src=$1
dst=$2
dir=$(mktemp -d)
trap "rm -rf $dir" EXIT
/*
* unalign_check - check the CPU behaviour on different alignments
* Copyright (C) 2021 Matteo Croce <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@teknoraver
teknoraver / extensions.conf
Last active January 17, 2023 13:30
Magnotta based voice mail
[general]
static=yes
writeprotect=yes
clearglobalvars=no
[globals]
[outgoing_context]
exten => _[+]X.,1,Dial(PJSIP/${EXTEN}@vodafone-out)
exten => _X.,1,Dial(PJSIP/${EXTEN}@vodafone-out)
@teknoraver
teknoraver / fiorun
Last active December 22, 2020 15:27
#!/bin/sh
dev=/dev/nvme0n1p1
mnt=/media
run_one() {
echo "$2t"
fio \
--output="fio-$1-$2t.csv" --output-format=terse \
--directory="$mnt" \
@teknoraver
teknoraver / libertus.sh
Last active September 22, 2020 10:59
easily switch the default GIT branch from master to main
#!/bin/sh -e
# Switch the default GIT branch from `master` to `main`
# for GitHub users, it can do the remote change too, but:
# 1. assumes that the name of the current directory name is the repo name
# 2. you must provide valid user and token to authenticate
user=
token=
@teknoraver
teknoraver / rxmastree.go
Last active December 9, 2019 01:16
tool to find reverse Xmas tree declarations in a source tree
/*
* rxmastree - tool to find reverse Xmas tree declarations in a source tree
* Copyright (C) 2019 Matteo Croce <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#!/bin/sh
lip=192.168.0.1
rip=192.168.0.2
ip netns add peer
ip link add name vethov type veth peer name vethov netns peer
ip addr add ${lip}/24 dev vethov
ip -n peer addr add ${rip}/24 dev vethov
ip link set vethov up
#!/bin/sh
lip=192.168.0.1
rip=192.168.0.2
lip2=192.168.1.1
rip2=192.168.1.2
wg genkey >wg1.priv
wg pubkey <wg1.priv >wg1.pub
wg genkey >wg2.priv
@teknoraver
teknoraver / sctprank.c
Last active November 6, 2019 09:28
[CVE-2019-3874] a tool to fill the kernel memory using SCTP network buffers
/*
* SCTPrank - a tool to fill the kernel memory using SCTP network buffers
* its main purpose was to test CVE-2019-3874
* Copyright (C) 2019 Matteo Croce <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*