Skip to main content

A minimalist REST API wrapper for python's subprocess API.

Project description

Flask-Shell2HTTP

CodeFactor Language grade: Python flask-shell2http on pypi

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 pre-defined shell commands asynchronously and securely via flask's endpoints with dynamic arguments, file upload, callback function capabilities.
  • 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. See Example code.
  • Map a base command to an endpoint and pass dynamic arguments to it. See Example code.
  • Can also process multiple uploaded files in one command. See Example code.
  • This is useful for internal docker-to-docker communications if you have different binaries distributed in micro-containers. See real-life example.
  • You can define a callback function/ use signals to listen for process completion. See Example code.
    • Maybe want to pass some additional context to the callback function ?
    • Maybe intercept on completion and update the result ? See Example code
  • 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 releases for commands that return immediately.

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.

Documentation / Quick Start

Documentation Status

Read the Quickstart from the documentation to get started!

I highly recommend the Examples section.

Inspiration

This was initially made to integrate various command-line tools easily with Intel Owl, which I am working on as part of Google Summer of Code.

The name was inspired by the awesome folks over at msoap/shell2http.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-Shell2HTTP-1.4.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

Flask_Shell2HTTP-1.4.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file Flask-Shell2HTTP-1.4.3.tar.gz.

File metadata

  • Download URL: Flask-Shell2HTTP-1.4.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Flask-Shell2HTTP-1.4.3.tar.gz
Algorithm Hash digest
SHA256 6f5b6dedf8f69b50a3b159d3d6788de3f9c4d04f3ba606cc8421c48220c9b46a
MD5 263b2e268d7395f4f2daa8f49bcc7d68
BLAKE2b-256 c8beed43d202c355bc8abf8e9858ccf2fdc45c73a83592a7ea521171057317fe

See more details on using hashes here.

File details

Details for the file Flask_Shell2HTTP-1.4.3-py3-none-any.whl.

File metadata

  • Download URL: Flask_Shell2HTTP-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Flask_Shell2HTTP-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec64d74f412da1d29c19728d9e95a5c712cf0f6f4a5e6a8f19c08577ec2f7cd6
MD5 ed4b069caddc9b2833b6811edaa7b879
BLAKE2b-256 c6b64e874c77aa70a6052916fe670f1be27a17b52ea532ccb3f7295d09d971be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page