-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreat.py
More file actions
34 lines (29 loc) · 1.04 KB
/
Copy paththreat.py
File metadata and controls
34 lines (29 loc) · 1.04 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
from sqlalchemy import Column, Integer, String, Float, DateTime, Enum
from sqlalchemy.sql import func
from app.core.database import Base
import enum
class SeverityLevel(enum.Enum):
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
CRITICAL = "critical"
class ThreatLog(Base):
__tablename__ = "threat_logs"
id = Column(Integer, primary_key=True, index=True)
source_ip = Column(String, index=True)
destination_ip = Column(String)
attack_type = Column(String)
severity = Column(Enum(SeverityLevel))
confidence_score = Column(Float)
raw_log = Column(String)
status = Column(String, default="detected")
created_at = Column(DateTime, default=func.now())
class NetworkLog(Base):
__tablename__ = "network_logs"
id = Column(Integer, primary_key=True, index=True)
source_ip = Column(String)
dest_ip = Column(String)
protocol = Column(String)
bytes_sent = Column(Integer)
packets = Column(Integer)
timestamp = Column(DateTime, default=func.now())