Skip to content

Instantly share code, notes, and snippets.

View nbulischeck's full-sized avatar

Nick Bulischeck nbulischeck

View GitHub Profile
@nbulischeck
nbulischeck / install-glibc-debug.sh
Last active October 22, 2024 14:44
Install glibc debug symbols on Arch Linux for pwndbg heap analysis
#!/bin/bash
# Install Dependencies
sudo pacman -S git svn gd lib32-gcc-libs patch make bison fakeroot
# Checkout glibc source
svn checkout --depth=empty svn://svn.archlinux.org/packages
cd packages
svn update glibc
cd glibc/repos/core-x86_64
import re
import os, shutil, pathlib
from zipfile import ZipFile, BadZipFile
from string import ascii_uppercase, ascii_lowercase
whitespace = ["\r", "\n", "\t", "\f", "\v", " "]
rep_var = ["{i}", "{j}", "{k}"]
def solve_challenge():
# Values from the white paper
EXAMPLE_PHDR = 'L2 F\' B2 U D2 B U D\' F2 L\' F U2 R U\' L\' R\' U\' B F D U\''.split(" ")
EXAMPLE_LHDR = 'B U2 D2 R\' F U2 B R L\' B L\' B L\' D F\' L U\' B2 R F2 L\' F2'.split(" ")
EXAMPLE_MSG = 'F L U2 L2 F\' B D\' B2 L\' B\' U L2 F\' R2 D\' B\' U\' L\' B R D2 L2 R\' B F2 D\' U R B D2 U2 R2 U\' F2 R2 F D F2 B2 D\' R\' D R\' U\' F\' B2 U F2 D R U L F U2 L2 D R B D\' B\' U L U\''.split(" ")
# Values from the challenge
CHALL_PHDR = 'B2 R U F\' R\' L\' B B2 L F D D\' R\' F2 D\' R R D2 B\' L R'.split(" ")
CHALL_LHDR = 'L\' L B F2 R2 F2 R\' L F\' B\' R D\' D\' F U2 B\' U U D\' U2 F\''.split(" ")
CHALL_MSG = 'L F\' F2 R B R R F2 F\' R2 D F\' U L U\' U\' U F D F2 U R U\' F U B2 B U2 D B F2 D2 L2 L2 B\' F\' D\' L2 D U2 U2 D2 U B\' F D R2 U2 R\' B\' F2 D\' D B\' U B\' D B\' F\' U\' R U U\' L\' L\' U2 F2 R R F L2 B2 L2 B B\' D R R\' U L'.split(" ")
@nbulischeck
nbulischeck / sql-param-bind.c
Created December 5, 2018 20:56
Function that uses SQL parameter binding in C
#include <mysql.h>
int commit_db(MYSQL *con){
MYSQL_STMT *stmt;
MYSQL_BIND bind[2];
my_ulonglong affected_rows;
item_t *curr = items_list;
int count, param_count;
unsigned long str_length;
@nbulischeck
nbulischeck / cyclic.py
Created November 1, 2018 23:35
GDB Python Plugin to Generate De Bruijn Sequences
#!/usr/bin/env python
from itertools import islice
from string import ascii_lowercase
def de_bruijn(k, n):
try:
_ = int(k)
alphabet = list(map(str, range(k)))
except (ValueError, TypeError):
@nbulischeck
nbulischeck / Makefile
Created May 26, 2018 15:35
PoC using debugfs to execute files
BACKDOOR := backdoor
obj-m := $(BACKDOOR).o
$(BACKDOOR)-y += poc.o
default: all
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
@nbulischeck
nbulischeck / README.md
Created April 11, 2018 12:39
The README file for Nick's CTF.

Nick's CTF

A CTF that challenges you from trivia questions to reverse engineering ELF binaries.

Recommended Tools

  • netcat
    • gnu-netcat
    • nc6
    • openbsd-netcat (discouraged)
@nbulischeck
nbulischeck / partition.c
Created February 26, 2018 03:52
Frustrated with strtok? Partition parses strings based on strings instead of characters and doesn't fudge the target string.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct view { const char *s; size_t len; };
size_t partition(struct view *result, size_t n,
const char *str, const char *delim){
char *startp = (char *)str, *endp;
size_t l = strlen(delim), i = 0;
@nbulischeck
nbulischeck / Arch VM Install Script
Last active April 18, 2020 06:05
Bash script to automate an arch install for virtual machines
#!/bin/bash
DISK=""
USERNAME="user"
PASSWORD="pass"
btrfs_setup()
{
subvols=(
""