Code Monkey home page Code Monkey logo

webshell-cli's Introduction

webshell-cli


webshell-cli is a python script that allows accessing its associated webshells in a commandline fashion. webshell-cli supports changing the current working directory, setting environment variables and allows easy uploads and downloads of files.

webshell-cli.mp4

Installation


webshell-cli is just a python script. After installing the requirements, you should be able to run it:

[qtc@devbox ~]$ git clone https://github.com/qtc-de/webshell-cli
[qtc@devbox ~]$ cd webshell-cli
[qtc@devbox webshell-cli]$ pip3 install --user -r requirements.txt
[qtc@devbox webshell-cli]$ python3 webshell-cli.py 
usage: webshell-cli.py [-h] [-m] [-f FILE_HISTORY] [-s SHELL] url
webshell-cli.py: error: the following arguments are required: url

Supported Webshells


webshell-cli only works with webshells that were specifically build for this project. You can find the supported webshells within the webshells directory. Currently, the following server-side technologies are supported:

Additionally, the webshells directory contains a build script for building .war archives.

Special Commands


webshell-cli supports some special commands that can be invoked by using an exclamation mark as the first character on a command line. Below you can find the list of currently supported special commands:

  • !background <cmd> execute the specified command in the background
  • !download <rfile> [<lfile>] download a remote file from the server
  • !upload <lfile> [<rfile>] upload a local file to the server
  • !get <rfile> [<lfile>] alias for download
  • !put <lfile> [<rfile>] alias for upload
  • !eval <lfile> evaluate a local file on the server (only available for php)
  • !env [<var>=<val>] set an environment variable
  • !help show this help menu

When using the !env command without specifying a variable, it outputs a list containing the currently set variables. When !env clear was specified, all manually added environment variables get deleted.

Custom Shell Command


You can use a custom shell command for each shell by using the --shell option. The default shell commands are /bin/sh -c for Unix and cmd.exe /c for Windows. How about a base64 shell? No problem:

[qtc@devbox ~]$ webshell-cli 172.18.0.2/webshell.php --shell base64
[nobody@efd0355fda4c /var/www/html/public]$ /etc/issue
V2VsY29tZSB0byBBbHBpbmUgTGludXggMy4xNQpLZXJuZWwgXHIgb24gYW4gXG0gKFxsKQoK

Command History


By default, webshell-cli uses the history file ~/.webshell_cli_history to provide you a command line history for your latest commands. You can use the -f option to specify a different location for storing the history file or use the -m option to use an in-memory command history instead.

Final Remarks


Contributions to this project are always welcome. The docs folder contains a specification that lists the requirements for webshells to be consumable by webshell-cli. Furthermore, the documentation lists some design decisions, as certain things were not that straight forward to implement.

This project is meant to be used only for CTF challenges and educational purposes. As plenty of webshells are available on the internet and the shells from this repository do not even implement obfuscation or encryption, they won't be useful for real world attacks anyway.

webshell-cli's People

Contributors

qtc-de avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.