Что такое php shell

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A PHP/HTML5 «shell» that enables you to run commands, with partial interactive support.

EJTH/php-shell

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

readme.md

Screenshot of phpshell

PHPShell is foremost a pet project I make in late evenings. It is also a wannabe shell for your browser based on PHP, it is compact and comes in a single file (So you could use it for PoC pentesting etc. but seriously, there is better stuff out there)

While PHP-shell technically isnt an interactive shell it does have somewhat interactive support

PHP-shell has a very simple addon system. Take a look at the example addons in the addons/ folder. You basicly just register PHP callables (eg. functions) with the function registerCommand() and voila they are listed in the help command and are usable through the shell interface.

Well thats unfortunate, maybe take a look at the phpshell-config.php . If interactive doesnt work try changing mode with xsetmode shell_exec . If everything else fails, then please do feel free to create an issue regarding your problem.

About

A PHP/HTML5 «shell» that enables you to run commands, with partial interactive support.

Источник

PHP Shell

PHP Shell is a shell wrapped in a PHP script. It’s a tool you can use to execute arbitrary shell-commands or browse the filesystem on your remote webserver. This replaces, to a degree, a normal telnet connection, and to a lesser degree a SSH connection.

You use it for administration and maintenance of your website, which is often much easier to do if you can work directly on the server. For example, you could use PHP Shell to unpack and move big files around. All the normal command line programs like ps, free, du, df, etc. can be used.

Читайте также:  Python module file format

Getting Help

Please use the SourceForge facilities to obtain help on PHP Shell. You can submit bug reports, join the mailing lists.

Inherent Limitations

There are some limitations on what kind of programs you can run. It won’t do no good if you start a graphical program like Firefox or even a console based one like vi. All programs have to be strictly command line programs, and they will have no chance of getting user input after they have been launched.

They probably also have to terminate within 30 seconds, as this is the default time-limit imposed unto all PHP scripts, to prevent them from running in an infinite loop. Your ISP may have set this time-limit to something else.

But you can rely on all the normal shell-functionality, like pipes, output and input redirection, etc. (There is no -completion, though 🙂

Disabled functions

Some functions may be disabled for security reasons in php.ini (for example functions which execute system commands). If that is the case, PHP Shell will not work (it uses for example proc_open()).
In older versions of PHP Safe Mode was used for that.

Installation

PHP Shell is easy to install — download it, unpack it and configure a username/password. This is done in config.php . Please read the included INSTALL file for detailed information.

How to Use PHP Shell

When you point your browser at PHP Shell you will be asked to authenticate yourself. By default no username/password will work, so please go read INSTALL for information about adding a user.

You are back? Good. Enter your username and password and click on «Login».

You will then be presented with a rather simple page containing nothing much except a big window with the cursor blinking at the bottom, signaling that it’s ready to obey your commands.

Write a command and press RETURN — or alternatively, press the «Execute Command» button if you really want. The command will be executed and the result will be shows in the terminal. You can now enter another command.

To be more precise: the terminal is updated with the command line you have just executed, the output of the command to standard out (stdout), and following that any error output sent to stderr.

The commands are executed relative to a current working directory, which is written at the top. You change this by the normal cd command or use the links or select a subdirectory and click on «change to subdirectory».

Download

The latest version of PHP Shell is 2.6 from July 26, 2020. Download it as

You can use 7-zip to extract tar.gz -files on Windows. The tarball contains these files:

  • phpshell.php : This is the script you run when you use PHP Shell.
  • config.php : Configuration file in the INI format.
  • pwhash.php : Password hashing script. This is used to generate secure hashed passwords which you should use to prevent others from getting to know your password by reading the config.php file.
  • ChangeLog : This file describe the changes we have made to PHP Shell. By reading it you ‘ll always know when I’ve added a new feature or made a bugfix, and the nature of the feature/bugfix.
  • README : Approximately this page.
  • AUTHORS : Who contributed to PHP Shell?
  • INSTALL : Tells you how to install PHP Shell. Amoung other things, it explains how to change the password protection so that you can use PHP Shell. Remember that it’s very important to have PHP Shell password protected, or else everybody will be able so snoop into your files and perhaps also be able to delete them! Please take the time to protect your installation of PHP Shell.
  • SECURITY : A separate guide about security with PHP in general and PHP Shell in particular. Be sure to read this too, especially if you are getting strange errors back from PHP Shell.
  • COPYING : Standard GNU GPL.
  • .htaccess : Ensures, that phpshell.php will be used as index page.
Читайте также:  Arithmetic operator in php

PHP Shell is kindly hosted by SourceForge:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

php extension aimed to create infrastructure for lightweight php console scripts.

License

ovr/php-shell

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Shell php module — framework for shell scripts.

Dependency Status Latest Stable Version Total Downloads

Shell is a php extension aimed to ease creation command-line php scripts by providing most usable functionalities.

For Developing:

echo "extension=shell.so" > /etc/php5/conf.d/shell.ini 
  1. clone wapmorgan@php-shell-sources git clone https://github.com/wapmorgan/php-shell-sources.git
  2. phpize phpize
  3. configure ./configure
  4. make make
  5. install make install
  6. enable php5enmod shell

To make a shell script, you need:

  1. Create Shell instance (\Shell\Shell).
  2. Register handler (php function, class method or closure). Possible handler — any valid callback, that receives Shell instance as the 1st argument and array containing script arguments as the 2nd argument.
  3. Register script options. Possible options types:
    Option class cmdline example phpcode example
    FlagOption —version, —help new FlagOption(‘h:help’, ‘showHelp’)
    MultiValueOption file1 file2 file3 new MultiValueOption(null, ‘files’)
    StringOption —outputFile=/tmp/log new StringOption(‘o:outputFile’, ‘outputFile’)
    SwitchOption —mode=streams new SwitchOption(‘m:mode’, ‘mode’, array(‘colors’, ‘curl’, ‘streams))
  4. Write handler. You can extend AbstractScript or AbstractDaemon:
    • \Shell\AbstractScript:
      • run( shell, array arguments = [])
      • registerStreams(array streams, io)
    • \Shell\AbstractDaemon
      • daemonize()
      • isDaemonRunning(string pidFile)
 use \Shell\Shell; $shell = new Shell; $shell->registerHandler(/* handler callback here */); $shell->registerOptions(array( // . script options here )); $shell->process();

Handler can be any valid callback, for example:

$shell->registerHandler(function (Shell $shell, array $arguments) < ... >);

More complex examples of usage are collected here.

  1. AbstractDaemon
  2. AbstractOption
  3. AbstractScript
  4. Curl
  5. CurlSettingsContainer
  6. DependencyException
  7. FlagOption
  8. Formatter
  9. InputOutput
  10. MultiValueOption
  11. NotImplementedException
  12. Shell
  13. ShellException
  14. StringOption
  15. Subprocess
  16. SwitchOption

\Shell\Workers: Introduction to workers in docs/book/workers.

Why should I use the Shell ?

Because it’s faster, safer and well-documented.

  1. Shell is beeing compiled against C+ compiler, so it’s fast.
  2. Shell is beeing checked by Zephir parser and C++ parser, so it’s safe.
  3. Projects written in Zephir ain’t supported by PhpDoc, so we try to make useful and simple documentation.

Sergei Vanyushin (also known as wapmorgan)

About

php extension aimed to create infrastructure for lightweight php console scripts.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A simple, intutive, feature rich, php web shell for pen testing.

eb3095/php-shell

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A simple, intuitive, feature rich, php web shell for pen testing.

To download use one of the following (or similar)

curl https://github.com/eb3095/php-shell/raw/master/php-shell.php > /var/www/html/php-shell.php
wget https://github.com/eb3095/php-shell/raw/master/php-shell.php -O /var/www/html

From there just visit the website with /php-shell.php at the end and enjoy your web based shell from the host!

  • Arrow Up: History up
  • Arrow Down: History down
  • Enter: Run command
  • Click Anywhere: Focus command prompt

History is not saved across sessions and is stored locally in the browser for the time being.

  • exit: Log out
  • cd: Change directory
  • cls: Clear the screen
  • rshell: «rshell IP PORT» open a remote shell to the specified address
  • upload: Shows a file prompt then uploads the file to the current directory
  • download: Download a file either relative path or full. «download FILE»

cd is unique here. If you do the following,

This will be executed as a SH/BASH command. The cd will not set the current working directory outside of the exec. However,

This will be executed as an internal command setting the PHP cwd and it is permanent (until refresh).

The username and password are both hashed via sha512 and set in the file directly.

Screenshot2

Screenshot

About

A simple, intutive, feature rich, php web shell for pen testing.

Источник

Оцените статью