jaanya commited on
Commit
3ee9447
·
1 Parent(s): cf1a13b

updated main.py

Browse files
Files changed (1) hide show
  1. main.py +17 -0
main.py CHANGED
@@ -4,6 +4,23 @@ from fastapi import FastAPI
4
  from fastapi.staticfiles import StaticFiles
5
  from fastapi.middleware.cors import CORSMiddleware
6
  from routers import incidents, news, analyze, chat
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  app = FastAPI(title="OCULUS API")
9
 
 
4
  from fastapi.staticfiles import StaticFiles
5
  from fastapi.middleware.cors import CORSMiddleware
6
  from routers import incidents, news, analyze, chat
7
+ import os
8
+ import requests as req
9
+
10
+ def download_mitre():
11
+ path = "data/mitre_attack.json"
12
+ if not os.path.exists(path):
13
+ print("Downloading MITRE ATT&CK...")
14
+ os.makedirs("data", exist_ok=True)
15
+ r = req.get(
16
+ "https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json",
17
+ timeout=120
18
+ )
19
+ with open(path, "wb") as f:
20
+ f.write(r.content)
21
+ print("MITRE downloaded.")
22
+
23
+ download_mitre()
24
 
25
  app = FastAPI(title="OCULUS API")
26