[ SEA-GHOST MINI SHELL]

Path : /proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/root/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/root/var/lib/zabbix/pingdom_api.py

#!/usr/bin/env python
import requests
import json
import sys
from argparse import ArgumentParser

API_URL = 'https://api.pingdom.com/api/2.0/'
API_USER = 'gavin@syra.com.au'
API_PASS = '20S&RRA0E>ReR{@pg211be7xh|-<.vC'
API_KEY = 'q0co1zkjyl7o3ty6yc2w1tq94djnw698'
OUTPUT = {"data": []}
RESULT = ''
EXCLUDE_TAGS = 'competitor'
TIMEOUT=5


def get_opts():
    parser = ArgumentParser(
        usage='%(prog)s -a action [-u api_user] [-p api_password] [-k api_key] [-c check_id]',
        description='This program gets info using Pingdom API'
    )
    parser.add_argument(
        "-a", "--action",
        action="store",
        dest="action",
        choices=['discover', 'check'],
        help="",
        required=True,
    )
    parser.add_argument(
        "-u", "--user",
        action="store",
        dest="user",
        default=API_USER,
        help=""
    )
    parser.add_argument(
        "-p", "--pass",
        action="store",
        dest="password",
        default=API_PASS,
        help=""
    )
    parser.add_argument(
        "-k", "--key",
        action="store",
        dest="key",
        default=API_KEY,
        help=""
    )
    parser.add_argument(
        "-c", "--check",
        action="store",
        dest="check_id",
        help=""
    )
    args = parser.parse_args()
    return args


def api_call(resource, key, user, passwd):
    headers = {'App-Key': key, 'Account-Email': user}
    try:
        response = requests.get(API_URL + resource, auth=(user, passwd), headers=headers, timeout=TIMEOUT)
        result = response.json()
        if 'error' in result:
            print result['error']['errormessage']
            sys.exit(1)
        else:
            return result
    except requests.exceptions.ReadTimeout:
        print "Connection timeout"
        sys.exit(1)


def main():
    args = get_opts()
    if args.action == "discover":
        checks = api_call('checks', args.key, args.user, args.password)
        for check in checks['checks']:
#            tags = check['tags']
            # Filter the output by excluding certain tags
#            if not filter(lambda tags: tags['name'] == EXCLUDE_TAGS, tags):
            OUTPUT["data"].append({"{#CHECKID}": check['id'], "{#CHECKNAME}": check['name']})
        print json.dumps(OUTPUT)
    if args.action == "check":
        check = api_call('checks/' + args.check_id, args.key, args.user, args.password)
        print check['check']['status']


if __name__ == "__main__":
    main()


SEA-GHOST - SHELL CODING BY SEA-GHOST