Skip to content

Instantly share code, notes, and snippets.

View HerrSpace's full-sized avatar
💭
🧠🔥

Space Meyer HerrSpace

💭
🧠🔥
View GitHub Profile
@HerrSpace
HerrSpace / llvm-builder.bash
Created July 25, 2022 15:20
Building a bunch of LLVM versions from source
CONTAINER='debian:buster'
if [ ! -d ~/repos/llvm-project ]; then
mkdir -p ~/repos/
cd ~/repos/
git clone https://github.com/llvm/llvm-project.git
fi
mkdir -p ~/repos/llvm-bin/
cat << EOF > ~/repos/llvm-bin/build.bash

Here is a streamlined explanation of what you need to repro and fix.

Build serenity disk image for syzkaller

  • clone serenity (assumes fixes from SerenityOS/serenity#13846)
  • Meta/serenity.sh rebuild-toolchain
  • cd Ports/openssh and run ./package.sh
  • add sync-local.sh to serenity clone root:
printf "syzkaller modifications... "
pushd "$SERENITY_SOURCE_DIR/Build/$SERENITY_ARCH/"
Darwin spaces-iMac-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Sat Mar 20 19:47:58 CET 2021; space:xnu-7195.81.3/BUILD/obj/KASAN_X86_64 x86_64
space@spaces-iMac-Pro ~ % lldb kernel/xnu-7195.81.3/BUILD/obj/KASAN_X86_64/kernel.kasan
[...]
(lldb) disas -n getppid
kernel.kasan`getppid:
kernel.kasan[0xffffff80016f79e0] <+0>: pushq %rbp
kernel.kasan[0xffffff80016f79e1] <+1>: movq %rsp, %rbp
kernel.kasan[0xffffff80016f79e4] <+4>: pushq %r15
kernel.kasan[0xffffff80016f79e6] <+6>: pushq %r14
kernel.kasan[0xffffff80016f79e8] <+8>: pushq %rbx
# -*- mode: makefile;-*-
#
# Apple XNU build prep
# Jeremy C. Andrus
#
# This Makefile contains commands necessary to download
# and build the XNU kernel for macOS High Sierra through
# Big Sur. It will not actually build XNU, but it will
# build and install all of the prerequisites.
#
- prepare a new puppet branch with the updated version in the postgresql globals
- add the new pkgs to your repo and install them on the server
- systemctl stop postgresql@<old-version>
- systemctl stop postgresql@<new-version>
- pg_dropcluster <new version> main --stop
- try pg_upgradecluster <old version> main -j <cores> --link --method=upgrade
- if that fails try pg_upgradecluster <old version> main
- pg_dropcluster <old version> main
- run puppet with your new branch
- uninstall the old pg version
In [7]: zz={1:2, '1':'2'}
In [8]: zz
Out[8]: {1: 2, '1': '2'}
In [9]: json.dumps(zz)
Out[9]: '{"1": 2, "1": "2"}'
In [11]: qq=json.loads(json.dumps(zz))
@HerrSpace
HerrSpace / paramiko_agent.py
Last active April 3, 2019 14:42
Using paramiko to use and abuse ssh keys for signing and verifying. Load keys from agent or disk.
#!/usr/bin/env python3
# Example 1: Load priv and pub from file
from paramiko import RSAKey
# Load key from file, not from agent.
key = RSAKey.from_private_key_file('/Users/space/.ssh/tuer')
msg = key.sign_ssh_data(b"somestuff")
msg.rewind()
# This derives the public key.. Obviously.
pub = RSAKey(data=key.asbytes())
def git_version(path):
# Like v1.0.0 or v1.0.0-1-g963fc39.dirty
git_describe = check_output([
'git', '-C', path, 'describe', '--tags', '--dirty=.dirty']
).decode().strip()
# Like v1.0.0
last_tag = check_output([
'git', '-C', path, 'describe', '--tags', '--abbrev=0']
).decode().strip()
╭─space@FeTAp ~
╰─$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> b'\x00'.join(b'\x11\x11\x11')
'\x11\x00\x11\x00\x11'
>>> ^D
╭─space@FeTAp ~
╰─$ python3
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.
[Unit]
Description=PostgreSQL RDBMS
[Service]
Type=oneshot
ExecStart=/bin/true