File size: 915 Bytes
c6ef249
 
 
 
 
e6d95b8
3fb844e
b35a2f0
3fb844e
 
 
 
 
 
 
 
 
 
 
 
 
e6d95b8
 
 
3fb844e
 
c6ef249
 
 
 
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
27
28
29
30
31
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)