[ SEA-GHOST MINI SHELL]

Path : /proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/datacore_snap_disconery.py

#!/usr/bin/env python

import sys
import urllib2
import json

snapsurl = "http://" + sys.argv[1] + "/RestService/rest.svc/1.0/snapshots"
serverhost = sys.argv[2]
apiuser = sys.argv[3]
apipass = sys.argv[4]

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():
    DICT_OUTPUT = {"data": []}
    dcore_raw = datacore(serverhost,apiuser,apipass)
    for snap in dcore_raw:
        snap_raw = snap['Caption'].split(':')
        if len(snap_raw) == 3:
            snap_name = snap_raw[0]
            snap_type = snap_raw[2]
            snap_failure = snap['Failure']
            snap_time = snap['TimeStamp']
            DICT_OUTPUT["data"].append({"{#SNAPNAME}": snap_name, "{#SNAPTYPE}": snap_type})
    JSON_OUTPUT = json.dumps(DICT_OUTPUT)
    print JSON_OUTPUT

if __name__ == "__main__":
    main()

SEA-GHOST - SHELL CODING BY SEA-GHOST