How To Explore Linux Shell Remotely Using PHP Shell
To Explore Linux Shell Remotely Using PHP Shell
PHP Shell is a script which is written in PHP that provides Linux Terminal in the Browser. It helps to execute most of the shell commands in browser with limitations. Steps to explore Linux Shell remotely using PHP Shell is summarized in this article.
To Download the PHP Shell
Download the PHP Shell from the following link.
http://sourceforge.net/projects/phpshell/?source=dlp
Steps to Install PHP Shell
Before installing the Apache and PHP, update the repositories.
root@linuxhelp:~# apt-get update
Hit http://in.archive.ubuntu.com wily InRelease
Hit http://security.ubuntu.com wily-security InRelease
Hit http://in.archive.ubuntu.com wily-updates InRelease
Hit http://in.archive.ubuntu.com wily-backports InRelease
Hit http://security.ubuntu.com wily-security/main Sources
Hit http://in.archive.ubuntu.com wily/main Sources
.
.
.
Hit http://in.archive.ubuntu.com wily-backports/main Translation-en
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en
Reading package lists... Done
To Install Apache and PHP
For Red Hat System
[root@linuxhelp ~]# yum install httpd php php-mysql
[root@linuxhelp ~]# service httpd start
For Debian System
root@linuxhelp:~# apt-get install apache2 php5 php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libavahi-client-dev libavahi-common-dev libavahi-compat-libdnssd1
libdbus-1-dev libjs-jquery libruby2.1 libyaml-0-2 ruby2.1
.
.
.
apache2_invoke: Enable module php5
Setting up php5 (5.6.11+dfsg-1ubuntu3.3) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
root@linuxhelp:~# service apache2 start
Default working directory for Apache are as follows.
For Debian based distributions: /var/www
For RedHat based distributions: /var/www/html
Important: For security reason, it can be changed to any other folder.
Downloaded PHP Shell archive file should be moved to Apache working directory.
Now download the php shell in your browser.
Now unzip the package from the downloaded location
root@linuxhelp:~# cd Downloads/ root@linuxhelp:~/Downloads# ls phpshell-2.4.zip root@linuxhelp:~/Downloads# unzip phpshell-2.4.zip Archive: phpshell-2.4.zip creating: phpshell-2.4/ inflating: phpshell-2.4/ChangeLog inflating: phpshell-2.4/INSTALL inflating: phpshell-2.4/AUTHORS inflating: phpshell-2.4/phpshell.php inflating: phpshell-2.4/style.css inflating: phpshell-2.4/pwhash.php inflating: phpshell-2.4/COPYING inflating: phpshell-2.4/config.php inflating: phpshell-2.4/phpshell.ico inflating: phpshell-2.4/SECURITY inflating: phpshell-2.4/README root@linuxhelp:~/Downloads# ls phpshell-2.4 phpshell-2.4.zip
Now copy the extracted PHPshell directory into your default document root directory.
root@linuxhelp:~/Downloads# cp -r phpshell-2.4 /var/www/html
root@linuxhelp:~/Downloads# cd /var/www/html
root@linuxhelp:/var/www/html# ls
index.html phpshell-2.4
Now rename the directory as PHPshell.
root@linuxhelp:/var/www/html# mv phpshell-2.4 phpshell
root@linuxhelp:/var/www/html# ls
index.html phpshell
Now rename the phpshell.php as index.php, which is located under phpshell directory.
root@linuxhelp:/var/www/html# cd phpshell/ root@linuxhelp:/var/www/html/phpshell# ls AUTHORS config.php INSTALL phpshell.php README style.css ChangeLog COPYING phpshell.ico pwhash.php SECURITY root@linuxhelp:/var/www/html/phpshell# mv phpshell.php index.php root@linuxhelp:/var/www/html/phpshell# ls AUTHORS config.php index.php phpshell.ico README style.css ChangeLog COPYING INSTALL pwhash.php SECURITY
Now navigate to “ http://127.0.0.1/phpshell“ in the web browser.
To create user
Click the pwhash.php script, to create a user name and password.
In the above php page enter the Username, password and click ' Update' .
Add the sha line into config.php in the [user] section.
Now open the config.php file.
root@linuxhelp:/var/www/html/phpshell# vim config.php
Add the line in username section.
linuxhelp = " sha1:6939c784:c8732ccba93b751775b0db3bc0c829700c8955a4"
According to the username and password, sha1 will be unique.
Save and exit the config.php file.
Visit http://127.0.0.1/phpshell. Login using your ‘ User Name‘ and ‘ Password‘ .
Now you have logged into the php shell, you can able to execute the shell commands in the browser.
Disadvantages of PHP Shell
- Additional input were not support.
- At a certain time, all the webserver is configured to timeout.
- One line command is used in the PHPshell.
Comments ( 0 )
No comments available