Create a Simple PHP Shell Command Terminal
In this thread I (TechLab) will show you how to make a Super simple php command line shell.
This is similar to my X-Small shell which is under 200 bytes.
All credits go to Me TechLab!!!
To Begin
You need:
!# Basic html knowledge
!# A PHP host (in my case I am using a localhost)
!# And a brain (im my case I am using....)
First, create a php file and call it something such as shell.php.
Open it in a text editor.
Now, start the php with the opening and closing brakets:
In the php brackets we will create a php function and call it exec_cmd and add a if isset function to check to see if we have submitted any command:
Now, in the if statement let us add the actual functions to execute the command.
Your code should look something like this:
The php is almost done! :)
Now for the HTML!
Below the closing php tag (it MUST be out of the <?php ?> tags!) we will add the post form.
To begin, create a simple form and add a php post to self:
Note: the $_SERVER["PHP_SELF"] should only be used on tools like this, and not on pages accessed by other people because of a XSS vuln.
All the html is Done!!!
Your code should look like this:
All we need to add is the last bit of PHP!
Under the closing </form> tag, add this php code to Call the function:
You are finished!
The complete code looks like this:
I hoped you liked it!
Please say thanks if you thought it was useful! :)
And, Do Not leach!
facebook
In this thread I (TechLab) will show you how to make a Super simple php command line shell.
This is similar to my X-Small shell which is under 200 bytes.
All credits go to Me TechLab!!!
To Begin
You need:
!# Basic html knowledge
!# A PHP host (in my case I am using a localhost)
!# And a brain (im my case I am using....)
First, create a php file and call it something such as shell.php.
Open it in a text editor.
Now, start the php with the opening and closing brakets:
PHP Code:
<?php // code will go in here except for the html and calling the php function.?>
In the php brackets we will create a php function and call it exec_cmd and add a if isset function to check to see if we have submitted any command:
Now, in the if statement let us add the actual functions to execute the command.
PHP Code:
$exc = $_POST['command']; echo shell_exec($exc);
Your code should look something like this:
The php is almost done! :)
Now for the HTML!
Below the closing php tag (it MUST be out of the <?php ?> tags!) we will add the post form.
To begin, create a simple form and add a php post to self:
Note: the $_SERVER["PHP_SELF"] should only be used on tools like this, and not on pages accessed by other people because of a XSS vuln.
PHP Code:
<form action='<?php echo $_SERVER["PHP_SELF"]?>' method='post'>
<input type= 'text' name='command' />
<input type='submit' />
</form>
All the html is Done!!!
Your code should look like this:
All we need to add is the last bit of PHP!
Under the closing </form> tag, add this php code to Call the function:
PHP Code:
<?php exec_cmd();?>
You are finished!
The complete code looks like this:
I hoped you liked it!
Please say thanks if you thought it was useful! :)
And, Do Not leach!
No comments:
Post a Comment