-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
55 lines (42 loc) · 1.24 KB
/
Copy pathserver.py
File metadata and controls
55 lines (42 loc) · 1.24 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import sys
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'flask'])
from flask import Flask, redirect, render_template, request
from typing import List
import assets.utils as utils
app = Flask(__name__)
@app.route('/')
def index():
try:
import file
open(r'file.py', 'r').read()
except:
return render_template('failure.html')
return render_template('index.html')
@app.route('/input')
def student():
return render_template('input.html')
@app.route('/result', methods=['POST', 'GET'])
def result() -> List[str]:
if request.method == 'POST':
config = utils.configs(request.form)
if not os.path.exists('downloads'):
os.makedirs('downloads')
try:
with open("downloads/config.py", 'w', encoding="utf-8") as f:
f.write(config)
except:
print("No Data Provided!")
return redirect('/my-link/')
@app.route('/my-link/')
def my_link():
try:
import linkedin
open(r'linkedin.py', 'r').read()
except Exception as e:
print(e)
return render_template('failure.html')
return render_template('success.html')
if __name__ == '__main__':
app.run(debug=False)