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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| import requests import hashlib import time
device_info = { "objId": "你的设备ID", "objType": 0, "osType": 15, "deviceId": 60, "deviceCode": "你的设备代码", "deviceName": "你的设备名称", "sysVersion": "你的系统版本", "appVersion": "1.36.1", "hostName": "你的主机名称", "vdCommand": "", "ipAddress": "", "macAddress": "", "hardwareFeatureCode": "你的硬件特征码" }
app_model_value = "2" device_code_value = "你的设备代码" device_type_value = "60" request_id_value = "你的请求ID值" tenant_id_value = "你的租户ID值" userid_value = "你的用户ID值" version_value = "201360101" secret_key_value = "你的秘钥值"
timestamp_value = str(int(time.time() * 1000))
signature_str = device_type_value + request_id_value + tenant_id_value + timestamp_value + userid_value + version_value + secret_key_value
hash_obj = hashlib.md5() hash_obj.update(signature_str.encode('utf-8')) digest_hex = hash_obj.hexdigest().upper()
headers = { 'accept': 'application/json, text/plain, */*', 'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7', 'content-type': 'application/x-www-form-urlencoded', 'ctg-appmodel': app_model_value, 'ctg-devicecode': device_code_value, 'ctg-devicetype': device_type_value, 'ctg-requestid': request_id_value, 'ctg-signaturestr': digest_hex, 'ctg-tenantid': tenant_id_value, 'ctg-timestamp': timestamp_value, 'ctg-userid': userid_value, 'ctg-version': version_value, 'origin': 'https://pc.ctyun.cn', 'priority': 'u=1, i', 'referer': 'https://pc.ctyun.cn/', 'sec-ch-ua': '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-site', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' }
url = "https://desk.ctyun.cn:8810/api/" computer_connect = "desktop/client/connect"
response = requests.post(url + computer_connect, data=device_info, headers=headers)
print("云电脑连接状态:", response.json())
|