Created
April 23, 2016 02:06
-
-
Save blackknight36/b11a2eff5d19f254451acb58457f1797 to your computer and use it in GitHub Desktop.
List Mailman lists set up by a user. Uses cPanel json api.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !/usr/bin/python | |
| import json | |
| import requests | |
| host = "1.2.3.4" | |
| hash = """xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""" | |
| hash = hash.replace('\n', '') | |
| domain = "example.com" | |
| user = "example" | |
| url = "https://%s:2087/json-api/cpanel?cpanel_jsonapi_user=%s&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=listlists&domain=%s" %(host, user, domain) | |
| auth = "WHM root:" + hash; | |
| headers = {'Authorization': auth} | |
| r = requests.get(url, headers=headers, verify=False) | |
| print json.dumps(json.loads(r.text), indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment