32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import requests
|
|
import base64
|
|
import json
|
|
|
|
class cPanelAccount():
|
|
def __init__(self, cPanelHost, cPanelUser, cPanelPass):
|
|
self.cPanelHost = cPanelHost
|
|
self.cPanelUser = cPanelUser
|
|
self.cPanelPass = cPanelPass
|
|
self.baseURL = f"https://{self.cPanelHost}:2083/execute"
|
|
self.headers = {"Authorization" : f"Basic {base64.b64encode((self.cPanelUser+ ':' + self.cPanelPass).encode('UTF-8')).decode()}"}
|
|
|
|
def checkCreds(self):
|
|
try:
|
|
resp = requests.get(f"{self.baseURL}/Themes/list", headers=self.headers).json()
|
|
except Exception as e:
|
|
return False
|
|
return True
|
|
|
|
def getDomains(self):
|
|
return requests.get(f"{self.baseURL}/DomainInfo/list_domains", headers=self.headers).json()
|
|
|
|
def getServerInformation(self):
|
|
return requests.get(f"{self.baseURL}/ServerInformation/get_information", headers=self.headers).json()
|
|
|
|
def debugPrintData(self):
|
|
print(self.headers)
|
|
|
|
if __name__ == '__main__':
|
|
pass
|
|
|