Skip to content

Instantly share code, notes, and snippets.

View moyix's full-sized avatar

Brendan Dolan-Gavitt moyix

View GitHub Profile
@moyix
moyix / Dockerfile
Last active February 7, 2022 04:37
Misc infrastructure scripts for my Debian build attempts
FROM debian:unstable
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
RUN echo "deb-src http://deb.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get -y install build-essential bear
RUN useradd -ms /bin/bash builder
RUN apt-get -y install sudo
RUN adduser builder sudo
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@moyix
moyix / list_dsc.py
Created February 5, 2022 22:45
Script that uses python-apt to get some info about source packages
#!/usr/bin/env python
import re
import sys, os
sys.path.append('/usr/lib/python3/dist-packages')
import apt
import apt_pkg
import argparse
def urljoin(*args):
@moyix
moyix / daemon.json
Created February 5, 2022 22:40
Minimal config file for running a second instance of Docker with a different storage location
{
"data-root": "/fastdata/docker_img/storage",
"storage-driver": "overlay2",
"hosts": [
"unix:///var/run/docker-nvme.sock"
],
"pidfile": "/var/run/docker-nvme.pid",
"exec-root": "/fastdata/docker_img/run",
"bridge": "docker0",
"iptables": true
@moyix
moyix / ephemeral-github-actions-runner.env
Created January 30, 2022 17:53
Config file for ephemeral GitHub Actions runner
# Install with:
# sudo install -m 600 ephemeral-github-actions-runner.env /etc/
RUNNER_SCOPE=org
ORG_NAME=NYUAppSec
RUNNER_NAME_PREFIX=appsec_runner
ACCESS_TOKEN=INSERT_YOUR_GH_TOKEN_HERE
RUNNER_WORKDIR=/tmp/runner/work
EPHEMERAL=true
@moyix
moyix / find_runner.py
Created January 30, 2022 17:47
Script that kills any Github Actions Runner worker that has been running longer than 5 minutes
#!/usr/bin/env python3
import psutil
import docker
from datetime import timedelta, datetime
import time
client = docker.from_env()
while True:
time.sleep(10)
@moyix
moyix / favhelp.txt
Created December 30, 2021 02:32
moyix's favorite TeX '82 help messages
I'm broken. Please show this to someone who can fix can fix
--
I dddon't go any higher than filll.
--
Things are pretty mixed up, but I think the worst is over.
--
Sorry, I don't know how to help in this situation.
Maybe you should try asking a human?
--
If you really absolutely need more capacity,
@moyix
moyix / tex82_help.web
Created December 30, 2021 02:20
help() messages from TeX82
print_err("Emergency stop"); help1(s); succumb;
--
help1("I'm broken. Please show this to someone who can fix can fix");
--
help1("The magnification ratio must be between 1 and 32768.");
--
help1("I'm forgetting what you said and using zero for this \the.");
--
help1("I'm forgetting what you said and using zero for this \the.");
--
@moyix
moyix / emojiauthor.tex
Created December 13, 2021 19:52
Example of using emoji for author marks in IEEETran
% This is for IEEEtran but should give an idea of how to do it for other styles
% Preamble
\usepackage{emoji}
% [...]
% This is the main piece; we just redefine the IEEEauthorrefmark command and
% replace the symbols. We have to remove the \ensuremath{} because emoji don't
% seem to work in math mode. You can of course replace these emoji with any of
% the ones defined by the emoji package:
#!/usr/bin/env python3
import os
import sys
import hashlib
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
SHA384_SIZE=48
if len(sys.argv) != 4: