changes
This commit is contained in:
+11
-1
@@ -5,16 +5,26 @@ import sys
|
|||||||
|
|
||||||
URL = "http://"+sys.argv[1]+"/cgi-bin/reboot.cgi"
|
URL = "http://"+sys.argv[1]+"/cgi-bin/reboot.cgi"
|
||||||
USER = sys.argv[2]
|
USER = sys.argv[2]
|
||||||
|
USER_DEFAULT = "root"
|
||||||
PASS = sys.argv[3]
|
PASS = sys.argv[3]
|
||||||
|
PASS_DEFAULT = "root"
|
||||||
|
|
||||||
h = httplib2.Http(cache=None, timeout=0.5)
|
h = httplib2.Http(cache=None, timeout=0.5)
|
||||||
h.add_credentials(USER, PASS)
|
h.add_credentials(USER, PASS)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
|
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
|
||||||
if response.status==401:
|
if response.status==401:
|
||||||
|
retry = httplib2.Http(cache=None, timeout=0.5)
|
||||||
|
retry.add_credentials(USER_DEFAULT, PASS_DEFAULT)
|
||||||
|
res, con = retry.request(URL, "GET", headers={'cache-control':'no-cache'})
|
||||||
|
if res.status==500:
|
||||||
|
print "Change pass, Installed default password"
|
||||||
|
print "OK"
|
||||||
|
elif res.status==401:
|
||||||
print "Unauthorized, Wrong PASSWORD"
|
print "Unauthorized, Wrong PASSWORD"
|
||||||
|
if response.status==500:
|
||||||
|
print "OK"
|
||||||
elif response.status==404:
|
elif response.status==404:
|
||||||
URL = "http://"+sys.argv[1]+"/api/reboot"
|
URL = "http://"+sys.argv[1]+"/api/reboot"
|
||||||
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
|
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
|
||||||
|
|||||||
Reference in New Issue
Block a user