Archive for category Uncategorized

Linksys WRT400N DHCP Table Grabber

It was around 3:00 a.m. and I was supposed to be working on a paper – instead I was lurking on reddit like usual. Well I got an email from some random guy I didn’t know.  He started off with asking me if I could help secure his router. So I showed him him how to set up WPA encryption on his specific router. Well he didn’t like that because according to him he didn’t want “those people” to know he knew they were accessing his internet. So then he asked how he could see who is on his internet. So I promptly lead him to the DHCP table on his routers configuration menu. He said this was too challenging and said he would pay me $30 for a program to do it and I had three days. So I told him I would do it for $60 in three hours. He went for it.

So I start messing around with some code and think of how I am going to do it. I started programming some sockets calls and C and was just going to connect and then just go ahead and send over a GET request then put it into an array and parse the valuable information ( in this case it was the mac address and the device name). Well about thirty minutes in I was getting annoyed. I blame the terrible combination of sleep deprivation and time restraints. So I saved what code I had for later use and started to make it in Python. Well short story short I made it in Python in no time. It isn’t the ideal solution but it works and that’s all he cared about. His type of router was a WRT400N.

# DHCP Table POP
# Requests device name + mac address
# LogicKills.org
# Made for *****1979@yahoo.com (you creepy bastard)
# 5/4/2010

#blah blah imports
import urllib
import re
import json

#define username and password (he wanted to keep his default fml)
password = "admin"
user     = "admin"

#combines credentials with URL. Yes I hardcoded the URL, suck it.
website = urllib.urlopen("http://" + user + ":" + password + "@192.168.1.1/Static_dhcp.htm")

#looks for the fragment of code that stores DHCP clients
for lines in website.readlines():
if re.match("var myData", lines):
clients = lines

#cleans up the json object
clients = clients.strip("var myData =  ")
clients = clients.replace(';','')

#loads json object
jsonList = json.loads(clients)
for x in jsonList:
print x[0] + " " + x[3]

Product Review: Sparkfun 3.3V 16×2 LCD

So I am working on project that will eventually need to output some temperatures so I was looking for an LCD to buy. Being a long time Sparkfun customer and buying everything from resistors to soldering iron tips from them I can say that  I have never had a problem with them. It just so happened they had exactly what I was looking for.  This LCD does exactly what it needs to and isn’t cheap quality by any means. The only thing I didn’t think of was buying headers with it. So I HIGHLY recommend buying some headers with this LCD for easy prototyping. I got some at RatShack but Sparkfun has them too. If you are going to buy this LCD from them why not pick up some headers with it?

Programming tutorials – in the works

Check it out I got my first programming tutorial up with examples. Find it on the tutorial page