This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Solution from Disconnect3d [playing in Just Hit the Core] | |
""" | |
import os | |
import angr | |
import pwn | |
import subprocess | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [8]: import ctypes | |
...: | |
...: | |
...: class Foo(ctypes.LittleEndianStructure): | |
...: _fields_ = (('bar', ctypes.c_uint64),) | |
...: | |
...: def __str__(self): | |
...: return 'Foo .bar={}'.format(self.bar) | |
...: | |
...: @classmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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={})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |