Skip to content

Instantly share code, notes, and snippets.

@hashbrowncipher
hashbrowncipher / Cryptography and Computer Privacy.txt
Created October 20, 2021 05:57
Cryptography and Computer Privacy by Horst Fiestel
Scientific American
May 1973
Volume 228
Number 5
Cryptography and Computer Privacy
by Horst Fiestel
Computer systems in general and personal "data banks" in particular
need protection. This can be achieved by enciphering all material and authenticating
@hashbrowncipher
hashbrowncipher / loader.c
Created August 21, 2021 22:35
A little x86-64 loader for Linux's binfmt_misc.
/*
* A little x86-64 loader for Linux's binfmt_misc.
*
* Compile with: gcc -O3 -static -nostdlib -o loader loader.c
*
* Register as:
* mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
* echo ':amd64:E::amd64::/path/to/loader:O' > /proc/sys/fs/binfmt_misc/register
*
* Then just run your favorite shellcode. Sample:
@hashbrowncipher
hashbrowncipher / benchmark.txt
Created August 17, 2021 16:31
ec2-boot-bench: Ubuntu at 2.85 seconds (median)
Moving from running to port closed took: 3.147979 s
Moving from port closed to port open took: 0.000000 s
Moving from running to port closed took: 2.366330 s
Moving from port closed to port open took: 0.000000 s
Moving from running to port closed took: 2.998677 s
Moving from port closed to port open took: 0.000000 s
Moving from running to port closed took: 2.605815 s
Moving from port closed to port open took: 0.024404 s
Moving from running to port closed took: 2.754971 s
Moving from port closed to port open took: 0.009866 s
@hashbrowncipher
hashbrowncipher / notes.txt
Created July 16, 2021 23:22
boot in 1853ms
- this uses a squashfs root image with a writable overlay
- only a single application service is running (sshd)
- the instance was a c5.large that had already booted once
@hashbrowncipher
hashbrowncipher / notes.txt
Created July 13, 2021 11:30
boot in 2761ms
- This run was on a c5.large which had been booted up before
- Set MODULES=dep in /etc/initramfs-tools/initramfs.conf
- Deleted a bunch of initramfs-tools hooks, including especially: iscsi mdadm lvm2
- Removed a bunch of stock ubuntu services
* snapd
* ec2-instance-connect
* cryptsetup-initramfs
* udisks2
* unattended-upgrades
* plymouth
josh@ubuntu:~/hasher$ dd if=/dev/zero bs=65536 count=16384 | ./xxHash/xxh128sum
16384+0 records in
16384+0 records out
16024760318c6298efd1151033ad2e9f stdin
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.23966 s, 4.5 GB/s
josh@ubuntu:~/hasher$ dd if=/dev/zero bs=65536 count=16384 | ./a.out
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.210685 s, 5.1 GB/s
16024760318c6298efd1151033ad2e9f
from aiohttp.client_exceptions import ClientError
import asyncio
from asyncio import Queue
from aiohttp.resolver import AsyncResolver
import json
import os
import random
from blake3 import blake3
from hashlib import md5
from socket import socketpair
@hashbrowncipher
hashbrowncipher / assumerole.py
Created December 15, 2019 00:56
subclass of botocore.session.Session that assumes roles and refreshes credentials
from botocore.session import Session
credentials_cache = dict()
class Session(Session):
def __init__(self, role_arn, *args, **kwargs):
super().__init__(*args, **kwargs)
self._config = dict(
profiles=dict(
default=dict(
@hashbrowncipher
hashbrowncipher / coredump_uploader.sh
Created November 11, 2019 03:38
Example coredump uploader
#!/bin/bash
# Depends on zstd (>1.3.6) and aws-cli
set -o errexit
set -o nounset
set -o pipefail
# Set kernel.core_pattern = | coredump_uploader.sh %P %s %E
PID=$1
shift
SIGNAL=$1
$ sudo -u cassandra jstat -gcutil $(pgrep -f Cassandra) 100ms
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176
0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176
0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176