用于检测特定文件是否由离子立方编码的模式


Pattern for detecting if a specific file is encoded by ioncube

我想通过脚本识别ioncube编码的PHP文件。我在每个ioncube编码的PHP文件中都看到一些通用字符串:

<?php //003ab
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');@dl($__ln);if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('''','/',substr($__id,2));$__here=str_replace('''','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}@dl($__ln);}else{die('The file '.__FILE__." is corrupted.'n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the site administrator.');exit(199);
?>

我想知道这个字符串是否适用于所有ioncube编码文件,无论ioncube版本或编码操作发生时ioncube运行的平台。

在关闭php标签?>之后,Ioncube文件总是以:0a 03 c1 2b bytes

开始更新:

然后你需要加载ioncube扩展,然后:

" 5.4.1之前混合ioncube_read_file(string path [,bool &was_encrypted [,string passphrase]]])…如果一个文件被成功读取,其内容将作为一个二进制安全字符串返回。"

IONCUBE手册:http://www.ioncube.com/USER-GUIDE.pdf