Last active
February 11, 2019 15:33
-
-
Save olijf/9473080d55ec50c56b8e235ac94c4bc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
https://hpd.gasmi.net/ | |
32 82 56 11 a0 4b --> 32 82 56 16 da 3c | |
192.168.0.5 (c0 a8 00 05)--> 192.168.0.11 (c0 a8 00 0b) | |
UDP Source Port: 17861 | |
UDP Destination Port: 17861 | |
UDP Data: RESET | |
32 82 56 16 DA 3C 32 82 56 11 A0 4B 08 00 45 00 00 21 00 00 00 00 40 11 F9 6B C0 A8 00 05 C0 A8 00 0B 45 C5 45 C5 00 0D F9 5D 52 45 53 45 54 | |
''' | |
import urllib2,json | |
import json | |
import hashlib | |
def retrieveJSONReply(connection_url, dataparams): | |
data = json.dumps(dataparams, sort_keys=True, separators=(',', ':')) | |
re = urllib2.Request(connection_url , data) | |
re.add_header('Content-Type','application/json') | |
print re.get_full_url() | |
print re.get_method() | |
resp = urllib2.urlopen(re) | |
resp_data = resp.read(); | |
print resp_data | |
return json.loads(resp_data) | |
postdata = { "username": "user0df7ebc7", "password": "e2c515022602fc7df47685bb5dc4b12a0fbd0c25", "secret": "45498634c9a1b4c12602f4039e4e88c8daff3c78" } | |
ethernet_reset = "32 82 56 16 DA 3C 32 82 56 11 A0 4B 08 00 45 00 00 21 00 00 00 00 40 11 F9 6B C0 A8 00 05 C0 A8 00 0B 45 C5 45 C5 00 0D F9 5D 52 45 53 45 54".replace(" ", "") | |
login = retrieveJSONReply("https://compound-garage.certifiedsecure.org/login", postdata) | |
verify_url = "https://compound-garage.certifiedsecure.org/verification" | |
maintenance_url = "https://compound-garage.certifiedsecure.org/maintenance" | |
reset_url = "https://compound-garage.certifiedsecure.org/route" | |
if login["status"] == "OK": | |
print "Login Succes" | |
print postdata["secret"] | |
print login["login_token"] | |
print login["login_expiry"] | |
dataToSha = login["login_token"] + str(login["login_expiry"]).encode() + postdata["secret"] | |
m = hashlib.sha1() | |
m.update(dataToSha) | |
auth_secret = m.hexdigest() | |
print auth_secret | |
print "\n" | |
verify_data = {} | |
verify_data["login_token"] = login["login_token"] | |
verify_data["secret"] = auth_secret | |
reply_login1 = retrieveJSONReply(verify_url, verify_data) | |
if reply_login1["status"] == "OK": | |
print "Authenticate Succes" | |
print reply_login1["authentication_token"] | |
print "\n" | |
maintenance_data = {} | |
maintenance_data["authentication_token"] = reply_login1["authentication_token"] | |
maintenance_resp = retrieveJSONReply(maintenance_url, maintenance_data) | |
if(maintenance_resp["status"] == "OK"): | |
print "Maintenance Succes" | |
print "Maintenance code = " + maintenance_resp["maintenance_code"] | |
print "\n" | |
reset_data = {} | |
reset_data["authentication_token"] = reply_login1["authentication_token"] | |
reset_data["maintenance_code"] = maintenance_resp["maintenance_code"] | |
reset_data["packet"] = ethernet_reset | |
'''print json.dumps(reset_data, sort_keys=True, separators=(',', ':'))''' | |
reset = retrieveJSONReply(reset_url, reset_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment