-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
61 lines (42 loc) · 1.41 KB
/
main.py
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
56
57
58
59
60
61
from flask import Flask, render_template, request
app = Flask(__name__, template_folder='template')
@app.route("/")
def home():
return render_template("home.html")
@app.route("/Encryption")
def encrypt():
return render_template("Encryption.html")
@app.route("/Decryption")
def decrypt():
return render_template("Decryption.html")
@app.route("/Encryption", methods=["POST"])
def getdata_enc():
import os
source_name = request.form["source_name"]
p = int(request.form["prime_1"])
q = int(request.form["prime_2"])
cover_name = request.form["cover_name"]
new_img_name = request.form["new_name"]
import base_enc
base_enc.base_enc(source_name)
import rsa_enc
rsa_enc.call_rsa("s.txt", p, q)
import stego_enc
cover_name = os.path.dirname(os.path.abspath(__file__))+'/static/coverimages/'+cover_name
stego_enc.encode(cover_name, new_img_name)
return render_template("thank.html")
@app.route("/Decryption", methods=["POST"])
def getdata_dec():
cover_name = request.form["cover_name"]
p = int(request.form["prime_1"])
q = int(request.form["prime_2"])
new_cover_name = request.form["new_cover_name"]
import stego_dec
stego_dec.decode(cover_name)
import rsa_dec
rsa_dec.rsa_dec(p, q)
import base_dec
base_dec.base_dec(new_cover_name)
return render_template("thank.html")
if __name__ == "__main__":
app.run(debug=True)