Files
zabbix-mining/rebootasic
T

20 lines
504 B
Python
Raw Normal View History

2019-05-22 15:21:44 +08:00
#!/usr/bin/env python
import httplib2
import sys
URL = "http://"+sys.argv[1]+"/cgi-bin/reboot.cgi"
2020-06-02 00:25:07 +08:00
USER = sys.argv[2]
PASS = sys.argv[3]
2019-05-22 15:21:44 +08:00
2020-06-06 10:58:08 +08:00
h = httplib2.Http(cache=None, timeout=0.2)
2019-05-22 15:21:44 +08:00
h.add_credentials(USER, PASS)
2020-06-06 10:58:08 +08:00
2019-05-22 15:21:44 +08:00
try:
2020-06-06 10:58:08 +08:00
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
if response.status==401:
print "Unauthorized, Wrong PASSWORD"
elif response.status==404:
print "Wrong Request Address"
except httplib2.ServerNotFoundError:
print "HOST is Down"