Skip to content

Instantly share code, notes, and snippets.

@Kasimir123
Kasimir123 / patch.py
Last active July 25, 2023 16:34
Skeleton of the patch that is being applied to projects vulnerable to CVE-2007-4559. Based off of code from pip's unpacking.py.
import os
def is_within_directory(directory, target):
abs_directory = os.path.abspath(directory)
abs_target = os.path.abspath(target)
prefix = os.path.commonprefix([abs_directory, abs_target])
return prefix == abs_directory
@Kasimir123
Kasimir123 / z3.py
Created August 31, 2022 20:32
Template for Z3 CTF Solver
from z3 import *
# instantiate solver
s = Solver()
# flag length
FLAG_LEN = 40
# create arguments
args = [BitVec(f'args[{i}]', 32) for i in range(0,FLAG_LEN)]
@Kasimir123
Kasimir123 / fuzzer_test.cc
Created May 29, 2022 20:19
Example harness for test.c
// Kasimir "Abraxus" Schulz 5/27/2022
#include "backend.h"
#include "targets.h"
namespace fs = std::filesystem;
namespace fuzztest {
bool InsertTestcase(const uint8_t *Buffer, const size_t BufferSize) {
@Kasimir123
Kasimir123 / test.c
Created May 29, 2022 04:27
Example file for fuzzing elf files with WTF
#include <stdio.h>
#include <stdlib.h>
void print_char(char x)
{
if (x == 't')
{
exit(-1);
}
else if (x == 'c')
@Kasimir123
Kasimir123 / hangman.py
Created July 11, 2018 16:46
Simple Hangman game in python
import re
print ("Welcome to Hangman, please enter a word which you would like to use for the game, and then enter how many failed guesses you wish to give to the players.")
word = input("What is the word?")
guesses = []
counter = int(input("How many missed guesses do you want to give the players?"))
reveal = []
i = 30
for each in word:
reveal.append("_")
while i > 0: