遇到百度云防护和安全狗的解决
编辑时间:2017-03-26 作者:金满斗 浏览量:2310 来源:原创

有什么http访问一些网站,遇到有些网站会有百度云防护或者安全狗,这样返回的就是空值,其实解决的方法也很简单。

上代码片断吧

//安全狗跳转
getanquan = function(htm){
	if(string.indexOf(htm,"self.location")){
    	thread.command.print1("遇到安全狗,跳转")
    	 pattern=//self.location="(.+?)"
   		 var geturl = string.match(htm,pattern);
   		 http.beginRequest(url ++ geturl);
 		var htm,err,errNo = http.send() ;
    	htm = http.readAll();   //读取所有返回
    	htm =htm? string.fromto(htm,0,65001);    //gbk的转码	
 		var header = http.readHeader()  
		http.endRequest(); 
    	return htm; 
    }	
	return  htm; 	
}
 
 
 
//遇到百度云防护跳转
getbaidu = function(htm){
	if(string.indexOf(htm,"window.onload")){
    	thread.command.print1("遇到百度云防护,跳转-》");
    	pattern=/**setTimeout\("(.*?)".+(function .+})**/  	
    	var fun,js = string.match(htm,pattern);
    	pattern=/**eval\("qo=e.*;"\)**/
    	js = string.replace(js,pattern,"return po ");
    	vm.AddCode(js)
    	geturl = vm.Eval(fun) ;
    	var pattern=/**window.location="(.+?)"**/
   		var geturl = string.match(geturl,pattern);
   		 http.beginRequest(url ++ geturl);
 		var htm,err,errNo = http.send() ;
    	htm = http.readAll();   //读取所有返回
    	htm =htm? string.fromto(htm,0,65001);    //gbk的转码	
 		var header = http.readHeader()  
		http.endRequest(); 
		htm =htm? string.fromto(htm,0,65001);    //gbk的转码
    	return htm; 
    }	
	return  htm; 	
}

转码不转码自己判断,有的要写cookie的,再次访问要带cookie。其实都是技术的博弈,安全无绝对。

来说两句吧