2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00

修正账密登录sk问题(#46) 、去除验证码token

This commit is contained in:
ctrlcvs 2023-01-15 19:09:26 +08:00
parent 8c4d57b2f6
commit 57f4ae0835
5 changed files with 41 additions and 34 deletions

View File

@ -37,3 +37,5 @@ noteSetAuth: 2
noteTask: 0 0/10 * * * ? noteTask: 0 0/10 * * * ?
# 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭 # 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭
isNoteTask: false isNoteTask: false
# 验证码接口token
getToken:

View File

@ -81,7 +81,6 @@ export default class mysTopLogin {
Bot.logger.mark("[米哈游登录] 正在验证") Bot.logger.mark("[米哈游登录] 正在验证")
this.aigis_captcha_data = JSON.parse(res.aigis_data.data) this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
let vlData = await this.crack_geetest() let vlData = await this.crack_geetest()
console.log(vlData)
// let validate = await this.user.getData("validate", this.aigis_captcha_data, false) // let validate = await this.user.getData("validate", this.aigis_captcha_data, false)
if (vlData?.geetest_validate) { if (vlData?.geetest_validate) {
Bot.logger.mark("[米哈游登录] 验证成功") Bot.logger.mark("[米哈游登录] 验证成功")
@ -104,12 +103,12 @@ export default class mysTopLogin {
} }
if (res.retcode == 0) { if (res.retcode == 0) {
let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}` let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}`
let cookie_token = this.user.getData("bbsGetCookie", { cookies }) let cookie_token =await this.user.getData("bbsGetCookie", { cookies })
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false) let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies}` }, false)
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`)
return { return {
cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`, cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`,
stoken: `${cookies};stuid=${res.data.user_info.aid};` stoken: `${cookies.replace('&',';')};stuid=${res.data.user_info.aid};`
} }
} else { } else {
await this.e.reply(`错误:${JSON.stringify(res)}`, true) await this.e.reply(`错误:${JSON.stringify(res)}`, true)

View File

@ -209,10 +209,10 @@ export default class miHoYoApi {
query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`, query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`,
types: 'stoken' types: 'stoken'
}, },
//接口来源于外网扒来的 接口目前暂时免费后续看token是否收费祝你生活愉快 //很抱歉由于有人恶意倒卖不得已只能是关闭免费token了 开放免费供人使用还被恶意倒卖指责 开源确实不好弄捏
validate: { validate: {
url: `http://api.fuckmys.tk/geetest`, url: `http://api.fuckmys.tk/geetest`,
query: `token=fuckmys&gt=${data.gt}&challenge=${data.challenge}` query: `token=${data?.getToken}&gt=${data.gt}&challenge=${data.challenge}`
}, },
cloudLogin: { cloudLogin: {
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`, url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
@ -259,7 +259,7 @@ export default class miHoYoApi {
query: `callback=${data.challenge}` query: `callback=${data.challenge}`
}, },
loginByPassword: { loginByPassword: {
url: "https://passport-api.mihoyo.com/account/ma-cn-passport/app/loginByPassword", url: `${mys.pass_api}/account/ma-cn-passport/app/loginByPassword`,
body: { body: {
account: this.encrypt_data(data.account), account: this.encrypt_data(data.account),
password: this.encrypt_data(data.password) password: this.encrypt_data(data.password)
@ -267,14 +267,14 @@ export default class miHoYoApi {
types: 'pass' types: 'pass'
}, },
qrCodeLogin: { qrCodeLogin: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch`, url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/fetch`,
body: { body: {
app_id: mys.app_id, app_id: mys.app_id,
device: data.device device: data.device
} }
}, },
qrCodeQuery: { qrCodeQuery: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query`, url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/query`,
body: { body: {
app_id: mys.app_id, app_id: mys.app_id,
device: data.device, device: data.device,
@ -282,7 +282,7 @@ export default class miHoYoApi {
} }
}, },
getTokenByGameToken: { getTokenByGameToken: {
url: `https://passport-api.mihoyo.com/account/ma-cn-session/app/getTokenByGameToken`, url: `${mys.pass_api}/account/ma-cn-session/app/getTokenByGameToken`,
body: { body: {
account_id: data.uid * 1, account_id: data.uid * 1,
game_token: data.token game_token: data.token
@ -290,7 +290,7 @@ export default class miHoYoApi {
types: 'pass' types: 'pass'
}, },
getCookieAccountInfoByGameToken: { getCookieAccountInfoByGameToken: {
url: `https://api-takumi.mihoyo.com/auth/api/getCookieAccountInfoByGameToken`, url: `${mys.web_api}/auth/api/getCookieAccountInfoByGameToken`,
query: `account_id=${data.uid}&game_token=${data.token}` query: `account_id=${data.uid}&game_token=${data.token}`
}, },
GetCode:{ GetCode:{

View File

@ -4,16 +4,17 @@ const salt = "fdv0fY9My9eA7MR0NpjGP9RjueFvjUSQ"; //k2
const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"; //x6 const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"; //x6
const saltWeb = "jEpJb9rRARU2rXDA9qYbZ3selxkuct9a";//lk2 const saltWeb = "jEpJb9rRARU2rXDA9qYbZ3selxkuct9a";//lk2
const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9"; const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
const passSalt='JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS'; const passSalt = 'JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS';
const osSalt= ''; //599uqkwc0dlqu3h6epzjzfhgyyrd44ae rk4xg2hakoi26nljpr099fv9fck1ah10 const osSalt = ''; //599uqkwc0dlqu3h6epzjzfhgyyrd44ae rk4xg2hakoi26nljpr099fv9fck1ah10
const osSaltWeb = ''; //os 浏览帖子需要用到的salt const osSaltWeb = ''; //os 浏览帖子需要用到的salt
const web_api = `https://api-takumi.mihoyo.com` const web_api = `https://api-takumi.mihoyo.com`
const os_web_api = `https://api-os-takumi.mihoyo.com` const os_web_api = `https://api-os-takumi.mihoyo.com`
const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`; const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`;
const hk4_api = `https://hk4e-api.mihoyo.com`; const hk4_api = `https://hk4e-api.mihoyo.com`;
const hk4_sdk = `https://hk4e-sdk.mihoyo.com`;
const bbs_api = `https://bbs-api.mihoyo.com`; const bbs_api = `https://bbs-api.mihoyo.com`;
const cloud_api = `https://api-cloudgame.mihoyo.com` const cloud_api = `https://api-cloudgame.mihoyo.com`
const pass_api=`https://passport-api.mihoyo.com` const pass_api = `https://passport-api.mihoyo.com`
const app_id = 4 const app_id = 4
const publicKey = `-----BEGIN PUBLIC KEY----- const publicKey = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDvekdPMHN3AYhm/vktJT+YJr7cI5DcsNKqdsx5DZX0gDuWFuIjzdwButrIYPNmRJ1G8ybDIF7oDW2eEpm5sMbL9zs MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDvekdPMHN3AYhm/vktJT+YJr7cI5DcsNKqdsx5DZX0gDuWFuIjzdwButrIYPNmRJ1G8ybDIF7oDW2eEpm5sMbL9zs
@ -41,7 +42,7 @@ const boards = {
dataUrl = { dataUrl = {
url: `${api}/event/luna/sign`, url: `${api}/event/luna/sign`,
body: { body: {
lang:'zh-cn', lang: 'zh-cn',
region: data.region, region: data.region,
act_id: this.actid, act_id: this.actid,
uid: data.game_uid uid: data.game_uid
@ -66,7 +67,7 @@ const boards = {
forumid: 26, forumid: 26,
key: 'genshin', key: 'genshin',
biz: 'hk4e_cn', biz: 'hk4e_cn',
osbiz:'hk4e_global', osbiz: 'hk4e_global',
actid: 'e202009291139501', actid: 'e202009291139501',
name: '原神', name: '原神',
url: "https://bbs.mihoyo.com/ys/", url: "https://bbs.mihoyo.com/ys/",
@ -122,7 +123,7 @@ const boards = {
dataUrl = { dataUrl = {
url: `${api}/event/luna/sign`, url: `${api}/event/luna/sign`,
body: { body: {
lang:'zh-cn', lang: 'zh-cn',
region: data.region, region: data.region,
act_id: this.actid, act_id: this.actid,
uid: data.game_uid uid: data.game_uid
@ -223,9 +224,9 @@ export default {
osSaltWeb, osSaltWeb,
web_api, web_api,
os_web_api, os_web_api,
os_hk4_api,app_id, os_hk4_api, app_id,
hk4_api, hk4_api,hk4_sdk,
bbs_api,publicKey, bbs_api, publicKey,
pass_api,passSalt, pass_api, passSalt,
boards boards
} }

View File

@ -30,8 +30,10 @@ export default class user {
this.ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys") this.ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
this.configSign = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config"); this.configSign = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config");
this.configSign.signlist = this.configSign.signlist || "原神|崩坏3|崩坏2|未定事件簿".split("|") this.configSign.signlist = this.configSign.signlist || "原神|崩坏3|崩坏2|未定事件簿".split("|")
this.getToken = this.configSign.getToken || ''
this.getyunToken(this.e) this.getyunToken(this.e)
} }
async getCkData() { async getCkData() {
let sumData = {}; let sumData = {};
let yunres = await this.cloudSeach(); let yunres = await this.cloudSeach();
@ -124,14 +126,14 @@ export default class user {
} }
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`; message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
} else { } else {
let isgt=false let isgt = false
let signMsg=''; let signMsg = '';
for (let i = 0; i < 2; i++) { //循环请求 for (let i = 0; i < 2; i++) { //循环请求
await utils.sleepAsync(2000) await utils.sleepAsync(2000)
res = await this.getData("sign", data, false) res = await this.getData("sign", data, false)
if (res?.data?.gt) { if (res?.data?.gt) {
if(!isgt){ if (!isgt) {
isgt=true; isgt = true;
} }
let validate = await this.geetest(res.data) let validate = await this.geetest(res.data)
if (validate) { if (validate) {
@ -142,13 +144,13 @@ export default class user {
data.headers = header data.headers = header
res = await this.getData("sign", data, false) res = await this.getData("sign", data, false)
if (!res?.data?.gt) { if (!res?.data?.gt) {
if (this.allSign&&!isgt) { if (this.allSign && !isgt) {
this.allSign[forum.name].sign++; this.allSign[forum.name].sign++;
} }
signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n` signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break; break;
} else { } else {
if (this.allSign&&!isgt) { if (this.allSign && !isgt) {
this.allSign[forum.name].error++; this.allSign[forum.name].error++;
} }
item.is_sign = false; item.is_sign = false;
@ -156,7 +158,7 @@ export default class user {
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`; `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
} }
} else { } else {
if (this.allSign&&!isgt) { if (this.allSign && !isgt) {
this.allSign[forum.name].error++; this.allSign[forum.name].error++;
} }
signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n` signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n`
@ -172,7 +174,7 @@ export default class user {
break; break;
} }
} }
message+=signMsg message += signMsg
} }
//获取签到信息和奖励信息 //获取签到信息和奖励信息
const SignInfo = await this.getData("home", data, false) const SignInfo = await this.getData("home", data, false)
@ -200,6 +202,7 @@ export default class user {
return this.configSign[type.includes("云") ? "cloudDoc" : "cookiesDoc"] return this.configSign[type.includes("云") ? "cloudDoc" : "cookiesDoc"]
} }
async cloudSign() { async cloudSign() {
await this.cloudSeach()
let res = await this.getData("cloudReward") let res = await this.getData("cloudReward")
if (res?.data?.list?.length == 0 || !res?.data?.list) { if (res?.data?.list?.length == 0 || !res?.data?.list) {
res.message = `您今天的奖励已经领取了~` res.message = `您今天的奖励已经领取了~`
@ -559,7 +562,7 @@ export default class user {
} }
bbsTask = true; bbsTask = true;
let _reply = e.reply let _reply = e.reply
let counts=0; let counts = 0;
//获取需要签到的用户 //获取需要签到的用户
for (let dataUid of stoken) { for (let dataUid of stoken) {
for (let uuId in dataUid) { for (let uuId in dataUid) {
@ -610,7 +613,8 @@ export default class user {
try { try {
let res = await this.getData('bbsGetCaptcha', false) let res = await this.getData('bbsGetCaptcha', false)
// let challenge = res.data["challenge"] // let challenge = res.data["challenge"]
// await this.getData("geeType", res.data, false) //接入别的平台请把这段代码放出来 否则会一直出现提示拼图失效的情况 // await this.getData("geeType", res.data, false)
res.data.getToken=this.getToken
res = await this.getData("validate", res.data, false) res = await this.getData("validate", res.data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
res = await this.getData("bbsCaptchaVerify", res.data, false) res = await this.getData("bbsCaptchaVerify", res.data, false)
@ -625,6 +629,7 @@ export default class user {
} }
async geetest(data) { async geetest(data) {
try { try {
data.getToken=this.getToken
let res = await this.getData("validate", data, false) let res = await this.getData("validate", data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
let validate = res?.data?.validate let validate = res?.data?.validate