[ SEA-GHOST MINI SHELL]
#!/usr/bin/env python
import sys
import urllib2
import ssl
import socket
import json
import logging
import subprocess
import base64
#logging.basicConfig(level=logging.DEBUG)
#handler=urllib2.HTTPHandler(debuglevel=1)
#opener = urllib2.build_opener(handler)
#urllib2.install_opener(opener)
snapsurl = "http://" + sys.argv[1] + "/RestService/rest.svc/1.0/snapshots"
serverhost = sys.argv[2]
apiuser = sys.argv[3]
apipass = sys.argv[4]
report = []
def datacore(host,user,upass):
req = urllib2.Request(
snapsurl,
headers={'ServerHost': host,'Accept': 'application/json', 'Authorization': 'Basic {} {}'.format(user,upass)}
)
try:
response = urllib2.urlopen(req)
result = response.read()
return json.loads(result)
except urllib2.HTTPError:
print "Please check URL"
sys.exit(1)
except KeyError:
print "Please check USER/PASS"
sys.exit(1)
def main():
dcore_raw = datacore(serverhost,apiuser,apipass)
for snap in dcore_raw:
snap_name = snap['Caption']
snap_failure = snap['Failure']
if int(snap_failure) != 0:
report.append((json.dumps(snap_name),snap_failure))
print(report)
if __name__ == "__main__":
main()
SEA-GHOST - SHELL CODING BY SEA-GHOST