class SplitTrackableUUID4(SplitTrackableUUIDBase):
    """
    A table for the fourth segment of the cookie
    """
    __tablename__ = 'splitTrackableUUID4'
    visited = db.relationship('SplitHistoryBase4', backref='splitTrackableUUID4', lazy=True)

    def __repr__(self):
        return '<SplitTrackableUUID4 id=%r, uuid=%r>' % (self.id, self.uuid)
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)
Exemplo n.º 3
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
class FirstPartyUUID(BaseUUID):
    """
    Unique users that the first party sites keep track of via a unique identifier (cookie)
    """
    __tablename__ = 'firstpartyUUID'
    visited = db.relationship('FirstPartyHistory', backref='firstpartyUUID', lazy=True, cascade='all,delete')

    def __init__(self, uuid_length):
        if self.isFull(int(10 ** uuid_length)):
            self.delete_oldest()
        self.uuid = self.generate_unused_uuid(uuid_length)

    def __repr__(self):
        return '<FirstPartyUUID id=%r, uuid=%r>' % (self.id, self.uuid)
class JoinedTrackableUUID(BaseUUID):
    """
    After joining the four segments of the cookie together, this creates a user based on that string. Used by the
    master URL and the final chained URL.
    """
    __tablename__ = 'joinedTrackableUUID'
    visited = db.relationship('JoinedHistory', backref='joinedTrackableUUID', lazy=True, cascade='all,delete')

    @classmethod
    def get_or_create(cls, uuid):
        split_user = cls.query.filter_by(uuid=uuid).first()
        if split_user is None:
            split_user = cls(uuid)
            db.session.add(split_user)
            db.session.commit()
        return split_user

    def __init__(self, uuid):
        self.uuid = uuid

    def __repr__(self):
        return '<JoinedTrackableUUID id=%r, uuid=%r>' % (self.id, self.uuid)