wechat_brain

package module
v0.0.0-...-b49fc95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2018 License: MIT Imports: 16 Imported by: 0

README

wechat_brain

知乎答题王(小程序头脑王者)辅助工具,上万题库。

注意

本工具仅供辅助娱乐。

使用原理

本工具运行在PC端,本质是一个http/https代理服务,对头脑王者的接口请求进行截获,主要作用有

  • 将题目和返回的标准答案存储于本地数据库中(questions.data文件)
  • 未匹配到标准答案情况下,自动请求搜索引擎,注解形式返回最佳概率结果

使用步骤:

本工具必须结合PC和手机共同使用,PC和手机须在同一个网络下

以下为PC电脑操作步骤
  • 运行主程序。运行方法(三选一)

    1. 方法一: 在release页面下载对应的操作系统执行文件, 解压后, 将最新版本的questions.data 文件下载到同一个目录, 然后运行brain文件即可,命令行输入./brain

    2. 方法二: 安装go(>=1.8)环境后, clone本repo源码到对应$GOPATH/src/github.com/sundy-li/下, 进入源码目录后,执行 go run cmd/main.go

    3. 方法三: 使用docker命令运行:

       git clone https://github.com/sundy-li/wechat_brain.git
       cd wechat_brain
       docker build . -t wechat_brain
       docker run -p 8998:8998 --name my_wechat_brain -d wechat_brain
      
  • 新版本(version >= v0.18)加入了三种模式, 大家根据自己的需求选择模式运行

    1. 模式一: 默认模式, 修改了服务端返回的数据, 更加友好地提示正确答案, 运行方式如上所述: ./brain 或者源码下执行 go run cmd/main.go
    2. 模式二: 隐身模式, 严格返回原始数据, 该模式可以防止作弊检测(客户端提交返回题目和服务端对比,模式一很容易被侦测出使用了作弊, 模式二避免了这类检测), 但该模式的缺点是降低了用户的体验,题目答案的提示只能在PC电脑上显示, 运行方式如上所述 ./brain -m 1 或者源码下执行 go run cmd/main.go -m 1
    3. 模式三:自动模式 ** 注意此模式不同手机点击可能不稳定, 谨慎使用 ** 安卓机的自动刷题模式,需要将手机连接到电脑,并安装adb,且需要在开发者模式中打开usb调试,使用前请根据自身手机分辨率,调整spider文件clickProcess中的相应参数:手机屏幕中心x坐标,第一个选项中心y坐标,排位列表中最后一项中心y坐标。运行方式如上所述 ./brain -a 1 -m 1 或者源码下执行 go run cmd/main.go -a 1 -m 1
以下为手机安装步骤
  • 设置手机代理。手机连接wifi后进行代理设置,代理IP为个人pc的内网ip地址,以及端口为8998,移动网络下可通过设置新建APN并在其中设置代理的方式实现。如:
配置代理
  • 安装证书。代理运行成功后,手机浏览器访问 abc.com安装证书,ios记得要信任证书 (或者将 certs/goproxy.crt传到手机, 点击安装证书), 很多朋友会卡在安装证书这一步骤, 不同手机会有不同的安装方式,建议大家多搜索下自己机型如何安装证书

  • 打开微信并启动头脑王者小程序。

  • 正确的答案将在小程序的选项中以【标准答案】或【数字】字样。如:

自动提示标准答案 自动估算最可能的答案

问题

  • FAQ
  • 感谢@HsiangHo, @milkmeowo 的贡献,修复了ios代理问题,更新新版本后,最好重新安装证书,重启微信进程
    
    

合并题库

  • 请将questions.data文件压缩为zip文件后提交到这里, 题库将会定期合并更新。

支持

维护开源软件需要花费很大时间精力,如果各位觉得本工具对你有帮助,可以请我喝杯咖啡支持一下

轻松上王者效果图

自动提示标准答案

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mode      int
	AutoMatic int
)
View Source
var (
	QuestionBucket = "Question"
)

Functions

func Close

func Close()

func CountQuestions

func CountQuestions() int

func FetchQuestion

func FetchQuestion(question *Question) (str string)

func FetchQuestionTime

func FetchQuestionTime(quiz string) (res int64)

func GetFromApi

func GetFromApi(req *http.Request, quiz string, options []string) (res map[string]int)

func GetFromBaidu

func GetFromBaidu(quiz string, options []string) map[string]int

func MergeQuestions

func MergeQuestions(fs ...string)

func Run

func Run(port string, mode, automatic int)

func SetQuestion

func SetQuestion(question *Question)

func ShowAllQuestions

func ShowAllQuestions()

func StoreQuestion

func StoreQuestion(question *Question) error

Types

type ChooseResp

type ChooseResp struct {
	Data struct {
		UID         int  `json:"uid"`
		Num         int  `json:"num"`
		Answer      int  `json:"answer"`
		Option      int  `json:"option"`
		Yes         bool `json:"yes"`
		Score       int  `json:"score"`
		TotalScore  int  `json:"totalScore"`
		RowNum      int  `json:"rowNum"`
		RowMult     int  `json:"rowMult"`
		CostTime    int  `json:"costTime"`
		RoomID      int  `json:"roomId"`
		EnemyScore  int  `json:"enemyScore"`
		EnemyAnswer int  `json:"enemyAnswer"`
	} `json:"data"`
	Errcode int `json:"errcode"`
}

type Question

type Question struct {
	Data struct {
		Quiz        string   `json:"quiz"`
		Options     []string `json:"options"`
		Num         int      `json:"num"`
		School      string   `json:"school"`
		Type        string   `json:"type"`
		Contributor string   `json:"contributor"`
		EndTime     int      `json:"endTime"`
		CurTime     int      `json:"curTime"`
	} `json:"data"`
	Errcode int `json:"errcode"`

	CalData struct {
		RoomID string

		Answer     string
		TrueAnswer string
		// contains filtered or unexported fields
	} `json:"-"`
}

func GetQuestion

func GetQuestion(roomID, quizNum string) *Question

type QuestionCols

type QuestionCols struct {
	Answer string `json:"a"`
	Update int64  `json:"ts"`
}

func DecodeQuestionCols

func DecodeQuestionCols(bs []byte, update int64) *QuestionCols

func NewQuestionCols

func NewQuestionCols(answer string) *QuestionCols

func (*QuestionCols) GetData

func (q *QuestionCols) GetData() []byte

Directories

Path Synopsis
跑这个脚本的时候记得关掉其他服务,因为这个脚本需要读取questions.data
跑这个脚本的时候记得关掉其他服务,因为这个脚本需要读取questions.data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL