各种培训的摸鱼方法

1.常规视频检测

通过监听Video元素的play、pause、timeupdate、ratechange四大事件,实现对视频播放状态的全生命周期监控,核心逻辑包括:播放状态校验、进度跳转拦截、倍速限制。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const video = document.querySelector('video') || document.querySelector('iframe').contentDocument.querySelector('video');

if (video) {
// 1. 强制维持播放状态,拦截暂停事件
video.play().catch(err => {
// 处理浏览器自动播放限制,通过用户交互触发播放
document.addEventListener('click', () => video.play(), { once: true });
});
video.addEventListener('pause', () => {
if (!video.ended) video.play();
});

// 2. 劫持currentTime属性,解除进度跳转拦截
Object.defineProperty(video, 'currentTime', {
set: function(value) {
// 调用原生setter方法,规避平台拦截逻辑
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'currentTime').set.call(this, value);
},
get: function() {
return Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'currentTime').get.call(this);
}
});

// 3. 劫持playbackRate属性,解除倍速限制
Object.defineProperty(video, 'playbackRate', {
set: function(value) {
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'playbackRate').set.call(this, value);
},
get: function() {
// 可返回固定倍速,规避平台倍速校验
return Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'playbackRate').get.call(this);
}
});

// 4. 覆盖timeupdate事件,阻止平台进度校验
const originalAddEventListener = video.addEventListener;
video.addEventListener = function(type, listener, options) {
if (type !== 'timeupdate' && type !== 'ratechange') {
return originalAddEventListener.call(this, type, listener, options);
}
};

console.log('播放节点检测破解完成,支持自由调整进度与倍速,维持持续播放');

2.播放结尾检测

判定课程完成的核心逻辑为“视频播放至结尾”,通过监听Video元素的ended事件,结合进度校验,触发课程完成上报。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const video = document.querySelector('video') || document.querySelector('iframe').contentDocument.querySelector('video');
const token = localStorage.getItem('chaoxing_token') || localStorage.getItem('xuexitong_token');
const courseId = window.courseInfo?.courseId || prompt('请输入课程ID');

if (video && token && courseId) {
// 方案1:模拟自然播放完成(低风控,推荐)
video.currentTime = video.duration - 0.1; // 规避平台末尾进度校验
video.dispatchEvent(new Event('ended'));
console.log('已模拟视频播放至结尾,触发原生完成逻辑');

// 方案2:直接调用完成接口(高效,风控风险较高)
function manualCompleteCourse() {
fetch('/api/course/complete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token
},
body: JSON.stringify({
courseId,
userId: window.userInfo.userId,
progress: 100,
totalDuration: video.duration,
completeTime: new Date().toISOString()
})
}).then(res => res.json()).then(data => {
if (data.code === 200) {
console.log('课程完成上报成功,已标记为完成');
} else {
console.error('上报失败:', data.message);
}
});
}

// 按需执行方案2(注释取消即可启用)
// manualCompleteCourse();
}

3.会话保活检测

通过心跳机制维持用户学习会话有效性,前端按固定间隔向服务器发送心跳请求,上报用户在线状态与学习进度,若服务器连续多个周期未收到心跳,将判定用户离线,终止时长累计并强制退出课程。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function initCustomHeartbeat() {
// 自动获取平台配置参数,无需手动输入
const token = localStorage.getItem('xuexitong_token') || localStorage.getItem('zhihuishu_token');
const courseId = window.courseId || window.courseInfo?.courseId;
const userId = window.userId || window.userInfo?.userId;
const heartbeatUrl = '/api/study/heartbeat'; // 智慧教育平台通用心跳接口地址
const interval = 30000; // 与平台保持一致,降低风控风险

if (!token || !courseId || !userId) {
console.error('获取平台配置失败,请确认已登录');
return;
}

// 自定义心跳发送函数
function sendCustomHeartbeat() {
const video = document.querySelector('video');
const params = {
courseId,
userId,
timestamp: Date.now(),
pageState: 'active',
videoProgress: video?.currentTime || 0
};

fetch(heartbeatUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token
},
body: JSON.stringify(params)
}).then(() => {
console.log(`心跳发送成功,时间:${new Date().toLocaleTimeString()}`);
}).catch(err => {
console.error('心跳发送失败,重试中...', err);
setTimeout(sendCustomHeartbeat, 5000);
});
}

// 启动自定义心跳,覆盖平台原生定时器
window.customHeartbeatTimer = setInterval(sendCustomHeartbeat, interval);
console.log('心跳保活机制启动,持续维持会话有效性');

// 提供手动停止方法,便于调试
window.stopHeartbeat = () => {
clearInterval(window.customHeartbeatTimer);
console.log('心跳保活已停止');
};
}

// 初始化心跳破解
initCustomHeartbeat();

4.行为真实检测

通过检测用户交互行为、页面焦点状态、随机弹窗验证等,区分真人学习与机器挂机,核心目标是提升刷课门槛,确保学习真实性。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function simulateUserInteract() {
// 模拟交互间隔,1分钟一次,避免频繁触发风控
const simulateInterval = 60 * 1000;

window.interactTimer = setInterval(() => {
// 1. 模拟鼠标随机移动,模拟真人操作轨迹
const mouseMoveEvent = new MouseEvent('mousemove', {
clientX: Math.random() * window.innerWidth,
clientY: Math.random() * window.innerHeight,
bubbles: true,
cancelable: true,
passive: true
});
document.dispatchEvent(mouseMoveEvent);

// 2. 30%概率模拟鼠标点击,提升真实性
if (Math.random() > 0.7) {
const clickEvent = new MouseEvent('click', {
clientX: Math.random() * window.innerWidth,
clientY: Math.random() * window.innerHeight,
bubbles: true,
cancelable: true
});
document.dispatchEvent(clickEvent);
}

// 3. 20%概率模拟页面滚动,适配带滚动条的课程页面
if (Math.random() > 0.8) {
window.scrollBy(0, Math.random() > 0.5 ? 10 : -10);
const scrollEvent = new Event('scroll', { bubbles: true, cancelable: true });
document.dispatchEvent(scrollEvent);
}

console.log(`已模拟用户交互,时间:${new Date().toLocaleTimeString()}`);
}, simulateInterval);

// 手动停止模拟方法
window.stopInteract = () => {
clearInterval(window.interactTimer);
console.log('用户交互模拟已停止');
};

console.log('用户交互模拟启动,规避无交互挂机判定');
}

// 启动交互模拟
simulateUserInteract();

5.页面焦点检测

通过监听页面生命周期事件(visibilitychange、blur、focus),检测标签页/窗口状态,一旦页面失焦、标签页切换,立即暂停视频、停止时长累计。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function bypassFocusDetection() {
// 方案1:劫持visibilityState与hidden属性,强制返回可见状态(推荐,兼容性强)
Object.defineProperty(document, 'visibilityState', {
get: () => 'visible',
configurable: false
});

Object.defineProperty(document, 'hidden', {
get: () => false,
configurable: false
});

// 方案2:重写addEventListener,拦截焦点相关事件
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
const blockedEvents = ['visibilitychange', 'blur', 'focus', 'pagehide', 'pageshow'];
if (blockedEvents.includes(type)) {
console.log(`已拦截焦点检测事件:${type}`);
return;
}
return originalAddEventListener.call(this, type, listener, options);
};

// 方案3:兜底处理,切页时强制恢复视频播放
const video = document.querySelector('video');
window.addEventListener('blur', () => {
if (video && !video.ended) video.play();
});

document.addEventListener('visibilitychange', () => {
if (video && !video.ended) video.play();
});

console.log('页面焦点检测破解完成,切页、失焦不影响视频播放');
}

// 执行焦点破解
bypassFocusDetection();

6.随机弹窗验证

在视频播放过程中,随机(3-10分钟)弹出验证弹窗,要求用户在指定时间内完成点击确认或简单答题,未按时完成则暂停视频、清空有效时长。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function autoHandleVerifyModal() {
// 每秒检测一次弹窗,确保不超时
window.verifyTimer = setInterval(() => {
// 适配三大平台的弹窗按钮选择器,可根据实际场景补充
const verifySelectors = [
'#verify-confirm', // 学习通
'.verify-btn', // 智慧树
'#study-verify-btn', // 超星
'button:contains("确认")',
'button:contains("继续学习")'
];

let confirmBtn = null;
// 遍历选择器,找到有效按钮
for (const selector of verifySelectors) {
try {
confirmBtn = document.querySelector(selector);
// 确保按钮可见(排除隐藏的弹窗)
if (confirmBtn && confirmBtn.offsetParent !== null) {
break;
}
} catch (e) {
continue;
}
}

// 自动点击确认按钮
if (confirmBtn) {
confirmBtn.click();
console.log(`已自动完成验证,时间:${new Date().toLocaleTimeString()}`);
}

// 适配简单滑块验证(无轨迹校验场景)
const slider = document.querySelector('.verify-slider');
if (slider && slider.offsetParent !== null) {
// 模拟滑块拖动
const mouseDown = new MouseEvent('mousedown', { bubbles: true, clientX: 0 });
const mouseUp = new MouseEvent('mouseup', { bubbles: true, clientX: 300 });
slider.dispatchEvent(mouseDown);
slider.style.transform = 'translateX(300px)';
slider.dispatchEvent(mouseUp);
console.log('已自动完成滑块验证');
}
}, 1000);

// 手动停止自动验证
window.stopVerify = () => {
clearInterval(window.verifyTimer);
console.log('自动验证已停止');
};

console.log('自动验证机制启动,实时监听并处理弹窗');
}

// 启动自动验证破解
autoHandleVerifyModal();

7.有效时长检测

仅当同时满足“视频播放中、页面活跃、用户活跃、倍速合规”四个条件时,才累计有效时长,有效时长达标后才算完成课程。

查看代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function bypassEffectiveDuration() {
const video = document.querySelector('video');
const token = localStorage.getItem('platform_token');
const courseId = window.courseId;
const userId = window.userId;
const targetDuration = video?.duration || 3600; // 目标达标时长(默认1小时)

// 方案1:覆盖前端有效时长变量,强制达标
Object.defineProperty(window, 'effectiveDuration', {
get: () => targetDuration,
set: () => {}, // 禁止平台修改
configurable: false
});

// 方案2:直接上报达标时长,高效快捷
function reportTargetDuration() {
fetch('/api/study/effectiveDuration', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token
},
body: JSON.stringify({
courseId,
userId,
effectiveDuration: targetDuration,
totalDuration: targetDuration
})
}).then(res => res.json()).then(data => {
if (data.code === 200) {
console.log(`有效时长已上报达标:${targetDuration}秒`);
}
});
}

// 执行方案2(注释取消即可启用)
// reportTargetDuration();

console.log('有效时长累计检测破解完成,已强制达标');
}

// 执行有效时长破解
bypassEffectiveDuration();

8.真实位置检测

仅位置在设定位置范围内才可打卡成功。

安卓虚拟定位软件 下载

如上述软件无效,可访问

IOS用户可用PC安卓模拟器进行位置模拟。