Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
增加 题多多黄金版 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuweiyou authored Mar 8, 2018
1 parent ae793d5 commit dcf9f27
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
node_modules
.DS_Store
package-lock.json
yarn.lock
悦动音符/data/songs.json
大家来找茬腾讯版/data/*.png
31 changes: 31 additions & 0 deletions 题多多黄金版/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 题多多黄金版

智能答题辅助,没有爬题库,目前只是百度搜索 + 提示

接口加密解密方法已破解 [src/crypto.js](src/crypto.js),有兴趣可自行抓包好友对战爬

## 准备

- Node.js 9.x 以上
- 安装依赖 `npm i`

## 使用

执行 `npm run ca` 生成 RootCA,将生成的证书安装到手机上,并在手机上设置代理 IP(电脑的局域网 IP) 和 端口(8001)

证书配置遇到困难可以看[这里](http://anyproxy.io/cn/#%E8%AF%81%E4%B9%A6%E9%85%8D%E7%BD%AE)

一切都配置好之后,**完全退出游戏进程**,执行 `npm run robot`,再重新进入游戏

## 截图

<table>
<tr>
<td>
<img src="https://user-images.githubusercontent.com/8413791/37136419-8fcbdda6-22dc-11e8-8462-655cbf295d34.png" alt="">
</td>
<td>
<img src="https://user-images.githubusercontent.com/8413791/37136424-984b3a44-22dc-11e8-8be4-c92116b5a5f5.png" alt="">
</td>
</tr>
</table>
11 changes: 11 additions & 0 deletions 题多多黄金版/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scripts": {
"ca": "anyproxy-ca",
"robot": "anyproxy --intercept --ignore-unauthorized-ssl --ws-intercept --rule=src/robot.js"
},
"dependencies": {
"crypto-js": "^3.1.9-1",
"anyproxy": "^4.0.6",
"search": "github:game-helper/search"
}
}
25 changes: 25 additions & 0 deletions 题多多黄金版/src/crypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const e = require('crypto-js')
const r = 'MiniSecretKey123$@'

const t = function (t, n) {
var d = e.enc.Utf8.parse(e.MD5(r)),
p = e.enc.Utf8.parse(n)
return e.AES.encrypt(t, d, {
iv: p,
mode: e.mode.CBC,
padding: e.pad.ZeroPadding
}).toString()
}

const n = function (t, n) {
var d = e.enc.Utf8.parse(e.MD5(r)),
p = e.enc.Utf8.parse(n)
return e.AES.decrypt(t, d, {
iv: p,
mode: e.mode.CBC,
padding: e.pad.ZeroPadding
}).toString(e.enc.Utf8)
}

exports.encrypt = t
exports.decrypt = n
25 changes: 25 additions & 0 deletions 题多多黄金版/src/robot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const search = require('search')
const crypto = require('./crypto')

module.exports = {
* beforeSendRequest (requestDetail) {},
* beforeSendResponse (requestDetail, responseDetail) {
if (requestDetail.url.indexOf('/practice/practice_v2?action=get_subject') !== -1) {
const response = responseDetail.response
const body = JSON.parse(response.body)
const data = JSON.parse(crypto.decrypt(body.data, body.encrypt))
console.log('[返回题目]', JSON.stringify(data))
const searchResult = yield search({
question: data.title,
options: data.answer.map(({ans}) => ans)
})
console.log('[搜索答案]', JSON.stringify(searchResult))
searchResult.result.forEach((r, i) => {
data.answer[i].ans = `${searchResult.index === i ? '√ ' : ''}[${r}] ${data.answer[i].ans}`
})
body.data = crypto.encrypt(JSON.stringify(data), body.encrypt)
response.body = JSON.stringify(body)
return {response}
}
}
}
6 changes: 6 additions & 0 deletions 题多多黄金版/test/crypto-question.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const crypto = require('../src/crypto')

const data = 'Sm\/sQ0MC2CPbvGTxG8MswG+79SJVvp3P4XO5Gl+AE9HE90JYGUObeOg9rGp3EklRV4sXoD+Y83GyQL0gI4RrY82Q0mlpbh20nWjvtGOc6rFBUVMx3HlgHSzGn0XUFRIR8yN0AzkEbhCz\/k8VIjpojj3T77mGOVZlsKmfUugRO9HrxAdX45iT3ViMOD4B306UWaETRsWdeuuWGExeNyYVp14ZG33af5IvpKpQduzkzUGx+ejalTXcOUp9qo90pf2Pa4A0xpyNCzklCkamBLvrgM4f1t3wgOcQygHNJXCtCkzPVHdZAQvMe54Txtru\/lYfM\/SC5f3uro3teCieVqDzxbgcm30D25h3yDBKkG4fc6Xo6YKAOUIPXtriDKnhNlgYmNpbaQBqa4\/vhwtwxlUfkNOm8sDg3eMakkkyesL75Y\/uh\/d2s5fkMaDw\/pL4zxWNSzw6YWMwS0VCUanipNoE75XtQD1dovFJG0Btkt0cYh\/mUcSuSZvtasx\/6a\/+xtmW'
const encrypt = 'CavjsXgplAVwLUBd'

console.log(JSON.parse(crypto.decrypt(data, encrypt)))

0 comments on commit dcf9f27

Please sign in to comment.