-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodels.py
55 lines (45 loc) · 1.98 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
""" The models module provides App Engine db.Model classes for storing freefall models in the App Engine database. """
from google.appengine.ext import db
from google.appengine.ext import blobstore
class Protocol(db.Model):
creator=db.UserProperty(required=True)
name=db.StringProperty(required=True)
class Dataset(db.Model):
creator=db.UserProperty(required=True)
name=db.StringProperty(required=True)
class PcapStats(db.Model):
pcap=db.ReferenceProperty(PcapFile)
duration=db.ListProperty(float)
incomingStats=db.ReferenceProperty(DirectionalSummaryStats, collection_name="incomingStats")
outgoingStats=db.ReferenceProperty(DirectionalSummaryStats, collection_name="outgoingStats")
class DirectionalSummaryStats(db.Model):
lengths=db.ListProperty(int)
content=db.ListProperty(int)
entropy=db.ListProperty(float)
flow=db.ListProperty(int)
class Stats(db.Model):
lengths=db.ListProperty(int)
content=db.ListProperty(int)
entropy=db.FloatProperty(required=True)
flow=db.ListProperty(int)
class PcapFile(db.Model):
uploader=db.UserProperty(required=True)
filename=db.StringProperty(required=True)
filekey=blobstore.BlobReferenceProperty(required=True)
status=db.IntegerProperty(required=True)
port=db.IntegerProperty(required=True)
protocol=db.ReferenceProperty(Protocol, required=False)
dataset=db.ReferenceProperty(Dataset, required=False)
class Connection(db.Model):
pcap=db.ReferenceProperty(PcapFile)
portsId=db.StringProperty(required=False)
duration=db.FloatProperty(required=False)
incomingStats=db.ReferenceProperty(Stats, collection_name='incomingStats')
outgoingStats=db.ReferenceProperty(Stats, required=False, collection_name='outgoingStats')
class AdversaryModel(db.Model):
name=db.StringProperty(required=True)
class LabeledData(db.Model):
adversary=db.ReferenceProperty(AdversaryModel, required=True)
pcap=db.ReferenceProperty(PcapFile, required=True)
label=db.BooleanProperty(required=True)
training=db.BooleanProperty(required=True)