Compare commits
No commits in common. "70a5ec32cc4c02e896880061122d015d1d295d91" and "92cccd1799fbe337bb2743cab155e26ab79b4363" have entirely different histories.
70a5ec32cc
...
92cccd1799
6 changed files with 23 additions and 28 deletions
|
@ -2,4 +2,4 @@ FROM python:alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "client.py"]
|
|
@ -1,3 +1,2 @@
|
||||||
flask==3.1.0
|
flask==3.1.0
|
||||||
pyopenssl==25.0.0
|
pyopenssl==25.0.0
|
||||||
requests==2.26.0
|
|
20
RSA/server/__init__.py
Normal file
20
RSA/server/__init__.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import ssl
|
||||||
|
from flask import *
|
||||||
|
import flask_wtf as wtf
|
||||||
|
|
||||||
|
print(ssl.OPENSSL_VERSION)
|
||||||
|
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||||
|
context.load_cert_chain(certfile='ssl/CA.crt', keyfile='ssl/CA.key')
|
||||||
|
|
||||||
|
app= Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return render_template("index.html")
|
||||||
|
|
||||||
|
@app.route('/data', methods=['POST'])
|
||||||
|
def receiv():
|
||||||
|
encrypted_data = request.form['data']
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(ssl_context=context)
|
|
@ -3,6 +3,5 @@ WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "__init__.py"]
|
|
@ -1,23 +0,0 @@
|
||||||
import ssl
|
|
||||||
from flask import Flask, render_template, request
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
app.config['SECRET_KEY'] = 'your_secret_key_here' # Required for Flask-WTF
|
|
||||||
|
|
||||||
# SSL Configuration
|
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
|
||||||
context.load_cert_chain(certfile='ssl/CA.crt', keyfile='ssl/CA.key')
|
|
||||||
|
|
||||||
@app.route("/")
|
|
||||||
def index():
|
|
||||||
return render_template("index.html")
|
|
||||||
|
|
||||||
@app.route('/data', methods=['POST'])
|
|
||||||
def receive():
|
|
||||||
encrypted_data = request.form.get('data', None) # Safely get form data
|
|
||||||
if encrypted_data:
|
|
||||||
return f"Received encrypted data: {encrypted_data}", 200
|
|
||||||
return "No data received", 400
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run(ssl_context=context, host='0.0.0.0', port=5000) # Allow external access
|
|
Loading…
Add table
Add a link
Reference in a new issue