This repository was archived by the owner on Jun 8, 2021. It is now read-only.
forked from fkie-cad/iva
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver_runner.py
More file actions
52 lines (33 loc) · 1.33 KB
/
server_runner.py
File metadata and controls
52 lines (33 loc) · 1.33 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import threading
import config
import logger
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
MANAGE_FILE = ROOT_DIR + '/frontend/manage.py'
INDEX_FILE = 'web/index.py'
def run_iva_server(config_file):
logger.info("starting HTTP server for IVA")
IvaHttpServerThread(config_file).start()
def run_cve_search_server():
logger.info("starting HTTP server for cve-search")
if is_cve_search_installed():
CveSearchHttpServerThread().start()
else:
logger.error("cve-search was not found in " + config.get_cve_search_dir())
def is_cve_search_installed():
return os.path.exists(get_cve_search_index_file())
class IvaHttpServerThread(threading.Thread):
def __init__(self, config_file):
threading.Thread.__init__(self)
self.config_file = config_file
def run(self):
os.system('python3 ' + MANAGE_FILE + ' runserver ' + get_iva_server_address() + ' ' + self.config_file)
def get_iva_server_address():
return config.get_frontend_host() + ':' + config.get_frontend_port()
class CveSearchHttpServerThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
os.system('python3 ' + get_cve_search_index_file())
def get_cve_search_index_file():
return os.path.join(config.get_cve_search_dir(), INDEX_FILE)