├── README.md ├── srm_oparray_patch.c ├── LICENSE └── vld_patch.c /README.md: -------------------------------------------------------------------------------- 1 | # php vld扩展显示sg11组建解密后的opcodes的补丁 2 | 3 | 1.将vld_patch.c 和srm_oparray_patch.c 拷贝到vld扩展源码根目录下 4 | 5 | 2.执行 6 | 7 | patch -p0 < vld_patch.c 8 | 9 | patch -p0 < srm_oparray_patch.c 10 | 11 | 3.参照正常的编译vld扩展进行编译安装即可 12 | 13 | 4.需将php.ini vld扩展参数vld.execute设置为0时才有效 14 | -------------------------------------------------------------------------------- /srm_oparray_patch.c: -------------------------------------------------------------------------------- 1 | --- srm_oparray.c 2020-09-20 16:36:58.281375025 +0800 2 | +++ srm_oparray_modify.c 2020-09-20 16:36:25.000000000 +0800 3 | @@ -635,9 +635,9 @@ void vld_dump_op(int nr, zend_op * op_pt 4 | unsigned int flags, op1_type, op2_type, res_type; 5 | const zend_op op = op_ptr[nr]; 6 | 7 | - if (op.lineno == 0) { 8 | - return; 9 | - } 10 | +// if (op.lineno == 0) { 11 | +// return; 12 | +// } 13 | 14 | if (op.opcode >= NUM_KNOWN_OPCODES) { 15 | flags = ALL_USED; 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 clouds-flight 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vld_patch.c: -------------------------------------------------------------------------------- 1 | --- vld.c 2020-01-14 01:12:09.000000000 +0800 2 | +++ vld_modify.c 2020-09-20 12:56:52.982420619 +0800 3 | @@ -299,20 +299,6 @@ static zend_op_array *vld_compile_file(z 4 | 5 | op_array = old_compile_file (file_handle, type TSRMLS_CC); 6 | 7 | - if (VLD_G(path_dump_file)) { 8 | - fprintf(VLD_G(path_dump_file), "subgraph cluster_file_%p { label=\"file %s\";\n", op_array, op_array->filename ? ZSTRING_VALUE(op_array->filename) : "__main"); 9 | - } 10 | - if (op_array) { 11 | - vld_dump_oparray (op_array TSRMLS_CC); 12 | - } 13 | - 14 | - zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) VLD_WRAP_PHP7(vld_dump_fe), 0); 15 | - zend_hash_apply (CG(class_table), (apply_func_t) VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC); 16 | - 17 | - if (VLD_G(path_dump_file)) { 18 | - fprintf(VLD_G(path_dump_file), "}\n"); 19 | - } 20 | - 21 | return op_array; 22 | } 23 | /* }}} */ 24 | @@ -325,21 +311,42 @@ static zend_op_array *vld_compile_string 25 | 26 | op_array = old_compile_string (source_string, filename TSRMLS_CC); 27 | 28 | - if (op_array) { 29 | - vld_dump_oparray (op_array TSRMLS_CC); 30 | - 31 | - zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) vld_dump_fe_wrapper, 0); 32 | - zend_hash_apply (CG(class_table), (apply_func_t) vld_dump_cle_wrapper TSRMLS_CC); 33 | - } 34 | - 35 | return op_array; 36 | } 37 | /* }}} */ 38 | - 39 | +int execute_time=0; 40 | /* {{{ 41 | * This function provides a hook for execution */ 42 | static void vld_execute_ex(zend_execute_data *execute_data TSRMLS_DC) 43 | { 44 | - // nothing to do 45 | + 46 | + if (execute_time == 1) 47 | + { 48 | + zend_op_array *op_array; 49 | + 50 | + op_array=&execute_data->func->op_array; 51 | + 52 | + if (VLD_G(path_dump_file)) 53 | + { 54 | + fprintf(VLD_G(path_dump_file), "subgraph cluster_file_%p { label=\"file %s\";\n", op_array, op_array->filename ? ZSTRING_VALUE(op_array->filename) : "__main"); 55 | + } 56 | + if (op_array) 57 | + { 58 | + vld_dump_oparray(op_array TSRMLS_CC); 59 | + } 60 | + 61 | + zend_hash_apply_with_arguments(CG(function_table) TSRMLS_CC, (apply_func_args_t)VLD_WRAP_PHP7(vld_dump_fe), 0); 62 | + zend_hash_apply(CG(class_table), (apply_func_t)VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC); 63 | + 64 | + if (VLD_G(path_dump_file)) 65 | + { 66 | + fprintf(VLD_G(path_dump_file), "}\n"); 67 | + } 68 | + 69 | + return; 70 | + } 71 | + 72 | + execute_time = 1; 73 | + old_execute_ex(execute_data); 74 | } 75 | /* }}} */ 76 | 77 | --------------------------------------------------------------------------------