# DHCP Table POP
# Requests device name + mac address
import urllib
import re
import json
password = "admin"
user = "admin"
#combines credentials with URL.
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]
Diff to Previous Revision
--- revision 2 2010-05-23 07:12:16
+++ revision 3 2012-11-07 08:16:00
@@ -1,15 +1,12 @@
# 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"