forked from p1ngul1n0/blackbird
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webserver.py
29 lines (24 loc) · 897 Bytes
/
webserver.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
27
28
29
import asyncio
from flask import Flask, Response, render_template, request, jsonify, send_file
from flask_cors import CORS
from blackbird import findUsername
import logging
import requests
app = Flask(__name__, static_folder='templates/static')
app.config['CORS_HEADERS'] = 'Content-Type'
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
CORS(app, resources={r"/*": {"origins": "*"}})
loop = asyncio.get_event_loop()
logging.getLogger('werkzeug').disabled = True
@app.route('/')
def home():
return render_template('index.html')
@app.route('/search/username' ,methods=["POST"])
def searchUsername():
content = request.get_json()
username = content['username']
interfaceType = 'web'
results = loop.run_until_complete(findUsername(username, interfaceType))
return jsonify(results)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=9797)