-
Notifications
You must be signed in to change notification settings - Fork 2
/
models.py
70 lines (55 loc) · 2.15 KB
/
models.py
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
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Callback(db.Model):
__tablename__ = "callbacks"
id = db.Column(db.Integer, primary_key=True)
protocol = db.Column(db.String)
interactionString = db.Column(db.String)
time = db.Column(db.Integer)
client_ip = db.Column(db.String)
request = db.Column(db.String)
response = db.Column(db.String)
subDomain = db.Column(db.String)
payload = db.Column(db.String)
project_id = db.Column(db.Integer, db.ForeignKey('projects.id'))
def __init__(self, protocol, interactionString, time, client_ip, request, response, subDomain, payload, project_id):
self.protocol = protocol
self.interactionString = interactionString
self.time = time
self.client_ip = client_ip
self.request = request
self.response = response
self.subDomain = subDomain
self.payload = payload
self.project_id = project_id
class Project(db.Model):
__tablename__ = "projects"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
description = db.Column(db.String)
callbacks = db.relationship("Callback", lazy="dynamic")
packages = db.relationship("Package", lazy="dynamic")
def __init__(self, name, description):
self.name = name
self.description = description
class Package(db.Model):
__tablename__ = "packages"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
version = db.Column(db.String)
vulnerable = db.Column(db.Boolean)
campaign_active = db.Column(db.Boolean)
project_id = db.Column(db.Integer, db.ForeignKey("projects.id"))
def __init__(self, name, version, vulnerable, campaing_active=False):
self.name = name
self.version = version
self.vulnerable = vulnerable
self.campaign_active = campaing_active
class PackageCache(db.Model):
__tablename__ = "PackageCache"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
timestamp = db.Column(db.Integer)
def __init__(self, name, timestamp):
self.name = name
self.timestamp = timestamp