吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2909|回复: 42
上一主题 下一主题
收起左侧

[其他原创] 【油猴脚本】第九届全国学生宪法小卫士,答题脚本 更新了下大神版本,基本可以自动

  [复制链接]
跳转到指定楼层
楼主
meng521215 发表于 2024-10-6 22:42 回帖奖励
登录页面https://static.qspfw.moe.gov.cn/user/#/user/login?backUrl=http%3A%2F%2Fstatic.qspfw.moe.gov.cn%2Fxf2024%2Flearn_practice_list.html 在这里导入Excel表格 表格里是三列,学校账号,学生姓名,密码
。去年用过的应该都会,感谢https://www.52pojie.cn/forum.php?mod=viewthread&tid=1964190&highlight=%CF%DC%B7%A8 原贴作者
[JavaScript] 纯文本查看 复制代码
// ==UserScript==
// [url=home.php?mod=space&uid=170990]@name[/url]         普法网(宪法小卫士)课后练习、考试自动答题
// [url=home.php?mod=space&uid=467642]@namespace[/url]    Ne-21
// [url=home.php?mod=space&uid=1248337]@version[/url]      1.3.9
// @description  全国学生“学宪法 讲宪法”活动自动答题脚本,因缺少测试账号无法保证每年都能用,欢迎大家提供测试账号以支持此脚本长期可用,测试账号登录信息请发送至我们的邮箱[email]nawlgzs@gmail.com[/email]
// [url=home.php?mod=space&uid=686208]@AuThor[/url]       Ne-21
// [url=home.php?mod=space&uid=195849]@match[/url]        *://static.qspfw.moe.gov.cn/*
// [url=home.php?mod=space&uid=593100]@Icon[/url]         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAYAAADhXXHAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0I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qrsZILALZOdQWURgYSO7S0TDR70cpZ4eI2Ro5/O6od/jgcY12nkFSc0kcNIrJ5qs8dKB7vPvsnvc9HRStATzHr7g8sJZIAnd3DWGCZTc+Oqcsp84sPGSJQvTTONNFYI+FPOEZrWcffcAdCh+ghvIl+QQbAU0HVMd8K0dWKjwRTJ+UTPQl/SFKEYoL0VvGTdKIbktfPKKAtVIanL+b/YcAAwARLZvTKDgQZgAAAABJRU5ErkJggg==
// @run-at       document-end
// [url=home.php?mod=space&uid=609072]@grant[/url]        unsafeWindow
// @grant        GM_setValue
// @grant        GM_getValue
// @license      MIT
// @require      https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js
// @require      https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/limonte-sweetalert2/11.0.1/sweetalert2.all.min.js
// @require      https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/crypto-js/4.1.1/crypto-js.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js
// @downloadURL https://update.greasyfork.org/scripts/430038/%E6%99%AE%E6%B3%95%E7%BD%91%EF%BC%88%E5%AE%AA%E6%B3%95%E5%B0%8F%E5%8D%AB%E5%A3%AB%EF%BC%89%E8%AF%BE%E5%90%8E%E7%BB%83%E4%B9%A0%E3%80%81%E8%80%83%E8%AF%95%E8%87%AA%E5%8A%A8%E7%AD%94%E9%A2%98.user.js
// @updateURL https://update.greasyfork.org/scripts/430038/%E6%99%AE%E6%B3%95%E7%BD%91%EF%BC%88%E5%AE%AA%E6%B3%95%E5%B0%8F%E5%8D%AB%E5%A3%AB%EF%BC%89%E8%AF%BE%E5%90%8E%E7%BB%83%E4%B9%A0%E3%80%81%E8%80%83%E8%AF%95%E8%87%AA%E5%8A%A8%E7%AD%94%E9%A2%98.meta.js
// ==/UserScript==

var _self = unsafeWindow,
    $ = _self.jQuery || top.jQuery,
    Swal = Swal || window.Swal,
    columnId = getQueryVariable("columnId"),
    answer_list = [],
    exam_list = [],
    time = 2e3, // 答题间隔时间,最好为5秒
    save_key = "xfxws2024",
    num = {"A": 1,"B": 2, "C": 3, "D": 4};

(function() {
    //alert(window.location.pathname);

    if (window.location.pathname.indexOf('learn_exam.html') != -1) {
       // Swal.fire('宪法小助手提示','点击确定开始考试','info').then(()=>{
            Swal.fire({
                position: 'top-end',
                title: '脚本将在2秒后开始自动作答!',
                showConfirmButton: false,
                timer: 2000
            })
            getExam();
            let t = setInterval( function() {
                doExam(t)
            },time);
      //  })
    } else if (window.location.pathname.indexOf('learn-practice.html') != -1) {
     //   Swal.fire('宪法小助手提示','点击确定开始练习,脚本会自动收录本练习题目数据','info').then(()=>{
            getAnswer(columnId);
            let t = setInterval( function() {
                doQuestion(t)
            },time);
        //})
    } else if (window.location.pathname.indexOf('learn_practice_list.html') != -1) {
       // Swal.fire('宪法小助手提示','<div style="font-size: 13px;">脚本最后更新时间:2024.09.12<br />使用说明:<br /><div><span style="color: red;">1.脚本题库数据托管于本地,请在做综合评价前逐个完成练习,收集答案!!!</span><br />2.脚本运行故障如综合测评无操作等,请使用Edge浏览器+ScriptCat。<br />3.问题联系邮箱[email]nawlgzs@gmail.com[/email]<br />4.脚本数据来自本网站后端返回的明文JSON数据包,脚本不涉及任何逆向操作!<br />5.脚本仅供学习交流,请勿用于商业用途,否则后果自负!</div></div>')
   //toLearning(this);
        setTimeout(function(){ $(".red").click();},time / 2);
    } else if (window.location.pathname.indexOf('evaluation.html') != -1) {
       
    }
    else if (window.location.pathname.indexOf('learning-page.html') != -1) {
     //   alert(111);
        $('#afterClassPractice').click();
    }
    else if (window.location.pathname.indexOf('/user/') != -1) {
      // alert(111);
        //$('#afterClassPractice').click();

        setTimeout(function(){
             createFileInput();
            readFile();
            readAndWriteStudentInfo();

          //  $(".ant-radio-input").click();
        },2000);
    }
})();

// 解析url参数
function getQueryVariable(variable) {
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
};

// 正则匹配
function getStr(str, start, end) {
    let res = str.match(new RegExp(`${start}(.*?)${end}`))
    return res ? res[1] : null
}

// 获取答案
function getAnswer(columnId) {
    // var html = $("html").html(),
    //     taskId = getStr(html,'&taskId=','`,')

    $.ajax({
        url: _self.config.practice.host + _self.config.practice.practice + "?columnId="+ columnId + "&taskId=" + _self.config.taskId,
        headers: _self.config.apiConfig.header,
        async: false,
        success: function (res) {
            const { data, status } = res;
            if (status === "0") {
                var question_data = res.data
                var questionBankList = data.questionBankList
                answer_list = questionBankList;
                upload(answer_list)
            } else if (status === "1") {
                //无效的columnId(下个接口是chapterId)
                alert("请先学习当前模块");
                window.history.go(-1);
            } else if (status === "-2") {
                alert("请重新登陆");
            } else {

            }
        },
        error: function (err) {
        }
    });
}

// 答题操作
function doQuestion(t) {
    var cur_topic = $('#currentTopic').text(),
        tol_topic = $('#totalTopic').text(),
        answer = answer_list[cur_topic - 1].answer;
    $('#exam_answer > div:nth-child(' + num[answer] + ')').click();
    if (cur_topic == tol_topic) {
        // 清除Interval的定时器
        clearInterval(t);
        setTimeout(function(){
  $('#next_eval').click()
           // $('#next_exam').click()
const nextColumnId = $("#next_exam").attr("data-nextColumnId");
    if (nextColumnId) {
      window.location.href = `./learning-page.html?columnId=${nextColumnId}`;
    }
           // Swal.fire('宪法小助手提示','答题完成','info')

        },time / 2);
    } else{
        setTimeout(function(){$('#next_question').click()},time / 2);
    };
}

// 获取考试题目
function getExam(){
    // var html = $("html").html(),
    //     taskId = getStr(html,'taskId=','`,');
    $.ajax({
        url: _self.config.wexam.host + _self.config.wexam.getPaper + "?taskId=" + _self.config.taskId,
        headers: _self.config.apiConfig.header,
        async: false,
        success: function (res) {
            const { data, status, message } = res;
            if (status === "0") {
                var question_data = res.data;
                var paper = question_data.paper;
                var paperInfo = paper.paperInfo;
                exam_list = paperInfo;
            } else {
                alert('获取考试题目失败!')
            }
        },
        error: function (err) {
        }
    });
}
// 考试答题操作
function doExam(t){
    let db_json = []
    if (GM_getValue(save_key) && JSON.parse(GM_getValue(save_key)).length >= 0) {
        db_json = JSON.parse(GM_getValue(save_key))
    } else {
        Swal.fire('宪法小助手提示','无题库数据,请先收集答案或自己作答!','info')
        return
    }

    $('#ne21ans')[0] ? $('#ne21ans').html('<p style="color: red;">正在搜索答案~</p>') : $('#exam_question').append('<div id="ne21ans"><p style="color: red;">正在搜索答案~</p></div>')

    var cur_topic = $('#currentTopic').text(),
        tol_topic = $('#totalTopic').text(),
        questionInfo = exam_list[cur_topic - 1];


    ans_index = []
    ops = questionInfo.answerOptions.split("@!@")
    for (var i = 0; i < ops.length; i++) {
        hash_tmp = MD555(questionInfo.content+"|"+ops[i])
        db_json.forEach((item)=>{
            if (item.hash == hash_tmp) {
                ans_index.push(i)
            }
        }) 
    }

    if (ans_index.length == 0) {
        Swal.fire('宪法小助手提示','无题库数据,请先收集答案或自己作答!','info')
        return
    }

    ans_index.forEach((item1)=>{
        $('#ne21ans').html('<p style="color: red;">参考答案:'+ ops[item1] + '</p>')
        $('#exam_answer > div:nth-child(' + (item1+1) + ')').click();  
    })

    if (cur_topic == tol_topic) {
         // 清除Interval的定时器
         clearInterval(t);
         setTimeout(function(){
            // Swal.fire('宪法小助手提示','答题完成,请自己点击交卷!','info')
           //  $('#submit').click()
             saveResult();
         },time / 2);
    } else{
         setTimeout(function(){$('#next_question').click()},time / 2);
    };

}

function upload(question_data) {
    let db_json = []
    if (GM_getValue(save_key) && JSON.parse(GM_getValue(save_key)).length >= 0) {
        db_json = JSON.parse(GM_getValue(save_key))
    }
    question_data.forEach((item)=>{
        let question = item.content
        let ans_index = []
        item.answer.split().forEach(((item1)=>{
            let index_tmp = "ABCDEFG".indexOf(item1)
            ans_index.push(index_tmp)
        }))
        let ans_ops = item.answerOptions.split("@!@")
        ans_index.forEach((item3)=>{
            db_json.push({
                "hash":MD555(question+"|"+ans_ops[item3]), 
                "question": question, 
                "answer": ans_ops[item3]
                })
        })
    })

    let dbJson = uniqueByField(db_json,"hash")
    GM_setValue(save_key,JSON.stringify(dbJson))
    console.log(JSON.parse(GM_getValue(save_key)))
}

function MD555(str) {
    return CryptoJS.MD5(str).toString()
}

function uniqueByField(array, field) {
    const seen = new Set();
    return array.filter((item) => {
        const key = item[field];
        return seen.has(key) ? false : seen.add(key);
    });
}

 function nextExam() {
    const nextColumnId = $("#next_exam").attr("data-nextColumnId");
    if (nextColumnId) {
      window.location.href = `./learning-page.html?columnId=${nextColumnId}`;
    } else {
      //alert("没有下一章节了")
    }
  }



function createFileInput() {
    var courseGradeDetail = document.querySelector(".main");
    var fileInputHTML = '<div><input type="file" id="file-input" accept=".xls,.xlsx"></div>';
    courseGradeDetail.insertAdjacentHTML("afterbegin", fileInputHTML);
    var clearButton = document.createElement("button");
    clearButton.textContent = "清除缓存";
    clearButton.addEventListener("click", function() {
      localStorage.removeItem("students");
    });
    var file = document.querySelector("#file-input");
    file.parentNode.appendChild(clearButton);
}

function readFile() {
  var fileInput = document.getElementById("file-input");
  fileInput.addEventListener("change", function() {
    var file = fileInput.files[0];
    var reader = new FileReader();
    reader.onload = function(e) {
      var data = e.target.result;
        //alert(data);
      parseExcelData(data);
    };
    reader.readAsBinaryString(file);
  });
}

function parseExcelData(data) {
  var workbook = XLSX.read(data, {type: "binary"});
  var sheetName = workbook.SheetNames[0];
  var sheet = workbook.Sheets[sheetName];
  var json = XLSX.utils.sheet_to_json(sheet, {header: 1});
   // console.log(json);
  var students = {};
  for (var i = 2; i < json.length; i++) {
    var row = json[i];
    var id = row[0];
    var name = row[1];
    //  console.log(name);
    var password = row[2];
    if (students[name]) {
      continue;
    }
    students[id] = {name: name, password: password};
     // alert(sheetName);
  }
  var studentsString = JSON.stringify(students);
  localStorage.setItem("students", studentsString);
}

function readAndWriteStudentInfo() {
  //  alert(111);
  var students = JSON.parse(localStorage.getItem("students") || "{}");
  var keys = Object.keys(students || []);
  if (keys.length == 0) {
    return;
  }
     //alert(222);
  var id = keys[0];
   // console.log(id);
    console.log(students);
  var name = students[id].name; console.log(name);
  var paw = students[id].password;
  var  copy_text = id;
  var loginInfo = document.getElementById("formLogin_loginInfo");
  var userName = document.getElementById("formLogin_userName");
  var password = document.getElementById("formLogin_password");
  var captcha = document.getElementById("formLogin_captcha");
   // console.log(password);

  //  $("#formLogin_loginInfo").val("需赋值的内容");
    //document.getElementById("formLogin_loginInfo").value = "要设置的值";

  loginInfo.onfocus = async function() {
    await navigator.clipboard.writeText(id);
  };
  userName.onfocus = async function() {
    await navigator.clipboard.writeText(name);
  };
  password.onfocus = async function() {
   await navigator.clipboard.writeText(paw);
  };

    console.log("shancghu"+id);
     $(".ant-radio-input").click();
  delete students[id];
  localStorage.setItem("students", JSON.stringify(students));
}

免费评分

参与人数 7吾爱币 +15 热心值 +7 收起 理由
ohto + 1 + 1 我很赞同!
collinchen1218 + 3 + 1 厉害,答题好快,而且全对
骑猪追月亮 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
DK1 + 1 我很赞同!
ruanxiaoqi + 1 + 1 我很赞同!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
tzxinqing + 2 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
 楼主| meng521215 发表于 2024-10-7 10:25 |楼主
zxxiaopi 发表于 2024-10-7 09:54
都是为了应付检查!搞这种形式上的东西,也不是一年两年了,很久很久很久了……

是的,学生又做不好,苦了班主任
推荐
qianyu666 发表于 2024-10-7 01:13
推荐
ruanxiaoqi 发表于 2024-10-8 19:36
信息技术老师有福了,可以快速完成上级布置的任务。
4#
swl0515 发表于 2024-10-6 23:09
66666
5#
Kane1 发表于 2024-10-7 01:28
看起来好像很厉害的样子,但是我不用做
6#
zp820710 发表于 2024-10-7 07:54
压力来了
7#
luodeman 发表于 2024-10-7 08:09
感谢楼主分享,辛苦了
8#
jzx765 发表于 2024-10-7 08:11
学一下思路,虽然不用做了
9#
xlycaq1 发表于 2024-10-7 09:41
qianyu666 发表于 2024-10-7 01:13
还要做?    投诉完好多网上作业都不布置了

支持!!
10#
zxxiaopi 发表于 2024-10-7 09:54
都是为了应付检查!搞这种形式上的东西,也不是一年两年了,很久很久很久了……
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-12-14 22:56

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表