Skip to content

Instantly share code, notes, and snippets.

@xmpf
xmpf / format.py
Created March 20, 2021 19:37
Codefest CTF: Format Strings [#pwn]
#!/usr/bin/env python3
'''
0x080492df <+52>: push 0x50
0x080492e1 <+54>: lea eax,[ebp-0x58]
0x080492e4 <+57>: push eax
0x0804930d <+98>: call 0x80490a0 <printf@plt>
0x08049312 <+103>: add esp,0x10
@xmpf
xmpf / shellcode_test.c
Created February 18, 2021 09:00
test and verify shellcode
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
const char shellcode[] =
"\x48\x31\xf6\x56\x48\xbf\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x57\x54\x5f\x6a\x3b\x58\x99\x0f\x05";
@xmpf
xmpf / bin2shellcode.sh
Created February 17, 2021 21:10
binary2shellcode
function bin2shellcode {
echo "----- CUT HERE -----"
sc=""
for i in $(objdump -d "$1" | awk -F"\t" '{ print $2 }' | tr '\n' ' ' | sed 's/\ //g' | fold -w 2 | paste -sd' ')
do
sc="${sc}\\\x${i}"
done
echo "\"${sc}\""
echo "--------------------"
}
@xmpf
xmpf / ctftime_writeups,py
Created April 5, 2020 18:39
Naive script to find information about writeups of a CTF from ctftime
#!/usr/bin/env python3
import re
import sys
import json
import requests
from typing import List
from bs4 import BeautifulSoup
from urllib.parse import urlparse
@xmpf
xmpf / qposneg.c
Created February 25, 2015 22:08
ECE[@]NTUA: Σειρά 8 - Εισαγωγή στον Προγραμματισμό Η/Υ
#include <stdio.h>
#include <stdlib.h>
typedef enum bool_t {false, true} bool_t;
typedef struct node_t {
int data;
struct node_t *next;
} node_t;
@xmpf
xmpf / maxsum.c
Created January 11, 2015 18:17
ECE[@]NTUA: Σειρά 7 Άσκηση 23 (maxsum) - Εισαγωγή στον Προγραμματισμό Η/Υ
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int N;
int i;
int *a;
int sum;