反拦截器演示
by EpicCoder88123 lines5.8 KB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>反拦截器演示</title>
<style>
html,body{margin:0;height:100%;font-family:system-ui,sans-serif;background:#f5f5f5;color:#333;}
body{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;}
#block-notice{position:fixed;top:20px;left:50%;transform:translateX(-50%);background:#34c759;color:#fff;padding:10px 20px;border-radius:999px;font-weight:600;opacity:0;transition:opacity .3s;z-index:2147483647;font-size:13px;}
#block-notice.show{opacity:1;}
</style>
</head>
<body>
<h1>反拦截器病毒演示</h1>
<p>拦截器应该被废掉,弹窗会出现,绿条不出现。</p>
<div id="block-notice">已阻止</div>
<script>
// ===== 拦截器 v2 简化版(目标)=====
(function(){
var NOTICE='block-notice', t=null;
function notice(m){var e=document.getElementById(NOTICE);if(!e)return;e.textContent=m;e.classList.add('show');clearTimeout(t);t=setTimeout(function(){e.classList.remove('show');},2000);}
var KW=['fake-virus','无害弹窗','绕过演示','overlay'];
function has(txt){if(!txt)return false;var s=String(txt).toLowerCase();return KW.some(function(k){return s.indexOf(k.toLowerCase())>=0;});}
function susp(n){
if(!n||n.nodeType!==1)return false;
if(n.id&&has(n.id))return true;
if(n.className&&typeof n.className==='string'&&has(n.className))return true;
try{if(n.textContent&&has(n.textContent))return true;}catch(e){}
if(n.tagName==='IFRAME'){var sd=n.getAttribute&&n.getAttribute('srcdoc');if(sd&&has(sd))return true;}
if(n.querySelector&&n.querySelector('#fake-virus'))return true;
return false;
}
function scan(root,d){
if(!root||d>8)return null;
if(susp(root))return root;
if(root.children){for(var i=0;i<root.children.length;i++){var h=scan(root.children[i],d+1);if(h)return h;}}
if(root.shadowRoot){var h2=scan(root.shadowRoot,d+1);if(h2)return h2;}
return null;
}
function kill(n,m){if(!n)return;try{if(n.parentNode)n.parentNode.removeChild(n);}catch(e){}notice(m||'已阻止');}
var oa=Node.prototype.appendChild, oi=Node.prototype.insertBefore;
Node.prototype.appendChild=function(n){if(susp(n)){notice('已阻止:检测到可疑弹窗');return n;}return oa.call(this,n);};
Node.prototype.insertBefore=function(n,r){if(susp(n)){notice('已阻止:检测到可疑弹窗');return n;}return oi.call(this,n,r);};
new MutationObserver(function(ms){ms.forEach(function(m){m.addedNodes.forEach(function(n){if(susp(n))kill(n,'已阻止:检测到可疑弹窗');});});}).observe(document.documentElement,{childList:true,subtree:true,attributes:true,attributeFilter:['srcdoc','src','style','class','id']});
setInterval(function(){var h=scan(document.documentElement,0);if(h&&h!==document.documentElement&&h.parentNode)kill(h,'已阻止:检测到可疑弹窗');},400);
})();
</script>
<script>
// ===== 病毒:永久废掉拦截器 =====
(function(){
'use strict';
// 1. 用一个隐藏 iframe 拿干净的原生方法
var cleanFrame = document.createElement('iframe');
cleanFrame.style.display = 'none';
document.body.appendChild(cleanFrame); // 拦截器不会拦这个 iframe
var cleanWin = cleanFrame.contentWindow;
var nativeAppend = cleanWin.Node.prototype.appendChild;
var nativeInsert = cleanWin.Node.prototype.insertBefore;
var nativeRemove = cleanWin.Node.prototype.removeChild;
// 2. 还原父文档的 appendChild / insertBefore,废掉拦截器的插入劫持
Node.prototype.appendChild = nativeAppend;
Node.prototype.insertBefore = nativeInsert;
// 3. 保护节点集合
var protectedNodes = new WeakSet();
// 4. 覆盖 removeChild:受保护的节点删不掉
Node.prototype.removeChild = function(child){
if (protectedNodes.has(child)) {
return child; // 假装删了,实际不动
}
return nativeRemove.call(this, child);
};
// 5. 覆盖 getElementById:让拦截器找不到提示元素
var nativeGetById = document.getElementById.bind(document);
document.getElementById = function(id){
if (id === 'block-notice') return null;
return nativeGetById(id);
};
// 6. 插入弹窗,并加入保护
function launch(){
var overlay = document.createElement('div');
overlay.id = 'fake-virus';
overlay.innerHTML = '<div style="position:fixed;inset:0;background:rgba(0,0,0,.78);display:flex;align-items:center;justify-content:center;z-index:999999;"><div style="background:#101010;color:#fff;padding:26px;border-radius:18px;text-align:center;font-family:system-ui,sans-serif;"><div style="color:#00ff88;font-weight:700;font-size:20px;">⚠ 反拦截器弹窗</div><div style="font-size:56px;font-weight:800;margin:10px 0;">3</div><div style="color:#aaa;font-size:13px;">拦截器已被废掉</div></div></div>';
protectedNodes.add(overlay);
// 用干净原生方法插入
nativeAppend.call(document.body, overlay);
// 倒计时
var countEl = overlay.querySelector('div div:nth-child(2)');
var remain = 3;
var timer = setInterval(function(){
remain--;
if (remain > 0) {
if (countEl) countEl.textContent = remain;
} else {
clearInterval(timer);
// 自己移除自己:先解除保护,再用原生 remove
protectedNodes.delete(overlay);
if (overlay.parentNode) nativeRemove.call(overlay.parentNode, overlay);
}
}, 1000);
}
// 等拦截器初始化完再动手
setTimeout(launch, 800);
// 7. 永久废掉:以后拦截器再想拦任何东西,removeChild 已被覆盖,
// getElementById 也找不到提示元素。它的 MutationObserver 还在跑,
// 但已经无法移除受保护的节点,也无法显示提示。
})();
</script>
</body>
</html>Game Source: 反拦截器演示
Creator: EpicCoder88
Libraries: none
Complexity: moderate (123 lines, 5.8 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: game-epiccoder88-muqks4jb" to link back to the original. Then publish at arcadelab.ai/publish.