-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (23 loc) · 685 Bytes
/
app.py
File metadata and controls
28 lines (23 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import Flask, request, render_template
import subprocess
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/process', methods=['POST'])
def process():
input_text = request.form['input']
try:
result = subprocess.run(['python3', '-c', input_text], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.stderr:
output = result.stderr
else:
output = result.stdout
except Exception as e:
output = str(e)
return output
@app.route('/shell', methods=['POST'])
def terminal():
pass
if __name__ == '__main__':
app.run(debug=True)