wh8766
1/1/2014 - 3:28 PM

某猫的导游年审,抓取页面连接和参数,伪造错误答案,获取正确答案后构建新的URL进行遍历回答。

某猫的导游年审,抓取页面连接和参数,伪造错误答案,获取正确答案后构建新的URL进行遍历回答。

(function(){
	var s = document.createElement("script");
	s.src = "http://libs.baidu.com/jquery/1.9.0/jquery.js";
	s.setAttribute("type","text/javascript");
	// s.onload = hackReview;
	if (/MSIE/g.test(window.navigator.userAgent)){
		s.onreadystatechange = function() {
			if(this.readyState == "loaded" || this.readyState == "complete"){
				hackReview();
			}
		}
	}else{
		s.onload = function(){
			hackReview();
		};
	}
	document.documentElement.appendChild(s);
})

(function(doc){
	var UID = "";
	var TRY_NUM = 2;
	//预处理里面讨厌的函数
	showclock = function(){};

	//自动审核主入口
	var hackReview = function(){
		// Util.init();
		Hack.init();
		Hack.start();
	};

	var Hack = (function(){
		var _links = [];
		var _hash = [];

		var _reg_cenid = /setTimeout\("getTimu\(([0-9]*),([0-9]*)\)\", 80000/
		var _reg = /resid=([0-9]*)&year/
		var _reg_icon = /g.png/

		var init = function(){
			$("#form1 a", window.frames['list'].window.frames['listkc'].document).each(function(){
				var isRead = _reg_icon.test($(this).find("img").attr("src"));
				if (!isRead){
					_links.push(this.href);
				} else {
					console.log(_reg.exec(this.href)[1]+"已经完成")
				}
			});
			Util.initProcess(_links.length);
		}

		var start = function(){
			//初始化 获取所有的连接并获取课程id和问题id
			for (var i = 0; i < _links.length; i++) {
			// for (var i = 0; i < 10; i++) {
				var o = _links[i]
				var sid = _reg.exec(o)[1];
				(function(_sid){
					_hash[_sid] = 0
					$.get(o, function(html){
						var cenid = _reg_cenid.exec(html)[1];
						_request(_sid, cenid, 1, 1);
						var index = html.lastIndexOf("setTimeout(\"getTimu(");
						console.log(_sid +":"+cenid);
						_hash[_sid] = cenid;
					}, "html")
				})(sid)
			};
		}

		var _url = "http://dy.hnrtu.com/suitangdaan.ashx?uid=40600";
		var _request = function(sid, cenid, ans, tryNum){
			if (tryNum > TRY_NUM){return}
			$.get(_url, {
				srcid : sid,
				CEID : cenid,
				ans : ans || 1
			}, function(re){
				console.log(sid+":"+cenid+":"+re);
				if (re != -1){
					_request(sid, cenid, re, tryNum+1);
				}
			})
		}

		return {
			init : init,
			start : start
		}

	})();

	var Util = (function(){
		var _msg, _count, _current;

		var init = function(){
			_msg = $("#msg", doc);
			_msg.append("<span id='hackProcess'></span><button id='hackStart'>开始啦</button>");
		}

		var updateProcess = function(now){
			// console.log("")
		}

		var initProcess = function(count){
			_count = count;
		}

		return {
			init : init,
			updateProcess : updateProcess,
			initProcess : initProcess
		}
	})();

	//加载jQuery啦啦啦
	if (!$){
		var s = doc.createElement("script");
		s.src = "http://libs.baidu.com/jquery/1.9.0/jquery.js";
		s.setAttribute("type","text/javascript");
		// s.onload = hackReview;
		if (/MSIE/g.test(window.navigator.userAgent)){
			s.onreadystatechange = function() {
				if(this.readyState == "loaded" || this.readyState == "complete"){
					hackReview();
				}
			}
		}else{
			s.onload = function(){
				hackReview();
			};
		}
		doc.documentElement.appendChild(s);
	}else{
		hackReview();
	}

})(document)