0
votes

is there a way to make a php file execute the php filesystem functions? or just send a ssh command via the php file ? this is what I have so far very basic :

$cmd = $_GET['cmd'];
if (isset($cmd)){

    echo $cmd;
    return $cmd;

    }

the idea is I can do localhost/file.php?cmd=mkdir('meow');

and it create a folder called meow. if I do localhost/file.php?cmd=rmdir('meow') it removes it. if i do chown, unlink etc etc... you get the concept.I started writing each one alone.But I am wondering if there is a way to make it work this way.any input is greatly appreciated.

1
So basically you want to make a directory?Sankalp Mishra
PHP has lots of built-in filesystem functions. See php.net/manual/en/book.filesystem.phpBarmar
Is eval() the function you're looking for?Barmar

1 Answers

2
votes

OMG! Are you sure you want to do something like this? Imagine someone calling:

localhost/file.php?cmd=rm -rf /;

It's really dangerous and I strongly suggest you to avoid this practice.