[Flask] Exposing bash commands over Rest API with Flask
Shmulik Avramson
shmulikav at checkpoint.com
Sun Dec 3 11:12:24 EST 2017
Hi Flask community,
I'm using Flask to expose exiting (propriety) shell commands over Rest API.
Assuming I have "myCommand arg1 arg2 [arg3]" on my server, I'm exposing new API as below:
URL: https://<IP>/myCommand<https://%3cIP%3e/myCommand>
json:
{
"arg1":"<value>",
"arg2":"<value>",
"arg3":"<value>"
}
As I have many commands, I prepared an XML file to automate part of the process.
The XML contains also validation for arguments and aggregate the API under features.
An example:
<feature name="myFeature">
<commands>
<command url="/myCommand">
<must-args>
<arg key="arg1" type="boolean"/>
<arg key="arg2" type="int"/>
</must-args>
<opt-args>
<arg key="arg3" type="IP"/>
</opt-args>
<bash output="show/ignore"> myCommand {arg1} {arg2} {?arg3:arg3} </bash>
</command>
</commands>
</feature>
Now, with the above infrastructure, every person in my company can easily expose his own bash commands.
What do you think on the idea?
Are there any similar functionalities in Flask I can use instead of developing my own?
Assuming the answer is no, do you think it worth contribution?
Thank in advance :)
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20171203/9da89b8b/attachment.html>
More information about the Flask
mailing list