[ SEA-GHOST MINI SHELL]

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

#!/usr/bin/env python
"""
This script lists all the children of type 'domain' under scope 'global'.
See details:
https://campus.barracuda.com/product/emailsecuritygateway/article/BSF/APIGuide#h6_7
"""
import sys
import xmlrpclib
import requests
from xml.dom.minidom import parseString

def main():
    """Entry point if called as an executable"""
    name = sys.argv[1]
    port = sys.argv[2]

    url = 'http://{0}:{1}/cgi-mod/api.cgi?password=gEX$pRaWay99'.format(
        name, port)

    # Generating valid xml for request
    method_name = "config.list"
    arguments = {"child_type":"domain", "path":"", "type": "global"}
    call_string = xmlrpclib.dumps((arguments,), method_name)

    # requesting data
    headers = {'Content-Type': 'application/xml'}
    data = requests.post(url, data=call_string, headers=headers).text

    # Parsing XML
    root = parseString(data)

    # Counting domains
    return len(root.getElementsByTagName("string"))


if __name__ == '__main__':
    print main()

SEA-GHOST - SHELL CODING BY SEA-GHOST