Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hex-ci committed Aug 8, 2023
1 parent cadc62d commit 01290cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ql repo https://github.com/hex-ci/smzdm_script.git "" "env.js|bot.js|sendNotify.
环境变量请使用环境变量列表直接添加,不要使用 `export xxx=""` 这种方式添加环境变量。

* `SMZDM_COOKIE`: 抓包抓到的 Cookie 内容,需要所有 Cookie 内容,多用户可以用 `&` 分隔,或者使用多个同名环境变量。
* `SMZDM_SK`: 这个值是可选值,是从安卓 App 的 `https://user-api.smzdm.com/checkin` 请求参数中抓包抓到的,如果抓到这个值可以填写(强烈建议填写),如果没抓到可以忽略,多用户可以用 `&` 分隔,或者使用多个同名环境变量,顺序要保持与 `SMZDM_COOKIE` 多用户顺序一致。
* `SMZDM_SK`: 这个值是可选值,会自动计算,如果你一定想用自己的,可以抓取,是从安卓 App 的 `https://user-api.smzdm.com/checkin` 请求参数中抓包抓到的,多用户可以用 `&` 分隔,或者使用多个同名环境变量,顺序要保持与 `SMZDM_COOKIE` 多用户顺序一致。
* `SMZDM_USER_AGENT_APP`: 这个值是可选值,是指 APP 的 User-Agent,从 APP 的 API 请求头中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
* `SMZDM_USER_AGENT_WEB`: 这个值是可选值,是指 APP 中访问网页的 User-Agent,一般在 APP 内的转盘网页中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
* `SMZDM_COMMENT`: 如果要完成评论文章的任务请设置这个环境变量,环境变量的内容是评论的文案,文案要大于 10 个汉字,建议用比较个性化的文案,脚本发布评论后会删除这条评论,但是为防止删除失败的情况,请尽量用好一点的文案,防止被判定为恶意灌水。
Expand Down
15 changes: 11 additions & 4 deletions smzdm_checkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,35 +195,42 @@ class SmzdmCheckinBot extends SmzdmBot {
}

function random32() {
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let result = "";
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = '';

for (let i = 0; i < 32; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}

return result;
}

function getSk(cookie) {
const matchUserId = cookie.match(/smzdm_id=([^;]*)/);

if (!matchUserId) {
return ''
}

const userId = matchUserId[1];
const deviceId = getDeviceId(cookie);
const key = CryptoJS.enc.Utf8.parse('geZm53XAspb02exN');
const cipherText = CryptoJS.DES.encrypt(userId + deviceId, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});

return cipherText.toString();
}

function getDeviceId(cookie) {
const matchDeviceId = cookie.match(/device_id=([^;]*)/);

if (matchDeviceId) {
return matchDeviceId[1]
return matchDeviceId[1];
}
return random32()

return random32();
}

!(async () => {
Expand Down

0 comments on commit 01290cd

Please sign in to comment.