-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
33 lines (30 loc) · 1.12 KB
/
models.py
File metadata and controls
33 lines (30 loc) · 1.12 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
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class SecurityEvent(db.Model):
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.String(50))
source_ip = db.Column(db.String(50))
dest_ip = db.Column(db.String(50))
protocol = db.Column(db.String(20))
length = db.Column(db.Integer)
info = db.Column(db.Text)
severity = db.Column(db.String(20), default='low')
is_threat = db.Column(db.Boolean, default=False)
ai_summary = db.Column(db.Text, default='')
dest_port = db.Column(db.String(10), default='0')
threat_summary = db.Column(db.Text, default='Clean')
def to_dict(self):
return {
'id': self.id,
'timestamp': self.timestamp,
'source_ip': self.source_ip,
'dest_ip': self.dest_ip,
'protocol': self.protocol,
'length': self.length,
'info': self.info,
'severity': self.severity,
'is_threat': self.is_threat,
'ai_summary': self.ai_summary,
'dest_port': self.dest_port,
'threat_summary': self.threat_summary
}