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
Copy file name to clipboardExpand all lines: README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,23 @@
6
6
</a>
7
7
[](https://pypi.org/project/Flask-Shell2HTTP/)
8
8
9
-
A minimalist [Flask](https://github.com/pallets/flask) extension that serves as a REST API wrapper for python's subprocess API.
9
+
A minimalist [Flask](https://github.com/pallets/flask) extension that serves as a RESTful/HTTP wrapper for python's subprocess API.
10
10
11
11
-**Convert any command-line tool into a REST API service.**
12
-
- Execute pre-defined shell commands asynchronously and securely via flask's endpoints.
12
+
- Execute pre-defined shell commands asynchronously and securely via flask's endpoints with dynamic arguments, file upload, callback function capabilities.
13
13
- Designed for binary to binary/HTTP communication, development, prototyping, remote control and [more](https://flask-shell2http.readthedocs.io/en/stable/Examples.html).
14
14
15
-
Inspired by the work of awesome folks over at [msoap/shell2http](https://github.com/msoap/shell2http).
16
15
17
16
## Use Cases
18
17
19
18
- Set a script that runs on a succesful POST request to an endpoint of your choice. See [Example code](examples/run_script.py).
20
19
- Map a base command to an endpoint and pass dynamic arguments to it. See [Example code](examples/basic.py).
21
20
- Can also process multiple uploaded files in one command. See [Example code](examples/multiple_files.py).
22
21
- 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/develop/integrations/peframe/app.py).
23
-
- You can define a callback function/ use signals to listen for process completion. See [Example code](examples/with_callback.py). Meybe want to intercept on completion and update the result ? See [Example code](examples/custom_save_fn.py)
24
-
- 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.
22
+
- You can define a callback function/ use signals to listen for process completion. See [Example code](examples/with_callback.py).
23
+
- Maybe want to pass some additional context to the callback function ?
24
+
- Maybe intercept on completion and update the result ? See [Example code](examples/custom_save_fn.py)
25
+
- 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.
25
26
26
27
> Note: This extension is primarily meant for executing long-running
27
28
> shell commands/scripts (like nmap, code-analysis' tools) in background from an HTTP request and getting the result at a later time.
@@ -35,7 +36,8 @@ from the [documentation](https://flask-shell2http.readthedocs.io/) to get starte
35
36
36
37
I highly recommend the [Examples](https://flask-shell2http.readthedocs.io/en/stable/Examples.html) section.
37
38
38
-
## Why?
39
+
## Inspiration
39
40
40
41
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.
41
42
43
+
The name was inspired by the awesome folks over at [msoap/shell2http](https://github.com/msoap/shell2http).
Copy file name to clipboardExpand all lines: docs/source/Examples.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,4 +7,4 @@ I have created some example python scripts to demonstrate various use-cases. The
7
7
-[multiple_files.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/multiple_files.py): Upload multiple files for a single command.
8
8
-[with_callback.py](https://github.com/Eshaan7/Flask-Shell2HTTP/blob/master/examples/with_callback.py): Define a callback function that executes on command/process completion.
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
-
-[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 intercept the future object after completion and update it's result attribute.
10
+
-[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.
- Set a script that runs on a succesful POST request to an endpoint of your choice.
21
19
- Map a base command to an endpoint and pass dynamic arguments to it.
22
20
- Can also process multiple uploaded files in one command.
23
-
- Currently, all commands are run asynchronously, so result is not available directly. An option would be provided for this in future release.
21
+
- This is useful for internal docker-to-docker communications if you have different binaries distributed in micro-containers.
22
+
- You can define a callback function/ use signals to listen for process completion.
23
+
- 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.
24
24
25
25
`Note: This extension is primarily meant for executing long-running
26
26
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