|
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 |
|
|
|
|
|
command = f"holehe {email} --only-used" |
|
result = subprocess.run(command, shell=True, capture_output=True, text=True) |
|
|
|
|
|
websites = [] |
|
for line in result.stdout.splitlines(): |
|
if line.startswith('[+]'): |
|
website = line.split()[1] |
|
websites.append(website) |
|
|
|
|
|
websites = [website for website in websites if website.lower() != "email"] |
|
|
|
|
|
return jsonify({'email': email, 'websites': websites}) |
|
|
|
if __name__ == '__main__': |
|
app.run(host='0.0.0.0', port=7860) |
|
|