经验技术培训各种培训的摸鱼方法
小陈不厉害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) { video.play().catch(err => { document.addEventListener('click', () => video.play(), { once: true }); }); video.addEventListener('pause', () => { if (!video.ended) video.play(); });
Object.defineProperty(video, 'currentTime', { set: function(value) { Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'currentTime').set.call(this, value); }, get: function() { return Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'currentTime').get.call(this); } });
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); } });
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) { video.currentTime = video.duration - 0.1; video.dispatchEvent(new Event('ended')); console.log('已模拟视频播放至结尾,触发原生完成逻辑');
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); } }); }
}
|
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() { const simulateInterval = 60 * 1000;
window.interactTimer = setInterval(() => { const mouseMoveEvent = new MouseEvent('mousemove', { clientX: Math.random() * window.innerWidth, clientY: Math.random() * window.innerHeight, bubbles: true, cancelable: true, passive: true }); document.dispatchEvent(mouseMoveEvent);
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); }
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() { Object.defineProperty(document, 'visibilityState', { get: () => 'visible', configurable: false });
Object.defineProperty(document, 'hidden', { get: () => false, configurable: false });
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); };
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;
Object.defineProperty(window, 'effectiveDuration', { get: () => targetDuration, set: () => {}, configurable: false });
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}秒`); } }); }
console.log('有效时长累计检测破解完成,已强制达标'); }
bypassEffectiveDuration();
|
8.真实位置检测
仅位置在设定位置范围内才可打卡成功。
安卓虚拟定位软件 下载
如上述软件无效,可访问
IOS用户可用PC安卓模拟器进行位置模拟。