如何“破解”百度搜索结果中的加密地址

其他杂项来源:ITSEOhttp://www.itseo.net/direction/show-156.html1,3602字数 1049阅读3分29秒阅读模式

seo应该都知道搜索结果中的网站地址在2013年前左右就加密了。

加密后长这个样:https://www.baidu.com/link?url=NsHkjUPGl_mZhzM-TUlu6ZfyO3os9ubGKhDv9XiMklKxONjEtFTVLyrKWiW50gJzRFL2hChm_hkarUGQkmwPS_

自从加密后,获取着陆页的方法也就千奇百怪了。无数人沉醉于破解等方法。还有直接跳转到着陆页后再获取url,效率低效到难以想象。

解决获取着陆页需要明白以下几点:

1,加密是由服务端做的,啥算法,任何人都不知道。尝试破解,成功几率几乎为0

2, 如果跟随加密URL跳转到着陆页再获取,方法是可以的。但是效率最终会受到目标网站网速的影响。必然效率无法提高。

3,你需要了解web通信http协议

那就让我们来抓包看看吧!

我们可以很清楚的看到这条链接是302跳转链接。而302跳转链接在head中都会带一条location的参数。Location的值就是真实url。

原理就是这么简单。

接下来让我们用一句shell来搞定吧。

curl -s "http://7xq5c6.com1.z0.glb.clouddn.com/url.txt" | awk '{print "curl -sI \""$0"\"| grep Location"}' | sh

java代码:

Connection.Response res = Jsoup.connect("https://www.baidu.com/link?url=NsHkjUPGl_mZhzM-TUlu6ZfyO3os9ubGKhDv9XiMklKxONjEtFTVLyrKWiW50gJzRFL2hChm_hkarUGQkmwPS_").timeout(60000).method(Connection.Method.GET).followRedirects(false).execute();
String str= res.header("Location");

python代码:


php代码

<?php

foreach (file('http://7xq5c6.com1.z0.glb.clouddn.com/url.txt') as $url) {
    stream_context_set_default(array('http' => array('method' => 'HEAD')));
    $headers = get_headers(trim($url), 1);
    echo $headers['Location'];
}

 
  • 版权声明 本文源自 ITSEOhttp://www.itseo.net/direction/show-156.htmlasdfasd 整理 发表于 2016-09-2915:16:29
  • 转载请务必保留本文链接:http://wp.fangfa.me/other-note/%e5%a6%82%e4%bd%95%e7%a0%b4%e8%a7%a3%e7%99%be%e5%ba%a6%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c%e4%b8%ad%e7%9a%84%e5%8a%a0%e5%af%86%e5%9c%b0%e5%9d%80.html