定位使用 Zend Guard 编码的 PHP 文件

Posted

技术标签:

【中文标题】定位使用 Zend Guard 编码的 PHP 文件【英文标题】:Locating PHP Files Encoded with Zend Guard 【发布时间】:2013-06-16 07:41:56 【问题描述】:

有没有办法在源代码树中找到使用Zend Guard 编码的 php 文件?

有 existing questions 关于尝试解码 Zend 编码文件,但我继承了一个大型 PHP 应用程序,该应用程序必须在某个远程库的某处使用 Zend 编码文件,因为我不断收到以下输出在我的应用程序的错误日志中:

//Copyright UserScape, Inc. 2005-2008

<html><body>
<a href="http://www.zend.com/products/zend_guard">
<img border="0" src="http://www.zend.com/images/store/safeguard_optimizer_img.gif" align="right">
</a>
<center><h1>Zend Optimizer not installed</h1></center>
<p>This file was encoded by the
<a href="http://www.zend.com/products/zend_guard">Zend Guard</a>. 
In order to run it, please install the 
<a href="http://www.zend.com/products/zend_optimizer">Zend Optimizer</a> 
(available without charge), version 3.0.0 or later. </p>
<h2>Seeing this message instead of the website you expected?</h2>
This means that this webserver is not configured correctly. 
In order to view this website properly, please contact the 
website's system administrator/webmaster with the following 
message:<br><br>
<tt>The component "Zend Optimizer" is not installed on the
Web Server and therefore cannot service encoded files. 
Please download and install the Zend Optimizer (available 
without charge) on the Web Server.</tt><br><br>
<b>Note</b>: Zend Technologies cannot resolve issues related
to this message appearing on websites not belonging to 
<a href="http://www.zend.com">Zend Technologies</a>. 
<h2>What is the Zend Optimizer?</h2>
<p>The Zend Optimizer is one of the most popular PHP plugins 
for performance-improvement, and has been available without 
charge, since the early days of PHP 4. It improves performance 
by scanning PHP's intermediate code and passing it through 
multiple Optimization Passes to replace inefficient code 
patterns with more efficient code blocks. The replaced code 
blocks perform exactly the same operations as the original 
code, only faster. </p>
<p>In addition to improving performance, the Zend Optimizer 
also enables PHP to transparently load files encoded by the 
Zend Guard. </p>
<p>The Zend Optimizer is a free product available for download 
from <a href="http://www.zend.com">Zend Technologies</a>. 
Zend Technologies also developed the PHP scripting engine, 
known as the <a href="http://www.zend.com/products/zend_engine">Zend Engine</a>.</p>
</body></html>

知道此文件在应用程序中的位置!我一直无法找到有关 Zend Guard 编码的文件特征的任何信息,所以我不知道要在文件系统中搜索什么。 Google 一直没有帮助。简单的greps 用于“userscape”“helpspot”(显然是 UserScape 的产品),甚至“zend”都是空白。

编辑:但是,根据the FAQ Zend Guard 使用public key crypto,所以我相当确定这些文件无论如何都不会包含任何可识别的 PHP 代码。


是否有一种通用方法可以在文件系统中定位 Zend Guard 编码的 PHP 文件?是否有可搜索的文件的共同属性?

【问题讨论】:

在不知道它是如何混淆文件的情况下,我不能确定,但​​我建议寻找 evalpreg_replace /ebase64_decode 之类的东西 好主意,不幸的是 eval 只返回大量 SimpleTest 和 javascript 命中。 你和其他人有什么收获吗?您还可以执行grep -r eval * | grep php 之类的操作来递归查找包含eval 的文件,然后将结果grep 用于php - 这可能有助于跳过javascript。 没什么大不了的。我对 Zend Optimizer 的(有限)理解是,您必须安装 PHP 扩展才能处理这些文件,所以我怀疑在源代码级别有什么可检测的。换句话说,我希望该文件在纯文本编辑器中完全是乱码。我很确定我需要的是帮助识别这些文件的一些共同特征。我的意思是,优化器必须有识别它们的方法。 根据the FAQ,Zend Guard 使用public key crypto,所以我更加确定文件中不会有任何可识别的 PHP 代码。 【参考方案1】:

我相信大多数 Zend Optimizer 编码的文件都会以类似以下的标题开头:

<?php @Zend;

它们还将包含您在错误消息中看到的所有文本,包括“Zend Optimizer”字样。所以你可以直接搜索。 :)

【讨论】:

问题已经表明在项目范围内搜索“zend”不会返回任何结果。搜索“@Zend”同样不会返回任何结果。您能否指出任何 Zend 编码文件的公开示例来证实您的断言? @beporter:Here's one example。 (source) 是的,这确实看起来很像我看到的日志的输出。无奈之下,我在服务器的整个文件系统上运行了 grep,并在一个完全不同的 Apache vhost 文件夹中找到了“helpspot”文件!这解决了这个问题,但是这些文件如何将条目添加到我的应用程序日志中的奥秘仍然存在(当然,这是一个完全不同的问题)。谢谢!

以上是关于定位使用 Zend Guard 编码的 PHP 文件的主要内容,如果未能解决你的问题,请参考以下文章

让 Zend Guard Loader (php 5.3) 执行受 zendnc52.exe 保护的脚本的任何方法

使用 Zend Studio 解码 Zend Guard 编码文件

如何在 Xampp 上安装 Zend Guard Loader

PHP:使用Zend对源码加密Zend Guard安装以及Zend Guard Run-time support missing的解决方法

如何在 wamp 中添加 Zend Guard 运行时

使用 Zend Guard 编码的 Laravel 在浏览器中显示刀片视图文本