09月22日, 2014 5927次
https://github.com/clouds-flight/php7-vld-sg11-patch
php vld扩展显示sg11组建解密后的opcodes的补丁
1.将vld_patch.c 和srm_oparray_patch.c 拷贝到vld扩展源码根目录下
2.执行
patch -p0 < vld_patch.c
patch -p0 < srm_oparray_patch.c
3.参照正常的编译vld扩展进行编译安装即可
4.需将php.ini vld扩展参数vld.execute设置为0时才有效
--- srm_oparray.c 2020-09-20 16:36:58.281375025 +0800
+++ srm_oparray_modify.c 2020-09-20 16:36:25.000000000 +0800
@@ -635,9 +635,9 @@ void vld_dump_op(int nr, zend_op * op_pt
unsigned int flags, op1_type, op2_type, res_type;
const zend_op op = op_ptr[nr];
- if (op.lineno == 0) {
- return;
- }
+// if (op.lineno == 0) {
+// return;
+// }
if (op.opcode >= NUM_KNOWN_OPCODES) {
flags = ALL_USED;--- vld.c 2020-01-14 01:12:09.000000000 +0800
+++ vld_modify.c 2020-09-20 12:56:52.982420619 +0800
@@ -299,20 +299,6 @@ static zend_op_array *vld_compile_file(z
op_array = old_compile_file (file_handle, type TSRMLS_CC);
- if (VLD_G(path_dump_file)) {
- 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");
- }
- if (op_array) {
- vld_dump_oparray (op_array TSRMLS_CC);
- }
-
- zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) VLD_WRAP_PHP7(vld_dump_fe), 0);
- zend_hash_apply (CG(class_table), (apply_func_t) VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC);
-
- if (VLD_G(path_dump_file)) {
- fprintf(VLD_G(path_dump_file), "}\n");
- }
-
return op_array;
}
/* }}} */
@@ -325,21 +311,42 @@ static zend_op_array *vld_compile_string
op_array = old_compile_string (source_string, filename TSRMLS_CC);
- if (op_array) {
- vld_dump_oparray (op_array TSRMLS_CC);
-
- zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) vld_dump_fe_wrapper, 0);
- zend_hash_apply (CG(class_table), (apply_func_t) vld_dump_cle_wrapper TSRMLS_CC);
- }
-
return op_array;
}
/* }}} */
-
+int execute_time=0;
/* {{{
* This function provides a hook for execution */
static void vld_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
{
- // nothing to do
+
+ if (execute_time == 1)
+ {
+ zend_op_array *op_array;
+
+ op_array=&execute_data->func->op_array;
+
+ if (VLD_G(path_dump_file))
+ {
+ 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");
+ }
+ if (op_array)
+ {
+ vld_dump_oparray(op_array TSRMLS_CC);
+ }
+
+ zend_hash_apply_with_arguments(CG(function_table) TSRMLS_CC, (apply_func_args_t)VLD_WRAP_PHP7(vld_dump_fe), 0);
+ zend_hash_apply(CG(class_table), (apply_func_t)VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC);
+
+ if (VLD_G(path_dump_file))
+ {
+ fprintf(VLD_G(path_dump_file), "}\n");
+ }
+
+ return;
+ }
+
+ execute_time = 1;
+ old_execute_ex(execute_data);
}
/* }}} */
暂无留言,赶快评论吧