Welcome, guest | Sign In | My Account | Store | Cart
# DHCP Table POP
# Requests device name + mac address
# LogicKills.org
# Made for *****1979@yahoo.com 
# 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]

History