wordpress模板网站程序版权保护的代码

  • A+
所属分类:wordpress 网站建设

在很多程序和wordpress模板都会各种加密的设置来版权保护。包括一些免费的商业程序,个人使用,都是要求保留他的网站链接。

无意中,发现了一个JS的保护版权的代码。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="./hsmw.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="home">
<div class="home">
  <div class="copyright">Copyright © 蓝色石头 版权所有<!-- 为了能够正常使用,建议保留该链接 -->
  <a title="数字营销" href="http://www.garygeng.net" id="link" target="_blank">数字营销杂志</a>
  </div>
</div>
</body>
</html>

这个作者写的代码很鸡贼,远程调用,加密以后,隐藏到了 jquery.js文件中。还是被我给提取了出来。把下面JS代码保存成 hsmw.js 文件。

JS判断有很多,比如防止版权链接文字被篡改,URL被替换,被用display隐藏。你自己读代码了。

function innerHTML(el, where, html) {
if (!el) {
return false;
}

where = where.toLowerCase();

if (el.insertAdjacentHTML) {//IE
el.insertAdjacentHTML(where, html);
} else {
var range = el.ownerDocument.createRange(),
frag = null;

switch (where) {
case "beforebegin":
range.setStartBefore(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el);
return el.previousSibling;
case "afterbegin":
if (el.firstChild) {
range.setStartBefore(el.firstChild);
frag = range.createContextualFragment(html);
el.insertBefore(frag, el.firstChild);
} else {
el.innerHTML = html;
}
return el.firstChild;
case "beforeend":
if (el.lastChild) {
range.setStartAfter(el.lastChild);
frag = range.createContextualFragment(html);
el.appendChild(frag);
} else {
el.innerHTML = html;
}
return el.lastChild;
case "afterend":
range.setStartAfter(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el.nextSibling);
return el.nextSibling;
}
}
}

function getStyle(obj,attr){
if(obj.currentStyle){
return obj.currentStyle[attr];
}else{
return getComputedStyle(obj,false)[attr];
};
};

window.onload=function(){
var urcopy = document.getElementById("link");
var urfromurl = window.location.hostname;
if(urcopy) {
if(urcopy.innerHTML.length < 3) {
alert("程序检测到版权链接文字被恶意篡改,已启动保护模式!");
window.open("http://26836659.blogcn.com","_top");
}
else {
insertHTML(urcopy, 'afterEnd', '');
}
}
else {
alert("网页必须元素丢失,请检查网站代码是否被篡改或粘贴了来自其他网站的不安全内容!");
window.open("http://26836659.blogcn.com","_top");
}
if(urcopy.getAttribute("href").substring(0,26) != "http://26836659.blogcn.com") {
alert("请不要修改网站底部版权链接!");
window.open("http://26836659.blogcn.com","_top");
}
if(getStyle(urcopy,"display") === "none") {
alert("程序检测到你隐藏了网站版权信息,已开启保护模式!");
window.open("http://26836659.blogcn.com","_top");
}
if(getStyle(urcopy.parentElement,"display") === "none") {
alert("程序检测到你隐藏了网站版权信息,已开启保护模式!");
window.open("http://26836659.blogcn.com","_top");
}
}
;

 

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: