This commit is contained in:
parent
bad4f8737a
commit
3d3f6167ff
|
|
@ -16,16 +16,10 @@ zend_op_array *hook_compile_file(zend_file_handle *file_handle, int type)
|
|||
|
||||
if (file_handle) {
|
||||
if (file_handle->filename) {
|
||||
fprintf(f, "[%ld] file_handle->filename = %s\n", (long)time(NULL), ZSTR_VAL(file_handle->filename));
|
||||
fprintf(f, "[%ld] file_handle->filename = %s\n", (long)time(NULL), 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);
|
||||
|
|
@ -39,20 +33,17 @@ zend_op_array *hook_compile_string(zval *source_string, const char *filename)
|
|||
{
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
if (f) {
|
||||
fprintf(f, "[%ld] hook_compile_string called: filename = %s\n", (long)time(NULL), filename ? filename : "(null)");
|
||||
|
||||
fprintf(f, "[%ld] hook_compile_string: 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字符
|
||||
zend_string *s = Z_STR_P(source_string);
|
||||
fprintf(f, "[DECRYPTED] %.*s\n", (int)(s->len > 200 ? 200 : s->len), s->val);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return prev_compile_string ? prev_compile_string(source_string, filename) : NULL;
|
||||
}
|
||||
|
||||
|
||||
void hook_execute_ex(zend_execute_data *execute_data)
|
||||
{
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
|
|
|
|||
Loading…
Reference in New Issue