Python toolbox for hacking and problem solving
In order to use pwnbox.number, gmpy2 should be installed.
brew install libmpc
pip install gmpy2
In your python environment:
pip install git+https://github.com/pwnbox/pwnbox
To upgrade:
pip install --upgrade pwnbox
General purpose pipe interface:
import pwnbox
# Open pipes
# pipe = pwnbox.pipe.popen("nc example.com 80")
pipe = pwnbox.pipe.connect("example.com", 80)
# Send request
pipe.write(b"GET / HTTP/1.0\r\nHost: example.com\r\n\r\n")
# Receive response header
pipe.read_until(b"\r\n\r\n")
# Interact with standard IO
pipe.interact()
# Close pipe
pipe.close()
Number theory implementations:
- Chinese Remainder Theorem
- Weiner's attack
- Fermat's factorization
- Pollard's rho method
Utilties:
from pwnbox.utils import *
# DWORD to Little Endian
l = dtol(1234)
# QWORD to Big Endian
b = qtob(1234)
# Little Endian to Integer
i = ltoi(b"\x01\x02\x03\x04")
# string operations
a = sand(dtol(0x12345678), dtol(0xffff0000))
x = sxor(dtol(0xdeafbeef), dtol(0x12345678))
Documents are available at http://pwnbox.readthedocs.org/.