方维o2o系统域名绑定破解详解

来源:互联网 发布:域名注册怎么弄 编辑:程序博客网 时间:2024/06/13 18:09

方维o2o系统是一款电子商城类的网站系统,提供给需要快速建立电子商城的用户,因为该系统可供用户自主安装,网站通过后台的操作,可塑性比较强,若想对该系统进行二次开发,则必须让每个程序员都可以在本地安装并使用,由于方维开发团队对该系统进行了绑定唯一域名的限制,以限制系统被滥用,重复建站;此时就产生了矛盾,所以以下是个人的一下开发经验,仅供参考,不可用于非法活动,一经转载请说明出处 http://blog.csdn.net/haiqiao_2010 

 

方维o2o系统绑定唯一域名的原理

1.      项目在安装成功后,首次运行,程序会自动生成该文件~public/runtime/~core.php,该文件的主页用途是判断当前域名是否授权

2.      文件~public/runtime/~core.php是根据项目加密文件license(位于项目根目录下,是方维经过加密后的域名许可证文件,该文件会在网站运行时进行判断是否存在,不存在则抛出异常”domain not authorized”即域名未经授权),进行解密并生成的,密钥为文件~system/utils/es_key.php;

3.      文件~public/runtime/~core.php不仅承当着域名是否授权的功能,还有项目运行的基本框架文件的加载及配置的作用,所以单纯的删除文件~public/runtime/~core.php会导致网站无法运行,此时就需要对该文件进行破解,补充网站运行所缺少的项目构架

 

方维o2o系统绑定唯一域名的破解方法

1.      在网站运行前,需要主动创建文件~public/runtime/~core.php避免方维系统程序对该文件自动生成

2.      文件~public/runtime/~core.php的作用是绑定指定域名,并是完善项目构架,保证项目正常运行;

 

文件~public/runtime/~core.php的重新编写

对文件~core.php的重写,代码如下:

<?php /** desc: init_checker()检测当前域名是否授权*return:true or false*/function init_checker($str){If(empty($str)){return false;}$arr = explode("|",base64_decode($str));$arr = unserialize($arr[1]);foreach($arr as $k=>$v){$arr[$k] = base64_decode(base64_decode($v));}$host = $_SERVER['HTTP_HOST'];$host = explode(":",$host);$host = $host[0];$passed = false;if(!in_array($host,$arr))    {    return false;    }return true;} //调用方法,判断当前域名是否授权,若未经授权则抛出异常,结束进程$urldecode=" ";//已经被加密的编码字符串$checker = init_checker($urldecode);if(!$checker)die("domain not authorized");//域名授权通过后,完善项目构架,保证项目正常运行//定义缓存require APP_ROOT_PATH.'system/cache/Cache.php';$cache = CacheService::getInstance();require_once APP_ROOT_PATH."system/cache/CacheFileService.php";$fcache = new CacheFileService();  //专用于保存静态数据的缓存实例$fcache->set_dir(APP_ROOT_PATH."public/runtime/data/");//end 定义缓存//定义DBrequire APP_ROOT_PATH.'system/db/db.php';define('DB_PREFIX', app_conf('DB_PREFIX')); if(!file_exists(APP_ROOT_PATH.'public/runtime/app/db_caches/'))mkdir(APP_ROOT_PATH.'public/runtime/app/db_caches/',0777);$pconnect = false;$db = new mysql_db(app_conf('DB_HOST').":".app_conf('DB_PORT'), app_conf('DB_USER'),app_conf('DB_PWD'),app_conf('DB_NAME'),'utf8',$pconnect);//end 定义DB//定义模板引擎require  APP_ROOT_PATH.'system/template/template.php';if(!file_exists(APP_ROOT_PATH.'public/runtime/app/tpl_caches/'))mkdir(APP_ROOT_PATH.'public/runtime/app/tpl_caches/',0777);if(!file_exists(APP_ROOT_PATH.'public/runtime/app/tpl_compiled/'))mkdir(APP_ROOT_PATH.'public/runtime/app/tpl_compiled/',0777);$tmpl = new AppTemplate;//end 定义模板引擎$_REQUEST = array_merge($_GET,$_POST);filter_request($_REQUEST);$lang = require APP_ROOT_PATH.'/app/Lang/'.app_conf("SHOP_LANG").'/lang.php';?>


       该文件中, 变量$urldecode为已经授权并加密后的域名字符串,对授权的域名进行加密的方法domain_encryption()

/* * desc:domain_encryption()对授权的域名进行加密的方法* param:$arr授权的域名或者ip的数组* return:$str 返回已经加密后的域名字符串*/function domain_encryption($arr=array()){if (count($arr>0)){foreach ($arr as $k=>$v){$domain_array[]=base64_encode(base64_encode($v));}}return base64_encode(base64_encode(serialize($domain_array))."|".serialize($domain_array));}echo domain_encryption(array("imember.cc","localhost","127.0.0.1"));

以上是本人自己总结的经验,希望对大家有所帮助
仅供参考,不可用于非法活动,一经转载请说明出处 http://blog.csdn.net/haiqiao_2010