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.Dismiss alert
A minimalist [Flask](https://github.com/pallets/flask) extension that serves as a RESTful/HTTP wrapper for python's subprocess API.
@@ -18,23 +18,20 @@ A minimalist [Flask](https://github.com/pallets/flask) extension that serves as
18
18
- Execute pre-defined shell commands asynchronously and securely via flask's endpoints with dynamic arguments, file upload, callback function capabilities.
19
19
- Designed for binary to binary/HTTP communication, development, prototyping, remote control and [more](https://flask-shell2http.readthedocs.io/en/stable/Examples.html).
20
20
21
-
22
21
## Use Cases
23
22
24
23
- Set a script that runs on a succesful POST request to an endpoint of your choice. See [Example code](examples/run_script.py).
25
24
- Map a base command to an endpoint and pass dynamic arguments to it. See [Example code](examples/basic.py).
26
25
- Can also process multiple uploaded files in one command. See [Example code](examples/multiple_files.py).
27
26
- This is useful for internal docker-to-docker communications if you have different binaries distributed in micro-containers. See [real-life example](https://github.com/intelowlproject/IntelOwl/blob/master/integrations/static_analyzers/app.py).
28
-
- You can define a callback function/ use signals to listen for process completion. See [Example code](examples/with_callback.py).
29
-
* Maybe want to pass some additional context to the callback function ?
30
-
* Maybe intercept on completion and update the result ? See [Example code](examples/custom_save_fn.py)
27
+
- You can define a callback function/ use signals to listen for process completion. See [Example code](examples/with_callback.py).
28
+
- Maybe want to pass some additional context to the callback function ?
29
+
- Maybe intercept on completion and update the result ? See [Example code](examples/custom_save_fn.py)
31
30
- You can also apply [View Decorators](https://flask.palletsprojects.com/en/1.1.x/patterns/viewdecorators/) to the exposed endpoint. See [Example code](examples/with_decorators.py).
32
-
- 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.
33
31
34
32
> Note: This extension is primarily meant for executing long-running
35
33
> shell commands/scripts (like nmap, code-analysis' tools) in background from an HTTP request and getting the result at a later time.
This was initially made to integrate various command-line tools easily with [Intel Owl](https://github.com/intelowlproject/IntelOwl), which I am working on as part of Google Summer of Code.
Copy file name to clipboardExpand all lines: docs/source/Examples.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,3 +9,4 @@ I have created some example python scripts to demonstrate various use-cases. The
9
9
-[with_signals.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/with_signals.py): Using [Flask Signals](https://flask.palletsprojects.com/en/1.1.x/signals/) as callback function.
10
10
-[with_decorators.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/with_decorators.py): Shows how to apply [View Decorators](https://flask.palletsprojects.com/en/1.1.x/patterns/viewdecorators/) to the exposed endpoint. Useful in case you wish to apply authentication, caching, etc. to the endpoint.
11
11
-[custom_save_fn.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/custom_save_fn.py): There may be cases where the process doesn't print result to standard output but to a file/database. This example shows how to pass additional context to the callback function, intercept the future object after completion and update it's result attribute before it's ready to be consumed.
12
+
-[deletion.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/deletion.py): Example demonstrating how to request cancellation/deletion of an already running job.
Copy file name to clipboardExpand all lines: docs/source/index.rst
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,6 @@ A minimalist Flask_ extension that serves as a RESTful/HTTP wrapper for python's
23
23
- This is useful for internal docker-to-docker communications if you have different binaries distributed in micro-containers.
24
24
- You can define a callback function/ use signals to listen for process completion.
25
25
- You can also apply View Decorators to the exposed endpoint.
26
-
- 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.
27
26
28
27
`Note: This extension is primarily meant for executing long-running
29
28
shell commands/scripts (like nmap, code-analysis' tools) in background from an HTTP request and getting the result at a later time.`
0 commit comments