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 <unistd.h> | |
#include <signal.h> | |
void handle_alarm() | |
{ | |
return; | |
} | |
int main(void) |
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
from pwn import * | |
context.terminal = ["terminator", "-e"] | |
BINARY_NAME = "<enter binary name>" | |
LIBC_NAME = "./libc.so" | |
REMOTE = ("<enter hostname>", 0000) | |
context.binary = BINARY_NAME | |
binary = context.binary |
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
... | |
... | |
execve("/mnt/c/Windows/explorer.exe", ["./test"], NULL) = 0 | |
arch_prctl(ARCH_SET_FS, 0x29c800) = 0 | |
set_tid_address(0x29c838) = 1514 | |
brk(NULL) = 0x218f000 | |
brk(0x2190000) = 0x2190000 | |
sched_getaffinity(0, 128, [0, 1, 2, 3]) = 32 | |
getpid() = 1514 | |
getcwd("/home/david/wsl_testing/execve_PE", 4096) = 34 |
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
def check_pohlig_hellman(curve, generator=None): | |
""" | |
The Pohlig-Hellman algorithm allows for quick (EC)DLP solving if the order of the curve is smooth, | |
i.e its order is a product of multiple (small) primes. | |
The best general purpose algorithm for finding a discrete logarithm is the Baby-step giant-step | |
algorithm, with a running time of O(sqrt(n)). | |
If the order of the curve (over a finite field) is smooth, we can however solve the (EC)DLP | |
algorithm by solving the (EC)DLP for all the prime powers that make up the order, then using the |
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
def bruteforce_suffix(encryption_routine, block_size=16, bruteforce_space=bytes(range(0, 0x100)), debug=False): | |
def _to_blocks(text): | |
blocks = [] | |
for i in range(0, len(text), block_size): | |
blocks.append(text[i:i+block_size]) | |
return blocks |
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 numpy as np | |
def proj(u, v): | |
return np.multiply(u, (np.inner(u, v)/np.inner(u, u))) | |
def orthogonal_basis(*V): | |
"""Uses the Gram-Schmidt algorithm for finding an orthogonal basis of V""" | |
U = [None] * len(V) | |
for k in range(len(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
from typing import List | |
from sys import getrecursionlimit, setrecursionlimit | |
def int_pow(base: int, power: int, modulus: int=None, safe: bool=True): | |
""" | |
Calculate `base` raised to `power`, optionally mod `modulus` | |
The python standard library offers the same functionality, | |
and this function exists only as a proof of Concept. | |
This function only aims to support positive integer operands. |
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 sys | |
from gf2 import GF2, GF2Element | |
def append_c_header(path, s): | |
with open(path, 'a') as o: | |
o.write(s) | |
def clear_c_header(path): | |
open(path, 'w').close() |
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
from typing import Union, Optional | |
from math import log, floor | |
""" | |
This code is taken from the AES implementation which supplements my paper: 'Cryptography: A concise overview'. | |
It is released as beerware: | |
*************************************************************************************************************** |
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
from pwn import * | |
from base64 import b64encode as be, b64decode as bd | |
context.terminal = ["sn"] | |
BINARY_NAME = "./pwn_slot" | |
LIBC_NAME = "./libc.so" | |
REMOTE = ("34.107.41.169", 32674) |
NewerOlder