class SplitHistoryBase4(BaseHistory): """ A history log for the fourth segment of the cookie """ visitor_id = db.Column(db.Integer, db.ForeignKey('splitTrackableUUID4.id'), nullable=False) visitor = db.relationship(SplitTrackableUUID4) def __repr__(self): return '<SplitHistoryBase4 id=%r, site=%r, visitor=%r>' % (self.id, self.site, self.visitor)
class FirstPartyHistory(BaseHistory): """ History log table that creates logs of the visited sites for each user identifier (model above) """ visitor_id = db.Column(db.Integer, db.ForeignKey('firstpartyUUID.id'), nullable=False) visitor = db.relationship(FirstPartyUUID) def __repr__(self): return '<FirstPartyHistory id=%r, site=%r, visitor=%r>' % (self.id, self.site, self.visitor)
class JoinedHistory(BaseHistory): """ A history log for the joined segments of the cookie (the user in the model above) which tracks the recently visited sites. """ visitor_id = db.Column(db.Integer, db.ForeignKey('joinedTrackableUUID.id'), nullable=False) visitor = db.relationship(JoinedTrackableUUID) def __repr__(self): return '<JoinedHistory id=%r, site=%r, visitor=%r>' % (self.id, self.site, self.visitor)
class FirstPartyClickHistory(BaseHistory): """ For the malicious first party sites, this creates a log of the recently clicked external sites for each user identifier """ visitor_id = db.Column(db.Integer, db.ForeignKey('firstpartyUUID.id'), nullable=False) visitor = db.relationship(FirstPartyUUID) def __repr__(self): return '<FirstPartyClickHistory id=%r, site=%r, visitor=%r>' % (self.id, self.site, self.visitor)
class User(BaseUUID): """ Model which represents a user looking to test their browser/adblocker configuration. The results of most recent benchmark, as well as the selected mode/cookie size preferences are stored per user. """ mode = db.Column(db.String(1), default='1', nullable=False) first_party_cookie_size = db.Column(db.Integer, default=16, nullable=False) cookie_size = db.Column(db.Integer, default=16, nullable=False) split_cookie_size = db.Column(db.Integer, default=3, nullable=False) local_storage_super_cookie_size = db.Column(db.Integer, default=16, nullable=False) local_storage_split_super_cookie_size = db.Column(db.Integer, default=4, nullable=False) first_party_test_result = db.Column(db.String(16), default='Untested', nullable=False) third_party_test_result = db.Column(db.String(16), default='Untested', nullable=False) third_party_split_result = db.Column(db.String(16), default='Untested', nullable=False) third_party_split_chain_result = db.Column(db.String(16), default='Untested', nullable=False) third_party_super_cookie_result = db.Column(db.String(16), default='Untested', nullable=False) third_party_split_super_cookie_result = db.Column(db.String(16), default='Untested', nullable=False) def __init__(self, uuid_length): if self.isFull(int(10**(uuid_length / 2))): self.delete_oldest() self.uuid = self.generate_unused_uuid(uuid_length) def __repr__(self): return '<User: id=%r, uuid=%r>' % (self.id, self.uuid)