Repository navigation
Expand file tree
/
Copy pathstart.sh
More file actions
71 lines (61 loc) · 2.75 KB
/
Copy pathstart.sh
File metadata and controls
71 lines (61 loc) · 2.75 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# ─────────────────────────────────────────────
# VulnMonitor — Startup Script
# Team CodeCrafters | IntrusionX Second Edition
# ─────────────────────────────────────────────
set -e
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${CYAN}"
echo " ██╗ ██╗██╗ ██╗██╗ ███╗ ██╗"
echo " ██║ ██║██║ ██║██║ ████╗ ██║"
echo " ██║ ██║██║ ██║██║ ██╔██╗ ██║"
echo " ╚██╗ ██╔╝██║ ██║██║ ██║╚██╗██║"
echo " ╚████╔╝ ╚██████╔╝███████╗██║ ╚████║"
echo " ╚═══╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝"
echo " MONITOR — Automated Vulnerability Tracker"
echo -e "${NC}"
echo -e "${YELLOW}Team CodeCrafters | IntrusionX Second Edition${NC}"
echo ""
# Check Python
if ! command -v python3 &>/dev/null; then echo "❌ Python 3 is required"; exit 1; fi
# Install deps
echo -e "${GREEN}[1/3]${NC} Installing Python dependencies..."
cd backend
pip install -r requirements.txt -q --break-system-packages 2>/dev/null || pip install -r requirements.txt -q
# Init DB
echo -e "${GREEN}[2/3]${NC} Initializing database..."
python3 -c "
from app import init_db, fetch_and_store_cves, get_db
init_db()
conn = get_db()
cnt = conn.cursor().execute('SELECT COUNT(*) FROM vulnerabilities').fetchone()[0]
conn.close()
if cnt == 0:
print(' → Fetching initial CVE data...')
fetch_and_store_cves(days_back=7)
else:
print(f' → Database has {cnt} CVEs already.')
"
# Start backend
echo -e "${GREEN}[3/3]${NC} Starting backend on http://localhost:5000 ..."
python3 app.py &
BACKEND_PID=$!
cd ..
sleep 2
# Open frontend
echo ""
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e " ${GREEN}✔ Backend running${NC} → http://localhost:5000"
echo -e " ${GREEN}✔ Frontend ready${NC} → Open frontend/index.html in browser"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo " Press Ctrl+C to stop the server."
echo ""
# Try to open browser
if command -v xdg-open &>/dev/null; then xdg-open frontend/index.html
elif command -v open &>/dev/null; then open frontend/index.html; fi
# Wait for backend
wait $BACKEND_PID