-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWHMAccessURL.py
More file actions
executable file
·32 lines (24 loc) · 840 Bytes
/
WHMAccessURL.py
File metadata and controls
executable file
·32 lines (24 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
import requests
import os
import subprocess
__author__ = "Anoop P Alias"
__license__ = "GPL"
__email__ = "anoopalias01@gmail.com"
def get_whm_access():
with open("/root/.accesshash", 'r') as accessfile:
hashdata = accessfile.read().replace('\n', '')
authdata = "WHM root:"+hashdata
headers = {'Authorization': authdata}
r = requests.get("https://127.0.0.1:2087/json-api/create_user_session?api.version=1&user=root&service=whostmgrd", headers=headers, verify=False)
jsonresp = r.json()
datadict = jsonresp.get('data')
url = datadict.get('url')
print(url)
return
if __name__ == "__main__":
if os.path.exists("/root/.accesshash"):
get_whm_access()
else:
subprocess.call("/usr/local/cpanel/bin/mkaccesshash", shell=True)
get_whm_access()