这是从百度搜集的,并未做实际验证,仅做记录。
v8:
修改 inc/common/template.php //url加密 function encrypt($urljiami, $key2 = '22ad6h5') { $coded = ''; $keylength = strlen($key2); for ($i = 0, $count = strlen($urljiami); $i < $count; $i += $keylength) { $coded .= substr($urljiami, $i, $keylength) ^ $key2; } return str_replace('=', '', base64_encode($coded)); } $urljiami=$urlpath; $pwdjiami = encrypt($urljiami); //加密结束 <?php //简单解密函数 function decrypt($str, $key = '22ad6h5') { $coded = ''; $keylength = strlen($key); $str = base64_decode($str); for ($i = 0, $count = strlen($str); $i < $count; $i += $keylength) { $coded .= substr($str, $i, $keylength) ^ $key; } return $coded; } $str=$_GET["v"]; $jiemi = decrypt($str); echo "解密还原:".$jiemi;
v10:
一:加密部分代码部署
1、打开application/admin/view/system/config.html
找到大概约420行
<select style="width:150px;" name="app[encrypt]"> <option value="0">{:lang('admin/system/config/encrypt_not')}</option> <option value="1" {if condition="$config['app']['encrypt'] eq 1"}selected {/if}>escape</option> <option value="2" {if condition="$config['app']['encrypt'] eq 2"}selected {/if}>base64</option> </select>
在下面添加
<option value="3" {if condition="$config['app']['encrypt'] eq 3"}selected {/if}>ASE编码</option>
2、打开application/common/controller/All.php
找到大概537行
elseif($GLOBALS['config']['app']['encrypt']=='2'){ $player_info['url'] = base64_encode(mac_escape($player_info['url'])); $player_info['url_next'] = base64_encode(mac_escape($player_info['url_next'])); }
在下面添加
elseif($GLOBALS['config']['app']['encrypt']=='3'){ require_once 'jiami.php'; //引用加密文件 $player_info['url'] = jiami($player_info['url']); $player_info['url_next'] = jiami($player_info['url_next']); }
3、保存下列代码为jiami.php保存到目录application/common/controller/里
<?php function jiami($xzv_4 = ”, $xzv_1 = ‘tianciwangluo’) { $xzv_3 = str_split(base64_encode($xzv_4)); $xzv_5 = count($xzv_3); foreach (str_split($xzv_1) as $xzv_2 => $xzv_0) $xzv_2 < $xzv_5 && $xzv_3[$xzv_2] .= $xzv_0; return str_replace(array(‘=’, ‘+’, ‘/’), array( ‘O0O0O’, ‘o000o’, ‘oo00o’ ), join(”, $xzv_3)); } ?>
二:解密代码部署
在你的解析文件里部署以下代码
$url = $_GET[‘url’]; $skey = ‘tianciwangluo’;//密钥 function decrypt($string = ”, $skey = ”) { $strArr = str_split(str_replace(array(‘O0O0O’, ‘o000o’, ‘oo00o’), array(‘=’, ‘+’, ‘/’), $string), 2); $strCount = count($strArr); foreach (str_split($skey) as $key => $value) $key <= $strCount && isset($strArr[$key]) && $strArr[$key][1] === $value && $strArr[$key] = $strArr[$key][0]; return base64_decode(join(”, $strArr)); } $url=decrypt($url,$skey);
解密函数调用方法$url=decrypt($url,$skey);