zuehue commited on
Commit
3fb844e
·
verified ·
1 Parent(s): 572aa84

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, jsonify, request
2
+ import subprocess
3
+ import json
4
+ import os
5
+
6
+ app = Flask(__name__)
7
+
8
+ @app.route('/check_email', methods=['POST'])
9
+ def check_email():
10
+ email = request.json.get('email')
11
+ if not email:
12
+ return jsonify({'error': 'Email is required'}), 400
13
+
14
+ # Run the holehe command
15
+ command = f"holehe {email} --only-used"
16
+ result = subprocess.run(command, shell=True, capture_output=True, text=True)
17
+
18
+ # Process the output to return only the websites
19
+ websites = []
20
+ for line in result.stdout.splitlines():
21
+ if line.startswith('[+]'):
22
+ website = line.split()[1]
23
+ websites.append(website)
24
+
25
+ # Return the result as JSON
26
+ return jsonify({'email': email, 'websites': websites})
27
+
28
+ if __name__ == '__main__':
29
+ app.run(host='0.0.0.0', port=7860)