December 30, 2015

Closures and Decorators in Python

Closures basically mean that an inner function defined in an outer function remembers what its enclosing name space (or name spaces) looked like at definition time. The variables defined in this name space can later be accessed by the inner function: def closure(): x = 1 def inner(y): return y - x return inner print(closure()(5)) 4 Closures also work, when an variable is passed to the outer function: def otherClosure(x): def inner(y): return y - x return inner print(otherClosure(1)(5)) 4 Read more

May 15, 2015

Messing With DNS Using NFQUEUE and Scapy

Some days ago I taught myself a little about NFQUEUE and Python. Meanwhile I dug a little more into the matter and looked into building new network packets. In this special case I wanted to create DNS packets. The idea was to intercept DNS requests with Netfilter and return a fake IP address in a faked DNS response. Messing with packets in Python is quite easy to do when you use the Python bindings for Scapy, a quite powerful packet manipulation tool. Read more

May 8, 2015

Messing With VoIP Calls Using NFQUEUE

For the project of one of my students we need to intercept and modify SIP messages. Our first idea was to configure a proxy in the SIP user agent (soft phone) and to modify an existing SIP proxy to our liking. Unfortunately this approach did not work reliably as the soft phone seemed to be faulty: some SIP messages were sent via the proxy we configured, other were sent directly to the server. Read more

January 24, 2015

Markdown Mass Converter

I hacked a little python script that converts a directory tree full of markdown files to PDF using pandoc. The script remembers the hash sum of each markdown file and thus only converts new or updated files. The script is available via my Github. The tex template is used by pandoc. It is very basic but tweaks the output of pandoc to my liking.

© ho1ger 2015 - 2022