arp-spoofing/RSA/server/main.py

23 lines
845 B
Python

import ssl
from flask import Flask, render_template, request
app = Flask(__name__)
app.config['SECRET_KEY'] = 'c&S2QL9DDhZjwlqPoRYRGSN6gOidjaC9f25CW#SF1AinsMg7$3*JxC3e^9FnuliC5DWfhAPwiPcAMJcutBn#5k&VsIP0KBOMf9VvzKTN@Wuuq5i*UjoonTZEMHiyabpI' # 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