Decrypt Zend encrypted PHP

Source: Internet
Author: User

Http://www.huanle.net/down/vld.php

Run

# Tar-xzf vld-0.8.0.tgz // unzip
# Music vld-0.8.0 VLD // rename
# Cd-r VLD ../php-4.3.8/EXT // copy the VLD directory to ext under the decompressed directory of PHP
# Cd php-4.3.8
# Rm configure // Delete configure because the following buildconf will generate a new configure
#./Buildconf // if an error occurs, add the corresponding parameter as prompted.
#./Configure -- With-mysql -- with-apxs2 =/usr/www/bin/apxs -- enable-VLD re-check PHP
# Make Compilation
# Make install Installation

The server must first install zendoptimizer
After running Zend, you can view the source code.

Method 2:
As long as you have a Linux host and another program, you can access the source machine.

# Ifdef have_config_h
# Include "config. H"
# Endif

# Include "php. H"
# Include "php_ini.h"
# Include "ext/standard/info. H"
# Include "php_vld.h"
# Include "srm_oparray.h"

Static zend_op_array * (* old_compile_file) (zend_file_handle * file_handle, int type TSRMLS_DC );
Static zend_op_array * vld_compile_file (zend_file_handle *, int TSRMLS_DC );

Static void (* old_execute) (zend_op_array * op_array TSRMLS_DC );
Static void vld_execute (zend_op_array * op_array TSRMLS_DC );

Function_entry vld_functions [] = {
{NULL, NULL, NULL}
};

Zend_module_entry vld_module_entry = {
# If ZEND_MODULE_API_NO> = 20010901
STANDARD_MODULE_HEADER,
# Endif
"Vld ",
Vld_functions,
PHP_MINIT (vld ),
PHP_MSHUTDOWN (vld ),
PHP_RINIT (vld ),
PHP_RSHUTDOWN (vld ),
PHP_MINFO (vld ),
# If ZEND_MODULE_API_NO> = 20010901
"0.8.0 ",
# Endif
STANDARD_MODULE_PROPERTIES
};

# Ifdef COMPILE_DL_VLD
ZEND_GET_MODULE (vld)
# Endif

ZEND_BEGIN_MODULE_GLOBALS (vld)
Int active;
Int skip_prepend;
Int skip_append;
Int execute;
ZEND_END_MODULE_GLOBALS (vld)

ZEND_DECLARE_MODULE_GLOBALS (vld)

# Ifdef ZTS
# Define VLD_G (v) TSRMG (vld_globals_id, zend_vld_globals *, v)
# Else
# Define VLD_G (v) (vld_globals.v)
# Endif

PHP_INI_BEGIN ()
STD_PHP_INI_ENTRY ("vld. active", "0", PHP_INI_SYSTEM, OnUpdateBool, active, zend_vld_globals, vld_globals)
STD_PHP_INI_ENTRY ("vld. skip_prepend", "0", PHP_INI_SYSTEM, OnUpdateBool, skip_prepend, zend_vld_globals, vld_globals)
Std_php_ini_entry ("VLD. skip_append", "0", php_ini_system, onupdatebool, skip_append, zend_vld_globals, vld_globals)
Std_php_ini_entry ("vld.exe cute", "1", php_ini_system, onupdatebool, execute, zend_vld_globals, vld_globals)
Php_ini_end ()

Static void vld_init_globals (zend_vld_globals * vld_globals)
{
Vld_globals-> active = 0;
Vld_globals-> skip_prepend = 0;
Vld_globals-> skip_append = 0;
Vld_globals-> execute = 1;
}

Php_minit_function (VLD)
{
Zend_init_module_globals (VLD, vld_init_globals, null );
Register_ini_entries ();
Old_compile_file = zend_compile_file;
Old_execute = zend_execute;

Return success;
}

Php_mshutdown_function (VLD)
{
UNREGISTER_INI_ENTRIES ();

Zend_compile_file = old_compile_file;
Zend_execute = old_execute;

Return SUCCESS;
}

PHP_RINIT_FUNCTION (vld)
{
If (VLD_G (active )){
Zend_compile_file = vld_compile_file;
If (! VLD_G (execute )){
Zend_execute = vld_execute;
}
}
Return SUCCESS;
}

PHP_RSHUTDOWN_FUNCTION (vld)
{
Zend_compile_file = old_compile_file;
Zend_execute = old_execute;

Return SUCCESS;
}

PHP_MINFO_FUNCTION (vld)
{
Php_info_print_table_start ();
Php_info_print_table_header (2, "vld support", "enabled ");
Php_info_print_table_end ();

}

Static int vld_check_fe (zend_op_array * Fe, zend_bool * have_fe tsrmls_dc)
{
If (Fe-> type = zend_user_function ){
* Have_fe = 1;
}

Return 0;
}

Static int vld_dump_fe (zend_op_array * Fe tsrmls_dc)
{
If (Fe-> type = zend_user_function ){
Fprintf (stderr, "function % s:
", Fe-> function_name );
Vld_dump_oparray (FE );
Fprintf (stderr, "end of function % S.

", Fe-> function_name );
}

Return zend_hash_apply_keep;
}

# Ifdef zend_engine_2
Static int vld_dump_cle (zend_class_entry ** class_entry tsrmls_dc)
# Else
Static int vld_dump_cle (zend_class_entry * class_entry tsrmls_dc)
# Endif
{
Zend_class_entry * CE;
Zend_bool have_fe = 0;

# Ifdef zend_engine_2
Ce = * class_entry;
# Else
Ce = class_entry;
# Endif

If (Ce-> type! = Zend_internal_class ){
Zend_hash_apply_with_argument (& Ce-> function_table, (apply_func_arg_t) vld_check_fe, (void *) & have_fe tsrmls_cc );
If (have_fe ){
Fprintf (stderr, "Class % s:
", Ce-> name );
Zend_hash_apply (& Ce-> function_table, (apply_func_t) vld_dump_fe tsrmls_cc );
Fprintf (stderr, "end of class % S.

", Ce-> name );
} Else {
Fprintf (stderr, "Class % s: [no user functions]
", Ce-> name );
}
}

Return zend_hash_apply_keep;
}

/* {Zend_op_array vld_compile_file (file_handle, type)
* This function provides a hook for compilation */
Static zend_op_array * vld_compile_file (zend_file_handle * file_handle, int type tsrmls_dc)
{
Zend_op_array * op_array;

If (! Vld_g (execute )&&
(Vld_g (skip_prepend) & PG (auto_prepend_file) [0] & PG (auto_prepend_file) = file_handle-> filename)
(Vld_g (skip_append) & PG (auto_append_file) [0] & PG (auto_append_file) = file_handle-> filename )))
{
Zval NOP;
Zval_stringl (& NOP, "Return;", 8, 0 );
Return compile_string (& NOP, "NOP" tsrmls_cc );;
}

Op_array = old_compile_file (file_handle, type tsrmls_cc );

If (op_array ){
Vld_dump_oparray (op_array );
}

Zend_hash_apply (CG (function_table), (apply_func_t) vld_dump_fe tsrmls_cc );
Zend_hash_apply (CG (class_table), (apply_func_t) vld_dump_cle tsrmls_cc );

Return op_array;
}
/*}}}*/

/* {Void vld_execute (zend_op_array * op_array tsrmls_dc)
* This function provides a hook for execution */
Static void vld_execute (zend_op_array * op_array tsrmls_dc)
{
// Nothing to do
}
/*}}}*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.