TV Style Computer Hacking!
Posted on Thursday, April 17, 2014, 03:56 PM
| nessy
My son asked the other night if hacking computers really worked like on television, and if numbers/words really flashed across the screen. I explained to him a bit, then told him we could make something that looked like he seen on television. Below is a print out I wrote for him. Keep in mind I tried to dumb it down a bit for my 10 year old son. Hacking MD5 Hashes What is a MD5 Hash?
Split Python List by Nth Item
Posted on Monday, April 14, 2014, 10:37 AM
| nessy
This has been one of the processes I’ve normally not solved in a clean or readable way.
In []: a = [1,2,3,4,5,6,7,8] Taking the top output I want to return something similar to below.
Out[]: [(1, 2), (3, 4), (5, 6), (7, 8)] Using a Pythonic approach this task isn’t to difficult, but there is some explaining to do.
First lets look at the code:
In []: a = iter([1,2,3,4,5,6,7,8]) In []: [ i for i in zip(a, a) ] Out[]: [(1, 2), (3, 4), (5, 6), (7, 8)] First we need to pass our list to the iter function, this turns our list into a iterator object:
Linux /proc/net/route addresses unreadable
Posted on Wednesday, April 9, 2014, 10:33 AM
| nessy
So you may have looked at /proc/net/route before and thought how the heck am I suppose to read this. Well here is the low down.
This file uses endianness to store the addresses as hexadecimal, in reverse; for example 192 as hex is C0 :
In []: hex(192) Out[]: '0xc0' So lets take a look at our route file:
Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT eth0 00087F0A 00000000 0001 0 0 0 00FFFFFF 0 0 0 eth0 0000FEA9 00000000 0001 0 0 1002 0000FFFF 0 0 0 eth0 00000000 01087F0A 0003 0 0 0 00000000 0 0 0 Now the first entry has a destination of 00087F0A , lets go ahead and chunk these in to hex characters:
Reading Yum Repository Data
Posted on Tuesday, February 18, 2014, 09:24 AM
| nessy
I’ve spent a lot of time working with RPM in the last couple years, and have had the pleasure of maintaining the IUS Community .
I wanted to share a small utility we use quite often called repodataParser , repodataParser is a Python class for working with RPM repositories, and used in a few of our Django applications .
The idea is all RPM repositories contain a XML file containing details about the package it contains.
Random Board Game Selection using Board Game Geek
Posted on Thursday, February 6, 2014, 09:05 AM
| nessy
Using Board Game Geek’s API I wanted to create a simple Python tool for randomly picking a game to play. Below is some quick Python code to achieve my goal:
from urllib2 import urlopen from lxml import etree from random import choice def get_xml(): req = urlopen('http://www.boardgamegeek.com/xmlapi/collection/flip387') return req def get_items(): xml = etree.parse(get_xml()) return xml.xpath('//item') def get_thumbnail(item): t = item.xpath('thumbnail') if len(t) == 1: return t[0].text def get_name(item): t = item.
Android Dice Roller
Posted on Wednesday, January 29, 2014, 12:26 PM
| nessy
Found an old Android App I wrote about a year back, this was the first and last Android App I wrote.
Android Installable Package for Dice Roller
md5 => 49e138fc4b2cf8b83bc28e780ff2411b Source Code can be viewed at Github 4.0 Holo theme on the left and 2.1 default theme on the right
Boardgame Geek API
Posted on Wednesday, January 29, 2014, 10:06 AM
| nessy
Today I learned Boardgamegeek.com provides a XML API which appears to be pretty well documented. For example if I wanted to list all the Board Games I own I could do something like this in python:
In [1]: from urllib2 import urlopen In [2]: from lxml import etree In [3]: req = urlopen('http://www.boardgamegeek.com/xmlapi/collection/flip387') In [4]: xml = etree.parse(req) In [5]: sorted([ i.text for i in xml.xpath('//name') ]) Out[5]: ['Arkham Horror', 'Bears!
Predictable Random Numbers
Posted on Tuesday, December 10, 2013, 08:18 AM
| nessy
Well that title is odd, right?
What I’m wanting to do here is demonstrate one way to generate random numbers using a seed . The requirement here is we need to test a number at any given time, this will be useful if we intend to use the process as a token of sort, think RSA SecureID .
Anyways I wanted to make a implementation that used Python and didn’t cost me hundreds of dollars.
Python chroot and exit chroot
Posted on Thursday, December 5, 2013, 05:38 PM
| nessy
I know this has been written a few time online, but the last time I needed to read up on it, it took a little long to find the answer.
What I wanted to do was to chroot in to a new root, then exit that chroot via python .
Below we have my current working directory that is /root , take a look at what we have in the directory:
Get Interface Golang Part 2
Posted on Tuesday, November 26, 2013, 08:08 AM
| nessy
Wanted to share a few updates and tweaks to the original Get Interface name by hardware address code. The below is broken up in to functions to help with code re-useability .
If also prints all interface names and hardware address when no command line argument are present.
package main import ( "net" "fmt" "os" "strings" ) // Use the net library to return all Interfaces // and capture any errors.