- Server operating system version
- Ubuntu 18.04.4 LTS
- Plesk version and microupdate number
- Plesk Obsidian 18.0.33
Hello,
I just installed plesk
Ubuntu 18.04.4 LTS
Plesk Obsidian 18.0.33
I try to create a domain name using requests but when I make my requests it returns me
Script:
I just installed plesk
Ubuntu 18.04.4 LTS
Plesk Obsidian 18.0.33
I try to create a domain name using requests but when I make my requests it returns me
quests.exceptions.ConnectionError: HTTPSConnectionPool(host='suspicious-feistel.178-170-9-6.plesk .pagewpb-site.tld', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001BAC4C570A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed '))
Script:
def generate_PLESKSESSID():
headers = {
'Content-Type': 'text/xml',
'HTTP_AUTH_LOGIN': USER,
'HTTP_AUTH_PASSWD': PASSWORD,
'HTTP_PRETTY_PRINT': 'TRUE',
}
client_ip = getip()
data = f"""
<?xml version='1.0'?>
<packet version="1.6.3.5">
<server>
<create_session>
<login>{USER}</login>
<data>
<!-- Base64-encoded IP address of client, who logs into Plesk -->
<user_ip>{client_ip}</user_ip>
<!-- Base64-encoded hostname of computer from which the request is sent -->
<source_server>d3BiLXNpdGUudGxk</source_server>
</data>
</create_session>
</server>
</packet>""".replace("\n", "")
response = s.post(plesk_link + "/enterprise/control/agent.php", headers=headers, data=data, verify=False).text
PLESKSESSID = response.split("<id>")[1].split("</id>")[0]
response = s.get(plesk_link + f"/smb/web/add-domain?PLESKSESSID=" + PLESKSESSID)
return PLESKSESSID
def create_domain(plesk_username):
plesk_name = "test.plesk" + "".join(choices("123456789", k=3))
token = generate_token()
headers = {
'authority': 'suspicious-feistel.178-170-9-6.plesk.page',
'accept': '*/*',
'accept-language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7',
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryBFapGll9PCN79K2N',
'origin': 'https://suspicious-feistel.178-170-9-6.plesk.page',
'referer': 'https://suspicious-feistel.178-170-9-6.plesk.page/smb/web/add-domain',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'sec-gpc': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36',
'x-forgery-protection-token': token,
'x-requested-with': 'XMLHttpRequest',
}
cookies = {
'PLESKSESSID': generate_PLESKSESSID(),
}
json_data = {
"applicationName": "upload-files",
"hidden": "",
"forgery_protection_token": token,
"domainName[name]": plesk_name,
"domainName[type]": "custom",
"domainName[webspace]": "new",
"hostingType[hosting]": "hosting",
"dnsSettings[dns]": "master",
"mailSettings[mail]": "1",
"domainInfo[userName]": plesk_username.lower(),
"domainInfo[password]": "".join(choices("abcdefghijklmnopqrstuvwxyz", k=5)).capitalize() + "#" + "".join(choices("123456789", k=6)),
"domainInfo[ipSelector][ipv4]": "1",
"domainInfo[ipSelector][ipv6]": "none",
"forwardingSettings[forwardTo]": "" ,
"forwardingSettings[forwardingType]": "std_fwd301",
"hostingSettings[root]": plesk_name,
"hostingSettings[rootPattern]": "httpdocs",
"hostingSettings[seoRedirectDirection]": "none",
"sslit[blocked]": "0",
"sslit[enabled]": "0",
"sslit[decoratorsHack_49b09d88ed1e550a1ed210fd32251aa3]": ""
}
response = s.post('https://suspicious-feistel.178-170-9-6.plesk.page/smb/web/add-domain', json=json_data, headers=headers, cookies=cookies) #here is the problem