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

@ -36,4 +36,6 @@ noteSetAuth: 2
# 体力推送 间隔 10分钟检索一次
noteTask: 0 0/10 * * * ?
# 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭
isNoteTask: false
isNoteTask: false
# 验证码接口token
getToken:

View File

@ -81,7 +81,6 @@ export default class mysTopLogin {
Bot.logger.mark("[米哈游登录] 正在验证")
this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
let vlData = await this.crack_geetest()
console.log(vlData)
// let validate = await this.user.getData("validate", this.aigis_captcha_data, false)
if (vlData?.geetest_validate) {
Bot.logger.mark("[米哈游登录] 验证成功")
@ -104,12 +103,12 @@ export default class mysTopLogin {
}
if (res.retcode == 0) {
let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}`
let cookie_token = this.user.getData("bbsGetCookie", { cookies })
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false)
let cookie_token =await this.user.getData("bbsGetCookie", { cookies })
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies}` }, false)
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`)
return {
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 {
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}`,
types: 'stoken'
},
//接口来源于外网扒来的 接口目前暂时免费后续看token是否收费祝你生活愉快
//很抱歉由于有人恶意倒卖不得已只能是关闭免费token了 开放免费供人使用还被恶意倒卖指责 开源确实不好弄捏
validate: {
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: {
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
@ -259,7 +259,7 @@ export default class miHoYoApi {
query: `callback=${data.challenge}`
},
loginByPassword: {
url: "https://passport-api.mihoyo.com/account/ma-cn-passport/app/loginByPassword",
url: `${mys.pass_api}/account/ma-cn-passport/app/loginByPassword`,
body: {
account: this.encrypt_data(data.account),
password: this.encrypt_data(data.password)
@ -267,14 +267,14 @@ export default class miHoYoApi {
types: 'pass'
},
qrCodeLogin: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch`,
url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/fetch`,
body: {
app_id: mys.app_id,
device: data.device
}
},
qrCodeQuery: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query`,
url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/query`,
body: {
app_id: mys.app_id,
device: data.device,
@ -282,7 +282,7 @@ export default class miHoYoApi {
}
},
getTokenByGameToken: {
url: `https://passport-api.mihoyo.com/account/ma-cn-session/app/getTokenByGameToken`,
url: `${mys.pass_api}/account/ma-cn-session/app/getTokenByGameToken`,
body: {
account_id: data.uid * 1,
game_token: data.token
@ -290,7 +290,7 @@ export default class miHoYoApi {
types: 'pass'
},
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}`
},
GetCode:{

View File

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

View File

@ -30,8 +30,10 @@ export default class user {
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.signlist = this.configSign.signlist || "原神|崩坏3|崩坏2|未定事件簿".split("|")
this.getToken = this.configSign.getToken || ''
this.getyunToken(this.e)
}
async getCkData() {
let sumData = {};
let yunres = await this.cloudSeach();
@ -124,16 +126,16 @@ export default class user {
}
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
} else {
let isgt=false
let signMsg='';
let isgt = false
let signMsg = '';
for (let i = 0; i < 2; i++) { //循环请求
await utils.sleepAsync(2000)
res = await this.getData("sign", data, false)
if (res?.data?.gt) {
if(!isgt){
isgt=true;
if (!isgt) {
isgt = true;
}
let validate = await this.geetest(res.data)
let validate = await this.geetest(res.data)
if (validate) {
let header = {}
header["x-rpc-challenge"] = res["data"]["challenge"]
@ -142,13 +144,13 @@ export default class user {
data.headers = header
res = await this.getData("sign", data, false)
if (!res?.data?.gt) {
if (this.allSign&&!isgt) {
if (this.allSign && !isgt) {
this.allSign[forum.name].sign++;
}
signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break;
} else {
if (this.allSign&&!isgt) {
if (this.allSign && !isgt) {
this.allSign[forum.name].error++;
}
item.is_sign = false;
@ -156,12 +158,12 @@ export default class user {
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
}
} else {
if (this.allSign&&!isgt) {
if (this.allSign && !isgt) {
this.allSign[forum.name].error++;
}
signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n`
}
} else {
if (this.allSign) {
this.allSign[forum.name].sign++;
@ -172,7 +174,7 @@ export default class user {
break;
}
}
message+=signMsg
message += signMsg
}
//获取签到信息和奖励信息
const SignInfo = await this.getData("home", data, false)
@ -200,6 +202,7 @@ export default class user {
return this.configSign[type.includes("云") ? "cloudDoc" : "cookiesDoc"]
}
async cloudSign() {
await this.cloudSeach()
let res = await this.getData("cloudReward")
if (res?.data?.list?.length == 0 || !res?.data?.list) {
res.message = `您今天的奖励已经领取了~`
@ -559,7 +562,7 @@ export default class user {
}
bbsTask = true;
let _reply = e.reply
let counts=0;
let counts = 0;
//获取需要签到的用户
for (let dataUid of stoken) {
for (let uuId in dataUid) {
@ -610,7 +613,8 @@ export default class user {
try {
let res = await this.getData('bbsGetCaptcha', false)
// 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)
if (res?.data?.validate) {
res = await this.getData("bbsCaptchaVerify", res.data, false)
@ -625,6 +629,7 @@ export default class user {
}
async geetest(data) {
try {
data.getToken=this.getToken
let res = await this.getData("validate", data, false)
if (res?.data?.validate) {
let validate = res?.data?.validate