// ==UserScript==
// @name EasyWJX-破解问卷星复制限制,绕过作弊检测搜索答案
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 这个脚本可以帮助你绕过问卷星的复制限制,并且可以直接在问卷星的答题页面搜索答案,防止被企业版防作弊检测。同时可以自动清理cookie来绕过设备限制(部分浏览器可用)
// @author MelonFish
// @match https://ks.wjx.top/*/*
// @match http://ks.wjx.top/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// @license GNU GPLv3
// ==/UserScript==
(function() {
'use strict';
// Your code here...
console.log("EasyWJX is running. From xq.kzw.ink. Version 0.5")
if(window.location.protocol == 'https:') {
window.location.href = window.location.href.replace('https', 'http')
}
foreach();
deleteAllCookies();
if ($("#divTip").text().indexOf("最大填写次数")>=0) {
alert('监测到您可能被问卷星限制,这种情况请清空浏览器Cookie并重新联网(开一下飞行模式)再试')
}
$('#spanPower').html('<a href="https://xq.kzw.ink" title="线圈_专为学生谋福利">线圈脚本</a><span>提供破解</span>')
// 创建按钮
var addtrueans_btn = document.createElement("button"); //创建一个input对象(提示框按钮)
addtrueans_btn.textContent = "添加答对题目";
addtrueans_btn.style.width = "6rem";
addtrueans_btn.style.height = "1.5rem";
addtrueans_btn.style.marginLeft = "1rem";
addtrueans_btn.type = 'button';
addtrueans_btn.onclick = function (e){
var addtrueans_ls=prompt("请问需要将哪些题改为正确的?(输入题目ID,如需多个可用空格隔开,如需修改全部清输入“all”)")
if (addtrueans_ls!=null && addtrueans_ls!="") {
if (addtrueans_ls!='all') {
addtrueans_ls = addtrueans_ls.split(' ')
for (var i=0; i<addtrueans_ls.length; i++) {
changeAnsToTrue(addtrueans_ls[i])
}
} else if (addtrueans_ls=='all') {
var ans_list = document.querySelectorAll('.data__items');
for (var i=0; i<ans_list.length; i++) {
changeAnsToTrue(i)
}
}
}
};
var server_ip='xq.kzw.ink:8800'
var clear_btn = document.createElement("button"); //创建一个input对象(提示框按钮)
clear_btn.textContent = "我要截屏";
clear_btn.style.width = "4rem";
clear_btn.style.height = "1.5rem";
clear_btn.style.marginLeft = "1rem";
clear_btn.type = 'button';
clear_btn.onclick = function (e){
alert('该功能将清理所有页面上与脚本有关的元素方便截图')
$('#spanPower').html('<a href="https://xq.kzw.ink" title="线圈_专为学生谋福利">问卷星</a><span>提供技术支持</span>')
clear_btn.style.display = 'none';
addtrueans_btn.style.display = 'none';
var ques_titles = $('.data__tit_cjd');
for (var i=0; i<ques_titles.length; i++) {
ques_titles.eq(i).text(ques_titles.eq(i).text().split(' 题目ID:')[0])
}
};
// 以上为创建按钮
$("#stop_jiexiTxt").append(addtrueans_btn).append(clear_btn)
// 判断是否直接修改成绩
if ($(".score-font-style").length>0) {
if(window.location.protocol == 'https:') {
window.location.href = window.location.href.replace('https', 'http')
} else {
setTimeout(function () {
getAllAnswer_radio()
},2000)
// 放置题目ID
var ques_titles = $('.data__tit_cjd');
console.log(ques_titles.eq(0).text())
for (var i=0; i<ques_titles.length; i++) {
ques_titles.eq(i).text(ques_titles.eq(i).text()+' 题目ID:'+i)
}
var r=confirm("是否需要修改成绩?(可能出现问题,如修改效果不符合要求请刷新)")
if (r==true)
{
var score=prompt("修改后的分数(注意不要大于总分)")
if (score!=null && score!="")
{
$(".score-font-style").eq(0).text(score)
}
var correct_num=prompt("修改后的正确题数(注意不要大于总题数)")
if (correct_num!=null && correct_num!="")
{
//$(".tbottom-title").eq(3).html('<span style="font-size:20px;">'+correct_num+'</span>')
//$("span[style$='font-size:20px;']").text(correct_num)
$(".score-form__list.clearfix .tht-content span").text(correct_num)
}
if ($(".score-form__list.clearfix .tht-content").text().indexOf('名')>=0) {
var rank=prompt("修改后的名次(如果没有排名或者排名修改后出错请点击取消或留空)")
if (rank!=null && rank!="")
{
//$(".tbottom-title").eq(3).html('<span style="font-size:20px;">'+correct_num+'</span>')
//$("span[style$='font-size:20px;']").text(correct_num)
$(".score-form__list.clearfix .tht-content").eq(1).text("第"+rank+"名")
}
}
}
}
} else {
setTimeout(function () {
writeAnswer_radio()
},2000)
}
if ($(".wxtxt").length >0) {
var r2=confirm("监测到微信限制。是否需要移除限制并查看题目(可以查看题目但无法提交)")
if (r2==true) {
$("#zhezhao2").remove();
$("#divContent").removeClass('disabled').removeClass('isblur');
$("#ctlNext").text('破解后可能无法提交')
setTimeout(function () {
alert("重要信息:破解只是删除遮挡,无法提交,建议搜索答案后用微信提交")
},500)
}
}
// 使用搜索的方式
var div_list = $(".field-label");
var btn_list = [];
// var btn = $('<button type="button" style="height: 1.5rem; width: 2.3rem; margin-left: 1rem;" onclick="alert(102210);">搜索</button>')
for (i=0; i<div_list.length; i++) {
var btn = document.createElement("button"); //创建一个input对象(提示框按钮)
btn.id = "search_btn_"+i;
btn.textContent = "搜索";
btn.style.width = "2.3rem";
btn.style.height = "1.5rem";
btn.style.marginLeft = "1rem";
btn.type = 'button';
//绑定按键点击功能
btn_list.push(btn)
console.log(btn)
btn.onclick = function (e){
console.log('点击了按键', e.srcElement.id);
var btn_num = parseInt(e.srcElement.id.split('_')[2]);
var url = window.location.href;
var search_content = div_list.eq(btn_num).text().replace('搜索', '').replace('复制','').replace('✅','');
console.log(btn_num, search_content)
//iframe 层
/*
layer.msg('hello');
layer.open({
type: 2,
title: '很多时候,我们想最大化看,比如像这个页面。',
shadeClose: true,
shade: false,
maxmin: true, //开启最大化最小化按钮
area: ['100%', '100%'],
content: 'https://www.wjx.cn/',
zIndex: layer.zIndex, //重点1
success: function(layero){
layer.setTop(layero); //重点2
}
});
*/
//window.open('https://www.bing.com/search?q='+search_content)
if (e.srcElement.textContent=="搜索") {
var iframe = document.createElement("iframe");
iframe.id = "search_iframe"+btn_num;
iframe.style.width = "100%";
iframe.style.height = "20rem";
iframe.style.marginTop = "2rem";
iframe.src = 'https://www.bing.com/search?q='+search_content
div_list.eq(btn_num).append(iframe)
e.srcElement.textContent="收起";
} else {
e.srcElement.textContent="搜索";
document.getElementById("search_iframe"+btn_num).remove();
}
};
div_list.eq(i).append(btn)
}
for (var j=0; j<div_list.length; j++) {
var copy_btn = document.createElement("button"); //创建一个input对象(提示框按钮)
copy_btn.id = "copy_btn_"+j;
copy_btn.textContent = "复制";
copy_btn.style.width = "2.3rem";
copy_btn.style.height = "1.5rem";
copy_btn.style.marginLeft = "1rem";
copy_btn.type = 'button';
copy_btn.onclick = function (e){
console.log('点击了按键', e.srcElement.id);
var btn_num = parseInt(e.srcElement.id.split('_')[2]);
var search_content = div_list.eq(btn_num).text().replace('搜索', '').replace('复制','').replace('✅','');
copy_to_clipboard(search_content)
e.srcElement.textContent ="✅";
setTimeout(function(){
e.srcElement.textContent="复制";
},2000)
};
div_list.eq(j).append(copy_btn)
}
function copy_to_clipboard(txt_str){
const input = document.createElement('input');
document.body.appendChild(input);
input.setAttribute('value', txt_str);
input.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
console.log('复制成功');
//Alert(500,'复制成功');
}
document.body.removeChild(input);
}
function deleteAllCookies() {
var cookies = document.cookie.split(";");
console.log(cookies)
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name +"=;";
//document.cookie = null
}
var cookies2 = document.cookie.split(";");
console.log(cookies2)
}
function DelCookie(name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
function foreach() {
var strCookie=document.cookie;
var arrCookie=strCookie.split("; "); // 将多cookie切割为多个名/值对
for(var i=0;i <arrCookie.length;i++)
{ // 遍历cookie数组,处理每个cookie对
var arr=arrCookie[i].split("=");
if(arr.length>0)
DelCookie(arr[0]);
}
}
function GetCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return GetCooki (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function GetCooki(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return decodeURIComponent(document.cookie.substring(offset, endstr));
}
function getAnswer_radio(str_id) {
// 问卷星迷惑行为: 是已选radio标志, 是未选标志,真的它俩不一样,不要尝试修改不然可能出问题。或者说我改成unicode字符是不是会好一点
// 好的我现在转换出来了,已选对应的unicode是\ue6df,未选对应的是\ue6e0,问卷星我真谢谢你
// 然后接着就发现h5里只支持10进制的所以还得转一下,现在h5对应的就是:选中:59103 未选:59104
// html里转译这种字符的方式就是: 
var id = parseInt(str_id);
console.log('开始检查',id)
var ans_list_html = document.querySelector('.query__data-result.new__data-result');
var ans_data_key = ans_list_html.querySelectorAll('.data__key')[id]
if (ans_data_key.querySelectorAll('.ulradiocheck').length !=0){
var ans_span_txt = ans_data_key.querySelector('.judge_ques_right span').innerText;
var ans_radio_list = ans_data_key.querySelectorAll('.ulradiocheck div')
var true_ans_num=-1
var i=0
if (ans_span_txt == '回答正确'){
true_ans_num = -1
for (i=0; i<ans_radio_list.length; i++) {
if (ans_radio_list[i].querySelector('i').innerText=='') {
true_ans_num = i
break
}
}
console.log(true_ans_num)
} else {
var true_ans_txt = ans_data_key.querySelector('.answer-ansys div').innerText
console.log(true_ans_txt)
true_ans_num = -1
for (i=0; i<ans_radio_list.length; i++) {
console.log(ans_radio_list[i].querySelector('span').innerText)
if (ans_radio_list[i].querySelector('span').innerText==true_ans_txt) {
true_ans_num = i
break
}
}
console.log(true_ans_num)
}
return true_ans_num
} else {
console.log('不是radio题目')
return "NOTRADIO"
}
}
function sendUploadRequest(wj_id, content) {
$.post('//'+server_ip+'/upload', {wj_id: wj_id, content: JSON.stringify(content)}, function (result) {
console.log(result)
})
}
function getAllAnswer_radio() {
var ans_list_html = document.querySelector('.query__data-result.new__data-result');
var ans_title_list = ans_list_html.querySelectorAll('.data__tit_cjd')
var send_ls = []
for (var i=0; i<ans_title_list.length; i++) {
var title = ans_title_list[i].innerText;
var id= title.split('题目ID:')[1];
var ans = getAnswer_radio(id);
if (ans != 'NOTRADIO') {
send_ls.push({ques_id: id, answer: ans, kind: 'radio'})
}
}
var wj_id = getQueryString('activityid')
console.log(send_ls)
sendUploadRequest(wj_id, send_ls)
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function writeAnswer_radio() {
var wj_id = window.location.pathname.replace('/vm/', '').replace('.aspx', '')
console.log(wj_id)
var answer_ls;
$.post('//'+server_ip, {wj_id: wj_id}, function (result) {
if (result.length==0) {
return false;
}
console.log(result[0].content)
answer_ls = JSON.parse(result[0].content)
console.log(answer_ls)
var ans_ls_html = document.querySelectorAll('.field.ui-field-contain');
console.log(ans_ls_html)
for (var i=0; i<ans_ls_html.length; i++) {
var radios = ans_ls_html[i].querySelectorAll('.ui-radio')
console.log(radios)
if (radios.length!=0){
for (var j=0; j<answer_ls.length; j++) {
if (answer_ls[j].ques_id==i && answer_ls[j].kind=='radio') {
radios[answer_ls[j].answer].click()
}
}
}
}
})
}
function changeAnsToTrue(str_id) {
var id = parseInt(str_id);
var ans_list_html = document.querySelector('.query__data-result.new__data-result');
console.log(ans_list_html);
var ans_title_list = ans_list_html.querySelectorAll('.data__tit_cjd')
for (var i=0; i<ans_title_list.length; i++) {
var title = ans_title_list[i].innerText
console.log(parseInt(title.split('题目ID:')[1]), id)
if (parseInt(title.split('题目ID:')[1]) == id) {
var num = i
break;
}
}
for (i=0; i<ans_title_list.length; i++) {
try{
ans_list_html.querySelectorAll('.data__items')[i].querySelector('.judge_ques_right font').innerText='';
}catch{}
}
try{
if (ans_list_html.querySelectorAll('.data__items')[num].querySelector('.judge_ques_right span').innerText=='回答错误') {
console.log('修改成绩',num)
ans_list_html.querySelectorAll('.data__items')[num].querySelector('.judge_ques_right').style.color='#01AD56';
ans_list_html.querySelectorAll('.data__items')[num].querySelector('.judge_ques_right img').src = '//image.wjx.cn/images/newimg/score-form/[email protected]';
ans_list_html.querySelectorAll('.data__items')[num].querySelector('.judge_ques_right font').innerText='';
ans_list_html.querySelectorAll('.data__items')[num].querySelector('.answer-ansys').remove()
ans_list_html.querySelectorAll('.data__items')[num].querySelector('.judge_ques_right span').innerText = '回答正确'
}
}catch{}
}
})();