生成百度加密地址baidu/link?url=PHP代码

教程方法 jonh 6个月前 (04-14) 63次浏览 0个评论 扫描二维码

我们知道百度搜索排序中快照的地址并非目标URL,而是一个baidu/link?url=xxx形式的地址,302跳转到目标URL,那么,我们可不可以加密直接给自己的URL生成一个这样的地址呢?

生成百度加密地址baidu/link?url=PHP代码

网上其实有很多研究的文章,给出的答案都是无法获知加密方式是不可能破解的,但是根据研究,可以实现生成一个类似的URL,并能实现跳转到目标页。下面是我从网上抄录的代码

PHP代码一

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<?php
//$ascii码表x,y位置
$ascii = array(
	0=>array(' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/'),
	1=>array('0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?'),
	2=>array('@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O'),
	3=>array('P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_'),
	4=>array('`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o'),
	5=>array('p','q','r','s','t','u','v','w','x','y','z','{','|','}','~',' '),);
//url第N个位置对应的(x,y),目前只得到80位的url
$data  = array(
	array(13,10),
	array(10,1),
	array(16,15),
	array(7,6),
	array(5,13),
	array(18,9),
	array(13,11),
	array(7,12),
	array(10,5),
	array(15,9),
	array(15,9),
	array(13,5),
	array(16,11),
	array(0,1),
	array(8,2),
	array(8,5),
	array(0,0),
	array(17,15),
	array(14,8),
	array(2,1),
	array(10,5),
	array(17,14),
	array(16,5),
	array(3,8),
	array(14,9),
	array(5,8),
	array(15,1),
	array(3,15),
	array(13,10),
	array(10,12),
	array(5,7),
	array(0,2),
	array(18,14),
	array(0,15),
	array(1,6),
	array(13,5),
	array(2,1),
	array(15,14),
	array(18,8),
	array(18,9),
	array(1,10),
	array(14,14),
	array(13,2),
	array(5,3),
	array(5,8),
	array(0,4),
	array(1,5),
	array(16,1),
	array(8,1),
	array(2,5),
	array(10,7),
	array(10,15),
	array(14,14),
	array(17,3),
	array(15,0),
	array(14,5),
	array(7,7),
	array(3,4),
	array(14,8),
	array(12,0),
	array(13,12),
	array(12,3),
	array(6,5),
	array(3,1),
	array(1,14),
	array(5,4),
	array(0,12),
	array(7,0),
	array(10,7),
	array(15,12),
	array(8,2),
	array(18,15),
	array(3,12),
	array(1,12),
	array(0,15),
	array(17,4),
	array(17,2),
	array(11,1),
	array(3,12),
	array(11,5),
	array(0,13),
	array(1,1),
	array(2,12)
);
//所有的y值
$y = array(
0=>
'0123456789abcdef',
'1032547698badcfe',
'23016745ab89efcd',
'32107654ba98fedc',
'45670123cdef89ab',
'54761032dcfe98ba',
'67452301efcdab89',
'76543210fedcba98',
'89abcdef01234567',
'98badcfe10325476',
'ab89efcd23016745',
'ba98fedc32107654',
'cdef89ab45670123',
'dcfe98ba54761032',
'efcdab8967452301',
'fedcba9876543210'
);
//所有的x值
$x = array(
0=>
'016745',
'107654',
'234567',
'321076',
'325476',
'452301',
'543210',
'670123',
'765432',
'761032',
'89abcd',
'89efcd',
'98fedc',
'abcdef',
'badcfe',
'cdab89',
'dcba98',
'ef89ab',
'fe98ba'
);


	//解密过程:

$domain = "www.wakey.fit";
	$len = strlen($domain);
	
	
	for($i=0;$i<$len;$i++){
		$domain_one  = substr($domain,$i,1);//输出el
		
		$arr_x = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
		$arr_y = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
		
		for($ax =0;$ax<sizeof($arr_x);$ax++){
			for($ay =0;$ay<sizeof($arr_y);$ay++){
			//读取每一组密文的x 和 y
			$one = array($arr_x[$ax],$arr_y[$ay]);//str_split($v);
			$encode_x = $one[0];	//f
			$encode_y = $one[1];	//d
			//得到第$k位的data
			$this_data_x = str_split($x[$data[$i][0]]);	// $data[$k]=13,10 [0] = $x[13] 
			$this_data_y = str_split($y[$data[$i][1]]); // $data[$k]=13,10 [1] = $y[10] 

			//得到在ascii码表的x,y
			$real_x = array_search($encode_x,$this_data_x);	//5 

			$real_y = array_search($encode_y,$this_data_y); //7	3
			//结果
			$result = $ascii[$real_x][$real_y];
			
			if($result == $domain_one ){
				$mi .= $arr_x[$ax].$arr_y[$ay];
				$url .= $result;
				echo '密文对应:'.$arr_x[$ax].$arr_y[$ay].'----'.$result."<br>";
				 break 2;
			}

			
			}
		}
	}
	echo '密文对应:http://www.baidu.com/link?url=a3f48d30fc293c5e471ef23de092fddc99'.$mi.'----'.$url."<br>";
?>
</body>
</html>
PHP

此代码与《什么是百度反推秒收录技术,原理怎么实现》文末给出的生成链接原理基本一致

PHP代码二

验证后获得的地址返回的是404,已经失效了,贴出来参考学习
<?php
$time = time().rand(1000,9999);
$data = "{$time}###http://www.wakey.fit";        // 被加密信息  
$key = '4xseo.com';                   // 密钥  
$encrypt = encrypt($data, $key);  
$decrypt = decrypt($encrypt, $key);  
echo $encrypt, "\n", $decrypt; 
 
 
function encrypt($data, $key)  
{  
    $key    =   md5($key);  
    $x      =   0;  
    $len    =   strlen($data);  
    $l      =   strlen($key);  
    for ($i = 0; $i < $len; $i++)  
    {  
        if ($x == $l)   
        {  
            $x = 0;  
        }  
        $char .= $key{$x};  
        $x++;  
    }  
    for ($i = 0; $i < $len; $i++)  
    {  
        $str .= chr(ord($data{$i}) + (ord($char{$i})) % 256);  
    }  
    return base64_encode($str);  
}
 
function decrypt($data, $key)  
{  
    $key = md5($key);  
    $x = 0;  
    $data = base64_decode($data);  
    $len = strlen($data);  
    $l = strlen($key);  
    for ($i = 0; $i < $len; $i++)  
    {  
        if ($x == $l)   
        {  
            $x = 0;  
        }  
        $char .= substr($key, $x, 1);  
        $x++;  
    }  
    for ($i = 0; $i < $len; $i++)  
    {  
        if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1)))  
        {  
            $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));  
        }  
        else  
        {  
            $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));  
        }  
    }  
    return $str;  
} 
PHP

以上代码来源《百度反推算法PHP代码

转载请注明来源及本文地址:https://www.wakey.fit/2022/04/blog-post_13.html


生成百度加密地址baidu/link?url=PHP代码
转载请注明文章来源和地址:https://www.tnell.com/81,html
喜欢 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址