Skip to content

Instantly share code, notes, and snippets.

View disconnect3d's full-sized avatar
🎯
deadlocking the reality

Disconnect3d disconnect3d

🎯
deadlocking the reality
View GitHub Profile
@disconnect3d
disconnect3d / list_docker_containers.py
Last active September 29, 2016 09:08
Simple server listing docker containers with exposed ports as links on all network interfaces. Works with Python 3; `pip install flask` is required.
#!/usr/bin/env python3
# flask is required - install with `pip install flask`
import sys
import subprocess
from flask import Flask
if len(sys.argv) < 2:
print("Usage: %s <public ip>" % sys.argv[0])
@disconnect3d
disconnect3d / binary_addition.py
Last active November 15, 2016 20:18
"First steps programming exercise to add two binary numbers" lol
def add(b1, b2):
result = []
carry = 0
for i, j in zip(reversed(b1), reversed(b2)):
tmp = int(i) + int(j) + carry # 0, 1, 2
#print("i=%s, j=%s, carry=%d" % (i, j, carry))
carry = tmp / 2
tmp = tmp % 2
@disconnect3d
disconnect3d / gdb_bruteforce.py
Last active December 16, 2023 17:57
QIWI CTF re_3 [100 pts] gdb brute force
# QIWI CTF 2016 reverse 3 [100 pts] solution
# The flag could have been calculated by hand,
# but I've decided to write a brute force to train gdb scripting...
# (one had to see that input on particular index changed output on particular index linearly)
# thx to http://tromey.com/blog/?p=548
import gdb
import string
break_addr = 0x0000555555554B9F
/*
//// Decompiled from .so compiled with Cython
//// hidden.pyx code:
import numpy as np
def bar(x):
print "Hello from bar"
arr = np.array(x)
return arr * arr.T
%%cython
# Minkowski Distance with p=0.5
# based on scikit-learn MinkowskiDistance cython's class
# https://github.com/scikit-learn/scikit-learn/blob/cbd3bca20f1d19461011b5f59d9416669eb30535/sklearn/neighbors/dist_metrics.pyx#L524
from libc.math cimport fabs, sqrt, pow
cimport numpy as np
HIDDENSC:
02:00 <@crowell> disconnect3d: it's from the poking holes in information hiding paper
https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/oikonomopoulos
POC: 02:11:16 <yrp> tezeb: https://gist.github.com/yrp604/82e4f1cb8ed553c7a995237062177a6c
MINESWEEPER:
02:00 <yyyyyyy> minesweeper writeup: https://hxp.io/blog/30
RSA:
02:00 <@gsilvis> RSA: 1 has a small factor [use pollard's rho]; 2 has a factor p where p-1 is smooth [use pollard's p-1]; 3 was GCD; 4 was Weiner's attack; 5 was Fermat's factorization algorithm
@disconnect3d
disconnect3d / defconquals2017_sorcerery_solve.py
Created May 1, 2017 08:25
Solution for sorcerery crackme2000 task from DefCon Quals CTF
"""
Solution from Disconnect3d [playing in Just Hit the Core]
"""
import os
import angr
import pwn
import subprocess
@disconnect3d
disconnect3d / fancy_ctypes.py
Created May 8, 2017 12:47
Example showing that ctypes might be tricky... (the bytes buffer gets garbage collected so we get weird results)
In [8]: import ctypes
...:
...:
...: class Foo(ctypes.LittleEndianStructure):
...: _fields_ = (('bar', ctypes.c_uint64),)
...:
...: def __str__(self):
...: return 'Foo .bar={}'.format(self.bar)
...:
...: @classmethod
import angr
# Just compile the modified code: `gcc modified.c`
# and run `python crack.py` (you need angr installed)
# NOTE: You can find WIN_ADDR with `objdump -Mintel -d a.out | grep 1337`
WIN_ADDR = 0x40063e
p = angr.Project('./a.out')
pg = p.factory.path_group()