Python Device Hacking (Gamepad)

So today I was reading an article on Hack A Day about a user who wrote a Python script to interrupt his USB Gamepad, I watched the video and realized I had a very similar gamepad laying around. One thing led to another and I found my self attempting the same sort of project. The Gamepad I am using is a Logitec Dual Action : Using some of the code posted on Hackaday I quickly realized my Gamepad returned quite different result and thus needed different code.

Reverse Engineering a Binary 1

DISCLAIMER Through this paper I am not encouraging people to hack, destroy or steal anything, you must comply with laws and you shall take entire responsibility if you use this knowledge for bad behavior. With great power comes great responsibilities. Reverse engineering is not always legal, check EULA/laws in your country. THE CODE In this paper we are going to go over the reverse engineering of a simple compiled C++ binary, if you look below I have included the source code.

Reverse Engineering a Binary 2

DISCLAIMER Through this paper I am not encouraging people to hack, destroy or steal anything, you must comply with laws and you shall take entire responsibility if you use this knowledge for bad behavior. With great power comes great responsibilities. Reverse engineering is not always legal, check EULA/laws in your country. THE CODE In this example we have a bit more complicated program which assigns two integers to varibles then performs a multiplication on them to get our code :

Python Frequency Analysis for Ciphers

Frequency Analysis is the study of the frequency of letters or groups of letters in a cipher text. Using Python we can extract the count of letters, bigrams, and trigrams, lets have a look shall we: $ ./frequency.py --help usage: frequency.py [-h] [--letters] [--bigrams] [--trigrams] msg positional arguments: msg Message to count letters in optional arguments: -h, --help show this help message and exit --letters, -l Frequency of letters --bigrams, -b Frequency of bigrams --trigrams, -t Frequency of trigrams Lets go ahead and enter a simple sentence and do some testing:

Wacky Python Image Creation

The other night I had a wacky idea of extracting each pixel from an image in order to save it as a plain text ASCII file. Of course this is not ideal and can take a bit of time, but like most things I do with python its just for the fun of it. I figured the easiest way to achieve this would be to use Python’s Image library and save the output to a serialized pickle text file.