Skip to content

Instantly share code, notes, and snippets.

View moyix's full-sized avatar

Brendan Dolan-Gavitt moyix

View GitHub Profile
#!/usr/bin/env python3
import sys
import struct
from pprint import pprint
# Parser for ELF executables
def parse_elf_header(f):
# Parse ELF header
#!/usr/bin/env python3
import sys
import struct
from pprint import pprint
# Parser for ELF executables
def parse_elf_header(f):
# Parse ELF header
@moyix
moyix / gist:d675c84dca9eb0cf031a755e0e9a9f4f
Last active November 4, 2021 20:33
Tiny script to convert my .bib to Markdown
#!/usr/bin/env python
import sys
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import *
def comma_separator(sequence):
if not sequence:
return ''
-1.541954 | /* ssl/t1_lib.c */
-0.001411 | /* Copyright (C) 1995-1998 Eric Young ([email protected])
-0.000049 | * All rights reserved.
-0.000127 | *
-0.000071 | * This package is an SSL implementation written
-0.000021 | * by Eric Young ([email protected]).
-0.000132 | * The implementation was written so as to conform with Netscapes SSL.
-0.168987 | *
-0.000021 | * This library is free for commercial and non-commercial use as long as
-0.000075 | * the following conditions are aheared to. The following conditions
@moyix
moyix / heartbleed_probabilities.txt
Created September 19, 2021 22:14
Log probabilities assigned by the OpenAI Codex model to each line of the function containing Heartbleed
-0.471773 | #ifndef OPENSSL_NO_HEARTBEATS
-3.596041 | int
-0.389579 | tls1_process_heartbeat(SSL *s)
-0.135248 | {
-0.778353 | unsigned char *p = &s->s3->rrec.data[0], *pl;
-0.588106 | unsigned short hbtype;
-0.750892 | unsigned int payload;
-0.836333 | unsigned int padding = 16; /* Use minimum padding */
- |
-1.023496 | /* Read type and payload length first */
/* License:
* Public domain.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#!/usr/bin/env python3
# Z3 solver for Copilot hash list
# Written by @RolfRolles, ported to integer math by @moyix
import z3
import sys
MIN_STR_LEN = 3
MAX_STR_LEN = 15
@moyix
moyix / copilot_fmt_plug.c
Last active September 2, 2025 13:41
JtR cracker for Copilot slur list hash format
/*
* Copilot cracker for JtR. Hacked together during August of 2021 by
* Brendan Dolan-Gavitt <mooyix at gmail.com>
*
* This software is Copyright (c) 2021, Brendan Dolan-Gavitt <mooyix at gmail.com>
* and it is hereby released to the general public under the following terms:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* Most of the file ripped off from pst_fmt_plug.c by Dhiru Kholia
@moyix
moyix / obfs.c
Created August 31, 2021 00:20
KLEE-friendly implementation of Copilot hash algorithm
#include <stdio.h>
#include <klee/klee.h>
#include <assert.h>
int obfuscateWord(char *e) {
double t = 0x17ed2e7f1ccbb000;
char c;
while ((c = *e++)) {
__int128 x = (__int128)(t*33);
int y = x & 0xffffffff;
@moyix
moyix / shapshot_diff.py
Created August 17, 2021 14:27
Diff two PANDA snapshots to compress one based on the other
#!/usr/bin/env python3
# PANDA Snapshot Diff Tool
#
# Copyright (c) 2021 Brendan Dolan-Gavitt <[email protected]>
#
# Based on: Migration Stream Analyzer
#
# Copyright (c) 2015 Alexander Graf <[email protected]>
#
# This library is free software; you can redistribute it and/or