词达人小工具2.0 开放源码 C/Python

词达人小工具2.0 开放源码 C/Python

额外注意事项

  • 无法使用的请仔细参考文章开头链接的使用方法Fidder配置
  • 配置Fidder时的脚本时添加脚本变更为以下内容即可:
      if(oSession.uriContains("https://wap.vocabgo.com/Student/ClassTask/SubmitAnswer")){
            oSession.utilDecodeResponse();
            oSession.SaveResponseBody("C:/responseBody.txt");
       }
       if(oSession.uriContains("https://wap.vocabgo.com/Student/StudyTask/SubmitAnswer")){
            oSession.utilDecodeResponse();
            oSession.SaveResponseBody("C:/responseBody.txt");
        }
  • 记得使用右键管理员模式运行Fidder
词达人小工具2.0新特性
  • 满足自学任务使用
  • 答案显示优化
  • 源码开放提供大家学习(一代为C,2.0为Python)(文章末尾)
代码运行截图(左为1.0)

在这里插入图片描述
在这里插入图片描述

源码C/Python

C - 词达人小工具1.0
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include<windows.h>

#define MAX_BUFFER 1024		//缓冲区大下 
#define BIT 2

/**
** time:2020年3月29日 13:16:36
** author:江浒一只猫
** describe:自动搜索词达人答案,仅供学习参考使用,任何人不得将此用于商用
*/

int main() {
	static char answer[9] = "\"answer\"";
	static char answer_arr[11] = "answer_arr";
	static char answer_content[15] = "answer_content";
	static char Ture[BIT] = "t";

	long answersite;
	char buff[BIT],answerbuff[MAX_BUFFER/BIT], answer_arrbuff[MAX_BUFFER/BIT];
	int answerlite;
	FILE *fp;            /*文件指针*/


	while(1) {
		answerlite = 0;
		answersite = 0;

		//if((fp = fopen("D:\\responseBody.txt","r")) == NULL) {
			if((fp = fopen("C:\\responseBody.txt","r")) == NULL) {
				perror("读取资源失败!请检查配置!\n");
				Sleep(1000);
				exit (0) ;
			}
		//}
		//寻找答案
		while(fgets(buff, BIT, (FILE*)fp) != NULL) {
			//printf("%s", b);
			answersite = ftell(fp);
			fgets(answerbuff, 9, (FILE*)fp);
			
			//遇到答案标识 
			if(strcmp(answerbuff, answer) == 0) {
				//第几个答案
				answerlite ++;
				//answersite = ftell(fp);
				//取出答案
				fgets(buff, BIT, (FILE*)fp);
				fgets(buff, BIT, (FILE*)fp);
				//答案是否正确
				if(strcmp(buff, Ture) == 0) {
					//答案正确 则输出答案索引
					printf("%d \n", answerlite);
				}
			}
			fseek(fp, answersite, 0);
			
			fgets(answerbuff, 11, (FILE*)fp);
			if(strcmp(answerbuff, answer_arr) == 0){
				fgets(buff, BIT, (FILE*)fp);fgets(buff, BIT, (FILE*)fp);fgets(buff, BIT, (FILE*)fp);
				while(fgets(buff, BIT, (FILE*)fp) != NULL && strcmp(buff, "]")){
					printf("%s", buff);
				}
			}
			fseek(fp, answersite, 0);
			
			fgets(answerbuff, 15, (FILE*)fp);
			if(strcmp(answerbuff, answer_content) == 0){
				fgets(buff, BIT, (FILE*)fp);fgets(buff, BIT, (FILE*)fp);fgets(buff, BIT, (FILE*)fp);
				while(fgets(buff, BIT, (FILE*)fp) != NULL && strcmp(buff, "\"")){
					printf("%s", buff);
				}
			}
			fseek(fp, answersite, 0);
		}
		answerlite = 0;
		printf("\n----------------------\n");
		if ( fp != NULL ) {
			fclose(fp);
		}
		Sleep(500);
	}
	return 0;
}
Python - 词达人小工具2.0
import os
import json
import time

lodec = 'C:\\responseBody.txt'

def init():
    print("=====================词达人小工具2.0=====================\n\n")
    time.sleep(1)
    if os.path.getsize(lodec) == 0:
        print("没有在C盘中找到资源,检查办法:\n(1):手动答题一道然后再打开本程序(前面的听力部分不算)\n(2):查看C盘下是否存在responseBody.txt文件\n(3):检查Fidder配置")
        print("如有疑问请联系作者QQ:1753047507\n该程序已经开放源码,包含C/Python两个版本,如果遇见倒卖请不要相信")
        print("程序将在10秒后自动退出")
        time.sleep(10)
        exit()
    print("资源检查成功,开始使用")
    time.sleep(1)
    
def main(data):
    #多选
    if data['data']['topic_mode'] in [31] :
        options = data['data']['options']
        count = 0;
        for option in options:
            count += 1;
            if option['answer']==True :
                print(str(count) + ' == ' + option['content'])
    #单选
    if data['data']['topic_mode'] in [11,22,42] :
        options = data['data']['options']
        count = 1;
        for option in options:
            if option['answer']==False :
                count+=1;
            if option['answer']==True :
                print(str(count))
                print(option['content'])
    #选词
    if data['data']['topic_mode'] in [32] :
        options = data['data']['options']
        arr = data['data']['answer_content']['answer_arr']
        for arr in arr:
            count = 0;
            for option in options:
                count += 1
                if option['content']==arr :
                    print(count, end=' ')
        print("\n" + data['data']['answer_content']['answer_str'])

    #填空
    if data['data']['topic_mode'] in [51] :
        print(data['data']['answer_content'])
        
def read():
    return open(lodec, "r", encoding='utf-8').read();


if __name__ == '__main__':
    init()
    while True:
        main(json.loads(read()))
        time.sleep(1)
        print("----------------------")
发布了15 篇原创文章 · 获赞 3 · 访问量 2755

猜你喜欢

转载自blog.csdn.net/SR02020/article/details/105451725