This commit is contained in:
parent
db32006e60
commit
bad4f8737a
|
|
@ -13,21 +13,46 @@ zend_op_array *hook_compile_file(zend_file_handle *file_handle, int type)
|
||||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "[%ld] hook_compile_file called\n", (long)time(NULL));
|
fprintf(f, "[%ld] hook_compile_file called\n", (long)time(NULL));
|
||||||
|
|
||||||
|
if (file_handle) {
|
||||||
|
if (file_handle->filename) {
|
||||||
|
fprintf(f, "[%ld] file_handle->filename = %s\n", (long)time(NULL), ZSTR_VAL(file_handle->filename));
|
||||||
|
} else {
|
||||||
|
fprintf(f, "[%ld] file_handle->filename = (null)\n", (long)time(NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "[%ld] file_handle->type = %d\n", (long)time(NULL), file_handle->type);
|
||||||
|
|
||||||
|
if (file_handle->type == ZEND_HANDLE_MAPPED) {
|
||||||
|
fprintf(f, "[%ld] This is a memory-mapped file (可能是swoole_loader加载的)\n", (long)time(NULL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prev_compile_file ? prev_compile_file(file_handle, type) : NULL;
|
return prev_compile_file ? prev_compile_file(file_handle, type) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
zend_op_array *hook_compile_string(zval *source_string, const char *filename)
|
zend_op_array *hook_compile_string(zval *source_string, const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "[%ld] hook_compile_string called\n", (long)time(NULL));
|
fprintf(f, "[%ld] hook_compile_string called: filename = %s\n", (long)time(NULL), filename ? filename : "(null)");
|
||||||
|
|
||||||
|
if (Z_TYPE_P(source_string) == IS_STRING) {
|
||||||
|
zend_string *code = Z_STR_P(source_string);
|
||||||
|
fprintf(f, "[DECRYPTED] code snippet: %.200s\n", ZSTR_VAL(code)); // 截取前200字符
|
||||||
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prev_compile_string ? prev_compile_string(source_string, filename) : NULL;
|
return prev_compile_string ? prev_compile_string(source_string, filename) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hook_execute_ex(zend_execute_data *execute_data)
|
void hook_execute_ex(zend_execute_data *execute_data)
|
||||||
{
|
{
|
||||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue