Skip to content

Instantly share code, notes, and snippets.

🌍
Hack the planet!

David Buchanan DavidBuchanan314

View GitHub Profile
@DavidBuchanan314
DavidBuchanan314 / dumb.py
Last active Apr 8, 2019
PoC web directory scanner using asyncio. It's fast. NOTE: This does not follow any particular HTTP spec and is probably very broken. AIOHTTP would be a more reliable solution, but in my tests it was a lot slower...
View dumb.py
import asyncio
from urllib.parse import quote
# dirb time: 1m36.7s
# 32 workers: 3.6s
DOMAIN = "www.google.com"
async def scan_worker(queue):
while True:
@DavidBuchanan314
DavidBuchanan314 / root_my_vm.py
Last active Apr 8, 2019
Get root any running *nix VM by patching it's memory from the host.
View root_my_vm.py
#!/usr/bin/python3
import sys
import os
import signal
PATTERN = b"root:x:0:0:root"
REPLACE = b"root::00:0:root"
View otw_advent_2018_day0.txt
01101101011001010111001001110010011110/ \010010000001101000011001010111100001101
101011000010111001100100000001011010 / f \ 0100000011011010110010101110010011100
10011110010010000001101000011001010 / a31 \ 111100001101101011000010111001100100
0000010110100100000011011010110010 / c0 8e \ 10111001001110010011110010010000001
101000011001010111100001101101011 / d88 e \ 0000101110011001000000010110100100
00001101101011001010111001001110 / c08ee08ed \ 010011110010010000001101000011001
0101111000011011010110000101110 / 08 ee83 1 \ 01100100000001011010010000001101
101011001010111001001110010011 / dbbc 0 0 7c \ 1100100100000011010000110010101
11100001101101011000010111001 / b eb17 ce88d 0 \ 100100000001011010010000001101
1010110010101110010011100100 / 0bfc a7c30 e 4cd \ 11110010010000001101000011001
View addless_add.c
#include <stdio.h>
#include <stdint.h>
#define ADD_LOBIT(a, b, c) ((a)^(b)^(c))
#define ADD_CARRY(a, b, c) ((a&b)|(b&c)|(c&a))
#define ADD_ROUND(i) \
c|=ADD_LOBIT((a>>(i))&1,(b>>(i))&1,carry)<<(i); \
carry=ADD_CARRY((a>>(i))&1,(b>>(i))&1,carry);
@DavidBuchanan314
DavidBuchanan314 / 35c3_collection.py
Created Dec 30, 2018
Dirty code, cleanup/writeup to follow...
View 35c3_collection.py
os = [t for t in ().__class__.__bases__[0].__subclasses__() if 'ModuleSpec' in t.__name__][0].__repr__.__globals__['sys'].modules["os.path"].os
opmap = {'POP_TOP': 1, 'ROT_TWO': 2, 'ROT_THREE': 3, 'DUP_TOP': 4, 'DUP_TOP_TWO': 5, 'NOP': 9, 'UNARY_POSITIVE': 10, 'UNARY_NEGATIVE': 11, 'UNARY_NOT': 12, 'UNARY_INVERT': 15, 'BINARY_MATRIX_MULTIPLY': 16, 'INPLACE_MATRIX_MULTIPLY': 17, 'BINARY_POWER': 19, 'BINARY_MULTIPLY': 20, 'BINARY_MODULO': 22, 'BINARY_ADD': 23, 'BINARY_SUBTRACT': 24, 'BINARY_SUBSCR': 25, 'BINARY_FLOOR_DIVIDE': 26, 'BINARY_TRUE_DIVIDE': 27, 'INPLACE_FLOOR_DIVIDE': 28, 'INPLACE_TRUE_DIVIDE': 29, 'GET_AITER': 50, 'GET_ANEXT': 51, 'BEFORE_ASYNC_WITH': 52, 'INPLACE_ADD': 55, 'INPLACE_SUBTRACT': 56, 'INPLACE_MULTIPLY': 57, 'INPLACE_MODULO': 59, 'STORE_SUBSCR': 60, 'DELETE_SUBSCR': 61, 'BINARY_LSHIFT': 62, 'BINARY_RSHIFT': 63, 'BINARY_AND': 64, 'BINARY_XOR': 65, 'BINARY_OR': 66, 'INPLACE_POWER': 67, 'GET_ITER': 68, 'GET_YIELD_FROM_ITER': 69, 'PRINT_EXPR': 70, 'LOAD_BUILD_CLASS': 71, 'YIELD_FROM': 72,
@DavidBuchanan314
DavidBuchanan314 / panopto_dl.py
Last active Dec 14, 2018
Panopto video downloader
View panopto_dl.py
import requests
import json
import os
import youtube_dl
PANOPTO_BASE = "https://cardiff.cloud.panopto.eu"
"""
Place the value of your .ASPXAUTH token in the following variable
"""
@DavidBuchanan314
DavidBuchanan314 / App.js
Created Nov 27, 2018 — forked from oliverjc/App.js
Cardiff Uni Phishing Attack
View App.js
import React, { Component } from 'react'
import axios from 'axios'
import { Helmet } from 'react-helmet'
import { createBrowserHistory } from 'history'
const browserHistory = createBrowserHistory({ forceRefresh: false })
var randomstring = require('randomstring')
const devtools = require('devtools-detect')
let DISABLE_PROTECTION = true
@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active Apr 16, 2019
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
View cursed_mandelbrot.c
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
View inject.py
#!/usr/bin/python3
"""
WARNING: The code you are about to view is DISGUSTING
I wrote most of it months ago, so don't ask me what it's doing, or why.
"""
import struct
import sys
View csaw_turtles.py
#!/usr/bin/python2
from pwn import *
elf = ELF("./turtles")
POP4 = 0x400d3c
POP5 = 0x400d3b
POP_RBP = 0x400ac0
POP_RDI = 0x400d43
POP_RSI_R15 = 0x400d41
You can’t perform that action at this time.