-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflaskapp.py
More file actions
23 lines (18 loc) · 1.08 KB
/
Copy pathflaskapp.py
File metadata and controls
23 lines (18 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask, request, render_template
import subprocess, time
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("root.html")
@app.route("/echo", methods=['POST'])
def echo():
createuser=subprocess.Popen('aws iam create-user --user-name ' + str(request.form['text']), shell=True)
time.sleep(4)
wait=subprocess.Popen('aws iam user-exists --user-name ' +str(request.form['text']), shell=True)
addgroup=subprocess.Popen('aws iam add-user-to-group --user-name ' + str(request.form['text']) + ' --group-name workshopGrp', shell=True)
createpass=subprocess.Popen('aws iam create-login-profile --user-name ' + str(request.form['text']) + ' --password hackpsu', shell=True)
return render_template("confirmationpage.html", username=str(request.form['text']))
#return "User " + str(request.form['text']) + ' has been created. Your password is: hackpsu <br> Log into the AWS environment at <a href="https://hackpsu.signin.aws.amazon.com/console"> https://hackpsu.signin.aws.amazon.com/console </a>'
#add arns to iam policies
if __name__ == "__main__":
app.run(debug=True)