diff --git a/Caeser-Cipher/caeser-cipher.py b/Web/Caeser-Cipher/Caeser-Cipher.py similarity index 97% rename from Caeser-Cipher/caeser-cipher.py rename to Web/Caeser-Cipher/Caeser-Cipher.py index cec75ba..2147767 100644 --- a/Caeser-Cipher/caeser-cipher.py +++ b/Web/Caeser-Cipher/Caeser-Cipher.py @@ -46,7 +46,7 @@ def encrypt(ciphertext, shiftNum, letters): # Grab parameters letterCount = letterCount + 1 # Keep track of how many times we're doing this. - print("\nYour enciphered text is: " + answer) + return print("\nYour enciphered text is: " + answer) def decrypt(ciphertext, shiftNum, letters): # Grab parameters @@ -77,7 +77,7 @@ def decrypt(ciphertext, shiftNum, letters): # Grab parameters letterCount = letterCount + 1 # Keep track of how many times we're doing this. - print("\nYour decrypted text is: " + answer) + return print("\nYour decrypted text is: " + answer) def freq(ciphertext): diff --git a/Caeser-Cipher/README.md b/Web/Caeser-Cipher/README.md similarity index 100% rename from Caeser-Cipher/README.md rename to Web/Caeser-Cipher/README.md diff --git a/Web/app.py b/Web/app.py new file mode 100644 index 0000000..060bce3 --- /dev/null +++ b/Web/app.py @@ -0,0 +1,20 @@ +#!flask/bin/python +from flask import Flask, request, render_template +import os +import subprocess + +app = Flask(__name__) + +@app.route('/') +def my_form(): + return render_template('my-form.html') + +@app.route('/', methods=['POST']) +def form_post(): + text = request.form['secret'] + command = "python3 Caeser-Cipher/Caeser-Cipher.py encrypt " + str(text) + " 3" + ciphered_text = subprocess.check_output(command, shell=True) + return ciphered_text + +if __name__ == '__main__': + app.run(debug=True) diff --git a/Web/templates/my-form.html b/Web/templates/my-form.html new file mode 100644 index 0000000..e5e15c9 --- /dev/null +++ b/Web/templates/my-form.html @@ -0,0 +1,12 @@ +
+

Enter your message in this box.

+
+ + +
+