Giter Club home page Giter Club logo

jsshell's Introduction

JSShell

An interactive multi-user web based JS shell written in Python with Flask (for server side) and of course Javascript and HTML (client side). It was initially created to debug remote esoteric browsers during tests and research. I'm aware of other purposes this tool might serve, use it at your own responsibility and risk.

Author

Daniel Abeles.

Installation

It is recommended to use a virtual environment (I used python 3.6, but eariler work just fine):

Pyenv

pyenv virtualenv -p python3.6 venv
pyenv activate venv

virtualenv

virtualenv -p python3.6 venv
source venv/bin/activate

For both

pip install -r requirements.txt

Features

  • Multi client support
  • Cyclic DOM objects support
  • Pre flight scripts
  • Command queue
  • Command Context

Running

Create the database

python db_handler.py create

Start the server (at the background):

python run.py

Navigate with a browser to the server address

If you running localy, then navigate to http://localhost:5000 (port and host can of course be changed)

Open the interactive shell

python shell.py

Optional : Pre flight scripts

Those are scripts that will execute on every registration of a new client. Use them wisely :)

Profit :)

Usage

The shell interface contains various commands (can be revealed using the help command).

  ╦╔═╗╔═╗┬ ┬┌─┐┬  ┬
  ║╚═╗╚═╗├─┤├┤ │  │
 ╚╝╚═╝╚═╝┴ ┴└─┘┴─┘┴─┘
  By @Daniel_Abeles

>> help
+-------------+---------------------------------------------------------------+
| command     | description                                                   |
+-------------+---------------------------------------------------------------+
| list        | Lists all the clients registered                              |
| help        | self.help()                                                   |
| select <id> | Selected a specific client from the list                      |
| <command>   | Executes a command to the current selected client             |
| back        | Detaches from the current client                              |
| exit        | Exists this interactive shell                                 |
| coms        | Displays the commands and output for the current client       |
| com <id>    | Displays a specific command and output for the current client |
| comk        | Kills a command ("*" for all)                                 |
| clik        | Kills a client ("*" for all)                                  |
+-------------+---------------------------------------------------------------+                               

Utilizing the command queue, you can fire mutliple commands and the client will execute them one by one. All the commands are executed using a single context, so all of the commands are aware of each other (same scope).

To view the commands issued to a client, first select a client:

>> select 1

Then, issue the coms command to view all the commands for the client:

(Client 1) >> coms

To view the full command and it's full output (on the coms command the output is truncated to fit the screen):

(Client 1) >> com 1

Workflow

After all the installations and configuration is done, the workflow of the application is the following:

  1. Client visits the home page http://localhost:5000/ (or the host you chose)

  2. The client makes an asynchronous register request to the server

  3. Then he waits for commands

  4. In the meanwhile, on the server, you execute commands using the shell.py script

  5. The client probes the server for commands, when he sees a new one appeared, he pulls it and executes it

  6. Once he's done executing, he will post back the result to the server

  7. Now, using the coms command, you can see the output for that command

Database Handling

I have included a script that I've been using during tests, which is the db_handler.py file. It includes varius function to handle and test your database.

Credits

Canop for JSON.prune

jsshell's People

Contributors

den1al avatar

Watchers

James Cloos 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.