Skip to content

Commit 336bd9c

Browse files
committed
ff
1 parent 0c05f00 commit 336bd9c

8 files changed

Lines changed: 118 additions & 0 deletions

File tree

web/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn app:app

web/app.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from flask import Flask, render_template, redirect, request, jsonify
2+
from piencrypt import pie
3+
import random
4+
from data import*
5+
6+
app = Flask(__name__)
7+
8+
Texts = ['Hi', 'Solo', 'Sid', 'Test', 'Lily', 'Python', 'Throttlerz', 'Password', 'Good Morning', 'Good Evening']
9+
10+
def infile_quality_test():
11+
for i in range(10):
12+
data = []
13+
for i in range(5000):
14+
r = random.choice(Texts)
15+
data.append(r)
16+
17+
input = ", ".join(data)
18+
try:
19+
r = pie.PiEncrypt('pic.png')
20+
r.get_data()
21+
r.hide_data(input)
22+
output = r.read_data()
23+
r.revert()
24+
# print(output, end=r" %FINISHED% ")
25+
except Exception as e:
26+
raise ValueError(e)
27+
28+
def infile_quantity_test():
29+
for i in range(1000):
30+
data = []
31+
for i in range(5):
32+
r = random.choice(Texts)
33+
data.append(r)
34+
35+
input = ", ".join(data)
36+
try:
37+
r = pie.PiEncrypt('pic.png')
38+
r.get_data()
39+
r.hide_data(input)
40+
output = r.read_data()
41+
r.revert()
42+
# print(output, end=r" %FINISHED% ")
43+
except Exception as e:
44+
raise ValueError(e)
45+
46+
47+
@app.route('/')
48+
def index():
49+
return render_template('index.html')
50+
51+
@app.route('/test/<name>')
52+
def test(name):
53+
if name == "sid86":
54+
try:
55+
infile_quality_test()
56+
infile_quantity_test()
57+
return jsonify(PiEncrypt=hash) # Returns HTTP Response for testing
58+
except:
59+
return "Test Failed"
60+
else:
61+
return "Test not allowed"
62+
63+
if __name__ == "__main__":
64+
app.run(debug=True, port=4000)

web/binary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HEREPython, Lily, Python, Good Evening, Good EveningHERESolo, Solo, Good Evening, Solo, SidHEREPassword, Solo, Lily, Solo, Good EveningHERESid, Good Evening, Good Evening, Lily, SoloHEREHi, Test, Good Morning, Good Morning, LilyHERETest, Python, Good Morning, Python, PasswordHERESolo, Test, Good Evening, Lily, TestHEREPassword, Lily, Lily, Python, LilyHEREHi, Solo, Password, Test, Good EveningHERELily, Python, Solo, Lily, Good MorningHERELily, Good Morning, Password, Python, Good EveningHEREThrottlerz, Sid, Solo, Solo, HiHEREGood Evening, Throttlerz, Hi, Sid, SidHERELily, Hi, Python, Sid, HiHEREGood Evening, Test, Good Morning, Test, LilyHEREGood Morning, Test, Solo, Throttlerz, Good MorningHEREPassword, Sid, Solo, Good Evening, SidHEREGood Evening, Test, Test, Lily, SoloHEREPython, Lily, Sid, Sid, SoloHEREHi, Lily, Sid, Test, Good MorningHERETest, Throttlerz, Lily, Sid, LilyHERESid, Good Morning, Sid, Good Morning, ThrottlerzHERESid, Test, Good Morning, Password, PasswordHERESid, Hi, Throttlerz, Python, Solo

web/pic.png

Lines changed: 1 addition & 0 deletions
Loading

web/requirements.txt

414 Bytes
Binary file not shown.

web/static/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.container {
2+
margin-top: 100px;
3+
display: flex;
4+
justify-content: center;
5+
}

web/templates/download.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Binary - Converter</title>
9+
<link rel="stylesheet" href="/static/style.css">
10+
</head>
11+
12+
<body>
13+
<div class="container">
14+
<a href="/binary.txt">
15+
<button>Download</button>
16+
</a>
17+
<br><br>
18+
<a href="/">
19+
<button>back to Home</button>
20+
</a>
21+
</div>
22+
</body>
23+
24+
</html>

web/templates/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Piencrypt</title>
9+
<link rel="stylesheet" href="/static/style.css">
10+
</head>
11+
12+
<body>
13+
<div class="container">
14+
<h1>This is binary Converter</h1>
15+
<form action="/process" method="POST">
16+
<button type="submit">Process</button>
17+
</form>
18+
</div>
19+
20+
</body>
21+
22+
</html>

0 commit comments

Comments
 (0)