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
%%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()
@disconnect3d
disconnect3d / numpy_array_attrs_ids.py
Created June 5, 2017 23:09
Helper code for Murmus CTF numpy fuzzing/exploitation stream -> https://www.youtube.com/watch?v=v61uh0NJ4_U
#!/usr/bin/env python
import numpy as np
from types import FunctionType, MethodType, BuiltinFunctionType
n = np.array("ABC")
attr_names = dir(n)
for attr in attr_names:
val = getattr(n, attr)
import functools
import inspect
class Bar:
def changelist_view(self, request, extra_content):
print("Bar.changelist_view(request={}, extra_content={})".format(request, extra_content))
def change_view(self, request, object_id, form_url, extra_content):
print("Bar.change_view(request={}, object_id={}, form_url={}, extra_content={})"
#!/usr/bin/env python3
NODE_START = 4
NODE_WIDTH = 6
NODE_START_X = 1 # left of node
NODE_START_Y = 1 # bottom of node
NODE_SHORT_HEIGHT = 1
NODE_LONG_HEIGHT = 1.5
@disconnect3d
disconnect3d / pytest_iter_mock.py
Created September 4, 2017 13:29
Is this the best way to return list like thing?
@pytest.fixture
def mock_time_in_ms(monkeypatch):
def _mock_time_in_ms(values_to_return):
idx = [0]
def _time():
v = values_to_return[idx[0]]
idx[0] += 1
return v
#include <stdio.h>
#include <semaphore.h>
#include <unistd.h>
#include <fcntl.h>
#define INFOFUNC printf("[%d] %s\n", getpid(), __FUNCTION__)
#define INFO(m) printf("[%d] %s\n", getpid(), m)
sem_t* parent_sem;
sem_t* sem;