Skip to content

Instantly share code, notes, and snippets.

View bedekelly's full-sized avatar

Bede Kelly bedekelly

View GitHub Profile
@bedekelly
bedekelly / Namespaces.py
Created October 20, 2014 17:39
Namespaces
x = 5
def my_function():
print(x)
x = 6
print(x)
my_function()
print(x)
@bedekelly
bedekelly / access_crypt.py
Last active August 29, 2015 14:12
Create a session to mount encrypted files and unmount on exit
# access_crypt.py
# Makes using encrypted storage easier.
# Mounts the storage, opens a shell, and unmounts when the shells closes (however ungracefully)
# Works under Ubuntu 14.04, following these instructions to set up your encrypted storage file:
# https://www.digitalocean.com/community/tutorials/how-to-use-dm-crypt-to-create-an-encrypted-volume-on-an-ubuntu-vps
from contextlib import contextmanager
from pysh import sh
@bedekelly
bedekelly / typecheck.py
Last active August 29, 2015 14:12
Typechecking for Python
"""
Quick 'n dirty hack for a typecheck decorator.
Only tested on functions without kwargs. Use at own peril, etc.
Usage:
@typecheck
def some_function(x: str, y: int) -> str:
...
"""
@bedekelly
bedekelly / typecheck_test.py
Last active August 29, 2015 14:12
Typechecking for Python - Test Suite
"""
Quick unit-test for typecheck.py.
Wonder if there's any way to unittest an exception's text?
"""
import unittest
from typecheck import typecheck
@typecheck
def add(x: int, y: int) -> int:
@bedekelly
bedekelly / huffman.py
Created March 22, 2015 15:37
Building a Huffman Coding Tree using Python
#!/usr/bin/env python3
from pprint import pprint
def main():
text = input()
forest = []
for letter in text:
for tree in forest:
if tree["letter"] == letter:
break
@bedekelly
bedekelly / dc_build.sh
Created June 28, 2015 13:13
[Failing] Build DarkCrave, including undocumented dependencies
#!/bin/bash
apt-get update && apt-get upgrade -y
apt-get install libboost1.54-dev-all
apt-get install -y qt5-default qt5-qmake qtbase5-dev-tools qttools5-dev-tools \
build-essential libboost-dev libboost-system-dev \
libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev \
libssl-dev libdb++-dev libminiupnpc-dev libdb++-dev;
git clone https://github.com/DarkCrave/DarkCrave
git clone https://github.com/bitcoin/secp256k1
cd secp256k1
@bedekelly
bedekelly / tty_colors.zsh
Created July 7, 2015 15:58
Change TTY Colors
# Change TTY colors to the Railscast theme.
if [ "$TERM" = "linux" ]; then
echo -en "\e]P0232323" #black
echo -en "\e]P82B2B2B" #darkgrey
echo -en "\e]P1D75F5F" #darkred
echo -en "\e]P9E33636" #red
echo -en "\e]P287AF5F" #darkgreen
echo -en "\e]PA98E34D" #green
echo -en "\e]P3D7AF87" #brown
@bedekelly
bedekelly / rcs-core.rb.out
Last active August 29, 2015 14:24
Hacking Team `./rcs-core.rb -h` output after build
Usage: rcs-core [options]
Core listing:
-l, --list get the list of cores
Core selection:
-n, --name NAME identify the core by it's name
Core operations:
-g, --get FILE get the core from the db and store it in FILE
@bedekelly
bedekelly / exploit.py
Created July 9, 2015 17:46
Microsoft Word Exploit - Original
import sys
import os
import warnings
import zlib
sys.path.append(os.getcwd() + '/' + "pylzma.egg")
import pylzma
import struct
import random
import shutil
from zipfile import ZipFile
@bedekelly
bedekelly / cleaned_exploit.py
Last active March 2, 2020 10:42
Cleanup in Progress - MS Word Exploit
import sys
import os
import warnings
import zlib
import struct
import random
import shutil
import zipfile
from zipfile import ZipFile
import time