以CQ市为例
在登陆页,任意输入一个帐号密码,然后在控制台看到登陆接口为
forum.png (41.02 KB, 下载次数: 0)
下载附件
2023-2-14 12:49 上传
[Asm] 纯文本查看 复制代码usercenter/api/v3/wx/login?checkShowQrCode=true&tmp=false
数据并未加密,那么无感登陆就简单了
[Asm] 纯文本查看 复制代码$.ajax({
url: "https://appapi.xueanquan.com/usercenter/api/v3/wx/login?checkShowQrCode=true&tmp=false",
type: "POST",
contentType: "application/json",
dataType: "json",
xhrFields: {
withCredentials: true
},
timeout: 10 * 1000,
data: JSON.stringify({ username: _o.user, password: _o.pwd, "loginOrigin": 1 }),
success: function (_data) {
console.log(_data);
}}
第二步,进入学习任务页
同上,得到,任务完成情况接口为:
[Asm] 纯文本查看 复制代码safeapph5/api/v1/homework/homeworklist
无感开启任务页
[Asm] 纯文本查看 复制代码//学习任务
var openTabs = {};
function studyList(_isTest) {
console.log("获取学习任务列表");
$.ajax({
url: "https://yyapi.xueanquan.com/chongqing/safeapph5/api/v1/homework/homeworklist",
type: "GET",
contentType: "application/json",
dataType: "json",
xhrFields: {
withCredentials: true
},
timeout: 10 * 1000,
success: function (_data) {
var _t = _data.length;
var _num = 0;
if (_t > 0) {
while (_t--) {
if (_data[_t].workStatus == "UnFinish") {
console.log(_data[_t].title, ":", _data[_t].url);
var _gid = getValueByUrl(_data[_t].url, "gid");
var _li = getValueByUrl(_data[_t].url, "li");
//常规授课课程
if (_gid && _li) {
//看视频(方案失败)
//killVideo(_data[_t].title, _gid, _li);
//把手机版地址转换为电脑版地址
var _videoUrl = _data[_t].url.replace("platform/student/skilltrain.html", "jt/student/SeeVideo.html");
if (!openTabs[_videoUrl]) {
openTabs[_videoUrl] = true;
window.sendMessage({ type: "createTab", data: { url: _videoUrl, selected: false } });
} else {
//完成答题
console.log("答题");
killStudy(_data[_t].title, _li);
}
} else {
//专项课程(参数sid在列表数据中没有)
//window.open(_data[_t].url);
sutdentSign(818);
}
_num++;
}
}
} else {
_num = -1;
console.log("本期还没有开启需要完成的任务。");
}
if (_num == 0) {
if (_isTest) {
console.log("任务完成有效,验证通过。");
} else {
console.log("当前没有需要完成的任务。");
}
setTimeout(lockUser, 600, getUrlParam("uid"));
} else {
_num > 0 && console.log("尝试完成了" + _num + "个任务。");
setTimeout(studyList, 1000, true);
//window.sendMessage({ type: "reloadTime", data: { time: _num + 0.5 } });
}
}
})
}
视频只要打开就视为完成,关键的是答题,通过分析得到。答案其实就在接口返回的sjon数据中,在提交时作答的情况并未返回到后面判断 。
而给后台的数据是:
[Asm] 纯文本查看 复制代码_answer = {
"workId": _data.workId,
"fid": _data.fid,
"title": _title,
"require": "",
"purpose": "",
"contents": "",
"testanswer": "0|0|0",
"testinfo": "已掌握技能",
"testMark": 100,
"testResult": 1,
"siteName": "",
"siteAddrees": "",
"watchTime": "2022-04-08T02:45:24.323Z",
"courseID": _cid
}
以上数据 中的 "0|0|0", 表示做的全对。那么直接无感提交:
[Asm] 纯文本查看 复制代码function killStudy(_title, _cid) {
//获得题目的ID
$.ajax({
url: "https://yyapi.xueanquan.com/chongqing/api/v1/StudentHomeWork/GetSkillTestPaper?courseId=" + _cid,
type: "GET",
contentType: "application/json",
dataType: "json",
xhrFields: {
withCredentials: true
},
timeout: 10 * 1000,
asycn: false,
success: function (_data) {
console.log(_data);
_data = _data.result;
_answer = {
"workId": _data.workId,
"fid": _data.fid,
"title": _title,
"require": "",
"purpose": "",
"contents": "",
"testanswer": "0|0|0",
"testinfo": "已掌握技能",
"testMark": 100,
"testResult": 1,
"siteName": "",
"siteAddrees": "",
"watchTime": "2022-04-08T02:45:24.323Z",
"courseID": _cid
}
sendAnswer(_answer);
}
})
}
function sendAnswer(_data) {
//提交答题数据,完成答题
$.ajax({
url: " https://yyapi.xueanquan.com/chon ... meWork/HomeWorkSign",
type: "POST",
contentType: "application/json",
dataType: "json",
data: JSON.stringify(_data),
xhrFields: {
withCredentials: true
},
timeout: 10 * 1000,
success: function (_data) {
console.log(_data);
}
})
}
一个任务就算完成了。
专项任务也直接上
[Asm] 纯文本查看 复制代码//专项活动视频签到(很重要)
function sutdentSign(_sid, _exit) {
var _sid = _sid || $("body").attr("data-specialId") || 808;
$.ajax({
url: "https://huodongapi.xueanquan.com/p/chongqing/Topic/topic/platformapi/api/v1/records/sign",
type: "POST",
contentType: "application/json",
dataType: "json",
xhrFields: {
withCredentials: true
},
data: JSON.stringify({ "specialId": _sid, "step": 1 }),
timeout: 10 * 1000,
success: function (_data) {
console.log(_data);
if (_exit) {
//lockUser(getUrlParam("uid"));
}
}
})
}
到此,登陆 看视频 做练习 专项作业就串起来了。 因为数据没有加密,所以完全没有压力。