Current Path :
/
opt
/
node_api
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//opt/node_api/node_api.py.copy
#!/usr/bin/python import os import re import json from flask import request, url_for, abort from flask_api import FlaskAPI, status, exceptions app = FlaskAPI(__name__) @app.before_request def limit_remote_addr(): if request.remote_addr not in ( '77.222.144.118', '194.28.84.9', '91.223.223.89', '176.241.143.3', '79.143.42.245', '185.67.1.84', '91.223.223.7', '178.74.235.62'): abort(403) # Forbidden @app.route("/info/backup", methods=['GET']) def backup(): stream = os.popen("mount | grep /backup | awk {'print$1'}") output = stream.readlines() if output: stream = os.popen('df -h | grep ' + output[0].rstrip() + ' | awk {\'print$5\'}') output = stream.readlines() return output[0].rstrip().replace('%', '') @app.route("/info/backup_local", methods=['GET']) def backup_local(): return os.popen("/opt/node_api/backup.hook_shared.v2").read() if __name__ == "__main__": app.run(debug=True,host='0.0.0.0')