更新 'SrcJyAliPublic.js'

main
src48597962 1 year ago
parent dd813d7c94
commit b2f30a2907
  1. 45
      SrcJyAliPublic.js

@ -432,3 +432,48 @@ function getOpenToken(authorization) {
} }
return open_access_token || ""; return open_access_token || "";
} }
function test_aliecc() {
let headers = {
"content-type": "application/json;charset=UTF-8",
"origin": "https://www.aliyundrive.com",
"referer": "https://www.aliyundrive.com/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41"
};
let appId = "5dde4e1bdf9e4966b387ba58f4b3fdc3";
let nonce = 0;
// 生成私钥和公钥
let private_key = BigInt.random(2 ** 256 - 1);
let ecc_pri = new ECDSA.ECDSA(private_key, "secp256k1");
let ecc_pub = ecc_pri.getVerifyingKey();
let public_key = "04" + ecc_pub.toString();
function r(appId, deviceId, userId, nonce) {
return `${appId}:${deviceId}:${userId}:${nonce}`;
}
function sign(appId, deviceId, userId, nonce) {
let sign_dat = ecc_pri.sign(
r(appId, deviceId, userId, nonce).getBytes('utf-8'),
ECDSA.sha256
);
return sign_dat.toString() + "01";
}
let signature = sign(appId, "3a9935208f4b4fce95a9655c7725d640", "3426ad8ebaa04e1ea9ee01bd998d06d4", nonce);
log(signature);
headers['x-signature'] = signature;
let data = {
"deviceName": "Edge浏览器",
"modelName": "Windows网页版",
"pubKey": public_key,
}
if (signature && public_key) {
let req = JSON.parse(request("https://api.aliyundrive.com/users/v1/users/device/create_session", { headers: headers, body: data, timeout: 3000 }));
log(req);
if (req.success) {
return { "signature": signature, "success": 1 }
}
}
return { "success": 0 }
}
Loading…
Cancel
Save