from flask import Flask, jsonify, request import subprocess app = Flask(__name__) @app.route('/api', methods=['GET']) def check_email(): email = request.args.get('email') if not email: return jsonify({'error': 'Email is required'}), 400 # Run the holehe command command = f"holehe {email} --only-used" result = subprocess.run(command, shell=True, capture_output=True, text=True) # Process the output to return only the websites websites = [] for line in result.stdout.splitlines(): if line.startswith('[+]'): website = line.split()[1] websites.append(website) # Exclude "Email" if it appears websites = [website for website in websites if website.lower() != "email"] # Return the result as JSON return jsonify({'email': email, 'websites': websites}) if __name__ == '__main__': app.run(host='0.0.0.0', port=7860)