Welcome to Flask-Shell2HTTP!¶
A minimalist Flask extension that serves as a RESTful/HTTP wrapper for python’s subprocess API.
Convert any command-line tool into a REST API service.
Execute shell commands asynchronously and safely via flask’s endpoints.
Designed for binary to binary/HTTP communication, development, prototyping, remote control and more.
Use Cases:
Set a script that runs on a succesful POST request to an endpoint of your choice.
Map a base command to an endpoint and pass dynamic arguments to it.
Can also process multiple uploaded files in one command.
This is useful for internal docker-to-docker communications if you have different binaries distributed in micro-containers.
You can define a callback function/ use signals to listen for process completion.
You can also apply View Decorators to the exposed endpoint.
Currently, all commands run asynchronously (default timeout is 3600 seconds), so result is not available directly. An option _may_ be provided for this in future release.
Note: This extension is primarily meant for executing long-running shell commands/scripts (like nmap, code-analysis’ tools) in background from an HTTP request and getting the result at a later time.
Quickstart¶
Get started at Quick Start. There are also more detailed Examples that shows different use-cases for this package.
API Reference¶
If you are looking for information on a specific function, class or method, this part of the documentation is for you.