-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (25 loc) · 853 Bytes
/
Copy pathapp.py
File metadata and controls
33 lines (25 loc) · 853 Bytes
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
32
33
from flask import Flask, request, jsonify, render_template
import requests
app = Flask(__name__)
@app.route('/', methods=['GET'])
def index():
return render_template("index.html")
# Endpoint para consultar VirusTotal
@app.route('/consultar', methods=['POST'])
def consultar_virus_total():
data = request.json
ioc = data.get('ioc')
api_key = data.get('apiKey')
if not ioc or not api_key:
return jsonify({'error': 'Missing IOC or API key'}), 400
url = f'https://www.virustotal.com/api/v3/search?query={ioc}'
headers = {
'x-apikey': api_key
}
response = requests.get(url, headers=headers)
if response.ok:
return jsonify(response.json())
else:
return jsonify({'error': 'Failed to fetch data from VirusTotal'}), response.status_code
if __name__ == '__main__':
app.run()